mirror of
https://github.com/MariaDB/server.git
synced 2025-08-01 03:47:19 +03:00
don't do DROP SYSTEM VERSIONING online
because ALTER TABLE ... DROP SYSTEM VERSIONING is not just a change in the table structure, it also deletes all historical rows
This commit is contained in:
@ -408,55 +408,8 @@ a b UNIX_TIMESTAMP(row_start) UNIX_TIMESTAMP(row_end)
|
|||||||
1 55 1.000000 2147483647.999999
|
1 55 1.000000 2147483647.999999
|
||||||
3 44 1.000000 2147483647.999999
|
3 44 1.000000 2147483647.999999
|
||||||
6 77 1.000000 2147483647.999999
|
6 77 1.000000 2147483647.999999
|
||||||
connection con2;
|
alter table t1 drop system versioning, algorithm= copy, lock= none;
|
||||||
set debug_sync= 'now WAIT_FOR ended';
|
ERROR 0A000: LOCK=NONE is not supported. Reason: COPY algorithm requires a lock. Try LOCK=SHARED
|
||||||
connection default;
|
|
||||||
set debug_sync= 'alter_table_copy_end SIGNAL ended WAIT_FOR end';
|
|
||||||
alter table t1 drop system versioning,
|
|
||||||
algorithm= copy, lock= none;
|
|
||||||
connection con2;
|
|
||||||
update t1 set b= 88 where a = 1;
|
|
||||||
set debug_sync= 'now SIGNAL end';
|
|
||||||
connection default;
|
|
||||||
# Can't UPDATE versioned -> plain (and can't DELETE)
|
|
||||||
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
|
|
||||||
show create table t1;
|
|
||||||
Table Create Table
|
|
||||||
t1 CREATE TABLE `t1` (
|
|
||||||
`a` int(11) NOT NULL,
|
|
||||||
`b` int(11) DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`a`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
|
|
||||||
select *, UNIX_TIMESTAMP(row_start), UNIX_TIMESTAMP(row_end) from t1 for system_time all;
|
|
||||||
a b UNIX_TIMESTAMP(row_start) UNIX_TIMESTAMP(row_end)
|
|
||||||
1 55 1.000000 3.000000
|
|
||||||
1 88 3.000000 2147483647.999999
|
|
||||||
3 44 1.000000 2147483647.999999
|
|
||||||
6 77 1.000000 2147483647.999999
|
|
||||||
connection con2;
|
|
||||||
set debug_sync= 'now WAIT_FOR ended';
|
|
||||||
connection default;
|
|
||||||
set debug_sync= 'alter_table_copy_end SIGNAL ended WAIT_FOR end';
|
|
||||||
alter table t1 drop system versioning,
|
|
||||||
algorithm= copy, lock= none;
|
|
||||||
connection con2;
|
|
||||||
insert into t1 values (8, 99);
|
|
||||||
set debug_sync= 'now SIGNAL end';
|
|
||||||
connection default;
|
|
||||||
# INSERT versioned -> plain works fine since it is a single versioned op.
|
|
||||||
show create table t1;
|
|
||||||
Table Create Table
|
|
||||||
t1 CREATE TABLE `t1` (
|
|
||||||
`a` int(11) NOT NULL,
|
|
||||||
`b` int(11) DEFAULT NULL,
|
|
||||||
PRIMARY KEY (`a`)
|
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
|
||||||
select * from t1;
|
|
||||||
a b
|
|
||||||
1 88
|
|
||||||
3 44
|
|
||||||
6 77
|
|
||||||
8 99
|
|
||||||
#
|
#
|
||||||
# Test ROLLBACK TO SAVEPOINT
|
# Test ROLLBACK TO SAVEPOINT
|
||||||
#
|
#
|
||||||
|
@ -492,52 +492,53 @@ set debug_sync= 'now SIGNAL end';
|
|||||||
show create table t1;
|
show create table t1;
|
||||||
select *, UNIX_TIMESTAMP(row_start), UNIX_TIMESTAMP(row_end) from t1 for system_time all;
|
select *, UNIX_TIMESTAMP(row_start), UNIX_TIMESTAMP(row_end) from t1 for system_time all;
|
||||||
|
|
||||||
--connection con2
|
## at the moment DROP SYSTEM VERSIONING cannot be done online
|
||||||
--send
|
## because it not only alters the structure, but also deletes history rows
|
||||||
set debug_sync= 'now WAIT_FOR ended';
|
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
|
||||||
|
alter table t1 drop system versioning, algorithm= copy, lock= none;
|
||||||
--connection default
|
#--connection con2
|
||||||
set debug_sync= 'alter_table_copy_end SIGNAL ended WAIT_FOR end';
|
#--send
|
||||||
|
#set debug_sync= 'now WAIT_FOR ended';
|
||||||
--send
|
#
|
||||||
alter table t1 drop system versioning,
|
#--connection default
|
||||||
algorithm= copy, lock= none;
|
#set debug_sync= 'alter_table_copy_end SIGNAL ended WAIT_FOR end';
|
||||||
|
#
|
||||||
--connection con2
|
#--send
|
||||||
--reap
|
#alter table t1 drop system versioning,
|
||||||
update t1 set b= 88 where a = 1;
|
# algorithm= copy, lock= none;
|
||||||
|
#
|
||||||
set debug_sync= 'now SIGNAL end';
|
#--connection con2
|
||||||
|
#--reap
|
||||||
--connection default
|
#update t1 set b= 88 where a = 1;
|
||||||
--echo # Can't UPDATE versioned -> plain (and can't DELETE)
|
#
|
||||||
--error ER_DUP_ENTRY
|
#set debug_sync= 'now SIGNAL end';
|
||||||
--reap
|
#
|
||||||
show create table t1;
|
#--connection default
|
||||||
select *, UNIX_TIMESTAMP(row_start), UNIX_TIMESTAMP(row_end) from t1 for system_time all;
|
#--reap
|
||||||
|
#show create table t1;
|
||||||
--connection con2
|
#select *, UNIX_TIMESTAMP(row_start), UNIX_TIMESTAMP(row_end) from t1 for system_time all;
|
||||||
--send
|
#
|
||||||
set debug_sync= 'now WAIT_FOR ended';
|
#--connection con2
|
||||||
|
#--send
|
||||||
--connection default
|
#set debug_sync= 'now WAIT_FOR ended';
|
||||||
set debug_sync= 'alter_table_copy_end SIGNAL ended WAIT_FOR end';
|
#
|
||||||
|
#--connection default
|
||||||
--send
|
#set debug_sync= 'alter_table_copy_end SIGNAL ended WAIT_FOR end';
|
||||||
alter table t1 drop system versioning,
|
#
|
||||||
algorithm= copy, lock= none;
|
#--send
|
||||||
|
#alter table t1 drop system versioning,
|
||||||
--connection con2
|
# algorithm= copy, lock= none;
|
||||||
--reap
|
#
|
||||||
insert into t1 values (8, 99);
|
#--connection con2
|
||||||
|
#--reap
|
||||||
set debug_sync= 'now SIGNAL end';
|
#insert into t1 values (8, 99);
|
||||||
|
#
|
||||||
--connection default
|
#set debug_sync= 'now SIGNAL end';
|
||||||
--echo # INSERT versioned -> plain works fine since it is a single versioned op.
|
#
|
||||||
--reap
|
#--connection default
|
||||||
show create table t1;
|
#--reap
|
||||||
select * from t1;
|
#show create table t1;
|
||||||
|
#select * from t1;
|
||||||
|
|
||||||
--echo #
|
--echo #
|
||||||
--echo # Test ROLLBACK TO SAVEPOINT
|
--echo # Test ROLLBACK TO SAVEPOINT
|
||||||
|
@ -10028,6 +10028,7 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
|
|||||||
|
|
||||||
if (alter_info->requested_lock == Alter_info::ALTER_TABLE_LOCK_SHARED
|
if (alter_info->requested_lock == Alter_info::ALTER_TABLE_LOCK_SHARED
|
||||||
|| alter_info->requested_lock > Alter_info::ALTER_TABLE_LOCK_NONE
|
|| alter_info->requested_lock > Alter_info::ALTER_TABLE_LOCK_NONE
|
||||||
|
|| alter_info->flags & ALTER_DROP_SYSTEM_VERSIONING
|
||||||
|| thd->locked_tables_mode == LTM_LOCK_TABLES
|
|| thd->locked_tables_mode == LTM_LOCK_TABLES
|
||||||
|| thd->lex->sql_command == SQLCOM_OPTIMIZE
|
|| thd->lex->sql_command == SQLCOM_OPTIMIZE
|
||||||
|| alter_info->algorithm(thd) > Alter_info::ALTER_TABLE_ALGORITHM_COPY)
|
|| alter_info->algorithm(thd) > Alter_info::ALTER_TABLE_ALGORITHM_COPY)
|
||||||
|
Reference in New Issue
Block a user