1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

Merge branch '10.3' into 10.4

This commit is contained in:
Oleksandr Byelkin
2019-05-19 20:55:37 +02:00
3893 changed files with 11766 additions and 6460 deletions

View File

@@ -15,7 +15,6 @@ rpl_get_master_version_and_clock : Bug#11766137 Jan 05 2011 joro Valgrind warnin
rpl_partition_archive : MDEV-5077 2013-09-27 svoj Cannot exchange partition with archive table
rpl_row_binlog_max_cache_size : MDEV-11092
rpl_blackhole : MDEV-11094
rpl_row_mysqlbinlog : MDEV-11095
rpl_row_index_choice : MDEV-11666
rpl_parallel2 : fails after MDEV-16172
rpl_semi_sync_after_sync : fails after MDEV-16172

View File

@@ -13,7 +13,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
use File::Basename;
use File::Copy qw(copy);

View File

@@ -0,0 +1,18 @@
include/master-slave.inc
[connection master]
connection slave;
set global debug_dbug='d,rows_log_event_before_open_table';
set debug_sync='now WAIT_FOR before_open_table';
connection master;
create table t1 (a int);
insert t1 values (1),(2),(3);
connection slave;
kill slave_sql_thread;
set debug_sync='now SIGNAL go_ahead_sql';
set global debug_dbug='';
set debug_sync='RESET';
connection master;
drop table t1;
connection slave;
start slave;
include/rpl_end.inc

View File

@@ -0,0 +1,29 @@
include/master-slave.inc
[connection master]
CREATE TABLE t1 (id mediumint(8) unsigned NOT NULL AUTO_INCREMENT, someLabel varchar(30) NOT NULL, flag tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (id)) Engine=MyISAM;
CREATE TABLE t2 (id mediumint(8) unsigned NOT NULL AUTO_INCREMENT, data varchar(30) NOT NULL, status tinyint(1) NOT NULL, PRIMARY KEY (id)) Engine=MyISAM;
CREATE TABLE t3 (id mediumint(8) unsigned NOT NULL AUTO_INCREMENT, t1id mediumint(8) unsigned NOT NULL, flag tinyint(1) NOT NULL DEFAULT 0, status tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (id)) Engine=MyISAM;
INSERT INTO t1 ( id, someLabel, flag ) VALUES ( 1, 'ABC', 0 );
CREATE OR REPLACE TRIGGER doNothing
BEFORE UPDATE ON t1
FOR EACH ROW
BEGIN
IF
new.someLabel != old.someLabel
THEN
UPDATE t3 SET t3.flag = 0;
END IF;
END|
FLUSH LOGS;
LOCK TABLES t1 WRITE, t2 WRITE;
INSERT INTO t2 (data, status) VALUES ('1', 4);
UPDATE t1 SET flag = 1 WHERE id = 1;
INSERT INTO t2 (data, status) VALUES ('2', 4);
UNLOCK TABLES;
connection slave;
include/diff_tables.inc [master:t1, slave:t1]
include/diff_tables.inc [master:t2, slave:t2]
include/diff_tables.inc [master:t3, slave:t3]
connection master;
DROP TABLE t1, t2, t3;
include/rpl_end.inc

View File

@@ -4,9 +4,13 @@ connection master;
SET GLOBAL event_scheduler=off;
CREATE TABLE t1 (a INT);
CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (10);
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
CREATE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (11);
ERROR HY000: Event 'ev1' already exists
CREATE OR REPLACE EVENT ev1 ON SCHEDULE EVERY 1 SECOND DO INSERT INTO t1 VALUES (11);
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
SELECT EVENT_NAME,STATUS,EVENT_DEFINITION FROM INFORMATION_SCHEMA.EVENTS;
EVENT_NAME STATUS EVENT_DEFINITION
ev1 ENABLED INSERT INTO t1 VALUES (11)

View File

@@ -90,6 +90,8 @@ include/diff_tables.inc [server_1:v_user, server_2:v_user, server_3:v_user]
# Verify 'ALTER EVENT...' statement
connection master;
CREATE EVENT e1 ON SCHEDULE EVERY 1 DAY DO SELECT * FROM t1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
# Explicitly assign CURRENT_USER() to definer
ALTER DEFINER=CURRENT_USER() EVENT e1 ENABLE;
include/rpl_sync.inc

View File

@@ -31,6 +31,8 @@ test justonce SLAVESIDE_DISABLED 1
DROP EVENT IF EXISTS test.slave_once;
CREATE EVENT test.slave_once ON SCHEDULE EVERY 5 MINUTE STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (3, 'from slave_once');
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
"Checking event status on the slave for originator value = slave's server_id"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_once';
db name status originator
@@ -78,6 +80,8 @@ db name status originator
"Creating event test.slave_terminate on the slave"
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND STARTS CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO
INSERT IGNORE INTO t1(id, c) VALUES (6, 'from slave_terminate');
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
"Checking event status on the slave"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
db name status originator
@@ -87,6 +91,8 @@ DROP EVENT test.slave_terminate;
"Creating event test.slave_terminate with DISABLE ON SLAVE on the slave"
CREATE EVENT test.slave_terminate ON SCHEDULE EVERY 3 SECOND DISABLE ON SLAVE DO
INSERT IGNORE INTO t1(c) VALUES (7, 'from slave_terminate');
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
"Checking event status on the slave"
SELECT db, name, status, originator FROM mysql.event WHERE db = 'test' AND name = 'slave_terminate';
db name status originator

View File

@@ -237,6 +237,8 @@ DO
BEGIN
UPDATE test.t1 SET a = a + 1 WHERE a < 10;
END|
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
connection slave;
RESET SLAVE;
CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=MASTER_PORT, MASTER_USER='root', MASTER_CONNECT_RETRY=20, MASTER_HEARTBEAT_PERIOD=5;

View File

@@ -679,6 +679,8 @@ DROP TRIGGER tr1;
******************** EVENTS ********************
INSERT INTO t1 VALUES(1, 'test1');
CREATE EVENT e1 ON SCHEDULE EVERY '1' SECOND COMMENT 'e_second_comment' DO DELETE FROM t1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
SHOW EVENTS;
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
test_rpl e1 root@localhost SYSTEM RECURRING NULL 1 # # NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci

View File

@@ -50,11 +50,15 @@ BEGIN
ALTER EVENT e1 DISABLE;
CALL p1(10, '');
END|
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
CREATE EVENT e11 ON SCHEDULE EVERY 1 SECOND DISABLE DO
BEGIN
ALTER EVENT e11 DISABLE;
CALL p11(10, '');
END|
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
CREATE FUNCTION f1 (x INT) RETURNS VARCHAR(64)
BEGIN
IF x > 5 THEN

View File

@@ -32,6 +32,8 @@ CREATE DATABASE d1;
CREATE EVENT e1
ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 DAY
DO INSERT INTO test.t1 VALUES (1);
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
CREATE FUNCTION f1 () RETURNS INT DETERMINISTIC
RETURN 1;
CREATE PROCEDURE p1 (OUT rows_cnt INT)

View File

@@ -62,6 +62,8 @@ INSERT INTO tt_1(ddl_case) VALUES (28);
DROP USER 'user_new'@'localhost';
INSERT INTO tt_1(ddl_case) VALUES (27);
CREATE EVENT evt ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT * FROM tt_1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
INSERT INTO tt_1(ddl_case) VALUES (26);
ALTER EVENT evt COMMENT 'evt';
INSERT INTO tt_1(ddl_case) VALUES (25);

View File

@@ -62,6 +62,8 @@ INSERT INTO tt_1(ddl_case) VALUES (28);
DROP USER 'user_new'@'localhost';
INSERT INTO tt_1(ddl_case) VALUES (27);
CREATE EVENT evt ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT * FROM tt_1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
INSERT INTO tt_1(ddl_case) VALUES (26);
ALTER EVENT evt COMMENT 'evt';
INSERT INTO tt_1(ddl_case) VALUES (25);

View File

@@ -169,7 +169,7 @@ use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=1342177280/*!*/;
SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
@@ -192,7 +192,7 @@ use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=1342177280/*!*/;
SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
@@ -307,7 +307,7 @@ use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=1342177280/*!*/;
SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
@@ -336,7 +336,7 @@ use `test`/*!*/;
SET TIMESTAMP=1000000000/*!*/;
SET @@session.pseudo_thread_id=999999999/*!*/;
SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
SET @@session.sql_mode=1342177280/*!*/;
SET @@session.sql_mode=1411383296/*!*/;
SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
/*!\C latin1 *//*!*/;
SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;

View File

@@ -62,6 +62,8 @@ INSERT INTO tt_1(ddl_case) VALUES (28);
DROP USER 'user_new'@'localhost';
INSERT INTO tt_1(ddl_case) VALUES (27);
CREATE EVENT evt ON SCHEDULE AT CURRENT_TIMESTAMP + INTERVAL 1 HOUR DO SELECT * FROM tt_1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
INSERT INTO tt_1(ddl_case) VALUES (26);
ALTER EVENT evt COMMENT 'evt';
INSERT INTO tt_1(ddl_case) VALUES (25);

View File

@@ -4,6 +4,8 @@ CREATE TEMPORARY TABLE t1 (a INT);
CREATE TABLE t2 (a INT, b INT) ENGINE= MyISAM;
INSERT INTO t1 VALUES (1);
CREATE EVENT e1 ON SCHEDULE EVERY 10 HOUR DO SELECT 1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
INSERT INTO t1 VALUES (1);
ALTER EVENT e1 ON SCHEDULE EVERY 20 HOUR DO SELECT 1;
INSERT INTO t1 VALUES (1);
@@ -125,6 +127,8 @@ ERROR HY000: Can't execute the given command because you have active locked tabl
INSERT INTO t2 VALUES ("CREATE EVENT e1 with table locked");
UNLOCK TABLE;
CREATE EVENT e2 ON SCHEDULE EVERY 10 HOUR DO SELECT 1;
Warnings:
Warning 1105 Event scheduler is switched off, use SET GLOBAL event_scheduler=ON to enable it.
LOCK TABLE t1 WRITE;
ALTER EVENT e2 ON SCHEDULE EVERY 20 HOUR DO SELECT 1;
ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction

View File

@@ -0,0 +1,28 @@
source include/have_debug_sync.inc;
source include/have_binlog_format_row.inc;
source include/master-slave.inc;
connection slave;
set global debug_dbug='d,rows_log_event_before_open_table';
send set debug_sync='now WAIT_FOR before_open_table';
connection master;
create table t1 (a int);
insert t1 values (1),(2),(3);
connection slave;
reap;
let $a=`select id from information_schema.processlist where state='debug sync point: now'`;
replace_result $a slave_sql_thread;
eval kill $a;
set debug_sync='now SIGNAL go_ahead_sql';
set global debug_dbug='';
set debug_sync='RESET';
connection master;
drop table t1;
connection slave;
start slave;
source include/rpl_end.inc;

View File

@@ -0,0 +1,72 @@
# ==== Purpose ====
#
# Test verifies that there are no duplicate entries in binlog (i.e a safe
# statement which follows an unsafe statement gets logged in both row format
# and statement format resulting in duplicate entry) when binlog-format=MIXED
# and LOCK TABLES are enabled.
#
# ==== Implementation ====
#
# Steps:
# 1 - Create three tables t1,t2 and t3 with AUTO_INCREMENT on.
# 2 - Create a trigger on table t3, so that trigger execution results in
# unsafe statement. Note query that modifies autoinc column in
# sub-statement can make the master and slave inconsistent. Hence they
# are logged in row format.
# 3 - Lock tables t1,t2 and t3.
# 4 - Execute an unsafe update which modifies tables t1 and t3. But since t2
# table is also locked its table map event also gets written into the
# binary log during the execution of update.
# 5 - Execute a safe DML operation using table 't2' and verify that master
# doesn't report any assert.
# 6 - Ensure that slave is in sync with master and data is consistent.
#
# ==== References ====
#
# MDEV-19158: MariaDB 10.2.22 is writing duplicate entries into binary log
--source include/have_binlog_format_mixed.inc
--source include/master-slave.inc
CREATE TABLE t1 (id mediumint(8) unsigned NOT NULL AUTO_INCREMENT, someLabel varchar(30) NOT NULL, flag tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (id)) Engine=MyISAM;
CREATE TABLE t2 (id mediumint(8) unsigned NOT NULL AUTO_INCREMENT, data varchar(30) NOT NULL, status tinyint(1) NOT NULL, PRIMARY KEY (id)) Engine=MyISAM;
CREATE TABLE t3 (id mediumint(8) unsigned NOT NULL AUTO_INCREMENT, t1id mediumint(8) unsigned NOT NULL, flag tinyint(1) NOT NULL DEFAULT 0, status tinyint(1) NOT NULL DEFAULT 0, PRIMARY KEY (id)) Engine=MyISAM;
INSERT INTO t1 ( id, someLabel, flag ) VALUES ( 1, 'ABC', 0 );
DELIMITER |;
CREATE OR REPLACE TRIGGER doNothing
BEFORE UPDATE ON t1
FOR EACH ROW
BEGIN
IF
new.someLabel != old.someLabel
THEN
UPDATE t3 SET t3.flag = 0;
END IF;
END|
DELIMITER ;|
FLUSH LOGS;
LOCK TABLES t1 WRITE, t2 WRITE;
INSERT INTO t2 (data, status) VALUES ('1', 4);
UPDATE t1 SET flag = 1 WHERE id = 1;
INSERT INTO t2 (data, status) VALUES ('2', 4);
UNLOCK TABLES;
sync_slave_with_master;
let $diff_tables= master:t1, slave:t1;
--source include/diff_tables.inc
let $diff_tables= master:t2, slave:t2;
--source include/diff_tables.inc
let $diff_tables= master:t3, slave:t3;
--source include/diff_tables.inc
--connection master
DROP TABLE t1, t2, t3;
--source include/rpl_end.inc

View File

@@ -151,8 +151,7 @@ remove_file $MYSQLTEST_VARDIR/tmp/master.sql;
--exec $MYSQL_BINLOG --short-form --local-load=$MYSQLTEST_VARDIR/tmp/ --stop-position=$stop_position --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
--echo --- Test 4 Second Remote test --
--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql
--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000002 >> $MYSQLTEST_VARDIR/tmp/remote.sql
--exec $MYSQL_BINLOG --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --to-last-log master-bin.000001 > $MYSQLTEST_VARDIR/tmp/remote.sql
# Now that we have our file, lets get rid of the current database.
# Cleanup the master and the slave and try to recreate.