1
0
mirror of https://github.com/MariaDB/server.git synced 2026-10-23 18:49:29 +03:00

Merge 10.11 into 11.4

This commit is contained in:
Marko Mäkelä
2025-11-28 12:56:27 +02:00
83 changed files with 2634 additions and 377 deletions

View File

@@ -1236,7 +1236,7 @@ static void backup_file_op_fail(uint32_t space_id, int type,
msg("DDL tracking : create %" PRIu32 " \"%.*s\"",
space_id, int(len), name);
fail = !check_if_skip_table(spacename.c_str());
if (!opt_no_lock && fail &&
if (fail && !opt_no_lock &&
check_if_fts_table(spacename.c_str())) {
/* Ignore the FTS internal table because InnoDB does
create intermediate table and their associative FTS
@@ -1263,6 +1263,11 @@ static void backup_file_op_fail(uint32_t space_id, int type,
break;
case FILE_DELETE:
fail = !check_if_skip_table(spacename.c_str())
/* Ignore the FTS internal table because InnoDB may
drop intermediate table and their associative FTS
internal table as a part of inplace rollback operation.
backup_set_alter_copy_lock() downgrades the
MDL_BACKUP_DDL before inplace phase of alter */
&& !check_if_fts_table(spacename.c_str());
msg("DDL tracking : delete %" PRIu32 " \"%.*s\"",
space_id, int(len), name);
@@ -5874,6 +5879,8 @@ void CorruptedPages::backup_fix_ddl(ds_ctxt *ds_data, ds_ctxt *ds_meta)
node, 0, dest_name.c_str(),
wf_write_through, *this);
}
DBUG_MARIABACKUP_EVENT("after_backup_fix_ddl", {});
}

View File

@@ -401,6 +401,13 @@ enum mariadb_field_attr_t
#define SERVER_STATUS_ANSI_QUOTES 32768U
/*
Set for stored procedures if the select query returned a row
To check for an empty query, one must also check thd::get_sent_row_count()
*/
#define SERVER_STATUS_RETURNED_ROW (1U << 16)
/**
Server status flags that must be cleared when starting
execution of a new SQL statement.
@@ -417,7 +424,8 @@ enum mariadb_field_attr_t
SERVER_STATUS_DB_DROPPED |\
SERVER_STATUS_CURSOR_EXISTS|\
SERVER_STATUS_LAST_ROW_SENT|\
SERVER_SESSION_STATE_CHANGED)
SERVER_SESSION_STATE_CHANGED|\
SERVER_STATUS_RETURNED_ROW)
#define MYSQL_ERRMSG_SIZE 512
#define NET_READ_TIMEOUT 30 /* Timeout on read */

View File

@@ -791,7 +791,7 @@ SELECT 'AB' RLIKE 'A# this is a comment\nB';
'AB' RLIKE 'A B'
1
SELECT 'AB' RLIKE 'A# this is a comment\nB';
'AB' RLIKE 'A# this is a comment\nB'
'AB' RLIKE 'A# this is a comment\nB'
1
SET default_regex_flags=DEFAULT;
SELECT 'Aq' RLIKE 'A\\q';

View File

@@ -381,6 +381,8 @@ SELECT 'AB' RLIKE 'A B';
SELECT 'AB' RLIKE 'A# this is a comment\nB';
SET default_regex_flags=DEFAULT;
# pcre2 versions differ in the reported error offset for invalid escapes
--replace_regex /offset 2/offset 3/
--error ER_REGEXP_ERROR
SELECT 'Aq' RLIKE 'A\\q';

View File

@@ -371,7 +371,7 @@ insert into t1 values ('85984',GeomFromText('MULTIPOLYGON(((-115.006363
# Expected results are 115.2970604672862 and 36.23335610879993, but IA64 returns
# slightly different values due to fused multiply-add instructions.
--replace_result 115.29706047613604 115.2970604672862 36.23335611157958 36.23335610879993
--replace_regex /115.2970604[67]\d+/115.2970604672862/ /36.233356111579\d+/36.23335610879993/
select object_id, geometrytype(geo), ISSIMPLE(GEO), ASTEXT(centroid(geo)) from
t1 where object_id=85998;

View File

@@ -4,10 +4,9 @@
create user foo@'127.0.0.1';
connect con1,127.0.0.1,foo,,;
connection default;
select user from information_schema.processlist;
select user from information_schema.processlist where id=$con1_id;
user
foo
root
kill user foo@'127.0.0.1';
drop user foo@'127.0.0.1';
#
@@ -28,11 +27,11 @@ Id User Host db Command Time State Info Progress
kill user a;
kill user x;
connection a;
show processlist;
Id User Host db Command Time State Info Progress
# root # test # # # # #
# a # NULL # # # # #
# b # test # # # # #
select user from information_schema.processlist where id in (connection_id(), $b_id, $default_id) order by user;
user
a
b
root
kill user b;
ERROR HY000: Operation KILL USER failed for b@%
connection default;

View File

@@ -16,9 +16,10 @@
create user foo@'127.0.0.1';
--connect (con1,127.0.0.1,foo,,)
let $con1_id= `select connection_id()`;
--connection default
select user from information_schema.processlist;
evalp select user from information_schema.processlist where id=$con1_id;
kill user foo@'127.0.0.1';
let $wait_condition=
@@ -31,6 +32,7 @@ drop user foo@'127.0.0.1';
--echo #
--echo # KILL USER and missing privileges
--echo #
let $default_id= `select connection_id()`;
create user a@'127.0.0.1';
create user b@'127.0.0.1';
grant process on *.* to a@'127.0.0.1';
@@ -38,13 +40,13 @@ grant select on *.* to b@'127.0.0.1';
--connect a,127.0.0.1,a
show grants;
--connect b,127.0.0.1,b
let $b_id= `select connection_id()`;
--replace_column 1 # 3 # 5 # 6 # 9 #
show processlist;
kill user a; # existing connection, but not visible to current_user
kill user x; # not existing connection
--connection a
--replace_column 1 # 3 # 5 # 6 # 7 # 8 # 9 #
show processlist;
evalp select user from information_schema.processlist where id in (connection_id(), $b_id, $default_id) order by user;
--error ER_KILL_DENIED_ERROR
kill user b;
--connection default

View File

@@ -45,4 +45,13 @@ REPAIR LOCAL TABLE t1 USE_FRM;
REPAIR LOCAL TABLE t1;
DROP TABLE t1;
SET max_session_mem_used=default;
#
# MDEV-38005 Assertion `(yyvsp[-3].simple_string) < (yyvsp[-1].simple_string)' failed
#
SET max_session_mem_used=1;
Warnings:
Warning 1292 Truncated incorrect max_session_mem_used value: '1'
CREATE TABLE t SELECT 1000000000000000000000000000000000000000000000000000000000000000000000000000000001 AS c;
ERROR HY000: The MariaDB server is running with the --max-session-mem-used=8192 option so it cannot execute this statement
SET max_session_mem_used=default;
# End of 10.6 tests

View File

@@ -82,4 +82,12 @@ REPAIR LOCAL TABLE t1;
DROP TABLE t1;
SET max_session_mem_used=default;
--echo #
--echo # MDEV-38005 Assertion `(yyvsp[-3].simple_string) < (yyvsp[-1].simple_string)' failed
--echo #
SET max_session_mem_used=1;
--error ER_OPTION_PREVENTS_STATEMENT
CREATE TABLE t SELECT 1000000000000000000000000000000000000000000000000000000000000000000000000000000001 AS c;
SET max_session_mem_used=default;
--echo # End of 10.6 tests

View File

@@ -98,4 +98,48 @@ SHOW STATUS LIKE "Empty_queries";
Variable_name Value
Empty_queries 2
DROP TABLE t1, t2;
#
# MDEV-32266 All queries in stored procedures increment empty_queries counter
#
show status like "Empty_queries";
Variable_name Value
Empty_queries 2
CREATE TABLE t1 (id INT);
insert into t1 values (1),(2);
CREATE PROCEDURE proc1 (OUT cnt INT, id_var int)
BEGIN
SELECT COUNT(*) INTO cnt FROM t1 where id=id_var;
END$$
CREATE PROCEDURE proc2 (id_var int)
BEGIN
declare cnt int;
SELECT id INTO cnt FROM t1 where id=id_var;
END$$
create function f1(x int) returns int return (x in ((select id from t1 where id <= 4)));
flush status;
show status like "Empty_queries";
Variable_name Value
Empty_queries 0
CALL proc1(@cnt,1);
CALL proc1(@cnt,3);
CALL proc2(1);
select f1(1);
f1(1)
1
select f1(8);
f1(8)
0
show status like "Empty_queries";
Variable_name Value
Empty_queries 0
CALL proc2(4);
Warnings:
Warning 1329 No data - zero rows fetched, selected, or processed
show status like "Empty_queries";
Variable_name Value
Empty_queries 1
drop procedure proc1;
drop procedure proc2;
drop function f1;
drop table t1;
# End of 10.11 tests

View File

@@ -92,4 +92,46 @@ SHOW STATUS LIKE "Empty_queries";
DROP TABLE t1, t2;
--echo #
--echo # MDEV-32266 All queries in stored procedures increment empty_queries counter
--echo #
show status like "Empty_queries";
CREATE TABLE t1 (id INT);
insert into t1 values (1),(2);
DELIMITER $$;
CREATE PROCEDURE proc1 (OUT cnt INT, id_var int)
BEGIN
SELECT COUNT(*) INTO cnt FROM t1 where id=id_var;
END$$
CREATE PROCEDURE proc2 (id_var int)
BEGIN
declare cnt int;
SELECT id INTO cnt FROM t1 where id=id_var;
END$$
DELIMITER ;$$
create function f1(x int) returns int return (x in ((select id from t1 where id <= 4)));
flush status;
show status like "Empty_queries";
# These should not increase empty queries
CALL proc1(@cnt,1);
CALL proc1(@cnt,3);
CALL proc2(1);
select f1(1);
select f1(8);
show status like "Empty_queries";
# These should increase empty queries
CALL proc2(4);
show status like "Empty_queries";
drop procedure proc1;
drop procedure proc2;
drop function f1;
drop table t1;
--echo # End of 10.11 tests

View File

@@ -0,0 +1,627 @@
connection node_2;
connection node_1;
SET GLOBAL sql_mode=0;
SET sql_mode=DEFAULT;
CREATE TABLE t (c INT,c2 BLOB NOT NULL,KEY k2 (c2 (1),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * from t;
c c2
1
1
1
1
1
DROP TABLE t;
CREATE TABLE t (c INT,c2 BLOB NOT NULL,UNIQUE KEY k2 (c2 (1),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
UPDATE t SET c2=NULL WHERE c = 1;
Warnings:
Warning 1048 Column 'c2' cannot be null
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
c c2
2
3
4
5
DROP TABLE t;
CREATE TABLE t (c INT,c2 BLOB NOT NULL,KEY k2 (c, c2 (1))) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
UPDATE t SET c2=NULL WHERE c = 1;
Warnings:
Warning 1048 Column 'c2' cannot be null
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
c c2
2
3
4
5
DROP TABLE t;
CREATE TABLE t (c INT,c2 VARCHAR(270) NOT NULL,UNIQUE KEY k2 (c2 (1),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
UPDATE t SET c2=NULL WHERE c = 1;
Warnings:
Warning 1048 Column 'c2' cannot be null
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
c c2
2
3
4
5
DROP TABLE t;
CREATE TABLE t (c INT,c2 VARCHAR(270) NOT NULL,KEY k2 (c, c2 (1))) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
UPDATE t SET c2=NULL WHERE c = 1;
Warnings:
Warning 1048 Column 'c2' cannot be null
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
c c2
2
3
4
5
DROP TABLE t;
CREATE TABLE t (c INT,c2 CHAR(80) NOT NULL,UNIQUE KEY k2 (c2 (1),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * from t;
c c2
1
2
3
4
5
DROP TABLE t;
CREATE TABLE t (c INT,c2 CHAR(80) NOT NULL,KEY k2 (c, c2 (1))) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * from t;
c c2
1
2
3
4
5
DROP TABLE t;
CREATE TABLE t (c INT,c2 TEXT NOT NULL,UNIQUE KEY k2 (c2 (1),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
UPDATE t SET c2=NULL WHERE c = 1;
Warnings:
Warning 1048 Column 'c2' cannot be null
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
c c2
2
3
4
5
DROP TABLE t;
CREATE TABLE t (c INT,c2 TEXT NOT NULL,KEY k2 (c, c2 (1))) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
UPDATE t SET c2=NULL WHERE c = 1;
Warnings:
Warning 1048 Column 'c2' cannot be null
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
c c2
2
3
4
5
DROP TABLE t;
CREATE TABLE t (c INT PRIMARY KEY,c2 BLOB NOT NULL,UNIQUE KEY k2 (c2 (1),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
UPDATE t SET c2=NULL WHERE c = 1;
Warnings:
Warning 1048 Column 'c2' cannot be null
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
c c2
2
3
4
5
DROP TABLE t;
CREATE TABLE t (c INT PRIMARY KEY,c2 BLOB NOT NULL,KEY k2 (c, c2 (1))) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
UPDATE t SET c2=NULL WHERE c = 1;
Warnings:
Warning 1048 Column 'c2' cannot be null
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
c c2
2
3
4
5
DROP TABLE t;
CREATE TABLE t (c INT PRIMARY KEY,c2 VARCHAR(270) NOT NULL,UNIQUE KEY k2 (c2 (1),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
UPDATE t SET c2=NULL WHERE c = 1;
Warnings:
Warning 1048 Column 'c2' cannot be null
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
c c2
2
3
4
5
DROP TABLE t;
CREATE TABLE t (c INT PRIMARY KEY,c2 VARCHAR(270) NOT NULL,KEY k2 (c, c2 (1))) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
UPDATE t SET c2=NULL WHERE c = 1;
Warnings:
Warning 1048 Column 'c2' cannot be null
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
c c2
2
3
4
5
DROP TABLE t;
CREATE TABLE t (c INT PRIMARY KEY,c2 CHAR(80) NOT NULL,UNIQUE KEY k2 (c2 (1),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * from t;
c c2
1
2
3
4
5
DROP TABLE t;
CREATE TABLE t (c INT PRIMARY KEY,c2 CHAR(80) NOT NULL,KEY k2 (c, c2 (1))) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
SELECT * from t;
c c2
1
2
3
4
5
DROP TABLE t;
CREATE TABLE t (c INT PRIMARY KEY,c2 TEXT NOT NULL,UNIQUE KEY k2 (c2 (1),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
UPDATE t SET c2=NULL WHERE c = 1;
Warnings:
Warning 1048 Column 'c2' cannot be null
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
c c2
2
3
4
5
DROP TABLE t;
CREATE TABLE t (c INT PRIMARY KEY,c2 TEXT NOT NULL,KEY k2 (c, c2 (1))) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
UPDATE t SET c2=NULL WHERE c = 1;
Warnings:
Warning 1048 Column 'c2' cannot be null
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
c c2
2
3
4
5
DROP TABLE t;
SET GLOBAL sql_mode=0;
SET sql_mode=DEFAULT;
CREATE TABLE t (c INT,c2 BLOB,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
DROP TABLE t;
CREATE TABLE t (c INT,c2 BLOB NOT NULL,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
UPDATE t SET c2=NULL WHERE c = 1;
Warnings:
Warning 1048 Column 'c2' cannot be null
Warning 1048 Column 'c2' cannot be null
Warning 1048 Column 'c2' cannot be null
Warning 1048 Column 'c2' cannot be null
Warning 1048 Column 'c2' cannot be null
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 BLOB,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
2 NULL
3 NULL
4 NULL
5 NULL
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 BLOB NOT NULL,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
UPDATE t SET c2=NULL WHERE c = 1;
Warnings:
Warning 1048 Column 'c2' cannot be null
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
2
3
4
5
DROP TABLE t;
CREATE TABLE t (c INT,c2 VARCHAR(270),KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
DROP TABLE t;
CREATE TABLE t (c INT,c2 VARCHAR(270) NOT NULL,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
UPDATE t SET c2=NULL WHERE c = 1;
Warnings:
Warning 1048 Column 'c2' cannot be null
Warning 1048 Column 'c2' cannot be null
Warning 1048 Column 'c2' cannot be null
Warning 1048 Column 'c2' cannot be null
Warning 1048 Column 'c2' cannot be null
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 VARCHAR(270),KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
2 NULL
3 NULL
4 NULL
5 NULL
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 VARCHAR(270) NOT NULL,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
UPDATE t SET c2=NULL WHERE c = 1;
Warnings:
Warning 1048 Column 'c2' cannot be null
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
2
3
4
5
DROP TABLE t;
CREATE TABLE t (c INT,c2 CHAR(80),KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
DROP TABLE t;
CREATE TABLE t (c INT,c2 CHAR(80) NOT NULL,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
UPDATE t SET c2=NULL WHERE c = 1;
Warnings:
Warning 1048 Column 'c2' cannot be null
Warning 1048 Column 'c2' cannot be null
Warning 1048 Column 'c2' cannot be null
Warning 1048 Column 'c2' cannot be null
Warning 1048 Column 'c2' cannot be null
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 CHAR(80),KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
2 NULL
3 NULL
4 NULL
5 NULL
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 CHAR(80) NOT NULL,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
UPDATE t SET c2=NULL WHERE c = 1;
Warnings:
Warning 1048 Column 'c2' cannot be null
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
2
3
4
5
DROP TABLE t;
CREATE TABLE t (c INT,c2 TEXT,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
DROP TABLE t;
CREATE TABLE t (c INT,c2 TEXT NOT NULL,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
UPDATE t SET c2=NULL WHERE c = 1;
Warnings:
Warning 1048 Column 'c2' cannot be null
Warning 1048 Column 'c2' cannot be null
Warning 1048 Column 'c2' cannot be null
Warning 1048 Column 'c2' cannot be null
Warning 1048 Column 'c2' cannot be null
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 TEXT,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
2 NULL
3 NULL
4 NULL
5 NULL
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 TEXT NOT NULL,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
Warnings:
Warning 1364 Field 'c2' doesn't have a default value
UPDATE t SET c2=NULL WHERE c = 1;
Warnings:
Warning 1048 Column 'c2' cannot be null
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
2
3
4
5
DROP TABLE t;
SET GLOBAL sql_mode=DEFAULT;
CREATE TABLE t (c INT,c2 BLOB,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
DROP TABLE t;
CREATE TABLE t (c INT,c2 VARCHAR(270),KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
DROP TABLE t;
CREATE TABLE t (c INT,c2 CHAR(80),KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
DROP TABLE t;
CREATE TABLE t (c INT,c2 TEXT,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 BLOB,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
2 NULL
3 NULL
4 NULL
5 NULL
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 VARCHAR(270),KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
2 NULL
3 NULL
4 NULL
5 NULL
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 CHAR(80),KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
2 NULL
3 NULL
4 NULL
5 NULL
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 TEXT,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
c c2
2 NULL
3 NULL
4 NULL
5 NULL
DROP TABLE t;

View File

@@ -0,0 +1,22 @@
connection node_2;
connection node_1;
connection node_2;
SET GLOBAL server_audit_logging=ON;
connection node_1;
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1);
connection node_2;
# Now checking the audit log
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'SET GLOBAL server_audit_logging=ON',0
TIME,HOSTNAME,<wsrep_applier>,,ID,ID,CREATE,test,t1,
TIME,HOSTNAME,<wsrep_applier>,,ID,ID,WRITE,test,t1,
TIME,HOSTNAME,root,localhost,ID,ID,READ,test,t1,
TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,table_stats,
TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,column_stats,
TIME,HOSTNAME,root,localhost,ID,ID,READ,mysql,index_stats,
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'SELECT COUNT(*) = 1 FROM test.t1',0
TIME,HOSTNAME,root,localhost,ID,ID,QUERY,test,'SELECT @@datadir',0
# resetting the test state
SET GLOBAL server_audit_logging=DEFAULT;
connection node_1;
DROP TABLE t1;

View File

@@ -0,0 +1,52 @@
connection node_2;
connection node_1;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (a INT) ENGINE=Aria;
CREATE TRIGGER trg AFTER UPDATE ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NEW.a);
SET GLOBAL wsrep_mode=replicate_aria;
UPDATE t1 SET a=10;
ERROR HY000: Transactional commit not supported by involved engine(s)
SELECT * FROM t1;
a
1
2
SELECT * FROM t2;
a
connection node_2;
SELECT * FROM t1;
a
1
2
SELECT * FROM t2;
a
connection node_1;
DROP TRIGGER trg;
DROP TABLE t1,t2;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
CREATE TRIGGER trg AFTER UPDATE ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NEW.a);
UPDATE t1 SET a=10;
SELECT * FROM t1;
a
10
10
SELECT * FROM t2;
a
10
10
connection node_2;
SELECT * FROM t1;
a
10
10
SELECT * FROM t2;
a
10
10
connection node_1;
DROP TRIGGER trg;
DROP TABLE t1,t2;
call mtr.add_suppression("WSREP: Replication of non-transactional engines is experimental. Storage engine Aria for table \'test\'\.\'t2\' is not supported in Galera");
SET GLOBAL wsrep_mode=DEFAULT;

View File

@@ -0,0 +1,17 @@
connection node_2;
connection node_1;
connection node_2;
connection node_1;
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
SET SESSION wsrep_trx_fragment_size=1;
START TRANSACTION;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
COMMIT;
connection node_2;
SELECT COUNT(*) = 2 FROM t1;
COUNT(*) = 2
1
connection node_2;
connection node_1;
DROP TABLE t1;

View File

@@ -0,0 +1,35 @@
connection node_2;
connection node_1;
connection node_1;
connection node_2;
connection node_1;
SET GLOBAL wsrep_provider_options ='pc.ignore_sb=true;pc.weight=2';
connection node_2;
CREATE TABLE t1 (f1 INT) ENGINE=InnoDB;
SET GLOBAL wsrep_IGNORE_apply_errors=1;
SET SESSION wsrep_dirty_reads=1;
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
`f1` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
FLUSH HOSTS;
CREATE TABLE t1 (f1 INT) ENGINE=InnoDB;
ERROR 42S01: Table 't1' already exists
FLUSH HOSTS;
ERROR HY000: Galera replication not supported
SHOW WARNINGS;
Level Code Message
Error 4165 Galera replication not supported
Warning 4165 Galera cluster is not ready to execute replication
connection node_1;
# Wait until inconsistent node_2 leaves from cluster
connection node_2;
# Restart node_2
call mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on");
connection node_1;
# Wait until node_2 is back in the cluster
SET GLOBAL wsrep_provider_options ='pc.ignore_sb=false;pc.weight=1';
DROP TABLE t1;
disconnect node_2;
disconnect node_1;

View File

@@ -206,7 +206,7 @@ t CREATE TABLE `t` (
) ENGINE=InnoDB SEQUENCE=1
connection node_1;
DROP SEQUENCE t;
CREATE SEQUENCE t INCREMENT BY 1 NOCACHE ENGINE=INNODB;
CREATE SEQUENCE t INCREMENT BY 0 CACHE 1 ENGINE=INNODB;
CREATE TABLE t1(a int not null primary key default nextval(t), b int) engine=innodb;
connection node_2;
# Wait DDL to replicate

View File

@@ -0,0 +1,132 @@
connection node_2;
connection node_1;
connection node_1;
CREATE SEQUENCE s INCREMENT=0 CACHE=5 ENGINE=InnoDB;
CREATE TABLE t1 (f1 INT PRIMARY KEY DEFAULT NEXTVAL(s), f2 INT) ENGINE=InnoDB;
connection node_1;
BEGIN;
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
connection node_2;
BEGIN;
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
Killing server ...
SELECT NEXTVAL(s);
NEXTVAL(s)
12
connection node_1;
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
COMMIT;
SELECT LASTVAL(s);
LASTVAL(s)
29
SELECT * FROM t1;
f1 f2
1 1
3 1
5 1
7 1
9 1
21 1
23 1
25 1
27 1
29 1
connection node_2;
SELECT LASTVAL(s);
LASTVAL(s)
12
SELECT NEXTVAL(s);
NEXTVAL(s)
32
SELECT * FROM t1;
f1 f2
1 1
3 1
5 1
7 1
9 1
21 1
23 1
25 1
27 1
29 1
connection node_1;
DROP TABLE t1;
DROP SEQUENCE s;
connection node_1;
CREATE SEQUENCE s INCREMENT=0 CACHE=5 ENGINE=InnoDB;
CREATE TABLE t1 (f1 INT PRIMARY KEY DEFAULT NEXTVAL(s), f2 INT) ENGINE=InnoDB;
connection node_1;
BEGIN;
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
connection node_2;
BEGIN;
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
Killing server ...
connection node_1;
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
COMMIT;
SELECT LASTVAL(s);
LASTVAL(s)
19
SELECT * FROM t1;
f1 f2
1 1
3 1
5 1
7 1
9 1
11 1
13 1
15 1
17 1
19 1
connection node_2;
SELECT NEXTVAL(s);
NEXTVAL(s)
22
SELECT * FROM t1;
f1 f2
1 1
3 1
5 1
7 1
9 1
11 1
13 1
15 1
17 1
19 1
connection node_1;
SELECT LASTVAL(s);
LASTVAL(s)
19
SELECT NEXTVAL(s);
NEXTVAL(s)
33
connection node_1;
DROP TABLE t1;
DROP SEQUENCE s;

View File

@@ -72,7 +72,7 @@ LASTVAL(s)
connection node_1a;
SELECT LASTVAL(s);
LASTVAL(s)
79
81
connection node_1;
SELECT * FROM t1;
f1 f2
@@ -106,7 +106,6 @@ f1 f2
56 1
58 1
60 1
61 1
63 1
65 1
67 1
@@ -116,6 +115,7 @@ f1 f2
75 1
77 1
79 1
81 1
connection node_2;
SELECT * FROM t1;
f1 f2
@@ -149,7 +149,6 @@ f1 f2
56 1
58 1
60 1
61 1
63 1
65 1
67 1
@@ -159,6 +158,7 @@ f1 f2
75 1
77 1
79 1
81 1
connection node_1;
DROP TABLE t1;
DROP SEQUENCE s;
@@ -299,10 +299,8 @@ connection node_1a;
ROLLBACK;
connection node_2;
COMMIT;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
connection node_2a;
ROLLBACK;
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
connection node_2;
SELECT LASTVAL(s);
LASTVAL(s)
@@ -332,6 +330,16 @@ f1 f2
15 1
17 1
19 1
22 1
24 1
26 1
28 1
30 1
32 1
34 1
36 1
38 1
40 1
connection node_2;
SELECT * FROM t1;
f1 f2
@@ -345,6 +353,16 @@ f1 f2
15 1
17 1
19 1
22 1
24 1
26 1
28 1
30 1
32 1
34 1
36 1
38 1
40 1
connection node_1;
DROP TABLE t1;
DROP SEQUENCE s;

View File

@@ -2,10 +2,7 @@ connection node_2;
connection node_1;
connection node_1;
connection node_2;
connection node_2;
call mtr.add_suppression("WSREP: TO isolation failed for: ");
connection node_1;
call mtr.add_suppression("CREATE TABLE isolation failure");
connection node_2;
Killing server ...
connection node_1;
@@ -14,5 +11,8 @@ CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
connection node_2;
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_1;
call mtr.add_suppression("WSREP: TO isolation error timeout_error for : test.t1");
call mtr.add_suppression("WSREP: CREATE TABLE isolation failure");
disconnect node_2;
disconnect node_1;

View File

@@ -1,6 +1,6 @@
connection node_2;
connection node_1;
call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled\\. Storage engine ");
call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled");
CREATE TABLE t1(a int NOT NULL PRIMARY KEY, b varchar(50)) ENGINE=INNODB;
CREATE TABLE t2(a int NOT NULL PRIMARY KEY, b varchar(50)) ENGINE=MYISAM;
CREATE TABLE t3(a int NOT NULL PRIMARY KEY, b varchar(50)) ENGINE=ARIA;
@@ -9,7 +9,11 @@ SET GLOBAL log_warnings=2;
SET GLOBAL wsrep_mode = "STRICT_REPLICATION,REPLICATE_MYISAM,REPLICATE_ARIA";
INSERT INTO t1 values (1,'innodb1');
INSERT INTO t2 values (1,'myisam1');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MyISAM for table 'test'.'t2' is not supported in Galera
INSERT INTO t3 values (1,'aria1');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
INSERT INTO t4 values (1,'memory1');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
@@ -24,6 +28,8 @@ Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria
SET GLOBAL log_warnings=1;
INSERT INTO t1 values (3,'innodb3');
INSERT INTO t2 values (3,'myisam3');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MyISAM for table 'test'.'t2' is not supported in Galera
INSERT INTO t3 values (3,'aria3');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
@@ -33,6 +39,8 @@ Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMO
include/assert_grep.inc [WSREP: wsrep_mode = STRICT_REPLICATION enabled.]
SET GLOBAL log_warnings=2;
INSERT INTO t2 values (4,'myisam3');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MyISAM for table 'test'.'t2' is not supported in Galera
INSERT INTO t3 values (4,'aria2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
@@ -40,6 +48,8 @@ INSERT INTO t4 values (4,'memory2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
INSERT INTO t2 values (5,'myisam3');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MyISAM for table 'test'.'t2' is not supported in Galera
INSERT INTO t3 values (5,'aria2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
@@ -47,6 +57,8 @@ INSERT INTO t4 values (5,'memory2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
INSERT INTO t2 values (6,'myisam3');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MyISAM for table 'test'.'t2' is not supported in Galera
INSERT INTO t3 values (6,'aria2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
@@ -54,6 +66,8 @@ INSERT INTO t4 values (6,'memory2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
INSERT INTO t2 values (7,'myisam3');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MyISAM for table 'test'.'t2' is not supported in Galera
INSERT INTO t3 values (7,'aria2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
@@ -61,6 +75,8 @@ INSERT INTO t4 values (7,'memory2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
INSERT INTO t2 values (8,'myisam3');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MyISAM for table 'test'.'t2' is not supported in Galera
INSERT INTO t3 values (8,'aria2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
@@ -68,6 +84,8 @@ INSERT INTO t4 values (8,'memory2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
INSERT INTO t2 values (9,'myisam3');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MyISAM for table 'test'.'t2' is not supported in Galera
INSERT INTO t3 values (9,'aria2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
@@ -75,6 +93,8 @@ INSERT INTO t4 values (9,'memory2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
INSERT INTO t2 values (10,'myisam3');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MyISAM for table 'test'.'t2' is not supported in Galera
INSERT INTO t3 values (10,'aria2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera
@@ -82,6 +102,8 @@ INSERT INTO t4 values (10,'memory2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MEMORY for table 'test'.'t4' is not supported in Galera
INSERT INTO t2 values (11,'myisam3');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine MyISAM for table 'test'.'t2' is not supported in Galera
INSERT INTO t3 values (11,'aria2');
Warnings:
Warning 1290 WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine Aria for table 'test'.'t3' is not supported in Galera

View File

@@ -3,16 +3,17 @@ connection node_1;
connection node_2;
SET AUTOCOMMIT=0;
SET SESSION wsrep_OSU_method='RSU';
CREATE TABLE t (i int primary key, j int);
CREATE TABLE t (i int primary key, j int) ENGINE=InnoDB;
CREATE TEMPORARY SEQUENCE seq2 NOCACHE ENGINE=InnoDB;
COMMIT;
SET SESSION wsrep_OSU_method='RSU';
CREATE SEQUENCE seq1 NOCACHE ENGINE=InnoDB;
SET SESSION wsrep_OSU_method='TOI';
COMMIT;
DROP TABLE t;
DROP SEQUENCE seq2;
DROP SEQUENCE seq1;
SET SESSION wsrep_OSU_method='TOI';
connection node_1;
SET GLOBAL wsrep_OSU_method='TOI';
CREATE TABLE t (i int primary key, j int) ENGINE=InnoDB;
SET AUTOCOMMIT=0;
INSERT INTO t VALUES (3,0);
@@ -20,8 +21,9 @@ CREATE TEMPORARY SEQUENCE seq1 NOCACHE ENGINE=InnoDB;
COMMIT;
INSERT INTO t VALUES (4,0);
CREATE SEQUENCE seq2 NOCACHE ENGINE=InnoDB;
commit;
COMMIT;
connection node_2;
SET SESSION wsrep_sync_wait=0;
SELECT * FROM t;
i j
3 0
@@ -44,3 +46,5 @@ connection node_1;
DROP TABLE t;
DROP SEQUENCE seq1;
DROP SEQUENCE seq2;
disconnect node_2;
disconnect node_1;

View File

@@ -22,7 +22,7 @@ SELECT * FROM t1;
a
SELECT * FROM s;
next_not_cached_value minimum_value maximum_value start_value increment cache_size cycle_option cycle_count
1 1 9223372036854775806 1 1 1000 0 0
1 1 9223372036854775806 1 1 0 0 0
connection node_1;
SET GLOBAL WSREP_MODE='REPLICATE_ARIA,REPLICATE_MYISAM';
DROP TABLE t1;

View File

@@ -11,9 +11,15 @@ connection node_1_ctrl;
SET DEBUG_SYNC = "now WAIT_FOR sync_point_reached";
connection node_2;
connection node_1_ctrl;
# Node should be in Donor/Desynced state as node_2 has not yet joined
SHOW STATUS LIKE 'wsrep_local_state_comment';
Variable_name Value
wsrep_local_state_comment Donor/Desynced
SET DEBUG_SYNC = "now SIGNAL sync_point_continue";
connection node_1;
SET DEBUG_SYNC = "RESET";
connection node_2;
connection node_1;
DROP TABLE t1;
disconnect node_2;
disconnect node_1;

View File

@@ -43,7 +43,7 @@ id val
connection node_2;
select * from t1;
id val
1 23
1 24
select * from t2;
id val
2 42

View File

@@ -0,0 +1,371 @@
--source include/galera_cluster.inc
#
# MDEV-30732 : wsrep_store_key_val_for_row() may invoke memcpy() on nullptr
# original test case
#
SET GLOBAL sql_mode=0;
SET sql_mode=DEFAULT;
CREATE TABLE t (c INT,c2 BLOB NOT NULL,KEY k2 (c2 (1),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
SELECT * from t;
DROP TABLE t;
#
# Additional test cases
#
CREATE TABLE t (c INT,c2 BLOB NOT NULL,UNIQUE KEY k2 (c2 (1),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
DROP TABLE t;
CREATE TABLE t (c INT,c2 BLOB NOT NULL,KEY k2 (c, c2 (1))) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
DROP TABLE t;
CREATE TABLE t (c INT,c2 VARCHAR(270) NOT NULL,UNIQUE KEY k2 (c2 (1),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
DROP TABLE t;
CREATE TABLE t (c INT,c2 VARCHAR(270) NOT NULL,KEY k2 (c, c2 (1))) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
DROP TABLE t;
CREATE TABLE t (c INT,c2 CHAR(80) NOT NULL,UNIQUE KEY k2 (c2 (1),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
SELECT * from t;
DROP TABLE t;
CREATE TABLE t (c INT,c2 CHAR(80) NOT NULL,KEY k2 (c, c2 (1))) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
SELECT * from t;
DROP TABLE t;
CREATE TABLE t (c INT,c2 TEXT NOT NULL,UNIQUE KEY k2 (c2 (1),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
DROP TABLE t;
CREATE TABLE t (c INT,c2 TEXT NOT NULL,KEY k2 (c, c2 (1))) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
DROP TABLE t;
CREATE TABLE t (c INT PRIMARY KEY,c2 BLOB NOT NULL,UNIQUE KEY k2 (c2 (1),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
DROP TABLE t;
CREATE TABLE t (c INT PRIMARY KEY,c2 BLOB NOT NULL,KEY k2 (c, c2 (1))) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
DROP TABLE t;
CREATE TABLE t (c INT PRIMARY KEY,c2 VARCHAR(270) NOT NULL,UNIQUE KEY k2 (c2 (1),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
DROP TABLE t;
CREATE TABLE t (c INT PRIMARY KEY,c2 VARCHAR(270) NOT NULL,KEY k2 (c, c2 (1))) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
DROP TABLE t;
CREATE TABLE t (c INT PRIMARY KEY,c2 CHAR(80) NOT NULL,UNIQUE KEY k2 (c2 (1),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
SELECT * from t;
DROP TABLE t;
CREATE TABLE t (c INT PRIMARY KEY,c2 CHAR(80) NOT NULL,KEY k2 (c, c2 (1))) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
SELECT * from t;
DROP TABLE t;
CREATE TABLE t (c INT PRIMARY KEY,c2 TEXT NOT NULL,UNIQUE KEY k2 (c2 (1),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
DROP TABLE t;
CREATE TABLE t (c INT PRIMARY KEY,c2 TEXT NOT NULL,KEY k2 (c, c2 (1))) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * from t;
DROP TABLE t;
SET GLOBAL sql_mode=0;
SET sql_mode=DEFAULT;
CREATE TABLE t (c INT,c2 BLOB,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (c INT,c2 BLOB NOT NULL,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 BLOB,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 BLOB NOT NULL,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (c INT,c2 VARCHAR(270),KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (c INT,c2 VARCHAR(270) NOT NULL,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 VARCHAR(270),KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 VARCHAR(270) NOT NULL,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (c INT,c2 CHAR(80),KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (c INT,c2 CHAR(80) NOT NULL,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 CHAR(80),KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 CHAR(80) NOT NULL,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="" WHERE c=1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (c INT,c2 TEXT,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (c INT,c2 TEXT NOT NULL,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 TEXT,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 TEXT NOT NULL,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;
SET GLOBAL sql_mode=DEFAULT;
CREATE TABLE t (c INT,c2 BLOB,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (c INT,c2 VARCHAR(270),KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (c INT,c2 CHAR(80),KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (c INT,c2 TEXT,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(1),(1),(1),(1);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 BLOB,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 VARCHAR(270),KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 CHAR(80),KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;
CREATE TABLE t (c INT NOT NULL PRIMARY KEY,c2 TEXT,KEY k2 (c2 (6),c)) DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT;
INSERT INTO t (c) VALUES (1),(2),(3),(4),(5);
UPDATE t SET c2=NULL WHERE c = 1;
UPDATE t SET c2="TESTtest" WHERE c = 1;
UPDATE t SET c2="BUGbug" WHERE c2 = "TESTtest";
DELETE FROM t WHERE c2="BUGbug";
SELECT * FROM t;
DROP TABLE t;

View File

@@ -0,0 +1,7 @@
!include ../galera_2nodes.cnf
[mysqld.1]
loose-mdev-30764
[mysqld.2]
loose-mdev-30764

View File

@@ -1,5 +1,6 @@
--source include/galera_cluster.inc
--source include/have_sequence.inc
--source include/force_restart.inc
# Save original auto_increment_offset values.
--let $node_1=node_1

View File

@@ -0,0 +1 @@
--plugin-load=server_audit

View File

@@ -0,0 +1,34 @@
--source include/galera_cluster.inc
if (!$SERVER_AUDIT_SO) {
skip No SERVER_AUDIT plugin;
}
# enable audit loggin in node 2
--connection node_2
SET GLOBAL server_audit_logging=ON;
# replicate CREATE and INSERT, these should be seen in the audit log
--connection node_1
CREATE TABLE t1(a INT);
INSERT INTO t1 VALUES (1);
--connection node_2
# make sure that the INSERT has been applied
--let $wait_condition = SELECT COUNT(*) = 1 FROM test.t1;
--source include/wait_condition.inc
--echo # Now checking the audit log
let $MYSQLD_DATADIR= `SELECT @@datadir`;
--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/
cat_file $MYSQLD_DATADIR/server_audit.log;
--echo # resetting the test state
SET GLOBAL server_audit_logging=DEFAULT;
--connection node_1
DROP TABLE t1;
#UNINSTALL PLUGIN server_audit;
remove_file $MYSQLD_DATADIR/server_audit.log;

View File

@@ -0,0 +1,39 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (a INT) ENGINE=Aria;
CREATE TRIGGER trg AFTER UPDATE ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NEW.a);
SET GLOBAL wsrep_mode=replicate_aria;
--error ER_ERROR_DURING_COMMIT
UPDATE t1 SET a=10;
SELECT * FROM t1;
SELECT * FROM t2;
--connection node_2
SELECT * FROM t1;
SELECT * FROM t2;
--connection node_1
DROP TRIGGER trg;
DROP TABLE t1,t2;
CREATE TABLE t1 (a INT) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1),(2);
CREATE TABLE t2 (a INT) ENGINE=InnoDB;
CREATE TRIGGER trg AFTER UPDATE ON t1 FOR EACH ROW INSERT INTO t2 VALUES (NEW.a);
UPDATE t1 SET a=10;
SELECT * FROM t1;
SELECT * FROM t2;
--connection node_2
SELECT * FROM t1;
SELECT * FROM t2;
--connection node_1
DROP TRIGGER trg;
DROP TABLE t1,t2;
call mtr.add_suppression("WSREP: Replication of non-transactional engines is experimental. Storage engine Aria for table \'test\'\.\'t2\' is not supported in Galera");
SET GLOBAL wsrep_mode=DEFAULT;

View File

@@ -0,0 +1,39 @@
#
# Ensure that the transaction_read_only option does not apply to Wsrep system
# threads (schema and appliers) and that the cluster keeps functioning.
#
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/big_test.inc
# Restart the node 2 in transaction_read_only mode.
--connection node_2
--source include/shutdown_mysqld.inc
--let $start_mysqld_params=--transaction_read_only=TRUE
--source include/start_mysqld.inc
--connection node_1
CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB;
# Note: this is not obligatory, but we want to test
# SR transactions as well.
SET SESSION wsrep_trx_fragment_size=1;
START TRANSACTION;
INSERT INTO t1 VALUES (1);
INSERT INTO t1 VALUES (2);
COMMIT;
--connection node_2
SELECT COUNT(*) = 2 FROM t1;
# Restart the node 2 in normal mode.
--connection node_2
--source include/shutdown_mysqld.inc
--let $start_mysqld_params=
--source include/start_mysqld.inc
# Cleanup
--connection node_1
DROP TABLE t1;

View File

@@ -0,0 +1,49 @@
--source include/galera_cluster.inc
--source include/force_restart.inc
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
--connection node_1
# Set higher weight for node_1 to keep it in primary
# while node_2 is inconsistent
SET GLOBAL wsrep_provider_options ='pc.ignore_sb=true;pc.weight=2';
--connection node_2
CREATE TABLE t1 (f1 INT) ENGINE=InnoDB;
SET GLOBAL wsrep_IGNORE_apply_errors=1;
SET SESSION wsrep_dirty_reads=1;
SHOW CREATE TABLE t1;
FLUSH HOSTS;
--error ER_TABLE_EXISTS_ERROR
CREATE TABLE t1 (f1 INT) ENGINE=InnoDB;
# This will cause inconsistency
--error ER_GALERA_REPLICATION_NOT_SUPPORTED
FLUSH HOSTS;
SHOW WARNINGS;
--connection node_1
--echo # Wait until inconsistent node_2 leaves from cluster
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
--connection node_2
--echo # Restart node_2
--source include/restart_mysqld.inc
call mtr.add_suppression("WSREP: Inconsistency detected: Inconsistent by consensus on");
--connection node_1
--echo # Wait until node_2 is back in the cluster
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
SET GLOBAL wsrep_provider_options ='pc.ignore_sb=false;pc.weight=1';
DROP TABLE t1;
--source include/auto_increment_offset_restore.inc
--source include/galera_end.inc

View File

@@ -163,7 +163,8 @@ SHOW CREATE TABLE t;
--connection node_1
DROP SEQUENCE t;
CREATE SEQUENCE t INCREMENT BY 1 NOCACHE ENGINE=INNODB;
# Don't use NOCACHE as it may produce duplicate entries from multiple nodes
CREATE SEQUENCE t INCREMENT BY 0 CACHE 1 ENGINE=INNODB;
CREATE TABLE t1(a int not null primary key default nextval(t), b int) engine=innodb;
--connection node_2
@@ -193,15 +194,11 @@ SET SESSION wsrep_sync_wait=0;
while ($count)
{
--connection node_1
--error 0,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK
INSERT INTO t1(b) values (1);
--connection node_2
--error 0,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK
INSERT INTO t1(b) values (2);
--error 0,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK
INSERT INTO t1(b) values (2);
--connection node_1
--error 0,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK
INSERT INTO t1(b) values (1);
--dec $count
}
@@ -251,15 +248,11 @@ SET SESSION wsrep_sync_wait=0;
while ($count)
{
--connection node_1
--error 0,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK
INSERT INTO t1(b) values (1),(2),(3),(4),(5),(6),(7),(8),(9);
--connection node_2
--error 0,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK
INSERT INTO t1(b) values (21),(22),(23),(24),(25),(26),(27),(28),(29);
--error 0,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK
INSERT INTO t1(b) values (21),(22),(23),(24),(25),(26),(27),(28),(29);
--connection node_1
--error 0,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK
INSERT INTO t1(b) values (1),(2),(3),(4),(5),(6),(7),(8),(9);
--dec $count
}

View File

@@ -0,0 +1,9 @@
!include ../galera_2nodes.cnf
[mysqld.1]
auto-increment-increment=2
auto-increment-offset=1
[mysqld.2]
auto-increment-increment=2
auto-increment-offset=2

View File

@@ -0,0 +1,13 @@
[binlogon]
log-bin
log-slave-updates
[binlogoff]
[binlogon-sr]
log-bin
log-slave-updates
wsrep-trx-fragment-size=1
[binlogoff-sr]
wsrep-trx-fragment-size=1

View File

@@ -0,0 +1,123 @@
#
# Test sequences crash recovery.
#
--source include/galera_cluster.inc
--source include/have_sequence.inc
--source include/big_test.inc
--disable_ps2_protocol
#
# Case 1: Crash a node during a transaction, bring the
# sequence in sync by receiving higher current value
#
--connection node_1
CREATE SEQUENCE s INCREMENT=0 CACHE=5 ENGINE=InnoDB;
CREATE TABLE t1 (f1 INT PRIMARY KEY DEFAULT NEXTVAL(s), f2 INT) ENGINE=InnoDB;
--connection node_1
BEGIN;
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
--connection node_2
BEGIN;
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
# Crash and restart the node, losing the transaciton
--source include/kill_galera.inc
--let $start_mysqld_params =
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--source include/start_mysqld.inc
# Check and update the last written sequence value
SELECT NEXTVAL(s);
--connection node_1
# Update the sequence value further
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
COMMIT;
SELECT LASTVAL(s);
SELECT * FROM t1;
--connection node_2
# The next value should be in sync now, but the last
# value is still the same
SELECT LASTVAL(s);
SELECT NEXTVAL(s);
SELECT * FROM t1;
--connection node_1
DROP TABLE t1;
DROP SEQUENCE s;
#
# Case 2: Crash a node during a transaction, bring the
# sequence in sync by sending higher current value
#
--connection node_1
CREATE SEQUENCE s INCREMENT=0 CACHE=5 ENGINE=InnoDB;
CREATE TABLE t1 (f1 INT PRIMARY KEY DEFAULT NEXTVAL(s), f2 INT) ENGINE=InnoDB;
--connection node_1
BEGIN;
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
--connection node_2
# Exhaust the cached values once, but no replication happens even
# though the sequnce table is updated
BEGIN;
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
INSERT INTO t1(f2) values (2);
# Crash and restart the node, losing the transaciton
--source include/kill_galera.inc
--let $start_mysqld_params =
--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.2.expect
--source include/start_mysqld.inc
--connection node_1
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
INSERT INTO t1(f2) values (1);
COMMIT;
SELECT LASTVAL(s);
SELECT * FROM t1;
--connection node_2
# Check and update the last written sequence value, it's still
# higher than the one from the other node
SELECT NEXTVAL(s);
SELECT * FROM t1;
--connection node_1
# The next value should be in sync now, but the last
# value is still the same
SELECT LASTVAL(s);
SELECT NEXTVAL(s);
--connection node_1
DROP TABLE t1;
DROP SEQUENCE s;

View File

@@ -3,3 +3,11 @@ log-bin
log-slave-updates
[binlogoff]
[binlogon-sr]
log-bin
log-slave-updates
wsrep-trx-fragment-size=1
[binlogoff-sr]
wsrep-trx-fragment-size=1

View File

@@ -230,10 +230,8 @@ COMMIT;
--connection node_1a
ROLLBACK;
--connection node_2
--error ER_LOCK_DEADLOCK
COMMIT;
--connection node_2a
--error ER_LOCK_DEADLOCK
ROLLBACK;
--connection node_2

View File

@@ -13,12 +13,8 @@
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
--connection node_2
call mtr.add_suppression("WSREP: TO isolation failed for: ");
--connection node_1
--let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address`
call mtr.add_suppression("CREATE TABLE isolation failure");
--connection node_2
--source include/kill_galera.inc
@@ -43,4 +39,8 @@ CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
--let $node_2=node_2a
--source include/auto_increment_offset_restore.inc
--connection node_1
call mtr.add_suppression("WSREP: TO isolation error timeout_error for : test.t1");
call mtr.add_suppression("WSREP: CREATE TABLE isolation failure");
--source include/galera_end.inc

View File

@@ -17,8 +17,9 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
--source include/have_aria.inc
--source include/force_restart.inc
call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled\\. Storage engine ");
call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled");
CREATE TABLE t1(a int NOT NULL PRIMARY KEY, b varchar(50)) ENGINE=INNODB;
CREATE TABLE t2(a int NOT NULL PRIMARY KEY, b varchar(50)) ENGINE=MYISAM;
@@ -47,7 +48,7 @@ INSERT INTO t3 values (3,'aria3');
INSERT INTO t4 values (3,'memory3');
# test warnings
--let $assert_count = 3
--let $assert_count = 5
--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.1.err
--let $assert_text = WSREP: wsrep_mode = STRICT_REPLICATION enabled.
--let $assert_select = WSREP: wsrep_mode = STRICT_REPLICATION enabled.

View File

@@ -4,17 +4,20 @@
--connection node_2
SET AUTOCOMMIT=0;
SET SESSION wsrep_OSU_method='RSU';
CREATE TABLE t (i int primary key, j int);
CREATE TABLE t (i int primary key, j int) ENGINE=InnoDB;
CREATE TEMPORARY SEQUENCE seq2 NOCACHE ENGINE=InnoDB;
COMMIT;
SET SESSION wsrep_OSU_method='RSU';
CREATE SEQUENCE seq1 NOCACHE ENGINE=InnoDB;
SET SESSION wsrep_OSU_method='TOI';
COMMIT;
DROP TABLE t;
DROP SEQUENCE seq2;
DROP SEQUENCE seq1;
SET SESSION wsrep_OSU_method='TOI';
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
SET GLOBAL wsrep_OSU_method='TOI';
CREATE TABLE t (i int primary key, j int) ENGINE=InnoDB;
SET AUTOCOMMIT=0;
INSERT INTO t VALUES (3,0);
@@ -22,9 +25,17 @@ CREATE TEMPORARY SEQUENCE seq1 NOCACHE ENGINE=InnoDB;
COMMIT;
INSERT INTO t VALUES (4,0);
CREATE SEQUENCE seq2 NOCACHE ENGINE=InnoDB;
commit;
COMMIT;
--connection node_2
SET SESSION wsrep_sync_wait=0;
--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't'
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 2 FROM t
--source include/wait_condition.inc
SELECT * FROM t;
--error ER_NO_SUCH_TABLE
SHOW CREATE TABLE seq1;
@@ -34,3 +45,5 @@ SHOW CREATE TABLE seq2;
DROP TABLE t;
DROP SEQUENCE seq1;
DROP SEQUENCE seq2;
--source include/galera_end.inc

View File

@@ -39,9 +39,12 @@ SET DEBUG_SYNC = "now WAIT_FOR sync_point_reached";
--write_line "restart:$start_mysqld_params" $_expect_file_name
# If the bug is present, FTWRL times out on node_1 in couple of
# seconds and node_2 fails to join.
--sleep 10
--connection node_1_ctrl
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment' and VARIABLE_VALUE = 'Donor/Desynced'
--source include/wait_condition.inc
--echo # Node should be in Donor/Desynced state as node_2 has not yet joined
SHOW STATUS LIKE 'wsrep_local_state_comment';
SET DEBUG_SYNC = "now SIGNAL sync_point_continue";
--connection node_1
@@ -56,3 +59,4 @@ SET DEBUG_SYNC = "RESET";
DROP TABLE t1;
--source include/auto_increment_offset_restore.inc
--source include/galera_end.inc

View File

@@ -1,17 +0,0 @@
connection node_2;
connection node_1;
CREATE SEQUENCE SEQ NOCACHE ENGINE=InnoDB;
SET SESSION wsrep_trx_fragment_size=1;
SET collation_connection=utf16_thai_520_w2;
SET autocommit=0;
CREATE TABLE t1 (a BLOB UNIQUE);
INSERT INTO t1 VALUES ('AAF');
SELECT SETVAL (SEQ, 100);
ERROR 42000: This version of MariaDB doesn't yet support 'SEQUENCEs with streaming replication in Galera cluster'
ALTER TABLE t1 ADD CONSTRAINT constraint_1 UNIQUE (a);
Warnings:
Note 1831 Duplicate index `constraint_1`. This is deprecated and will be disallowed in a future release
INSERT INTO t1 VALUES();
ALTER TABLE t1 ADD KEY(b (50));
ERROR 42000: Key column 'b' doesn't exist in table
DROP TABLE t1,SEQ;

View File

@@ -1,21 +0,0 @@
#
# MDEV-28971 - Assertion `total_length + thd->wsrep_sr().log_position() == saved_pos'
# failed in int wsrep_write_cache_inc(THD*, IO_CACHE*, size_t*)
#
--source include/galera_cluster.inc
--source include/have_sequence.inc
CREATE SEQUENCE SEQ NOCACHE ENGINE=InnoDB;
SET SESSION wsrep_trx_fragment_size=1;
SET collation_connection=utf16_thai_520_w2;
SET autocommit=0;
CREATE TABLE t1 (a BLOB UNIQUE);
INSERT INTO t1 VALUES ('AAF');
--error ER_NOT_SUPPORTED_YET
SELECT SETVAL (SEQ, 100);
ALTER TABLE t1 ADD CONSTRAINT constraint_1 UNIQUE (a);
INSERT INTO t1 VALUES();
--error ER_KEY_COLUMN_DOES_NOT_EXIST
ALTER TABLE t1 ADD KEY(b (50));
DROP TABLE t1,SEQ;

View File

@@ -0,0 +1,114 @@
CREATE TABLE t_2_9(a INT primary key) Engine=InnoDB STATS_PERSISTENT=0;
INSERT INTO t_2_9 SET a = 10;
CREATE TABLE t_2_8(a INT primary key) Engine=InnoDB STATS_PERSISTENT=0;
INSERT INTO t_2_8 SET a = 10;
CREATE TABLE t_2_7(a INT primary key) Engine=InnoDB STATS_PERSISTENT=0;
INSERT INTO t_2_7 SET a = 10;
CREATE TABLE t_2_6(a INT primary key) Engine=InnoDB STATS_PERSISTENT=0;
INSERT INTO t_2_6 SET a = 10;
CREATE TABLE t_2_5(a INT primary key) Engine=InnoDB STATS_PERSISTENT=0;
INSERT INTO t_2_5 SET a = 10;
CREATE TABLE t_2_4(a INT primary key) Engine=InnoDB STATS_PERSISTENT=0;
INSERT INTO t_2_4 SET a = 10;
CREATE TABLE t_2_3(a INT primary key) Engine=InnoDB STATS_PERSISTENT=0;
INSERT INTO t_2_3 SET a = 10;
CREATE TABLE t_2_2(a INT primary key) Engine=InnoDB STATS_PERSISTENT=0;
INSERT INTO t_2_2 SET a = 10;
CREATE TABLE t_2_1(a INT primary key) Engine=InnoDB STATS_PERSISTENT=0;
INSERT INTO t_2_1 SET a = 10;
CREATE TABLE t_1_0(a INT primary key) Engine=InnoDB STATS_PERSISTENT=0;
INSERT INTO t_1_0 SET a = 10;
CREATE TABLE t_2_0(a INT primary key) Engine=InnoDB STATS_PERSISTENT=0;
INSERT INTO t_2_0 SET a = 10;
InnoDB 0 transactions not purged
connect prevent_purge,localhost,root,,;
START TRANSACTION WITH CONSISTENT SNAPSHOT;
SET GLOBAL DEBUG_DBUG ="+d,assign_same_rseg";
connection default;
UPDATE t_2_1 SET a=150;
connect con_1_0, localhost,root,,;
BEGIN;
UPDATE t_1_0 SET a=15;
connect con_2_0, localhost,root,,;
BEGIN;
SET DEBUG_SYNC="before_undo_log_trx_id_write SIGNAL before_0 WAIT_FOR cont_0";
SET DEBUG_SYNC="after_undo_log_trx_id_write SIGNAL after_0";
UPDATE t_2_0 SET a=15;
connection con_1_0;
SET DEBUG_SYNC="now WAIT_FOR before_0";
connect con_2_1, localhost,root,,;
BEGIN;
SET DEBUG_SYNC="before_undo_log_trx_id_write SIGNAL before_1 WAIT_FOR cont_1";
UPDATE t_2_1 SET a=15;
connection default;
SET DEBUG_SYNC="now WAIT_FOR before_1";
connect con_2_2, localhost,root,,;
BEGIN;
SET DEBUG_SYNC="before_undo_log_trx_id_write SIGNAL before_2 WAIT_FOR cont_2";
UPDATE t_2_2 SET a=15;
connection default;
SET DEBUG_SYNC="now WAIT_FOR before_2";
connect con_2_3, localhost,root,,;
BEGIN;
SET DEBUG_SYNC="before_undo_log_trx_id_write SIGNAL before_3 WAIT_FOR cont_3";
UPDATE t_2_3 SET a=15;
connection default;
SET DEBUG_SYNC="now WAIT_FOR before_3";
connect con_2_4, localhost,root,,;
BEGIN;
SET DEBUG_SYNC="before_undo_log_trx_id_write SIGNAL before_4 WAIT_FOR cont_4";
UPDATE t_2_4 SET a=15;
connection default;
SET DEBUG_SYNC="now WAIT_FOR before_4";
connect con_2_5, localhost,root,,;
BEGIN;
SET DEBUG_SYNC="before_undo_log_trx_id_write SIGNAL before_5 WAIT_FOR cont_5";
UPDATE t_2_5 SET a=15;
connection default;
SET DEBUG_SYNC="now WAIT_FOR before_5";
connect con_2_6, localhost,root,,;
BEGIN;
SET DEBUG_SYNC="before_undo_log_trx_id_write SIGNAL before_6 WAIT_FOR cont_6";
UPDATE t_2_6 SET a=15;
connection default;
SET DEBUG_SYNC="now WAIT_FOR before_6";
connect con_2_7, localhost,root,,;
BEGIN;
SET DEBUG_SYNC="before_undo_log_trx_id_write SIGNAL before_7 WAIT_FOR cont_7";
UPDATE t_2_7 SET a=15;
connection default;
SET DEBUG_SYNC="now WAIT_FOR before_7";
connect con_2_8, localhost,root,,;
BEGIN;
SET DEBUG_SYNC="before_undo_log_trx_id_write SIGNAL before_8 WAIT_FOR cont_8";
UPDATE t_2_8 SET a=15;
connection default;
SET DEBUG_SYNC="now WAIT_FOR before_8";
connect con_2_9, localhost,root,,;
BEGIN;
SET DEBUG_SYNC="before_undo_log_trx_id_write SIGNAL before_9 WAIT_FOR cont_9";
UPDATE t_2_9 SET a=15;
connection default;
SET DEBUG_SYNC="now WAIT_FOR before_9";
connection con_1_0;
COMMIT;
SET DEBUG_SYNC="now SIGNAL cont_0";
SET DEBUG_SYNC="now WAIT_FOR after_0";
# Kill and restart
INSERT INTO t_2_1 SET a = 20;
INSERT INTO t_2_1 SET a = 30;
INSERT INTO t_2_1 SET a = 40;
INSERT INTO t_2_1 SET a = 50;
INSERT INTO t_2_1 SET a = 60;
SET GLOBAL innodb_max_purge_lag_wait=0;
DROP TABLE t_2_9;
DROP TABLE t_2_8;
DROP TABLE t_2_7;
DROP TABLE t_2_6;
DROP TABLE t_2_5;
DROP TABLE t_2_4;
DROP TABLE t_2_3;
DROP TABLE t_2_2;
DROP TABLE t_2_1;
DROP TABLE t_1_0;
DROP TABLE t_2_0;

View File

@@ -43,6 +43,7 @@ send SET GLOBAL innodb_log_file_size=7340032;
let $ignore= `SELECT @id := $ID`;
KILL QUERY @id;
--connection con1
--error 0,ER_QUERY_INTERRUPTED
reap;
--connection default

View File

@@ -0,0 +1,135 @@
--source include/have_innodb.inc
# The embedded server tests do not support restarting.
--source include/not_embedded.inc
--source include/have_debug.inc
--source include/have_debug_sync.inc
--let transactions_count=10
--let perl_inc_file=$MYSQL_TMP_DIR/max_trx_no_recovery.inc
--let $i=$transactions_count
# We need several tables to avoid blocking on records locking and pages latching
while($i) {
--dec $i
if ($i == 0) {
--eval CREATE TABLE t_1_$i(a INT primary key) Engine=InnoDB STATS_PERSISTENT=0
--eval INSERT INTO t_1_$i SET a = 10
}
--eval CREATE TABLE t_2_$i(a INT primary key) Engine=InnoDB STATS_PERSISTENT=0
--eval INSERT INTO t_2_$i SET a = 10
}
--source include/wait_all_purged.inc
--connect (prevent_purge,localhost,root,,)
START TRANSACTION WITH CONSISTENT SNAPSHOT;
# Let all the following redo logs will be pushed in the same rseg
SET GLOBAL DEBUG_DBUG ="+d,assign_same_rseg";
--connection default
# Add the first undo log to the history of trx_sys.rseg_array[0] to fordbid
# "if (auto len= flst_get_len(TRX_RSEG + TRX_RSEG_HISTORY + ...)" branch of
# "trx_rseg_mem_restore()" to update rseg->needs_purge. Let trx_id and trx_no
# of the following transaction is L and M correspondingly.
UPDATE t_2_1 SET a=150;
--connect (con_1_0, localhost,root,,)
BEGIN;
# After the following transaction the undo segment will contain the following
# undo logs:
# sn: 0, trx_id: L, trx_no: M
# sn: 1, trx_id: N=M+1, trx_no: 0
UPDATE t_1_0 SET a=15;
--connect (con_2_0, localhost,root,,)
BEGIN;
# Stop the following "UPDATE" just before the undo log creating.
SET DEBUG_SYNC="before_undo_log_trx_id_write SIGNAL before_0 WAIT_FOR cont_0";
SET DEBUG_SYNC="after_undo_log_trx_id_write SIGNAL after_0";
--send UPDATE t_2_0 SET a=15
--connection con_1_0
SET DEBUG_SYNC="now WAIT_FOR before_0";
# The following trick with perl code, which generates mysqltest code, is applied
# to bypass the restriction of mysqltest in substitution variable values in
# connection names.
--perl END_OF_FILE
use strict;
use warnings;
my $out_file = $ENV{'perl_inc_file'};
my $transactions_count = $ENV{'transactions_count'};
open (my $output, '>', $out_file) or die $!;
my $i = 1;
while ($i < $transactions_count) {
print $output
"--connect (con_2_$i, localhost,root,,)\n".
"BEGIN;\n".
"SET DEBUG_SYNC=\"before_undo_log_trx_id_write SIGNAL before_$i WAIT_FOR cont_$i\";\n".
"--send UPDATE t_2_$i SET a=15\n".
"--connection default\n".
"SET DEBUG_SYNC=\"now WAIT_FOR before_$i\";\n";
++$i;
}
close $output;
END_OF_FILE
# The generated code starts rw transactions just to increase
# trx_sys.m_max_trx_id by the number of started transactions S.
--source $perl_inc_file
--remove_file $perl_inc_file
--connection con_1_0
# After the following COMMIT and debug sync points the undo segment will contain
# the following undo logs:
# sn: 0, trx_id: L, trx_no: M
# sn: 1, trx_id: N=M+1, trx_no: N+S
# sn: 2, trx_id: N+1, trx_no: 0
COMMIT;
SET DEBUG_SYNC="now SIGNAL cont_0";
SET DEBUG_SYNC="now WAIT_FOR after_0";
--source include/kill_and_restart_mysqld.inc
# The trx_no of the last undo log is 0 and it's in active state, that's why
# the rseg->needs_purge is set to trx_id+1 = N+1+1 in
# trx_undo_mem_create_at_db_start(). The trx_sys.m_max_trx_id is set to maximum
# value of rseg->needs_purge among all rsegs + 1, i.e. for our case it's
# N+1+1+1.
#
# After uncommitted transactions rolling back on recovery, the undo
# segment will contain the following undo logs:
# sn: 0, trx_id: L, trx_no: M
# sn: 1, trx_id: N=M+1, trx_no: N+S
# and
# trx_sys.m_max_trx_id =
# N + 3(see above)
# + 1(row_merge_drop_temp_indexes())
# + 1(active transaction rollback)
# So trx_sys.m_max_trx_id = N + 5.
#
# The trx_no of the last undo log in the above undo segment is N+S. In the case
# if S > 5, the trx_no of one of the following transactions will be greater than
# N + S, i.e. the trx_no of the last undo log in the undo segment.
#
# That is treated as error in purge thread, because purge queue is
# min-heap of (trx_no, trx_sys.rseg_array index) pairs, where the key is trx_no,
# and it must not be that trx_no of the last parsed undo log of a committed
# transaction is greater than the last trx_no of the rseg at the top of
# the queue.
INSERT INTO t_2_1 SET a = 20;
INSERT INTO t_2_1 SET a = 30;
INSERT INTO t_2_1 SET a = 40;
INSERT INTO t_2_1 SET a = 50;
INSERT INTO t_2_1 SET a = 60;
# Assertion ut_a(tail.trx_no <= last_trx_no) failures in
# purge_sys_t::choose_next_log if the bug is not fixed.
SET GLOBAL innodb_max_purge_lag_wait=0;
--let $i=$transactions_count
while($i) {
--dec $i
if ($i == 0) {
--eval DROP TABLE t_1_$i
}
--eval DROP TABLE t_2_$i
}

View File

@@ -375,15 +375,15 @@ insert into t1 values ('85984',ST_GeomFromText('MULTIPOLYGON(((-115.006363
36.248666,-115.263639 36.247466,-115.263839 36.252766,-115.261439
36.252666,-115.261439 36.247366,-115.247239 36.247066)))'));
# Expected result is 115.31877315203187, but IA64 returns 115.31877315203188
# due to fused multiply-add instructions.
--replace_result 115.29706047613604 115.2970604672862 36.23335611157958 36.23335610879993
# Expected results are 115.2970604672862 and 36.23335610879993, but IA64 returns
# slightly different values due to fused multiply-add instructions.
--replace_regex /115.2970604[67]\d+/115.2970604672862/ /36.233356111579\d+/36.23335610879993/
select object_id, ST_geometrytype(geo), ST_ISSIMPLE(GEO), ST_ASTEXT(ST_centroid(geo)) from
t1 where object_id=85998;
# Expected result is 36.3310176346905, but IA64 returns 36.3310176346904
# Expected result is 36.34725218253213, but IA64 returns 36.34725217627852
# due to fused multiply-add instructions.
--replace_result 114.86854470090232 114.86854472054372 36.34725217627852 36.34725218253213
--replace_result 36.34725217627852 36.34725218253213 -114.86854470090232 -114.86854472054372
select object_id, ST_geometrytype(geo), ST_ISSIMPLE(GEO), ST_ASTEXT(ST_centroid(geo)) from
t1 where object_id=85984;

View File

@@ -368,15 +368,15 @@ insert into t1 values ('85984',ST_GeomFromText('MULTIPOLYGON(((-115.006363
36.248666,-115.263639 36.247466,-115.263839 36.252766,-115.261439
36.252666,-115.261439 36.247366,-115.247239 36.247066)))'));
# Expected result is 115.31877315203187, but IA64 returns 115.31877315203188
# due to fused multiply-add instructions.
--replace_result 115.29706047613604 115.2970604672862 36.23335611157958 36.23335610879993
# Expected results are 115.2970604672862 and 36.23335610879993, but IA64 returns
# slightly different values due to fused multiply-add instructions.
--replace_regex /115.2970604[67]\d+/115.2970604672862/ /36.233356111579\d+/36.23335610879993/
select object_id, ST_geometrytype(geo), ST_ISSIMPLE(GEO), ST_ASTEXT(ST_centroid(geo)) from
t1 where object_id=85998;
# Expected result is 36.3310176346905, but IA64 returns 36.3310176346904
# Expected result is 36.34725218253213, but IA64 returns 36.34725217627852
# due to fused multiply-add instructions.
--replace_result 114.86854470090232 114.86854472054372 36.34725217627852 36.34725218253213
--replace_result 36.34725217627852 36.34725218253213 -114.86854470090232 -114.86854472054372
select object_id, ST_geometrytype(geo), ST_ISSIMPLE(GEO), ST_ASTEXT(ST_centroid(geo)) from
t1 where object_id=85984;

View File

@@ -22,3 +22,21 @@ SELECT * FROM t1;
i
1
DROP TABLE t1;
#
# MDEV-38041 MariaBackup fails during rollback of
# inplace FTS alter table
#
CREATE TABLE t1(f1 int, f2 char(100), fulltext(f2)) ENGINE=InnoDB;
INSERT into t1 values(1, "MariaDB"), (1, "MySQL");
connect con2, localhost, root,,;
set lock_wait_timeout=1;
SET debug_sync='copy_data_between_tables_before_reset_backup_lock SIGNAL go WAIT_FOR after_backup_stage_block_ddl';
SET debug_sync='alter_table_after_temp_table_drop SIGNAL temp_table_dropped';
SET debug_sync='now WAIT_FOR after_backup_stage_start';ALTER TABLE test.t1 ADD PRIMARY KEY(f1), algorithm=COPY;|
connection default;
connection con2;
ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
SET debug_sync='RESET';
disconnect con2;
connection default;
DROP TABLE t1;

View File

@@ -49,3 +49,42 @@ exec $XTRABACKUP --prepare --target-dir=$targetdir;
SELECT * FROM t1;
DROP TABLE t1;
rmdir $targetdir;
--echo #
--echo # MDEV-38041 MariaBackup fails during rollback of
--echo # inplace FTS alter table
--echo #
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
CREATE TABLE t1(f1 int, f2 char(100), fulltext(f2)) ENGINE=InnoDB;
INSERT into t1 values(1, "MariaDB"), (1, "MySQL");
connect con2, localhost, root,,;
set lock_wait_timeout=1;
SET debug_sync='copy_data_between_tables_before_reset_backup_lock SIGNAL go WAIT_FOR after_backup_stage_block_ddl';
SET debug_sync='alter_table_after_temp_table_drop SIGNAL temp_table_dropped';
DELIMITER |;
send SET debug_sync='now WAIT_FOR after_backup_stage_start';ALTER TABLE test.t1 ADD PRIMARY KEY(f1), algorithm=COPY;|
DELIMITER ;|
connection default;
# setup mariabackup events
let backup_fix_ddl=;
let after_backup_stage_start=SET debug_sync='now SIGNAL after_backup_stage_start WAIT_FOR go';
let after_backup_stage_block_commit=SET debug_sync='now SIGNAL after_backup_stage_block_ddl';
let after_backup_fix_ddl=SET debug_sync='now WAIT_FOR temp_table_dropped';
let $backup_log=$MYSQLTEST_VARDIR/tmp/backup.log;
--disable_result_log
exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,mariabackup_events > $backup_log 2>&1;
--enable_result_log
connection con2;
--error ER_DUP_ENTRY
reap;
SET debug_sync='RESET';
disconnect con2;
connection default;
DROP TABLE t1;
rmdir $targetdir;

View File

@@ -0,0 +1,39 @@
include/master-slave.inc
[connection master]
connection master;
set @old_binlog_cache_size= @@global.binlog_cache_size;
set @@global.binlog_cache_size=4096;
CALL mtr.add_suppression('Error writing file');
#
# Initialize test data
connection master;
create table t1 (a int, b longtext default NULL) engine=innodb;
#
# Create transaction with cache data larger than the binlog_cache_size
# so it spills into a tmp file, then simulate ENOSPC while flushing
# the tmp file.
#
set @@session.debug_dbug="+d,simulate_binlog_tmp_file_no_space_left_on_flush";
insert into t1 values (2, repeat("y", 8192));
ERROR HY000: Error writing file '.../tmp/<FILENAME>' (Errcode: 28 "No space left on device")
set @@session.debug_dbug="";
#
# Create another transaction to make sure the server/replication can
# continue working normally after the error
#
insert into t1 values (3, repeat("z", 8192));
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
include/diff_tables.inc [master:test.t1,slave:test.t1]
#
# Cleanup
connection master;
drop table t1;
include/save_master_gtid.inc
connection slave;
include/sync_with_master_gtid.inc
connection master;
set @@global.binlog_cache_size= @old_binlog_cache_size;
include/rpl_end.inc
# End of rpl_row_binlog_tmp_file_flush_enospc.test

View File

@@ -0,0 +1,64 @@
#
# This test ensures that a large transaction (i.e. one whose data exceeds the
# binlog_cache_size limit and spills into a tmp file) that errors while
# flushing the tmp file (e.g. due to no space on disk) does not corrupt the
# binlog, and that the server/replication can continue working normally after
# the error. To simulate the error, the test uses debug_dbug to inject a
# failure in the my_write() function, which is called when flushing the tmp
# file.
#
# References:
# MDEV-37662: Binlog Corruption When tmpdir is Full
#
--source include/have_debug.inc
--source include/have_innodb.inc
--source include/have_binlog_format_row.inc
--source include/master-slave.inc
--connection master
set @old_binlog_cache_size= @@global.binlog_cache_size;
set @@global.binlog_cache_size=4096;
CALL mtr.add_suppression('Error writing file');
--echo #
--echo # Initialize test data
--connection master
create table t1 (a int, b longtext default NULL) engine=innodb;
--echo #
--echo # Create transaction with cache data larger than the binlog_cache_size
--echo # so it spills into a tmp file, then simulate ENOSPC while flushing
--echo # the tmp file.
--echo #
set @@session.debug_dbug="+d,simulate_binlog_tmp_file_no_space_left_on_flush";
--replace_regex /Error writing file '[^']+\/tmp\/[^']+'/Error writing file '...\/tmp\/<FILENAME>'/
--error 3
insert into t1 values (2, repeat("y", 8192));
set @@session.debug_dbug="";
--echo #
--echo # Create another transaction to make sure the server/replication can
--echo # continue working normally after the error
--echo #
insert into t1 values (3, repeat("z", 8192));
--source include/save_master_gtid.inc
--connection slave
--source include/sync_with_master_gtid.inc
--let $diff_tables=master:test.t1,slave:test.t1
--source include/diff_tables.inc
--echo #
--echo # Cleanup
--connection master
drop table t1;
--source include/save_master_gtid.inc
--connection slave
--source include/sync_with_master_gtid.inc
--connection master
set @@global.binlog_cache_size= @old_binlog_cache_size;
--source include/rpl_end.inc
--echo # End of rpl_row_binlog_tmp_file_flush_enospc.test

View File

@@ -2,6 +2,6 @@
show status like 'wsrep_protocol%';
Variable_name Value
wsrep_protocol_application 4
wsrep_protocol_gcs 5
wsrep_protocol_gcs 6
wsrep_protocol_replicator 11
wsrep_protocol_version 11

View File

@@ -2,7 +2,7 @@
--source include/force_restart.inc
--source include/have_innodb.inc
--let $galera_version=26.4.21
--let $galera_version=26.4.25
source include/check_galera_version.inc;
--sorted_result

View File

@@ -57,6 +57,7 @@ size_t my_write(File Filedes, const uchar *Buffer, size_t Count, myf MyFlags)
if (!errors) {
errno= ENOSPC;
writtenbytes= (size_t) -1;
MyFlags&= ~MY_WAIT_IF_FULL;
});
if (writtenbytes == Count)

View File

@@ -273,14 +273,6 @@ int ha_sequence::write_row(const uchar *buf)
#ifdef WITH_WSREP
if (WSREP_ON && WSREP(thd) && wsrep_thd_is_local(thd))
{
if (sequence_locked &&
(wsrep_thd_is_SR(thd) || wsrep_streaming_enabled(thd)))
{
my_error(ER_NOT_SUPPORTED_YET, MYF(0),
"SEQUENCEs with streaming replication in Galera cluster");
DBUG_RETURN(HA_ERR_UNSUPPORTED);
}
/*
We need to start Galera transaction for select NEXT VALUE FOR
sequence if it is not yet started. Note that ALTER is handled

View File

@@ -1746,6 +1746,31 @@ static int binlog_close_connection(handlerton *hton, THD *thd)
DBUG_RETURN(0);
}
/*
Ensures that the input IO Cache is consistent with where its data is stored,
i.e that the data is entirely either stored in-memory or backed by a
temporary file. In actuality, it is simple: if the IO Cache is actively
backed by a temporary file (i.e. the transaction or statement data is
sufficiently large to exceed its respective binlog_cache_size), then ensure
all data is flushed to the temporary file. Otherwise, the data is in-memory
by default, and we don't need to do anything.
Returns TRUE on success, FALSE on error.
*/
inline my_bool flush_write_buffer_if_file_backed(IO_CACHE *info)
{
my_bool ret= 0;
DBUG_ENTER("binlog_flush_cache_log_to_disk");
DBUG_ASSERT(info);
DBUG_ASSERT(!info->error);
DBUG_EXECUTE_IF("simulate_binlog_tmp_file_no_space_left_on_flush",
{ DBUG_SET("+d,simulate_file_write_error"); });
ret= info->pos_in_file && flush_io_cache(info);
DBUG_EXECUTE_IF("simulate_binlog_tmp_file_no_space_left_on_flush",
{ DBUG_SET("-d,simulate_file_write_error"); });
DBUG_RETURN(ret);
}
/*
This function flushes a cache upon commit/rollback.
@@ -1785,9 +1810,34 @@ binlog_flush_cache(THD *thd, binlog_cache_mngr *cache_mngr,
(using_trx && !cache_mngr->trx_cache.empty()) ||
thd->transaction->xid_state.is_explicit_XA())
{
if (using_stmt && thd->binlog_flush_pending_rows_event(TRUE, FALSE))
/*
thd->binlog_flush_pending_rows_event() ensures that the pending row event
is flushed into the respective IO cache. We also need to make sure that
the IO cache is consistent where its data is stored, i.e. it should
either be entirely in-memory or backed by a temporary file. So if
necessary (i.e if the cache data exceeds its binlog_cache_size), flush
the IO cache to its tmp file on disk.
Technically, this reconciliation would happen automatically when writing
the cache data to the actual binlog file. We pre-empt it though because:
1) we write the GTID event separately to the binlog directly before
moving the cache data, and if the reconciliation fails (e.g. if the
directory storing the tmp file is full), the binlog would get
corrupted with a standalone GTID event
2) that happens during group commit with locks held, and other
ready-to-commit (concurrent) transactions could be stalled
*/
if (using_stmt && !thd->binlog_flush_pending_rows_event(TRUE, FALSE) &&
flush_write_buffer_if_file_backed(
cache_mngr->get_binlog_cache_log(FALSE)))
DBUG_RETURN(1);
if (using_trx && thd->binlog_flush_pending_rows_event(TRUE, TRUE))
/*
See statment cache comment above.
*/
if (using_trx && !thd->binlog_flush_pending_rows_event(TRUE, TRUE) &&
flush_write_buffer_if_file_backed(
cache_mngr->get_binlog_cache_log(TRUE)))
DBUG_RETURN(1);
#ifdef WITH_WSREP
@@ -8061,8 +8111,12 @@ int Event_log::write_cache(THD *thd, binlog_cache_data *cache_data)
DBUG_RETURN(res ? ER_ERROR_ON_WRITE : 0);
}
DBUG_EXECUTE_IF("simulate_binlog_tmp_file_no_space_left_on_flush",
{ DBUG_SET("+d,simulate_file_write_error"); });
if (reinit_io_cache(cache, READ_CACHE, 0, 0, 0))
DBUG_RETURN(ER_ERROR_ON_WRITE);
DBUG_EXECUTE_IF("simulate_binlog_tmp_file_no_space_left_on_flush",
{ DBUG_SET("-d,simulate_file_write_error"); });
/* Amount of remaining bytes in the IO_CACHE read buffer. */
size_t log_file_pos;
uchar header_buf[LOG_EVENT_HEADER_LEN];
@@ -9293,12 +9347,27 @@ MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry *entry,
}
#endif /* WITH_WSREP */
/*
An error in the trx_cache will truncate the cache to the last good
statement, it won't leave a lingering error. Assert that this holds.
*/
DBUG_ASSERT(!(entry->using_trx_cache && !mngr->trx_cache.empty() &&
mngr->get_binlog_cache_log(TRUE)->error));
#ifndef DBUG_OFF
if (entry->using_trx_cache)
{
IO_CACHE *cache= mngr->get_binlog_cache_log(TRUE);
/*
An error in the trx_cache will truncate the cache to the last good
statement, it won't leave a lingering error. Assert that this holds.
*/
DBUG_ASSERT(mngr->trx_cache.empty() ||
!cache->error);
/*
If the transaction uses the IO cache temporary file (i.e if it is
sufficiently large), it should be fully flushed to disk by now.
*/
DBUG_ASSERT(!cache->pos_in_file ||
cache->write_pos == cache->write_buffer);
}
#endif
/*
An error in the stmt_cache would be caught on the higher level and result
in an incident event being written over a (possibly corrupt) cache content.

View File

@@ -6916,15 +6916,21 @@ int Rows_log_event::update_sequence()
bool old_master= false;
int err= 0;
if (!bitmap_is_set(table->rpl_write_set, MIN_VALUE_FIELD_NO) ||
(
#if defined(WITH_WSREP)
! WSREP(thd) &&
rpl_group_info *table_rgi=
#ifdef WITH_WSREP
WSREP(thd) ? thd->wsrep_rgi :
#endif
table->in_use->rgi_slave &&
!(table->in_use->rgi_slave->gtid_ev_flags2 & Gtid_log_event::FL_DDL) &&
table->in_use->rgi_slave;
rpl_group_info *thd_rgi=
#ifdef WITH_WSREP
WSREP(thd) ? thd->wsrep_rgi :
#endif
thd->rgi_slave;
if (!bitmap_is_set(table->rpl_write_set, MIN_VALUE_FIELD_NO) ||
(table_rgi &&
!(table_rgi->gtid_ev_flags2 & Gtid_log_event::FL_DDL) &&
!(old_master=
rpl_master_has_bug(thd->rgi_slave->rli,
rpl_master_has_bug(thd_rgi->rli,
29621, FALSE, FALSE, FALSE, TRUE))))
{
/* This event come from a setval function executed on the master.

View File

@@ -305,7 +305,8 @@ static TYPELIB tc_heuristic_recover_typelib=
const char *first_keyword= "first";
const char *my_localhost= "localhost",
*delayed_user= "delayed", *slave_user= "<replication_slave>";
*delayed_user= "delayed", *slave_user= "<replication_slave>",
*wsrep_user= "<wsrep_applier>";
bool opt_large_files= sizeof(my_off_t) > 4;
static my_bool opt_autocommit; ///< for --autocommit command-line option

View File

@@ -278,7 +278,7 @@ extern time_t server_start_time, flush_status_time;
extern char *opt_mysql_tmpdir, mysql_charsets_dir[];
extern size_t mysql_unpacked_real_data_home_len;
extern MYSQL_PLUGIN_IMPORT MY_TMPDIR mysql_tmpdir_list;
extern const char *first_keyword, *delayed_user, *slave_user;
extern const char *first_keyword, *delayed_user, *slave_user, *wsrep_user;
extern MYSQL_PLUGIN_IMPORT const char *my_localhost;
extern MYSQL_PLUGIN_IMPORT const char **errmesg; /* Error messages */
extern const char *myisam_recover_options_str;

View File

@@ -3530,6 +3530,7 @@ int select_export::send_data(List<Item> &items)
tmp.length(0);
row_count++;
thd->server_status|= SERVER_STATUS_RETURNED_ROW;
Item *item;
uint used_length=0,items_left=items.elements;
List_iterator_fast<Item> li(items);
@@ -3804,6 +3805,7 @@ int select_dump::send_data(List<Item> &items)
goto err;
}
}
thd->server_status|= SERVER_STATUS_RETURNED_ROW;
DBUG_RETURN(0);
err:
DBUG_RETURN(1);
@@ -4459,6 +4461,7 @@ bool select_dumpvar::send_data_to_var_list(List<Item> &items)
if (mv->set(thd, item))
DBUG_RETURN(true);
}
thd->server_status|= SERVER_STATUS_RETURNED_ROW;
DBUG_RETURN(false);
}
@@ -4478,6 +4481,7 @@ int select_dumpvar::send_data(List<Item> &items)
send_data_to_var_list(items))
DBUG_RETURN(1);
thd->server_status|= SERVER_STATUS_RETURNED_ROW;
DBUG_RETURN(thd->is_error());
}
@@ -4577,6 +4581,7 @@ int select_materialize_with_stats::send_data(List<Item> &items)
return 0;
++count_rows;
thd->server_status|= SERVER_STATUS_RETURNED_ROW;
while ((cur_item= item_it++))
{

View File

@@ -1770,7 +1770,7 @@ public:
bool check_access(const privilege_t want_access, bool match_any = false);
bool is_priv_user(const char *user, const char *host);
bool is_user_defined() const
{ return user && user != delayed_user && user != slave_user; };
{ return user && user != delayed_user && user != slave_user && user != wsrep_user; };
};

View File

@@ -5352,7 +5352,12 @@ mysql_execute_command(THD *thd, bool is_called_from_prepared_stmt)
REFRESH_STATUS |
REFRESH_USER_RESOURCES))
{
WSREP_TO_ISOLATION_BEGIN_WRTCHK(WSREP_MYSQL_DB, NULL, NULL);
if (WSREP(thd) && !thd->lex->no_write_to_binlog &&
wsrep_to_isolation_begin(thd, WSREP_MYSQL_DB, NULL, NULL))
{
res= 1;
goto error;
}
}
#endif /* WITH_WSREP*/
@@ -6234,8 +6239,13 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables)
}
}
}
/* Count number of empty select queries */
if (!thd->is_cursor_execution() && !thd->get_sent_row_count() && !res)
/*
Count number of empty select queries.
is_cursor_execution is used to handle opening of cursor.
For cursors, Empty_queries will be set when using the cursor.
*/
if (unlikely(!thd->get_sent_row_count() && !thd->is_cursor_execution() &&
!(thd->server_status & SERVER_STATUS_RETURNED_ROW) && !res))
status_var_increment(thd->status_var.empty_queries);
else
status_var_add(thd->status_var.rows_sent, thd->get_sent_row_count());

View File

@@ -4566,6 +4566,8 @@ my_bool post_init_callback(THD *thd, void *)
set_current_thd(thd);
plugin_thdvar_init(thd);
// Restore proper transaction read-only context
thd->variables.tx_read_only= false;
// Restore option_bits
thd->variables.option_bits= option_bits_saved;
}

View File

@@ -2837,7 +2837,9 @@ static my_bool list_callback(THD *tmp, list_callback_arg *arg)
thd_info->thread_id=tmp->thread_id;
thd_info->os_thread_id=tmp->os_thread_id;
thd_info->user= arg->thd->strdup(tmp_sctx->user && tmp_sctx->user != slave_user ?
thd_info->user= arg->thd->strdup(tmp_sctx->user &&
(tmp_sctx->user != slave_user &&
tmp_sctx->user != wsrep_user) ?
tmp_sctx->user :
(tmp->system_thread ?
"system user" : "unauthenticated user"));
@@ -3345,8 +3347,9 @@ static my_bool processlist_callback(THD *tmp, processlist_callback_arg *arg)
/* ID */
arg->table->field[0]->store((longlong) tmp->thread_id, TRUE);
/* USER */
val= tmp_sctx->user && tmp_sctx->user != slave_user ? tmp_sctx->user :
(tmp->system_thread ? "system user" : "unauthenticated user");
val= tmp_sctx->user && (tmp_sctx->user != slave_user &&
tmp_sctx->user != wsrep_user) ? tmp_sctx->user :
(tmp->system_thread ? "system user" : "unauthenticated user");
arg->table->field[1]->store(val, strlen(val), cs);
/* HOST */
if (tmp->peer_port && (tmp_sctx->host || tmp_sctx->ip) &&

View File

@@ -9250,7 +9250,7 @@ select_item:
}
| remember_name expr remember_end select_alias
{
DBUG_ASSERT($1 < $3);
DBUG_ASSERT($1 < $3 || thd->killed);
if (unlikely(add_item_to_list(thd, $2)))
MYSQL_YYABORT;

View File

@@ -118,12 +118,13 @@ cleanup:
*/
static int wsrep_write_cache_inc(THD* const thd,
IO_CACHE* const cache,
size_t const log_position,
size_t* const len)
{
DBUG_ENTER("wsrep_write_cache_inc");
my_off_t const saved_pos(my_b_tell(cache));
if (reinit_io_cache(cache, READ_CACHE, thd->wsrep_sr().log_position(), 0, 0))
if (reinit_io_cache(cache, READ_CACHE, log_position, 0, 0))
{
WSREP_ERROR("failed to initialize io-cache");
DBUG_RETURN(1);;
@@ -157,7 +158,7 @@ static int wsrep_write_cache_inc(THD* const thd,
} while ((cache->file >= 0) && (length= my_b_fill(cache)));
if (ret == 0)
{
assert(total_length + thd->wsrep_sr().log_position() == saved_pos);
assert(total_length + log_position == saved_pos);
}
}
@@ -178,9 +179,10 @@ cleanup:
*/
int wsrep_write_cache(THD* const thd,
IO_CACHE* const cache,
size_t const log_position,
size_t* const len)
{
return wsrep_write_cache_inc(thd, cache, len);
return wsrep_write_cache_inc(thd, cache, log_position, len);
}
void wsrep_dump_rbr_buf(THD *thd, const void* rbr_buf, size_t buf_len)

View File

@@ -36,11 +36,13 @@ int wsrep_write_cache_buf(IO_CACHE *cache, uchar **buf, size_t *buf_len);
This function quite the same as MYSQL_BIN_LOG::write_cache(),
with the exception that here we write in buffer instead of log file.
@param log_position position to start writing the cache from
@param len total amount of data written
@return wsrep error status
*/
int wsrep_write_cache(THD* thd,
IO_CACHE* cache,
size_t log_position,
size_t* len);
/* Dump replication buffer to disk */

View File

@@ -95,9 +95,11 @@ int Wsrep_client_service::prepare_data_for_replication()
size_t transactional_data_len= 0;
size_t stmt_data_len= 0;
// Write transactional cache
// Write transactional cache from the last remembered position
if (transactional_cache &&
wsrep_write_cache(m_thd, transactional_cache, &transactional_data_len))
wsrep_write_cache(m_thd, transactional_cache,
m_thd->wsrep_sr().log_position(),
&transactional_data_len))
{
WSREP_ERROR("rbr write fail, data_len: %zu",
data_len);
@@ -105,8 +107,8 @@ int Wsrep_client_service::prepare_data_for_replication()
DBUG_RETURN(1);
}
// Write stmt cache
if (stmt_cache && wsrep_write_cache(m_thd, stmt_cache, &stmt_data_len))
// Write stmt cache fully as it's only written upon transaction commit
if (stmt_cache && wsrep_write_cache(m_thd, stmt_cache, 0u, &stmt_data_len))
{
WSREP_ERROR("rbr write fail, data_len: %zu",
data_len);

View File

@@ -169,6 +169,10 @@ Wsrep_high_priority_service::Wsrep_high_priority_service(THD* thd)
*/
thd->variables.option_bits|= OPTION_BIN_LOG;
/* Allow applying in a transaction read-only context */
thd->tx_read_only= false;
thd->variables.tx_read_only= false;
thd->net.vio= 0;
thd->reset_db(&db_str);
thd->clear_error();

View File

@@ -1476,25 +1476,31 @@ bool wsrep_check_mode_after_open_table (THD *thd,
wsrep_push_warning(thd, WSREP_REQUIRE_PRIMARY_KEY, hton, tables);
}
if (wsrep_check_mode(WSREP_MODE_STRICT_REPLICATION))
{
/* Table is not an InnoDB table and strict replication is requested*/
wsrep_push_warning(thd, WSREP_REQUIRE_INNODB, hton, tables);
}
// Check are we inside a transaction
bool not_used;
uint rw_ha_count= ha_check_and_coalesce_trx_read_only(thd, thd->transaction->all.ha_list, true, &not_used);
bool changes= wsrep_has_changes(thd);
const bool changes= wsrep_has_changes(thd);
const bool active= wsrep_is_active(thd);
// We should not start TOI if transaction has made already
// changes and is active
if (changes && active)
{
my_message(ER_ERROR_DURING_COMMIT, "Transactional commit not supported "
"by involved engine(s)", MYF(0));
wsrep_push_warning(thd, WSREP_EXPERIMENTAL, hton, tables);
return false;
}
// Roll back current stmt if exists
wsrep_before_rollback(thd, true);
wsrep_after_rollback(thd, true);
wsrep_after_statement(thd);
// If there is updates, they would be lost above rollback
if (rw_ha_count > 0 && changes)
{
my_message(ER_ERROR_DURING_COMMIT, "Transactional commit not supported "
"by involved engine(s)", MYF(0));
wsrep_push_warning(thd, WSREP_EXPERIMENTAL, hton, tables);
return false;
}
WSREP_TO_ISOLATION_BEGIN(NULL, NULL, (tables));
}
} else if (db_type != DB_TYPE_UNKNOWN &&
@@ -2844,9 +2850,10 @@ static int wsrep_TOI_begin(THD *thd, const char *db, const char *table,
if (!wsrep_ready)
{
my_error(ER_GALERA_REPLICATION_NOT_SUPPORTED, MYF(0));
push_warning_printf(thd, Sql_state_errno_level::WARN_LEVEL_WARN,
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_GALERA_REPLICATION_NOT_SUPPORTED,
"Galera cluster is not ready to execute replication");
return -1;
}
return 1;
}
@@ -2896,51 +2903,33 @@ static int wsrep_TOI_begin(THD *thd, const char *db, const char *table,
if (ret)
{
DBUG_ASSERT(cs.current_error());
WSREP_DEBUG("to_execute_start() failed for %llu: %s, seqno: %lld",
thd->thread_id, wsrep_thd_query(thd),
(long long)wsrep_thd_trx_seqno(thd));
WSREP_WARN("TO isolation error %s for : %s.%s, sql: %s. ",
wsrep::to_c_string(cs.current_error()),
(db ? db : "(null)"),
(table ? table : " "),
wsrep_thd_query(thd));
/* jump to error handler in mysql_execute_command() */
switch (cs.current_error())
{
case wsrep::e_size_exceeded_error:
WSREP_WARN("TO isolation failed for: %d, schema: %s, sql: %s. "
"Maximum size exceeded.",
ret,
(thd->db.str ? thd->db.str : "(null)"),
wsrep_thd_query(thd));
my_error(ER_UNKNOWN_ERROR, MYF(0), "Maximum writeset size exceeded");
break;
case wsrep::e_deadlock_error:
WSREP_WARN("TO isolation failed for: %d, schema: %s, sql: %s. "
"Deadlock error.",
ret,
(thd->db.str ? thd->db.str : "(null)"),
wsrep_thd_query(thd));
my_error(ER_LOCK_DEADLOCK, MYF(0));
break;
case wsrep::e_timeout_error:
WSREP_WARN("TO isolation failed for: %d, schema: %s, sql: %s. "
"Operation timed out.",
ret,
(thd->db.str ? thd->db.str : "(null)"),
wsrep_thd_query(thd));
my_error(ER_LOCK_WAIT_TIMEOUT, MYF(0));
break;
default:
WSREP_WARN("TO isolation failed for: %d, schema: %s, sql: %s. "
"Check your wsrep connection state and retry the query.",
ret,
(thd->db.str ? thd->db.str : "(null)"),
wsrep_thd_query(thd));
if (!thd->is_error())
{
push_warning_printf(thd, Sql_state_errno_level::WARN_LEVEL_ERROR,
ER_LOCK_DEADLOCK,
"WSREP replication failed. Check "
"your wsrep connection state and retry the query.");
my_error(ER_LOCK_DEADLOCK, MYF(0));
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_LOCK_DEADLOCK,
"WSREP replication failed with error %s. "
"Check your wsrep connection state and retry the query.",
wsrep::to_c_string(cs.current_error()));
}
}
rc= -1;
@@ -3873,6 +3862,7 @@ void* start_wsrep_THD(void *arg)
thd->system_thread= SYSTEM_THREAD_SLAVE_SQL;
thd->security_ctx->skip_grants();
thd->security_ctx->user = (char *)wsrep_user;
/* handle_one_connection() again... */
thd->mark_connection_idle();

View File

@@ -715,15 +715,13 @@ Wsrep_schema::Wsrep_schema() = default;
Wsrep_schema::~Wsrep_schema() = default;
static void wsrep_init_thd_for_schema(THD *thd)
static void wsrep_init_thd_variables(THD *thd)
{
thd->security_ctx->skip_grants();
thd->system_thread= SYSTEM_THREAD_GENERIC;
thd->real_id=pthread_self(); // Keep purify happy
thd->prior_thr_create_utime= thd->start_utime=
thd->thr_create_utime= microsecond_interval_timer();
/* No Galera replication */
thd->variables.wsrep_on= 0;
/* Allow modifications in a transaction read-only context */
thd->tx_read_only= false;
thd->variables.tx_read_only= false;
/* No binlogging */
thd->variables.sql_log_bin= 0;
thd->variables.option_bits&= ~OPTION_BIN_LOG;
@@ -733,6 +731,17 @@ static void wsrep_init_thd_for_schema(THD *thd)
thd->variables.option_bits|= OPTION_LOG_OFF;
/* Read committed isolation to avoid gap locking */
thd->variables.tx_isolation= ISO_READ_COMMITTED;
}
static void wsrep_init_thd_for_schema(THD *thd)
{
thd->security_ctx->skip_grants();
thd->system_thread= SYSTEM_THREAD_GENERIC;
thd->real_id=pthread_self(); // Keep purify happy
thd->prior_thr_create_utime= thd->start_utime=
thd->thr_create_utime= microsecond_interval_timer();
wsrep_init_thd_variables(thd);
wsrep_assign_from_threadvars(thd);
wsrep_store_threadvars(thd);
}
@@ -1356,9 +1365,6 @@ static int replay_transaction(THD* thd,
const wsrep::ws_meta& ws_meta,
const std::vector<wsrep::seqno>& fragments)
{
Wsrep_schema_impl::wsrep_off wsrep_off(thd);
Wsrep_schema_impl::binlog_off binlog_off(thd);
Wsrep_schema_impl::sql_safe_updates sql_safe_updates(thd);
Wsrep_schema_impl::thd_context_switch thd_context_switch(orig_thd, thd);
int ret= 1;
@@ -1483,6 +1489,7 @@ int Wsrep_schema::replay_transaction(THD* orig_thd,
}
thd->thread_stack= (orig_thd ? orig_thd->thread_stack : (char *) &thd);
wsrep_init_thd_variables(thd);
wsrep_assign_from_threadvars(thd);
@@ -1504,9 +1511,6 @@ static int recover_sr_transactions(THD* storage_thd, THD* orig_thd)
TABLE* cluster_table= 0;
TABLE_LIST cluster_table_l;
Wsrep_storage_service storage_service(storage_thd);
Wsrep_schema_impl::binlog_off binlog_off(storage_thd);
Wsrep_schema_impl::wsrep_off wsrep_off(storage_thd);
Wsrep_schema_impl::sql_safe_updates sql_safe_updates(storage_thd);
Wsrep_schema_impl::thd_context_switch thd_context_switch(orig_thd,
storage_thd);
Wsrep_server_state& server_state(Wsrep_server_state::instance());
@@ -1666,6 +1670,7 @@ int Wsrep_schema::recover_sr_transactions(THD *orig_thd)
}
storage_thd->thread_stack=
(orig_thd ? orig_thd->thread_stack : (char *) &storage_thd);
wsrep_init_thd_variables(storage_thd);
wsrep_assign_from_threadvars(storage_thd);
int ret= ::recover_sr_transactions(storage_thd, orig_thd);

View File

@@ -55,6 +55,10 @@ Wsrep_storage_service::Wsrep_storage_service(THD* thd)
/* No binlogging */
/* Allow modifications in a transaction read-only context */
thd->tx_read_only= false;
thd->variables.tx_read_only= false;
/* No general log */
thd->variables.option_bits |= OPTION_LOG_OFF;

View File

@@ -1461,7 +1461,16 @@ static ulint buf_do_flush_list_batch(ulint max_n, lsn_t lsn) noexcept
buf_pool.delete_from_flush_list(bpage);
skip:
bpage= prev;
continue;
if (scanned & 31)
continue;
/* Release the buf_pool.flush_list_mutex every now and then
in order to reduce the wait time in buf_flush_ahead().
We attempt to preserve the pointer position while yielding.
Any thread that would remove 'prev' from buf_pool.flush_list
must adjust the hazard pointer. */
buf_pool.flush_hp.set(prev);
mysql_mutex_unlock(&buf_pool.flush_list_mutex);
goto next;
}
ut_ad(oldest_modification > 2);
@@ -1489,51 +1498,54 @@ static ulint buf_do_flush_list_batch(ulint max_n, lsn_t lsn) noexcept
buf_pool.flush_hp.set(prev);
}
const page_id_t page_id(bpage->id());
const uint32_t space_id= page_id.space();
if (!space || space->id != space_id)
{
if (last_space_id != space_id)
const page_id_t page_id(bpage->id());
const uint32_t space_id= page_id.space();
if (!space || space->id != space_id)
{
if (last_space_id != space_id)
{
mysql_mutex_unlock(&buf_pool.flush_list_mutex);
mysql_mutex_unlock(&buf_pool.mutex);
if (space)
space->release();
auto p= buf_flush_space(space_id);
space= p.first;
last_space_id= space_id;
mysql_mutex_lock(&buf_pool.mutex);
buf_pool.stat.n_pages_written+= p.second;
mysql_mutex_lock(&buf_pool.flush_list_mutex);
}
else
ut_ad(!space);
}
else if (space->is_stopping_writes())
{
space->release();
space= nullptr;
}
if (!space)
buf_flush_discard_page(bpage);
else
{
mysql_mutex_unlock(&buf_pool.flush_list_mutex);
mysql_mutex_unlock(&buf_pool.mutex);
if (space)
space->release();
auto p= buf_flush_space(space_id);
space= p.first;
last_space_id= space_id;
mysql_mutex_lock(&buf_pool.mutex);
buf_pool.stat.n_pages_written+= p.second;
mysql_mutex_lock(&buf_pool.flush_list_mutex);
do
{
if (neighbors && space->is_rotational())
count+= buf_flush_try_neighbors(space, page_id, bpage,
neighbors == 1, count, max_n);
else if (bpage->flush(space))
++count;
else
continue;
mysql_mutex_lock(&buf_pool.mutex);
}
while (0);
}
else
ut_ad(!space);
}
else if (space->is_stopping_writes())
{
space->release();
space= nullptr;
}
if (!space)
buf_flush_discard_page(bpage);
else
{
mysql_mutex_unlock(&buf_pool.flush_list_mutex);
do
{
if (neighbors && space->is_rotational())
count+= buf_flush_try_neighbors(space, page_id, bpage,
neighbors == 1, count, max_n);
else if (bpage->flush(space))
++count;
else
continue;
mysql_mutex_lock(&buf_pool.mutex);
}
while (0);
}
next:
mysql_mutex_lock(&buf_pool.flush_list_mutex);
bpage= buf_pool.flush_hp.get();
}

View File

@@ -6163,25 +6163,22 @@ ha_innobase::close()
/* The following accessor functions should really be inside MySQL code! */
#ifdef WITH_WSREP
ulint
wsrep_innobase_mysql_sort(
/* out: str contains sort string */
size_t
wsrep_normalize_string(
int mysql_type, /* in: MySQL type */
uint charset_number, /* in: number of the charset */
unsigned char* str, /* in: data field */
ulint str_length, /* in: data field length,
const unsigned char* str, /* in: input data field */
unsigned char* out_str, /* out: normalized string */
size_t str_length, /* in: data field length,
not UNIV_SQL_NULL */
ulint buf_length) /* in: total str buffer length */
size_t buf_length) /* in: total str buffer length */
{
CHARSET_INFO* charset;
enum_field_types mysql_tp;
ulint ret_length = str_length;
size_t ret_length= str_length;
const enum_field_types mysql_tp= (enum_field_types)mysql_type;
DBUG_ASSERT(str_length != UNIV_SQL_NULL);
mysql_tp = (enum_field_types) mysql_type;
switch (mysql_tp) {
case MYSQL_TYPE_BIT:
@@ -6193,8 +6190,7 @@ wsrep_innobase_mysql_sort(
case MYSQL_TYPE_LONG_BLOB:
case MYSQL_TYPE_VARCHAR:
{
uchar tmp_str[REC_VERSION_56_MAX_INDEX_COL_LEN] = {'\0'};
ulint tmp_length = REC_VERSION_56_MAX_INDEX_COL_LEN;
CHARSET_INFO* charset;
/* Use the charset number to pick the right charset struct for
the comparison. Since the MySQL function get_charset may be
@@ -6209,36 +6205,26 @@ wsrep_innobase_mysql_sort(
charset = get_charset(charset_number, MYF(MY_WME));
if (charset == NULL) {
sql_print_error("InnoDB needs charset %lu for doing "
"a comparison, but MariaDB cannot "
"find that charset.",
(ulong) charset_number);
sql_print_error("InnoDB needs charset %lu for doing "
"a comparison, but MariaDB cannot "
"find that charset.",
(ulong) charset_number);
ut_a(0);
}
}
ut_a(str_length <= tmp_length);
memcpy(tmp_str, str, str_length);
tmp_length = charset->strnxfrm(str, str_length,
uint(str_length), tmp_str,
tmp_length, 0);
DBUG_ASSERT(tmp_length <= str_length);
if (wsrep_protocol_version < 3) {
tmp_length = charset->strnxfrm(
str, str_length,
uint(str_length), tmp_str, tmp_length, 0);
DBUG_ASSERT(tmp_length <= str_length);
ret_length = charset->strnxfrm(
out_str, str_length,
uint(str_length), str, buf_length, 0);
} else {
/* strnxfrm will expand the destination string,
protocols < 3 truncated the sorted sring
protocols >= 3 gets full sorted sring
protocols < 3 truncated the normalized string
protocols >= 3 gets full normalized string
*/
tmp_length = charset->strnxfrm(
str, buf_length,
uint(str_length), tmp_str, str_length, 0);
DBUG_ASSERT(tmp_length <= buf_length);
ret_length = tmp_length;
ret_length = charset->strnxfrm(
out_str, buf_length,
uint(str_length), str, str_length, 0);
}
break;
@@ -6607,8 +6593,6 @@ wsrep_store_key_val_for_row(
KEY_PART_INFO* key_part = key_info->key_part;
KEY_PART_INFO* end = key_part + key_info->user_defined_key_parts;
char* buff_start = buff;
enum_field_types mysql_type;
Field* field;
ulint buff_space = buff_len;
DBUG_ENTER("wsrep_store_key_val_for_row");
@@ -6617,8 +6601,8 @@ wsrep_store_key_val_for_row(
*key_is_null = true;
for (; key_part != end; key_part++) {
uchar sorted[REC_VERSION_56_MAX_INDEX_COL_LEN] = {'\0'};
bool part_is_null = false;
uchar normalized[REC_VERSION_56_MAX_INDEX_COL_LEN+1];
bool part_is_null= false;
if (key_part->null_bit) {
if (buff_space > 0) {
@@ -6638,23 +6622,15 @@ wsrep_store_key_val_for_row(
}
if (!part_is_null) *key_is_null = false;
field = key_part->field;
mysql_type = field->type();
const Field* field= key_part->field;
const enum_field_types mysql_type= field->type();
if (mysql_type == MYSQL_TYPE_VARCHAR) {
/* >= 5.0.3 true VARCHAR */
ulint lenlen;
ulint len;
const byte* data;
ulint key_len;
ulint true_len;
const CHARSET_INFO* cs;
int error=0;
key_len = key_part->length;
const size_t key_len= key_part->length;
if (part_is_null) {
true_len = key_len + 2;
size_t true_len= key_len + 2;
if (true_len > buff_space) {
fprintf (stderr,
"WSREP: key truncated: %s\n",
@@ -6665,27 +6641,28 @@ wsrep_store_key_val_for_row(
buff_space -= true_len;
continue;
}
cs = field->charset();
const CHARSET_INFO* cs = field->charset();
lenlen = (ulint)
ulint lenlen = (ulint)
(((Field_varstring*)field)->length_bytes);
data = row_mysql_read_true_varchar(&len,
size_t len;
const byte* data = row_mysql_read_true_varchar(&len,
(byte*) (record
+ (ulint)get_field_offset(table, field)),
lenlen);
true_len = len;
size_t true_len= len;
/* For multi byte character sets we need to calculate
the true length of the key */
if (len > 0 && cs->mbmaxlen > 1) {
true_len = (ulint) my_well_formed_length(cs,
int error;
true_len= my_well_formed_length(cs,
(const char *) data,
(const char *) data + len,
(uint) (key_len /
cs->mbmaxlen),
(key_len / cs->mbmaxlen),
&error);
}
@@ -6694,16 +6671,21 @@ wsrep_store_key_val_for_row(
if (true_len > key_len) {
true_len = key_len;
}
/* cannot exceed max column lenght either, we may need to truncate
/* cannot exceed max column length either, we may need to truncate
the stored value: */
if (true_len > sizeof(sorted)) {
true_len = sizeof(sorted);
if (true_len >= sizeof(normalized)) {
true_len = sizeof(normalized) - 1;
}
/* Normalize string if is not empty string */
if (true_len) {
ut_ad(data);
true_len= wsrep_normalize_string(
mysql_type, cs->number, data,
normalized, true_len,
REC_VERSION_56_MAX_INDEX_COL_LEN);
}
memcpy(sorted, data, true_len);
true_len = wsrep_innobase_mysql_sort(
mysql_type, cs->number, sorted, true_len,
REC_VERSION_56_MAX_INDEX_COL_LEN);
if (wsrep_protocol_version > 1) {
/* Note that we always reserve the maximum possible
length of the true VARCHAR in the key value, though
@@ -6716,7 +6698,7 @@ wsrep_store_key_val_for_row(
wsrep_thd_query(thd));
true_len = buff_space;
}
memcpy(buff, sorted, true_len);
memcpy(buff, normalized, true_len);
buff += true_len;
buff_space -= true_len;
} else {
@@ -6730,19 +6712,11 @@ wsrep_store_key_val_for_row(
as BLOB data in innodb. */
|| mysql_type == MYSQL_TYPE_GEOMETRY) {
const CHARSET_INFO* cs;
ulint key_len;
ulint true_len;
int error=0;
ulint blob_len;
const byte* blob_data;
const size_t key_len= key_part->length;
ut_a(key_part->key_part_flag & HA_PART_KEY_SEG);
key_len = key_part->length;
if (part_is_null) {
true_len = key_len + 2;
size_t true_len= key_len + 2;
if (true_len > buff_space) {
fprintf (stderr,
"WSREP: key truncated: %s\n",
@@ -6755,14 +6729,15 @@ wsrep_store_key_val_for_row(
continue;
}
cs = field->charset();
const CHARSET_INFO* cs= field->charset();
blob_data = row_mysql_read_blob_ref(&blob_len,
size_t blob_len;
const byte* blob_data = row_mysql_read_blob_ref(&blob_len,
(byte*) (record
+ (ulint)get_field_offset(table, field)),
(ulint) field->pack_length());
true_len = blob_len;
size_t true_len= blob_len;
ut_a(get_field_offset(table, field)
== key_part->offset);
@@ -6771,12 +6746,13 @@ wsrep_store_key_val_for_row(
the true length of the key */
if (blob_len > 0 && cs->mbmaxlen > 1) {
true_len = (ulint) my_well_formed_length(cs,
int error;
true_len= my_well_formed_length(cs,
(const char *) blob_data,
(const char *) blob_data
+ blob_len,
(uint) (key_len /
cs->mbmaxlen),
(key_len / cs->mbmaxlen),
&error);
}
@@ -6788,11 +6764,16 @@ wsrep_store_key_val_for_row(
true_len = key_len;
}
memcpy(sorted, blob_data, true_len);
true_len = wsrep_innobase_mysql_sort(
mysql_type, cs->number, sorted, true_len,
REC_VERSION_56_MAX_INDEX_COL_LEN);
/* Normalize string if it is not empty string.
When true_len == 0 blob_data is not always
nullptr it may be empty string i.e. "" */
if (true_len) {
ut_ad(blob_data);
true_len= wsrep_normalize_string(
mysql_type, cs->number, blob_data,
normalized, true_len,
REC_VERSION_56_MAX_INDEX_COL_LEN);
}
/* Note that we always reserve the maximum possible
length of the BLOB prefix in the key value. */
@@ -6808,24 +6789,15 @@ wsrep_store_key_val_for_row(
} else {
buff += key_len;
}
memcpy(buff, sorted, true_len);
memcpy(buff, normalized, true_len);
} else {
/* Here we handle all other data types except the
true VARCHAR, BLOB and TEXT. Note that the column
value we store may be also in a column prefix
index. */
const CHARSET_INFO* cs = NULL;
ulint true_len;
ulint key_len;
const uchar* src_start;
int error=0;
enum_field_types real_type;
key_len = key_part->length;
if (part_is_null) {
true_len = key_len;
size_t true_len= key_part->length;
if (true_len > buff_space) {
fprintf (stderr,
"WSREP: key truncated: %s\n",
@@ -6838,9 +6810,9 @@ wsrep_store_key_val_for_row(
continue;
}
src_start = record + key_part->offset;
real_type = field->real_type();
true_len = key_len;
const uchar* src_start= record + key_part->offset;
const enum_field_types real_type= field->real_type();
size_t true_len= key_part->length;
/* Character set for the field is defined only
to fields whose type is string and real field
@@ -6852,26 +6824,32 @@ wsrep_store_key_val_for_row(
&& ( mysql_type == MYSQL_TYPE_VAR_STRING
|| mysql_type == MYSQL_TYPE_STRING)) {
cs = field->charset();
const CHARSET_INFO* cs= field->charset();
/* For multi byte character sets we need to
calculate the true length of the key */
if (key_len > 0 && cs->mbmaxlen > 1) {
if (true_len > 0 && cs->mbmaxlen > 1) {
int error;
true_len = (ulint)
my_well_formed_length(cs,
true_len= my_well_formed_length(cs,
(const char *)src_start,
(const char *)src_start
+ key_len,
(uint) (key_len /
cs->mbmaxlen),
+ true_len,
(true_len / cs->mbmaxlen),
&error);
}
memcpy(sorted, src_start, true_len);
true_len = wsrep_innobase_mysql_sort(
mysql_type, cs->number, sorted, true_len,
REC_VERSION_56_MAX_INDEX_COL_LEN);
/* Normalize string if it is not empty string */
if (true_len) {
ut_ad(src_start);
true_len= wsrep_normalize_string(
mysql_type, cs->number,
src_start, normalized, true_len,
REC_VERSION_56_MAX_INDEX_COL_LEN);
} else {
ut_ad(src_start == nullptr);
}
if (true_len > buff_space) {
fprintf (stderr,
@@ -6879,9 +6857,15 @@ wsrep_store_key_val_for_row(
wsrep_thd_query(thd));
true_len = buff_space;
}
memcpy(buff, sorted, true_len);
memcpy(buff, normalized, true_len);
} else {
memcpy(buff, src_start, true_len);
/* Copy only if there is data */
if (true_len) {
ut_ad(src_start);
memcpy(buff, src_start, true_len);
} else {
ut_ad(src_start == nullptr);
}
}
buff += true_len;
buff_space -= true_len;
@@ -8428,12 +8412,15 @@ wsrep_calc_row_hash(
return(0);
}
/** Append table-level exclusive key.
/** Append table-level exclusive/shared key.
@param thd MySQL thread handle
@param table table
@param exclusive Exclusive not shared certification key.
@retval false on success
@retval true on failure */
ATTRIBUTE_COLD bool wsrep_append_table_key(MYSQL_THD thd, const dict_table_t &table)
ATTRIBUTE_COLD bool wsrep_append_table_key(MYSQL_THD thd,
const dict_table_t &table,
bool exclusive)
{
char db_buf[NAME_LEN + 1];
char tbl_buf[NAME_LEN + 1];
@@ -8446,9 +8433,11 @@ ATTRIBUTE_COLD bool wsrep_append_table_key(MYSQL_THD thd, const dict_table_t &ta
return true;
}
/* Append table-level exclusive key */
const int rcode = wsrep_thd_append_table_key(thd, db_buf,
tbl_buf, WSREP_SERVICE_KEY_EXCLUSIVE);
/* Append table-level key */
const enum Wsrep_service_key_type key_type = exclusive
? WSREP_SERVICE_KEY_EXCLUSIVE
: WSREP_SERVICE_KEY_SHARED;
const int rcode = wsrep_thd_append_table_key(thd, db_buf, tbl_buf, key_type);
if (rcode)
{
WSREP_ERROR("Appending table key failed: %s, %d",
@@ -8613,10 +8602,10 @@ func_exit:
&& (thd_sql_command(m_user_thd) != SQLCOM_LOAD ||
thd_binlog_format(m_user_thd) == BINLOG_FORMAT_ROW)) {
/* We use table-level exclusive key for SEQUENCES
/* We use table-level shared key for SEQUENCES
and normal key append for others. */
if (table->s->table_type == TABLE_TYPE_SEQUENCE) {
if (wsrep_append_table_key(m_user_thd, *m_prebuilt->table))
if (wsrep_append_table_key(m_user_thd, *m_prebuilt->table, false))
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
} else if (wsrep_append_keys(m_user_thd,
wsrep_protocol_version >= 4

View File

@@ -148,9 +148,12 @@ innobase_basename(
const char* path_name);
#ifdef WITH_WSREP
ulint wsrep_innobase_mysql_sort(int mysql_type, uint charset_number,
unsigned char* str, ulint str_length,
ulint buf_length);
size_t wsrep_normalize_string(int mysql_type,
uint charset_number,
const unsigned char* str,
unsigned char* out_str,
ulint str_length,
ulint buf_length);
#endif /* WITH_WSREP */
/** Get high resolution timestamp for the current query start time.
@@ -408,13 +411,15 @@ char *dict_table_lookup(LEX_CSTRING db, LEX_CSTRING name,
dict_table_t **table, mem_heap_t *heap) noexcept;
#ifdef WITH_WSREP
/** Append table-level exclusive key.
/** Append table-level exclusive/shared key.
@param thd MySQL thread handle
@param table table
@param exclusive Exclusive not shared certification key.
@retval false on success
@retval true on failure */
struct dict_table_t;
bool wsrep_append_table_key(MYSQL_THD thd, const dict_table_t &table);
bool wsrep_append_table_key(MYSQL_THD thd, const dict_table_t &table,
bool exclusive);
#endif /* WITH_WSREP */
#endif /* !UNIV_INNOCHECKSUM */

View File

@@ -2730,11 +2730,10 @@ wsrep_rec_get_foreign_key(
*buf++ = 0;
key_len++;
}
memcpy(buf, data, len);
*buf_len = wsrep_innobase_mysql_sort(
*buf_len = wsrep_normalize_string(
(int)(col_f->prtype & DATA_MYSQL_TYPE_MASK),
dtype_get_charset_coll(col_f->prtype),
buf, static_cast<uint>(len),
data, buf, static_cast<uint>(len),
static_cast<uint>(*buf_len));
} else { /* new protocol */
if (!(col_r->prtype & DATA_NOT_NULL)) {
@@ -2763,13 +2762,10 @@ wsrep_rec_get_foreign_key(
case DATA_VARMYSQL:
case DATA_CHAR:
case DATA_MYSQL:
/* Copy the actual data */
memcpy(buf, data, len);
len = wsrep_innobase_mysql_sort(
(int)
(col_f->prtype & DATA_MYSQL_TYPE_MASK),
len = wsrep_normalize_string(
(int)(col_f->prtype & DATA_MYSQL_TYPE_MASK),
dtype_get_charset_coll(col_f->prtype),
buf, len, *buf_len);
data, buf, len, *buf_len);
break;
case DATA_BLOB:
case DATA_BINARY:

View File

@@ -2795,7 +2795,7 @@ avoid_bulk:
}
#ifdef WITH_WSREP
if (trx->is_wsrep() &&
wsrep_append_table_key(trx->mysql_thd, *index->table))
wsrep_append_table_key(trx->mysql_thd, *index->table, true))
{
trx->error_state = DB_ROLLBACK;
goto err_exit;

View File

@@ -815,6 +815,7 @@ static void trx_assign_rseg_low(trx_t *trx)
undo tablespaces that are scheduled for truncation. */
static Atomic_counter<unsigned> rseg_slot;
unsigned slot = rseg_slot++ % TRX_SYS_N_RSEGS;
DBUG_EXECUTE_IF("assign_same_rseg", slot= 0;);
ut_d(const auto start_scan_slot = slot);
ut_d(bool look_for_rollover = false);
trx_rseg_t* rseg;
@@ -827,6 +828,8 @@ static void trx_assign_rseg_low(trx_t *trx)
ut_ad(!look_for_rollover || start_scan_slot != slot);
ut_d(look_for_rollover = true);
slot = (slot + 1) % TRX_SYS_N_RSEGS;
DBUG_EXECUTE_IF("assign_same_rseg",
slot= (slot - 1) % TRX_SYS_N_RSEGS;);
if (!rseg->space) {
continue;

View File

@@ -1010,6 +1010,33 @@ corrupted_type:
case TRX_UNDO_ACTIVE:
case TRX_UNDO_PREPARED:
if (UNIV_LIKELY(type != 1)) {
/* The undo log of a previously committed
transaction that was logged in this page may
have trx_no greater than the trx_id of the
current undo log, because the trx_id of the
current transaction can be assigned before the
previous transaction is committed.
An undo page can contain several small
transactions when a TRX_UNDO_CACHED page is
being reused. Only the last (uncommitted)
transaction may lack a trx_no. By design, any
preceding transactions must be committed and
have a trx_no, and the last committed
transaction in the page must have the largest
trx_no. */
const uint16 prev_offset = mach_read_from_2(
undo_header + TRX_UNDO_PREV_LOG);
if (!prev_offset) {
break;
}
const trx_ulogf_t* const prev_undo_header=
block->page.frame + prev_offset;
const trx_id_t trx_no_prev = mach_read_from_8(
prev_undo_header + TRX_UNDO_TRX_NO);
if (trx_no_prev > trx_id) {
trx_no = trx_no_prev + 1;
}
break;
}
sql_print_error("InnoDB: upgrade from older version than"
@@ -1391,6 +1418,7 @@ trx_undo_assign_low(mtr_t *mtr, dberr_t *err,
);
*err = DB_SUCCESS;
DEBUG_SYNC_C("before_undo_log_trx_id_write");
rseg->latch.wr_lock(SRW_LOCK_CALL);
if (is_temp) {
ut_ad(!UT_LIST_GET_LEN(rseg->undo_cached));
@@ -1408,6 +1436,7 @@ trx_undo_assign_low(mtr_t *mtr, dberr_t *err,
}
rseg->latch.wr_unlock();
DEBUG_SYNC_C("after_undo_log_trx_id_write");
return block;
}

View File

@@ -1,9 +1,3 @@
[mariadbd]
#
# Uncomment line to enable
#
#plugin-maturity = alpha
[mariadb]
#
# Uncomment line to enable