mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-34705: Binlog-in-engine: Implement DELETE_DOMAIN_ID for FLUSH
Signed-off-by: Kristian Nielsen <knielsen@knielsen-hq.org>
This commit is contained in:
@@ -128,5 +128,34 @@ binlog-000029.ibb 262144
|
||||
SET SESSION binlog_format= MIXED;
|
||||
DROP TABLE t1;
|
||||
SET GLOBAL max_binlog_total_size= @old_max_total;
|
||||
SET GLOBAL slave_connections_needed_for_purge= @old_min_slaves;
|
||||
SET GLOBAL binlog_expire_logs_seconds= @old_expire;
|
||||
*** Test FLUSH BINARY LOGS DELETE_DOMAIN_ID.
|
||||
SET SESSION gtid_domain_id= 1;
|
||||
SET SESSION gtid_seq_no= 1000;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (2, 2), (3, 0), (4, 5), (5, 0), (6, 3), (7, 4), (8, 8);
|
||||
SET SESSION gtid_domain_id= 2;
|
||||
SET SESSION gtid_seq_no= 100;
|
||||
ALTER TABLE t1 ADD INDEX b_idx(b);
|
||||
SET SESSION gtid_domain_id= 1;
|
||||
INSERT INTO t1 VALUES (10, 0), (11, 0), (12, 0);
|
||||
SELECT @@GLOBAL.gtid_binlog_state;
|
||||
@@GLOBAL.gtid_binlog_state
|
||||
0-1-2508,1-1-1003,2-1-100
|
||||
FLUSH BINARY LOGS DELETE_DOMAIN_ID=(2);
|
||||
ERROR HY000: Could not delete gtid domain. Reason: binlog files may contain gtids from the domain ('2') being deleted. Make sure to first purge those files.
|
||||
SELECT @@GLOBAL.gtid_binlog_state;
|
||||
@@GLOBAL.gtid_binlog_state
|
||||
0-1-2508,1-1-1003,2-1-100
|
||||
FLUSH BINARY LOGS;
|
||||
PURGE BINARY LOGS TO 'binlog-000030.ibb';
|
||||
FLUSH BINARY LOGS DELETE_DOMAIN_ID=(2);
|
||||
SELECT @@GLOBAL.gtid_binlog_state;
|
||||
@@GLOBAL.gtid_binlog_state
|
||||
0-1-2508,1-1-1003
|
||||
# restart
|
||||
SELECT @@GLOBAL.gtid_binlog_state;
|
||||
@@GLOBAL.gtid_binlog_state
|
||||
0-1-2508,1-1-1003
|
||||
DROP TABLE t1;
|
||||
|
@@ -133,14 +133,18 @@ while ($i < $num_insert) {
|
||||
}
|
||||
COMMIT;
|
||||
--enable_query_log
|
||||
# We need to wait for 25 to be pre-allocated here, so we know that 23 has been
|
||||
# fully written to disk. Otherwise 23 may still be in the buffer pool, and the
|
||||
# file date can be older than @now and then the PURGE ... BEFORE @now below
|
||||
# fails.
|
||||
--let $binlog_name= binlog-000025.ibb
|
||||
--let $binlog_size= 262144
|
||||
--source include/wait_for_engine_binlog.inc
|
||||
PURGE BINARY LOGS BEFORE @now;
|
||||
--let $binlog_name= binlog-000022.ibb
|
||||
--let $binlog_size= 262144
|
||||
--let $wait_notfound= 1
|
||||
--source include/wait_for_engine_binlog.inc
|
||||
--let $binlog_name= binlog-000025.ibb
|
||||
--let $binlog_size= 262144
|
||||
--source include/wait_for_engine_binlog.inc
|
||||
SHOW BINARY LOGS;
|
||||
|
||||
--echo *** Test PURGE BINARY LOGS TO
|
||||
@@ -160,7 +164,6 @@ while ($i < $num_insert) {
|
||||
}
|
||||
COMMIT;
|
||||
--enable_query_log
|
||||
--source include/wait_for_engine_binlog.inc
|
||||
--let $binlog_name= binlog-000029.ibb
|
||||
--let $binlog_size= 262144
|
||||
--source include/wait_for_engine_binlog.inc
|
||||
@@ -185,5 +188,41 @@ SET SESSION binlog_format= MIXED;
|
||||
DROP TABLE t1;
|
||||
|
||||
SET GLOBAL max_binlog_total_size= @old_max_total;
|
||||
SET GLOBAL slave_connections_needed_for_purge= @old_min_slaves;
|
||||
SET GLOBAL binlog_expire_logs_seconds= @old_expire;
|
||||
|
||||
|
||||
--echo *** Test FLUSH BINARY LOGS DELETE_DOMAIN_ID.
|
||||
|
||||
SET SESSION gtid_domain_id= 1;
|
||||
SET SESSION gtid_seq_no= 1000;
|
||||
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (1, 0);
|
||||
INSERT INTO t1 VALUES (2, 2), (3, 0), (4, 5), (5, 0), (6, 3), (7, 4), (8, 8);
|
||||
SET SESSION gtid_domain_id= 2;
|
||||
SET SESSION gtid_seq_no= 100;
|
||||
ALTER TABLE t1 ADD INDEX b_idx(b);
|
||||
SET SESSION gtid_domain_id= 1;
|
||||
INSERT INTO t1 VALUES (10, 0), (11, 0), (12, 0);
|
||||
SELECT @@GLOBAL.gtid_binlog_state;
|
||||
--error ER_BINLOG_CANT_DELETE_GTID_DOMAIN
|
||||
FLUSH BINARY LOGS DELETE_DOMAIN_ID=(2);
|
||||
SELECT @@GLOBAL.gtid_binlog_state;
|
||||
FLUSH BINARY LOGS;
|
||||
--let $binlog_name= binlog-000031.ibb
|
||||
--let $binlog_size= 262144
|
||||
--source include/wait_for_engine_binlog.inc
|
||||
PURGE BINARY LOGS TO 'binlog-000030.ibb';
|
||||
FLUSH BINARY LOGS DELETE_DOMAIN_ID=(2);
|
||||
SELECT @@GLOBAL.gtid_binlog_state;
|
||||
|
||||
# Test that deletion of domains in the state got persisted to disk.
|
||||
--let $binlog_name= binlog-000032.ibb
|
||||
--let $binlog_size= 262144
|
||||
--source include/wait_for_engine_binlog.inc
|
||||
--source include/restart_mysqld.inc
|
||||
SELECT @@GLOBAL.gtid_binlog_state;
|
||||
|
||||
DROP TABLE t1;
|
||||
|
||||
# No need to restore @@GLOBAL.slave_connections_needed_for_purge, as we
|
||||
# restarted the server.
|
||||
|
Reference in New Issue
Block a user