Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
da5df339
Commit
da5df339
authored
Sep 28, 2022
by
Nikita Malyavin
Committed by
Sergei Golubchik
Aug 15, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpl: check should go after defaults and vcols update
parent
aa1a2507
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
13 deletions
+75
-13
mysql-test/main/alter_table_online_debug.result
mysql-test/main/alter_table_online_debug.result
+39
-6
mysql-test/main/alter_table_online_debug.test
mysql-test/main/alter_table_online_debug.test
+26
-1
sql/rpl_record.cc
sql/rpl_record.cc
+10
-6
No files found.
mysql-test/main/alter_table_online_debug.result
View file @
da5df339
...
...
@@ -864,9 +864,11 @@ insert t1 values (1),(2),(3),(4);
set debug_sync= 'now wait_for downgraded';
connection con2;
set debug_sync= 'alter_table_online_downgraded signal downgraded wait_for goforit';
alter table t1 add b int default(a
+10
), algorithm=copy, lock=none;
alter table t1 add b int default(a), algorithm=copy, lock=none;
connection default;
update t1 set a=a+10 where a > 2;
insert t1 values(5);
update t1 set a=a+10 where a = 5;
set debug_sync= 'now signal goforit';
connection con2;
connection default;
...
...
@@ -874,14 +876,45 @@ show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) DEFAULT
(`a` + 10)
`b` int(11) DEFAULT
`a`
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
select * from t1;
a b
1 11
2 12
13 23
14 24
1 1
2 2
13 13
14 14
15 15
drop table t1;
set debug_sync= 'reset';
## VCOL + CHECK
create table t1 (a int) engine=innodb;
insert t1 values (1),(2),(3),(4);
set debug_sync= 'now wait_for downgraded';
connection con2;
set debug_sync= 'alter_table_online_downgraded signal downgraded wait_for goforit';
alter table t1 add b int as (a), add check(b=a), algorithm=copy, lock=none;
connection default;
update t1 set a=a+10 where a > 2;
insert t1 values(5);
update t1 set a=a+10 where a = 5;
set debug_sync= 'now signal goforit';
connection con2;
connection default;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`a` int(11) DEFAULT NULL,
`b` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL,
CONSTRAINT `CONSTRAINT_1` CHECK (`b` = `a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
select * from t1;
a b
1 1
2 2
13 13
14 14
15 15
drop table t1;
set debug_sync= 'reset';
#
...
...
mysql-test/main/alter_table_online_debug.test
View file @
da5df339
...
...
@@ -1021,10 +1021,35 @@ insert t1 values (1),(2),(3),(4);
--
send
set
debug_sync
=
'now wait_for downgraded'
--
connection
con2
set
debug_sync
=
'alter_table_online_downgraded signal downgraded wait_for goforit'
;
--
send
alter
table
t1
add
b
int
default
(
a
+
10
),
algorithm
=
copy
,
lock
=
none
--
send
alter
table
t1
add
b
int
default
(
a
),
algorithm
=
copy
,
lock
=
none
--
connection
default
--
reap
update
t1
set
a
=
a
+
10
where
a
>
2
;
insert
t1
values
(
5
);
update
t1
set
a
=
a
+
10
where
a
=
5
;
set
debug_sync
=
'now signal goforit'
;
--
connection
con2
--
reap
--
connection
default
show
create
table
t1
;
select
*
from
t1
;
drop
table
t1
;
set
debug_sync
=
'reset'
;
--
echo
## VCOL + CHECK
create
table
t1
(
a
int
)
engine
=
innodb
;
insert
t1
values
(
1
),(
2
),(
3
),(
4
);
--
send
set
debug_sync
=
'now wait_for downgraded'
--
connection
con2
set
debug_sync
=
'alter_table_online_downgraded signal downgraded wait_for goforit'
;
--
send
alter
table
t1
add
b
int
as
(
a
),
add
check
(
b
=
a
),
algorithm
=
copy
,
lock
=
none
--
connection
default
--
reap
update
t1
set
a
=
a
+
10
where
a
>
2
;
insert
t1
values
(
5
);
update
t1
set
a
=
a
+
10
where
a
=
5
;
set
debug_sync
=
'now signal goforit'
;
--
connection
con2
--
reap
...
...
sql/rpl_record.cc
View file @
da5df339
...
...
@@ -387,12 +387,6 @@ int unpack_row(rpl_group_info *rgi, TABLE *table, uint const colcnt,
{
copy
->
do_copy
(
copy
);
}
/* we only check constraints for ALTER TABLE */
DBUG_ASSERT
(
table
->
in_use
->
lex
->
ignore
==
FALSE
);
error
=
table
->
verify_constraints
(
false
);
DBUG_ASSERT
(
error
!=
VIEW_CHECK_SKIP
);
if
(
error
)
DBUG_RETURN
(
HA_ERR_GENERIC
);
}
if
(
table
->
default_field
)
...
...
@@ -408,6 +402,16 @@ int unpack_row(rpl_group_info *rgi, TABLE *table, uint const colcnt,
DBUG_RETURN
(
error
);
}
if
(
rpl_data
.
is_online_alter
())
{
/* we only check constraints for ALTER TABLE */
DBUG_ASSERT
(
table
->
in_use
->
lex
->
ignore
==
FALSE
);
error
=
table
->
verify_constraints
(
false
);
DBUG_ASSERT
(
error
!=
VIEW_CHECK_SKIP
);
if
(
error
)
DBUG_RETURN
(
HA_ERR_GENERIC
);
}
/*
throw away master's extra fields
*/
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment