mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
Merge 10.5 into 10.6
This commit is contained in:
@@ -105,3 +105,60 @@ t1 CREATE TABLE `t1` (
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
DROP TABLE t1;
|
||||
SET DEBUG_SYNC='RESET';
|
||||
#
|
||||
# MDEV-33593: Auto increment deadlock error causes ASSERT in subsequent save point
|
||||
#
|
||||
CREATE TABLE t1(col1 INT PRIMARY KEY AUTO_INCREMENT, col2 INT) ENGINE=InnoDB;
|
||||
CREATE TABLE t2(col1 INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
INSERT INTO t1(col2) values(100);
|
||||
connect con1, localhost, root,,;
|
||||
START TRANSACTION;
|
||||
# T1: Acquiring Row X lock on table t2
|
||||
INSERT INTO t2 values(100);
|
||||
connect con2, localhost, root,,;
|
||||
START TRANSACTION;
|
||||
# T2: Wait for (T1) row lock on t2 after acquiring GAP Lock on t1
|
||||
UPDATE t1 SET col2 = 20 where col1 = 10;
|
||||
SET DEBUG_SYNC='lock_wait_before_suspend SIGNAL t2_waiting';
|
||||
INSERT INTO t2 values(100);
|
||||
connection default;
|
||||
SET DEBUG_SYNC='now WAIT_FOR t2_waiting';
|
||||
# T3: Wait for (T2) II row Lock on t1 after acquiring Auto Increment Lock on t1
|
||||
SET DEBUG_SYNC='lock_wait_before_suspend SIGNAL t3_waiting';
|
||||
INSERT INTO t1(col2) SELECT col2 from t1;
|
||||
connection con1;
|
||||
SAVEPOINT s1;
|
||||
SET DEBUG_SYNC='now WAIT_FOR t3_waiting';
|
||||
# T1: Wait for (T3) auto increment lock on t1 causing T1 -> T3 -> T2 -> T1 deadlock
|
||||
SET debug_dbug = '+d,innodb_deadlock_victim_self';
|
||||
INSERT INTO t1(col2) VALUES(200);
|
||||
ERROR HY000: Failed to read auto-increment value from storage engine
|
||||
# The transaction should have been rolled back
|
||||
SELECT * FROM t1;
|
||||
col1 col2
|
||||
1 100
|
||||
SELECT * FROM t2;
|
||||
col1
|
||||
# Release the previous savepoint using the same name
|
||||
SAVEPOINT s1;
|
||||
COMMIT;
|
||||
connection con2;
|
||||
COMMIT;
|
||||
connection default;
|
||||
COMMIT;
|
||||
disconnect con1;
|
||||
disconnect con2;
|
||||
# Cleanup
|
||||
SELECT * FROM t1;
|
||||
col1 col2
|
||||
1 100
|
||||
2 100
|
||||
DROP TABLE t1;
|
||||
SELECT * FROM t2;
|
||||
col1
|
||||
100
|
||||
DROP TABLE t2;
|
||||
SET DEBUG_SYNC='RESET';
|
||||
#
|
||||
# End of 10.5 tests
|
||||
#
|
||||
|
12
mysql-test/suite/innodb/r/log_upgrade_101_flags.result
Normal file
12
mysql-test/suite/innodb/r/log_upgrade_101_flags.result
Normal file
@@ -0,0 +1,12 @@
|
||||
call mtr.add_suppression("InnoDB: The change buffer is corrupted");
|
||||
call mtr.add_suppression("InnoDB: Tablespace size stored in header is 768 pages, but the sum of data file sizes is 384 pages");
|
||||
call mtr.add_suppression("InnoDB: adjusting FSP_SPACE_FLAGS of file");
|
||||
# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-force-recovery=5 --innodb-log-file-size=4m --innodb_page_size=32k --innodb_buffer_pool_size=10M
|
||||
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES
|
||||
WHERE engine = 'innodb'
|
||||
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
||||
COUNT(*)
|
||||
1
|
||||
FOUND 1 /InnoDB: Upgrading redo log:/ in mysqld.1.err
|
||||
# restart
|
||||
# End of 10.5 tests
|
@@ -21,11 +21,17 @@ path
|
||||
DROP DATABASE abc_def;
|
||||
# restart
|
||||
DROP DATABASE abc_def2;
|
||||
call mtr.add_suppression("InnoDB: (Operating system error|The error means|Cannot rename file)");
|
||||
call mtr.add_suppression("InnoDB: Cannot rename '.*t1.ibd' to '.*non_existing_db.*' because the target schema directory doesn't exist");
|
||||
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(100);
|
||||
RENAME TABLE t1 TO non_existing_db.t1;
|
||||
ERROR HY000: Error on rename of './test/t1' to './non_existing_db/t1' (errno: 168 "Unknown (generic) error from engine")
|
||||
FOUND 1 /\[ERROR\] InnoDB: Cannot rename file '.*t1\.ibd' to '.*non_existing_db/ in mysqld.1.err
|
||||
FOUND 1 /\[ERROR\] InnoDB: Cannot rename '.*t1\.ibd' to '.*non_existing_db/ in mysqld.1.err
|
||||
SET GLOBAL innodb_fast_shutdown=2;
|
||||
# restart
|
||||
SELECT * FROM t1;
|
||||
a
|
||||
100
|
||||
DROP TABLE t1;
|
||||
#
|
||||
# MDEV-25509 Atomic DDL: Assertion `err != DB_DUPLICATE_KEY'
|
||||
|
@@ -92,3 +92,69 @@ SELECT * FROM t1;
|
||||
SHOW CREATE TABLE t1;
|
||||
DROP TABLE t1;
|
||||
SET DEBUG_SYNC='RESET';
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-33593: Auto increment deadlock error causes ASSERT in subsequent save point
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1(col1 INT PRIMARY KEY AUTO_INCREMENT, col2 INT) ENGINE=InnoDB;
|
||||
CREATE TABLE t2(col1 INT PRIMARY KEY) ENGINE=InnoDB;
|
||||
INSERT INTO t1(col2) values(100);
|
||||
|
||||
--connect(con1, localhost, root,,)
|
||||
START TRANSACTION;
|
||||
--echo # T1: Acquiring Row X lock on table t2
|
||||
INSERT INTO t2 values(100);
|
||||
|
||||
--connect(con2, localhost, root,,)
|
||||
START TRANSACTION;
|
||||
--echo # T2: Wait for (T1) row lock on t2 after acquiring GAP Lock on t1
|
||||
UPDATE t1 SET col2 = 20 where col1 = 10;
|
||||
SET DEBUG_SYNC='lock_wait_before_suspend SIGNAL t2_waiting';
|
||||
--send INSERT INTO t2 values(100)
|
||||
|
||||
--connection default
|
||||
SET DEBUG_SYNC='now WAIT_FOR t2_waiting';
|
||||
--echo # T3: Wait for (T2) II row Lock on t1 after acquiring Auto Increment Lock on t1
|
||||
SET DEBUG_SYNC='lock_wait_before_suspend SIGNAL t3_waiting';
|
||||
--send INSERT INTO t1(col2) SELECT col2 from t1
|
||||
|
||||
--connection con1
|
||||
SAVEPOINT s1;
|
||||
SET DEBUG_SYNC='now WAIT_FOR t3_waiting';
|
||||
--echo # T1: Wait for (T3) auto increment lock on t1 causing T1 -> T3 -> T2 -> T1 deadlock
|
||||
SET debug_dbug = '+d,innodb_deadlock_victim_self';
|
||||
--error ER_AUTOINC_READ_FAILED
|
||||
INSERT INTO t1(col2) VALUES(200);
|
||||
|
||||
--echo # The transaction should have been rolled back
|
||||
SELECT * FROM t1;
|
||||
SELECT * FROM t2;
|
||||
|
||||
--echo # Release the previous savepoint using the same name
|
||||
SAVEPOINT s1;
|
||||
COMMIT;
|
||||
|
||||
--connection con2
|
||||
--reap
|
||||
COMMIT;
|
||||
|
||||
--connection default
|
||||
--reap
|
||||
COMMIT;
|
||||
|
||||
--disconnect con1
|
||||
--disconnect con2
|
||||
|
||||
--echo # Cleanup
|
||||
SELECT * FROM t1;
|
||||
DROP TABLE t1;
|
||||
|
||||
SELECT * FROM t2;
|
||||
DROP TABLE t2;
|
||||
|
||||
SET DEBUG_SYNC='RESET';
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.5 tests
|
||||
--echo #
|
||||
|
91
mysql-test/suite/innodb/t/log_upgrade_101_flags.test
Normal file
91
mysql-test/suite/innodb/t/log_upgrade_101_flags.test
Normal file
@@ -0,0 +1,91 @@
|
||||
--source include/have_innodb.inc
|
||||
--source include/big_test.inc
|
||||
--source include/not_embedded.inc
|
||||
call mtr.add_suppression("InnoDB: The change buffer is corrupted");
|
||||
call mtr.add_suppression("InnoDB: Tablespace size stored in header is 768 pages, but the sum of data file sizes is 384 pages");
|
||||
call mtr.add_suppression("InnoDB: adjusting FSP_SPACE_FLAGS of file");
|
||||
--source include/shutdown_mysqld.inc
|
||||
let bugdir= $MYSQLTEST_VARDIR/tmp/log_upgrade;
|
||||
--mkdir $bugdir
|
||||
--let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err
|
||||
--let $dirs= --innodb-data-home-dir=$bugdir --innodb-log-group-home-dir=$bugdir
|
||||
|
||||
# Test case similar to log_upgrade.test
|
||||
perl;
|
||||
do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl";
|
||||
my $polynomial = 0x82f63b78; # CRC-32C
|
||||
|
||||
die unless open OUT, ">", "$ENV{bugdir}/ibdata1";
|
||||
binmode OUT;
|
||||
|
||||
my $head = pack("Nx[18]", 0);
|
||||
# Add FSP_SPACE_FLAGS as 49152 (10.1.0...10.1.20), page_size = 32k
|
||||
my $body = pack("x[8]Nx[4]Nx[2]Nx[32696]", 768, 49152, 97937874);
|
||||
my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial);
|
||||
print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck);
|
||||
# Dummy pages 1..6.
|
||||
print OUT chr(0) x (6 * 32768);
|
||||
# Dictionary header page (page 7).
|
||||
$head = pack("Nx[18]", 7);
|
||||
$body = pack("x[32]Nx[8]Nx[32674]", 8, 9);
|
||||
$ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial);
|
||||
print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck);
|
||||
|
||||
# Empty SYS_TABLES page (page 8).
|
||||
$head = pack("NNNx[8]n", 8, ~0, ~0, 17855);
|
||||
$body = pack("nnx[31]Cx[20]", 2, 124, 1);
|
||||
$body .= pack("nxnn", 0x801, 3, 116) . "infimum";
|
||||
$body .= pack("xnxnxx", 0x901, 0x803) . "supremum";
|
||||
$body .= pack("x[32632]nn", 116, 101);
|
||||
$ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial);
|
||||
print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck);
|
||||
|
||||
# Empty SYS_INDEXES page (page 9).
|
||||
$head = pack("NNNx[8]n", 9, ~0, ~0, 17855);
|
||||
$body = pack("nnx[31]Cx[20]", 2, 124, 3);
|
||||
$body .= pack("nxnn", 0x801, 3, 116) . "infimum";
|
||||
$body .= pack("xnxnxx", 0x901, 0x803) . "supremum";
|
||||
$body .= pack("x[32632]nn", 116, 101);
|
||||
$ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial);
|
||||
print OUT pack("N",$ck).$head.pack("x[12]").$body.pack("Nx[4]",$ck);
|
||||
|
||||
die unless seek(OUT, 768 * 16384 - 1, 0);
|
||||
print OUT chr(0);
|
||||
close OUT or die;
|
||||
|
||||
die unless open OUT, ">", "$ENV{bugdir}/ib_logfile0";
|
||||
binmode OUT;
|
||||
$_= pack("Nx[5]nx[5]", 1, 0x1286) . "BogoDB 4.3.2.1" . chr(0) x 478;
|
||||
print OUT $_, pack("N", mycrc32($_, 0, $polynomial));
|
||||
# checkpoint page 1 and all-zero checkpoint 2
|
||||
$_= pack("x[13]nCNNx[484]", 0x1286, 12, 2, 0x80c);
|
||||
print OUT $_, pack("N", mycrc32($_, 0, $polynomial));
|
||||
die unless seek(OUT, 0x1FFFFFFFF, 0);
|
||||
print OUT chr(0);
|
||||
close OUT or die;
|
||||
die unless open OUT, ">", "$ENV{bugdir}/ib_logfile1";
|
||||
binmode OUT;
|
||||
die unless seek(OUT, 0x800, 0); # the first 2048 bytes are unused!
|
||||
$_= pack("Nnnx[500]", 0x80000944, 12, 12);
|
||||
print OUT $_, pack("N", mycrc32($_, 0, $polynomial));
|
||||
die unless seek(OUT, 0x1FFFFFFFF, 0);
|
||||
print OUT chr(0);
|
||||
close OUT or die;
|
||||
EOF
|
||||
|
||||
--let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=4m --innodb_page_size=32k --innodb_buffer_pool_size=10M
|
||||
--source include/start_mysqld.inc
|
||||
SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES
|
||||
WHERE engine = 'innodb'
|
||||
AND support IN ('YES', 'DEFAULT', 'ENABLED');
|
||||
--source include/shutdown_mysqld.inc
|
||||
--let SEARCH_PATTERN= InnoDB: Upgrading redo log:
|
||||
--source include/search_pattern_in_file.inc
|
||||
--let $restart_parameters= $dirs
|
||||
|
||||
--remove_files_wildcard $bugdir
|
||||
--rmdir $bugdir
|
||||
--let $restart_parameters=
|
||||
--source include/start_mysqld.inc
|
||||
|
||||
--echo # End of 10.5 tests
|
@@ -32,17 +32,22 @@ DROP DATABASE abc_def;
|
||||
|
||||
DROP DATABASE abc_def2;
|
||||
|
||||
call mtr.add_suppression("InnoDB: (Operating system error|The error means|Cannot rename file)");
|
||||
call mtr.add_suppression("InnoDB: Cannot rename '.*t1.ibd' to '.*non_existing_db.*' because the target schema directory doesn't exist");
|
||||
|
||||
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(100);
|
||||
--replace_result "\\" "/"
|
||||
--error ER_ERROR_ON_RENAME
|
||||
RENAME TABLE t1 TO non_existing_db.t1;
|
||||
|
||||
--let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot rename file '.*t1\.ibd' to '.*non_existing_db
|
||||
--let SEARCH_PATTERN= \[ERROR\] InnoDB: Cannot rename '.*t1\.ibd' to '.*non_existing_db
|
||||
let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err;
|
||||
--source include/search_pattern_in_file.inc
|
||||
|
||||
SET GLOBAL innodb_fast_shutdown=2;
|
||||
--source include/restart_mysqld.inc
|
||||
|
||||
SELECT * FROM t1;
|
||||
# Cleanup
|
||||
DROP TABLE t1;
|
||||
|
||||
|
@@ -1798,7 +1798,7 @@ t5 CREATE TABLE `t5` (
|
||||
`param09` longtext DEFAULT NULL,
|
||||
`const10` bigint(17) DEFAULT NULL,
|
||||
`param10` bigint(20) DEFAULT NULL,
|
||||
`const11` int(4) DEFAULT NULL,
|
||||
`const11` int(5) DEFAULT NULL,
|
||||
`param11` bigint(20) DEFAULT NULL,
|
||||
`const12` binary(0) DEFAULT NULL,
|
||||
`param12` bigint(20) DEFAULT NULL,
|
||||
@@ -1828,7 +1828,7 @@ def test t5 t5 const09 const09 12 19 19 Y 128 0 63
|
||||
def test t5 t5 param09 param09 252 4294967295 19 Y 16 0 8
|
||||
def test t5 t5 const10 const10 8 17 9 Y 32768 0 63
|
||||
def test t5 t5 param10 param10 8 20 9 Y 32768 0 63
|
||||
def test t5 t5 const11 const11 3 4 4 Y 32768 0 63
|
||||
def test t5 t5 const11 const11 3 5 4 Y 32768 0 63
|
||||
def test t5 t5 param11 param11 8 20 4 Y 32768 0 63
|
||||
def test t5 t5 const12 const12 254 0 0 Y 128 0 63
|
||||
def test t5 t5 param12 param12 8 20 0 Y 32768 0 63
|
||||
|
@@ -61,3 +61,15 @@ SELECT * from t6;
|
||||
i
|
||||
5
|
||||
DROP TABLE t6;
|
||||
#
|
||||
# MDEV-33011 mariabackup --backup: FATAL ERROR: ... Can't open datafile cool_down/t3
|
||||
#
|
||||
# Simulate zero initialized page to defer tablespace load after rename log is found
|
||||
SET @save_dbug = @@SESSION.debug_dbug;
|
||||
SET DEBUG_DBUG="+d,checkpoint_after_file_create";
|
||||
CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
# RENAME that fails after redo log entry is written and flushed
|
||||
RENAME TABLE t1 TO non_existing_db.t1;
|
||||
ERROR HY000: Error on rename of './test/t1' to './non_existing_db/t1' (errno: 168 "Unknown (generic) error from engine")
|
||||
DROP TABLE t1;
|
||||
|
@@ -92,4 +92,31 @@ SELECT * from t6;
|
||||
DROP TABLE t6;
|
||||
rmdir $targetdir;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-33011 mariabackup --backup: FATAL ERROR: ... Can't open datafile cool_down/t3
|
||||
--echo #
|
||||
|
||||
--disable_query_log
|
||||
call mtr.add_suppression("InnoDB: Cannot rename '.*t1.ibd' to '.*non_existing_db.*' because the target schema directory doesn't exist");
|
||||
--enable_query_log
|
||||
|
||||
mkdir $targetdir;
|
||||
|
||||
--echo # Simulate zero initialized page to defer tablespace load after rename log is found
|
||||
SET @save_dbug = @@SESSION.debug_dbug;
|
||||
SET DEBUG_DBUG="+d,checkpoint_after_file_create";
|
||||
CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES(1);
|
||||
|
||||
--echo # RENAME that fails after redo log entry is written and flushed
|
||||
--replace_result "\\" "/"
|
||||
--error ER_ERROR_ON_RENAME
|
||||
RENAME TABLE t1 TO non_existing_db.t1;
|
||||
|
||||
--disable_result_log
|
||||
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir;
|
||||
exec $XTRABACKUP --prepare --target-dir=$targetdir;
|
||||
--enable_result_log
|
||||
|
||||
DROP TABLE t1;
|
||||
rmdir $targetdir;
|
||||
|
64
mysql-test/suite/rpl/r/rpl_auditing.result
Normal file
64
mysql-test/suite/rpl/r/rpl_auditing.result
Normal file
@@ -0,0 +1,64 @@
|
||||
include/master-slave.inc
|
||||
[connection master]
|
||||
drop table if exists t1;
|
||||
connection slave;
|
||||
reset master;
|
||||
CREATE TABLE IF NOT EXISTS mysql.server_audit_filters (
|
||||
filtername char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
rule longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT 'true' CHECK (json_valid(rule)),
|
||||
CONSTRAINT c_filtername UNIQUE (filtername)
|
||||
) ENGINE=Aria;
|
||||
CREATE TABLE IF NOT EXISTS mysql.server_audit_users (host char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
user char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
filtername char(80) NOT NULL DEFAULT '',
|
||||
CONSTRAINT c_host_user UNIQUE (host, user)
|
||||
) ENGINE=Aria;
|
||||
INSERT INTO mysql.server_audit_filters VALUES ('ignore_sys', '{"ignore_tables" : "mysql.*"}');
|
||||
INSERT INTO mysql.server_audit_users VALUES ('%','<replication_slave>','ignore_sys');
|
||||
INSERT INTO mysql.server_audit_users VALUES ('%','root','ignore_sys');
|
||||
install plugin server_audit soname 'server_audit2';
|
||||
set global server_audit_logging=on;
|
||||
connection master;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1);
|
||||
truncate t1;
|
||||
drop table t1;
|
||||
connection slave;
|
||||
set global server_audit_logging=off;
|
||||
truncate mysql.server_audit_filters;
|
||||
truncate mysql.server_audit_users;
|
||||
INSERT INTO mysql.server_audit_filters VALUES ('no_logging','false');
|
||||
INSERT INTO mysql.server_audit_users VALUES ('%','<replication_slave>','no_logging');
|
||||
set global server_audit_logging=on;
|
||||
connection master;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1);
|
||||
truncate t1;
|
||||
drop table t1;
|
||||
connection slave;
|
||||
set global server_audit_logging=off;
|
||||
uninstall plugin server_audit;
|
||||
Warnings:
|
||||
Warning 1620 Plugin is busy and will be uninstalled on shutdown
|
||||
truncate mysql.server_audit_filters;
|
||||
truncate mysql.server_audit_users;
|
||||
TIME,HOSTNAME,,,0,0,AUDIT_CONFIG,,file_path=server_audit.log,0
|
||||
TIME,HOSTNAME,,,0,0,AUDIT_CONFIG,,rotate_size=1000000,0
|
||||
TIME,HOSTNAME,,,0,0,AUDIT_CONFIG,,file_rotations=9,0
|
||||
TIME,HOSTNAME,root,localhost,ID,0,AUDIT_CONFIG,test,logging=ON,0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_logging=on',0
|
||||
TIME,HOSTNAME,<replication_slave>,,ID,ID,CREATE,test,t1,
|
||||
TIME,HOSTNAME,<replication_slave>,,ID,ID,WRITE,test,t1,
|
||||
TIME,HOSTNAME,<replication_slave>,,ID,ID,CREATE,test,t1,
|
||||
TIME,HOSTNAME,<replication_slave>,,ID,ID,DROP,test,t1,
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select master_pos_wait(\'master-bin.#', POS, 300, \'\')',0
|
||||
TIME,HOSTNAME,root,localhost,ID,0,AUDIT_CONFIG,test,logging=OFF,0
|
||||
TIME,HOSTNAME,,,0,0,AUDIT_CONFIG,,file_path=server_audit.log,0
|
||||
TIME,HOSTNAME,,,0,0,AUDIT_CONFIG,,rotate_size=1000000,0
|
||||
TIME,HOSTNAME,,,0,0,AUDIT_CONFIG,,file_rotations=9,0
|
||||
TIME,HOSTNAME,root,localhost,ID,0,AUDIT_CONFIG,test,logging=ON,0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'set global server_audit_logging=on',0
|
||||
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'select master_pos_wait(\'master-bin.#', POS, 300, \'\')',0
|
||||
TIME,HOSTNAME,root,localhost,ID,0,AUDIT_CONFIG,test,logging=OFF,0
|
||||
connection master;
|
||||
include/rpl_end.inc
|
@@ -27,12 +27,19 @@ connection slave;
|
||||
# delaying a transaction; then when the reciprocal START SLAVE occurs,
|
||||
# if the event is still to be delayed, SBM should resume accordingly
|
||||
include/stop_slave.inc
|
||||
# Lock t1 on slave to ensure the event can't finish (and thereby update
|
||||
# Seconds_Behind_Master) so slow running servers don't accidentally
|
||||
# catch up to the master before checking SBM.
|
||||
connection server_2;
|
||||
LOCK TABLES t1 WRITE;
|
||||
include/start_slave.inc
|
||||
connection slave;
|
||||
# Waiting for replica to resume the delay for the transaction
|
||||
# Sleeping 1s to increment SBM
|
||||
# Ensuring Seconds_Behind_Master increases after sleeping..
|
||||
# ..done
|
||||
connection server_2;
|
||||
UNLOCK TABLES;
|
||||
include/sync_with_master_gtid.inc
|
||||
#
|
||||
# Pt 2) If the worker threads have not entered an idle state, ensure
|
||||
|
77
mysql-test/suite/rpl/t/rpl_auditing.test
Normal file
77
mysql-test/suite/rpl/t/rpl_auditing.test
Normal file
@@ -0,0 +1,77 @@
|
||||
if (!$SERVER_AUDIT2_SO) {
|
||||
skip No SERVER_AUDIT2 plugin;
|
||||
}
|
||||
|
||||
source include/master-slave.inc;
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1;
|
||||
sync_slave_with_master;
|
||||
reset master;
|
||||
--enable_warnings
|
||||
|
||||
--disable_warnings
|
||||
CREATE TABLE IF NOT EXISTS mysql.server_audit_filters (
|
||||
filtername char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
rule longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT 'true' CHECK (json_valid(rule)),
|
||||
CONSTRAINT c_filtername UNIQUE (filtername)
|
||||
) ENGINE=Aria;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS mysql.server_audit_users (host char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
user char(80) COLLATE utf8_bin NOT NULL DEFAULT '',
|
||||
filtername char(80) NOT NULL DEFAULT '',
|
||||
CONSTRAINT c_host_user UNIQUE (host, user)
|
||||
) ENGINE=Aria;
|
||||
--enable_warnings
|
||||
|
||||
INSERT INTO mysql.server_audit_filters VALUES ('ignore_sys', '{"ignore_tables" : "mysql.*"}');
|
||||
INSERT INTO mysql.server_audit_users VALUES ('%','<replication_slave>','ignore_sys');
|
||||
INSERT INTO mysql.server_audit_users VALUES ('%','root','ignore_sys');
|
||||
|
||||
install plugin server_audit soname 'server_audit2';
|
||||
set global server_audit_logging=on;
|
||||
|
||||
# this is done to make test deterministic
|
||||
# so the above 'set' command is always logged before the 'create table t1'
|
||||
-- disable_query_log
|
||||
-- disable_result_log
|
||||
select * from mysql.server_audit_filters;
|
||||
select * from mysql.server_audit_users;
|
||||
-- enable_result_log
|
||||
-- enable_query_log
|
||||
|
||||
connection master;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1);
|
||||
truncate t1;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
set global server_audit_logging=off;
|
||||
|
||||
truncate mysql.server_audit_filters;
|
||||
truncate mysql.server_audit_users;
|
||||
INSERT INTO mysql.server_audit_filters VALUES ('no_logging','false');
|
||||
INSERT INTO mysql.server_audit_users VALUES ('%','<replication_slave>','no_logging');
|
||||
|
||||
set global server_audit_logging=on;
|
||||
|
||||
connection master;
|
||||
create table t1 (a int);
|
||||
insert into t1 values (1);
|
||||
truncate t1;
|
||||
drop table t1;
|
||||
sync_slave_with_master;
|
||||
|
||||
set global server_audit_logging=off;
|
||||
uninstall plugin server_audit;
|
||||
truncate mysql.server_audit_filters;
|
||||
truncate mysql.server_audit_users;
|
||||
let $MYSQLD_DATADIR= `SELECT @@datadir`;
|
||||
# replace the timestamp and the hostname with constant values
|
||||
--replace_regex /[0-9]* [0-9][0-9]:[0-9][0-9]:[0-9][0-9]\,[^,]*\,/TIME,HOSTNAME,/ /\,[1-9][0-9]*\,/,1,/ /\,[1-9][0-9]*/,ID/ /000001\\', [0-9]*,/#', POS,/
|
||||
cat_file $MYSQLD_DATADIR/server_audit.log;
|
||||
remove_file $MYSQLD_DATADIR/server_audit.log;
|
||||
|
||||
connection master;
|
||||
--source include/rpl_end.inc
|
@@ -67,6 +67,13 @@ if (`SELECT $sbm_trx1_arrive > ($seconds_since_idling + 1)`)
|
||||
--echo # if the event is still to be delayed, SBM should resume accordingly
|
||||
|
||||
--source include/stop_slave.inc
|
||||
|
||||
--echo # Lock t1 on slave to ensure the event can't finish (and thereby update
|
||||
--echo # Seconds_Behind_Master) so slow running servers don't accidentally
|
||||
--echo # catch up to the master before checking SBM.
|
||||
--connection server_2
|
||||
LOCK TABLES t1 WRITE;
|
||||
|
||||
--source include/start_slave.inc
|
||||
|
||||
--connection slave
|
||||
@@ -86,6 +93,9 @@ if (`SELECT $sbm_trx1_after_1s_sleep <= $sbm_trx1_arrive`)
|
||||
}
|
||||
--echo # ..done
|
||||
|
||||
--connection server_2
|
||||
UNLOCK TABLES;
|
||||
|
||||
--source include/sync_with_master_gtid.inc
|
||||
|
||||
--echo #
|
||||
|
@@ -78,7 +78,7 @@ SELECT JSON_CONTAINS(@json_doc, '"COMMIT"', '$[0].statements_executed[1].sql_tex
|
||||
SET @sys.ps_thread_trx_info.max_length = 100;
|
||||
|
||||
# Should return an error JSON object
|
||||
--replace_regex /Row 1[1-2] was/Row 1X was/
|
||||
--replace_regex /Row \d+ was/Row 1X was/
|
||||
SELECT sys.ps_thread_trx_info(@ps_thread_id);
|
||||
|
||||
# Setting the user variable back to NULL should reset to 65535 from sys_config, and no truncation
|
||||
|
Reference in New Issue
Block a user