1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-07 00:04:31 +03:00

Merge 10.5 into 10.6

This commit is contained in:
Marko Mäkelä
2024-03-12 09:19:57 +02:00
80 changed files with 2667 additions and 617 deletions

View 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

View File

@@ -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

View 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

View File

@@ -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 #