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

Merge 10.10 into 10.11

This commit is contained in:
Marko Mäkelä
2023-08-15 11:24:41 +03:00
26 changed files with 1167 additions and 77 deletions

View File

@@ -90,7 +90,6 @@ C_MODE_START
#define MY_THREADSAFE 2048U /* my_seek(): lock fd mutex */ #define MY_THREADSAFE 2048U /* my_seek(): lock fd mutex */
#define MY_SYNC 4096U /* my_copy(): sync dst file */ #define MY_SYNC 4096U /* my_copy(): sync dst file */
#define MY_SYNC_DIR 32768U /* my_create/delete/rename: sync directory */ #define MY_SYNC_DIR 32768U /* my_create/delete/rename: sync directory */
#define MY_SYNC_FILESIZE 65536U /* my_sync(): safe sync when file is extended */
#define MY_THREAD_SPECIFIC 0x10000U /* my_malloc(): thread specific */ #define MY_THREAD_SPECIFIC 0x10000U /* my_malloc(): thread specific */
#define MY_ROOT_USE_MPROTECT 0x20000U /* init_alloc_root: read only segments */ #define MY_ROOT_USE_MPROTECT 0x20000U /* init_alloc_root: read only segments */
/* Tree that should delete things automatically */ /* Tree that should delete things automatically */

View File

@@ -2673,10 +2673,253 @@ INSERT INTO t1 VALUES('aa');
SET column_compression_threshold=DEFAULT; SET column_compression_threshold=DEFAULT;
DROP TABLE t1; DROP TABLE t1;
# #
# End of 10.3 tests # MDEV-31724 Compressed varchar values lost on joins when sorting on columns from joined table(s)
# #
CREATE TABLE t1 (
id int(10) unsigned not null,
txt varchar(5000) COMPRESSED NOT NULL DEFAULT '',
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin;
CREATE TABLE t2 (
id int(10) unsigned not null,
n1 bigint(20) NOT NULL,
n2 bigint(20) NOT NULL,
n3 bigint(20) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin;
INSERT INTO t1 VALUES
(1, 'short string < 100 chars'),
(2, 'long string = 99 chars '),
(3, 'long string = 100 chars !'),
(4, 'long string = 101 chars !');
INSERT INTO t2 VALUES
(1, 24, 1, 1),
(2, 99, 2, 2),
(3, 100, 3, 3),
(4, 101, 4, 4);
SELECT txt, v.* FROM t1 LEFT JOIN t2 v ON t1.id = v.id;
txt id n1 n2 n3
short string < 100 chars 1 24 1 1
long string = 99 chars 2 99 2 2
long string = 100 chars ! 3 100 3 3
long string = 101 chars ! 4 101 4 4
SELECT txt, v.* FROM t1 LEFT JOIN t2 v ON t1.id = v.id ORDER BY v.n1;
txt id n1 n2 n3
short string < 100 chars 1 24 1 1
long string = 99 chars 2 99 2 2
long string = 100 chars ! 3 100 3 3
long string = 101 chars ! 4 101 4 4
SELECT txt, v.* FROM t1 JOIN t2 v ON t1.id = v.id;
txt id n1 n2 n3
short string < 100 chars 1 24 1 1
long string = 99 chars 2 99 2 2
long string = 100 chars ! 3 100 3 3
long string = 101 chars ! 4 101 4 4
SELECT txt, v.* FROM t1 JOIN t2 v ON t1.id = v.id ORDER BY v.n1;
txt id n1 n2 n3
short string < 100 chars 1 24 1 1
long string = 99 chars 2 99 2 2
long string = 100 chars ! 3 100 3 3
long string = 101 chars ! 4 101 4 4
DROP TABLE t1, t2;
CREATE OR REPLACE TABLE t1 (
id INT NOT NULL PRIMARY KEY,
txt varchar(5000) COMPRESSED NOT NULL DEFAULT ''
) CHARSET=utf8mb3;
INSERT INTO t1 VALUES
(1, REPEAT('a', 10)),
(2, REPEAT('b', 99)),
(3, REPEAT('c', 100)),
(4, REPEAT('d', 121));
SELECT txt, sysdate(6) FROM t1 ORDER BY 2;
txt sysdate(6)
aaaaaaaaaa <sysdate>
bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb <sysdate>
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc <sysdate>
ddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd <sysdate>
DROP TABLE t1;
CREATE FUNCTION f1(imax INT, jmax INT) RETURNS TEXT
BEGIN
DECLARE res TEXT DEFAULT 'x';
FOR i IN 0..imax
DO
FOR j IN 0..jmax
DO
SET res=CONCAT(res, ' ', i, ' ', j);
END FOR;
END FOR;
RETURN res;
END;
$$
SET @@column_compression_threshold=32;
# VARCHAR1, 8bit, truncation
CREATE TABLE t1 (a VARCHAR(254) COMPRESSED CHARACTER SET latin1);
INSERT INTO t1 VALUES (f1(6,6));
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
LENGTH(a) LEFT(a,30) RIGHT(a,30)
197 x 0 0 0 1 0 2 0 3 0 4 0 5 0 6 6 6 0 6 1 6 2 6 3 6 4 6 5 6 6
FLUSH STATUS;
ALTER IGNORE TABLE t1 MODIFY a VARCHAR(4) COMPRESSED CHARACTER SET latin1;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
SHOW STATUS LIKE 'Column%compressions';
Variable_name Value
Column_compressions 0
Column_decompressions 1
SELECT LENGTH(a), a FROM t1;
LENGTH(a) a
4 x 0
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(254) COMPRESSED CHARACTER SET latin1);
INSERT INTO t1 VALUES (REPEAT('a',254));
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
LENGTH(a) LEFT(a,30) RIGHT(a,30)
254 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
FLUSH STATUS;
ALTER IGNORE TABLE t1 MODIFY a VARCHAR(4) COMPRESSED CHARACTER SET latin1;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
SHOW STATUS LIKE 'Column%compressions';
Variable_name Value
Column_compressions 0
Column_decompressions 1
SELECT LENGTH(a), a FROM t1;
LENGTH(a) a
4 aaaa
DROP TABLE t1;
# VARCHAR1, 8bit, no truncation
CREATE TABLE t1 (a VARCHAR(250) COMPRESSED CHARACTER SET latin1);
INSERT INTO t1 VALUES (f1(6,6));
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
LENGTH(a) LEFT(a,30) RIGHT(a,30)
197 x 0 0 0 1 0 2 0 3 0 4 0 5 0 6 6 6 0 6 1 6 2 6 3 6 4 6 5 6 6
FLUSH STATUS;
ALTER IGNORE TABLE t1 MODIFY a VARCHAR(254) COMPRESSED CHARACTER SET latin1;
SHOW STATUS LIKE 'Column%compressions';
Variable_name Value
Column_compressions 0
Column_decompressions 0
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
LENGTH(a) LEFT(a,30) RIGHT(a,30)
197 x 0 0 0 1 0 2 0 3 0 4 0 5 0 6 6 6 0 6 1 6 2 6 3 6 4 6 5 6 6
DROP TABLE t1;
# VARCHAR2, 8bit, truncation
CREATE TABLE t1 (a VARCHAR(32000) COMPRESSED CHARACTER SET latin1);
INSERT INTO t1 VALUES (f1(31,31));
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
LENGTH(a) LEFT(a,30) RIGHT(a,30)
5505 x 0 0 0 1 0 2 0 3 0 4 0 5 0 6 31 27 31 28 31 29 31 30 31 31
FLUSH STATUS;
ALTER IGNORE TABLE t1 MODIFY a VARCHAR(256) COMPRESSED CHARACTER SET latin1;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
SHOW STATUS LIKE 'Column%compressions';
Variable_name Value
Column_compressions 1
Column_decompressions 1
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
LENGTH(a) LEFT(a,30) RIGHT(a,30)
256 x 0 0 0 1 0 2 0 3 0 4 0 5 0 6 1 17 1 18 1 19 1 20 1 21 1 22
DROP TABLE t1;
# VARCHAR2, 8bit, no truncation
CREATE TABLE t1 (a VARCHAR(32000) COMPRESSED CHARACTER SET latin1);
INSERT INTO t1 VALUES (f1(31,31));
SELECT LENGTH(a), LEFT(a,30), RIGHT(a, 30) FROM t1;
LENGTH(a) LEFT(a,30) RIGHT(a, 30)
5505 x 0 0 0 1 0 2 0 3 0 4 0 5 0 6 31 27 31 28 31 29 31 30 31 31
FLUSH STATUS;
ALTER IGNORE TABLE t1 MODIFY a VARCHAR(32001) COMPRESSED CHARACTER SET latin1;
SHOW STATUS LIKE 'Column%compressions';
Variable_name Value
Column_compressions 0
Column_decompressions 0
SELECT LENGTH(a), LEFT(a,30), RIGHT(a, 30) FROM t1;
LENGTH(a) LEFT(a,30) RIGHT(a, 30)
5505 x 0 0 0 1 0 2 0 3 0 4 0 5 0 6 31 27 31 28 31 29 31 30 31 31
DROP TABLE t1;
# VARCHAR1, multi-byte, truncation
CREATE TABLE t1 (a VARCHAR(80) COMPRESSED CHARACTER SET utf8mb3);
INSERT INTO t1 VALUES (f1(3,3));
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
LENGTH(a) LEFT(a,30) RIGHT(a,30)
65 x 0 0 0 1 0 2 0 3 1 0 1 1 1 2 0 2 1 2 2 2 3 3 0 3 1 3 2 3 3
FLUSH STATUS;
ALTER IGNORE TABLE t1 MODIFY a VARCHAR(1) COMPRESSED CHARACTER SET utf8mb3;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
SHOW STATUS LIKE 'Column%compressions';
Variable_name Value
Column_compressions 0
Column_decompressions 1
SELECT LENGTH(a), a FROM t1;
LENGTH(a) a
1 x
DROP TABLE t1;
# VARCHAR1, multi-byte, no truncation
CREATE TABLE t1 (a VARCHAR(80) COMPRESSED CHARACTER SET utf8mb3);
INSERT INTO t1 VALUES (f1(3,3));
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
LENGTH(a) LEFT(a,30) RIGHT(a,30)
65 x 0 0 0 1 0 2 0 3 1 0 1 1 1 2 0 2 1 2 2 2 3 3 0 3 1 3 2 3 3
FLUSH STATUS;
ALTER IGNORE TABLE t1 MODIFY a VARCHAR(81) COMPRESSED CHARACTER SET utf8mb3;
SHOW STATUS LIKE 'Column%compressions';
Variable_name Value
Column_compressions 0
Column_decompressions 0
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
LENGTH(a) LEFT(a,30) RIGHT(a,30)
65 x 0 0 0 1 0 2 0 3 1 0 1 1 1 2 0 2 1 2 2 2 3 3 0 3 1 3 2 3 3
DROP TABLE t1;
# VARCHAR2, multi-byte, truncation
CREATE TABLE t1 (a VARCHAR(10000) COMPRESSED CHARACTER SET utf8mb3);
INSERT INTO t1 VALUES (f1(31,31));
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
LENGTH(a) LEFT(a,30) RIGHT(a,30)
5505 x 0 0 0 1 0 2 0 3 0 4 0 5 0 6 31 27 31 28 31 29 31 30 31 31
FLUSH STATUS;
ALTER IGNORE TABLE t1 MODIFY a VARCHAR(256) COMPRESSED CHARACTER SET utf8mb3;
Warnings:
Warning 1265 Data truncated for column 'a' at row 1
SHOW STATUS LIKE 'Column%compressions';
Variable_name Value
Column_compressions 1
Column_decompressions 1
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
LENGTH(a) LEFT(a,30) RIGHT(a,30)
256 x 0 0 0 1 0 2 0 3 0 4 0 5 0 6 1 17 1 18 1 19 1 20 1 21 1 22
DROP TABLE t1;
# VARCHAR2, multi-byte, no truncation
CREATE TABLE t1 (a VARCHAR(10000) COMPRESSED CHARACTER SET utf8mb3);
INSERT INTO t1 VALUES (f1(31,31));
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
LENGTH(a) LEFT(a,30) RIGHT(a,30)
5505 x 0 0 0 1 0 2 0 3 0 4 0 5 0 6 31 27 31 28 31 29 31 30 31 31
FLUSH STATUS;
ALTER IGNORE TABLE t1 MODIFY a VARCHAR(10001) COMPRESSED CHARACTER SET utf8mb3;
SHOW STATUS LIKE 'Column%compressions';
Variable_name Value
Column_compressions 0
Column_decompressions 0
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
LENGTH(a) LEFT(a,30) RIGHT(a,30)
5505 x 0 0 0 1 0 2 0 3 0 4 0 5 0 6 31 27 31 28 31 29 31 30 31 31
DROP TABLE t1;
SET @@column_compression_threshold=DEFAULT;
DROP FUNCTION f1;
# #
# Start of 10.5 tests # MDEV-24797 Column Compression - ERROR 1265 (01000): Data truncated for column
#
CREATE TABLE t1 (a VARCHAR(500) COMPRESSED CHARACTER SET utf8mb3) ENGINE=MyISAM;
INSERT INTO t1 SET a=REPEAT('x',127);
ALTER TABLE t1 FORCE, ALGORITHM=COPY;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(500) COMPRESSED CHARACTER SET utf8mb3) ENGINE=InnoDB;
INSERT INTO t1 SET a=REPEAT('x',127);
ALTER TABLE t1 FORCE, ALGORITHM=COPY;
DROP TABLE t1;
#
# End of 10.4 tests
# #
# #
# MDEV-19727 Add Type_handler::Key_part_spec_init_ft # MDEV-19727 Add Type_handler::Key_part_spec_init_ft

View File

@@ -267,13 +267,194 @@ INSERT INTO t1 VALUES('aa');
SET column_compression_threshold=DEFAULT; SET column_compression_threshold=DEFAULT;
DROP TABLE t1; DROP TABLE t1;
--echo # --echo #
--echo # End of 10.3 tests --echo # MDEV-31724 Compressed varchar values lost on joins when sorting on columns from joined table(s)
--echo # --echo #
CREATE TABLE t1 (
id int(10) unsigned not null,
txt varchar(5000) COMPRESSED NOT NULL DEFAULT '',
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin;
CREATE TABLE t2 (
id int(10) unsigned not null,
n1 bigint(20) NOT NULL,
n2 bigint(20) NOT NULL,
n3 bigint(20) NOT NULL,
PRIMARY KEY (id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin;
INSERT INTO t1 VALUES
(1, 'short string < 100 chars'),
(2, 'long string = 99 chars '),
(3, 'long string = 100 chars !'),
(4, 'long string = 101 chars !');
INSERT INTO t2 VALUES
(1, 24, 1, 1),
(2, 99, 2, 2),
(3, 100, 3, 3),
(4, 101, 4, 4);
SELECT txt, v.* FROM t1 LEFT JOIN t2 v ON t1.id = v.id;
SELECT txt, v.* FROM t1 LEFT JOIN t2 v ON t1.id = v.id ORDER BY v.n1;
SELECT txt, v.* FROM t1 JOIN t2 v ON t1.id = v.id;
SELECT txt, v.* FROM t1 JOIN t2 v ON t1.id = v.id ORDER BY v.n1;
DROP TABLE t1, t2;
CREATE OR REPLACE TABLE t1 (
id INT NOT NULL PRIMARY KEY,
txt varchar(5000) COMPRESSED NOT NULL DEFAULT ''
) CHARSET=utf8mb3;
INSERT INTO t1 VALUES
(1, REPEAT('a', 10)),
(2, REPEAT('b', 99)),
(3, REPEAT('c', 100)),
(4, REPEAT('d', 121));
--replace_column 2 <sysdate>
--sorted_result
SELECT txt, sysdate(6) FROM t1 ORDER BY 2;
DROP TABLE t1;
DELIMITER $$;
CREATE FUNCTION f1(imax INT, jmax INT) RETURNS TEXT
BEGIN
DECLARE res TEXT DEFAULT 'x';
FOR i IN 0..imax
DO
FOR j IN 0..jmax
DO
SET res=CONCAT(res, ' ', i, ' ', j);
END FOR;
END FOR;
RETURN res;
END;
$$
DELIMITER ;$$
# Let's override the default threshold (100) to force
# comression for VARCHAR1+MB, for example, for:
# VARCHAR(80) CHARACTER SET utf8mb3
SET @@column_compression_threshold=32;
--echo # VARCHAR1, 8bit, truncation
CREATE TABLE t1 (a VARCHAR(254) COMPRESSED CHARACTER SET latin1);
INSERT INTO t1 VALUES (f1(6,6));
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
FLUSH STATUS;
ALTER IGNORE TABLE t1 MODIFY a VARCHAR(4) COMPRESSED CHARACTER SET latin1;
SHOW STATUS LIKE 'Column%compressions';
SELECT LENGTH(a), a FROM t1;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(254) COMPRESSED CHARACTER SET latin1);
INSERT INTO t1 VALUES (REPEAT('a',254));
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
FLUSH STATUS;
ALTER IGNORE TABLE t1 MODIFY a VARCHAR(4) COMPRESSED CHARACTER SET latin1;
SHOW STATUS LIKE 'Column%compressions';
SELECT LENGTH(a), a FROM t1;
DROP TABLE t1;
--echo # VARCHAR1, 8bit, no truncation
CREATE TABLE t1 (a VARCHAR(250) COMPRESSED CHARACTER SET latin1);
INSERT INTO t1 VALUES (f1(6,6));
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
FLUSH STATUS;
ALTER IGNORE TABLE t1 MODIFY a VARCHAR(254) COMPRESSED CHARACTER SET latin1;
SHOW STATUS LIKE 'Column%compressions';
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
DROP TABLE t1;
--echo # VARCHAR2, 8bit, truncation
CREATE TABLE t1 (a VARCHAR(32000) COMPRESSED CHARACTER SET latin1);
INSERT INTO t1 VALUES (f1(31,31));
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
FLUSH STATUS;
ALTER IGNORE TABLE t1 MODIFY a VARCHAR(256) COMPRESSED CHARACTER SET latin1;
SHOW STATUS LIKE 'Column%compressions';
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
DROP TABLE t1;
--echo # VARCHAR2, 8bit, no truncation
CREATE TABLE t1 (a VARCHAR(32000) COMPRESSED CHARACTER SET latin1);
INSERT INTO t1 VALUES (f1(31,31));
SELECT LENGTH(a), LEFT(a,30), RIGHT(a, 30) FROM t1;
FLUSH STATUS;
ALTER IGNORE TABLE t1 MODIFY a VARCHAR(32001) COMPRESSED CHARACTER SET latin1;
SHOW STATUS LIKE 'Column%compressions';
SELECT LENGTH(a), LEFT(a,30), RIGHT(a, 30) FROM t1;
DROP TABLE t1;
--echo # VARCHAR1, multi-byte, truncation
CREATE TABLE t1 (a VARCHAR(80) COMPRESSED CHARACTER SET utf8mb3);
INSERT INTO t1 VALUES (f1(3,3));
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
FLUSH STATUS;
ALTER IGNORE TABLE t1 MODIFY a VARCHAR(1) COMPRESSED CHARACTER SET utf8mb3;
SHOW STATUS LIKE 'Column%compressions';
SELECT LENGTH(a), a FROM t1;
DROP TABLE t1;
--echo # VARCHAR1, multi-byte, no truncation
CREATE TABLE t1 (a VARCHAR(80) COMPRESSED CHARACTER SET utf8mb3);
INSERT INTO t1 VALUES (f1(3,3));
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
FLUSH STATUS;
ALTER IGNORE TABLE t1 MODIFY a VARCHAR(81) COMPRESSED CHARACTER SET utf8mb3;
SHOW STATUS LIKE 'Column%compressions';
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
DROP TABLE t1;
--echo # VARCHAR2, multi-byte, truncation
CREATE TABLE t1 (a VARCHAR(10000) COMPRESSED CHARACTER SET utf8mb3);
INSERT INTO t1 VALUES (f1(31,31));
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
FLUSH STATUS;
ALTER IGNORE TABLE t1 MODIFY a VARCHAR(256) COMPRESSED CHARACTER SET utf8mb3;
SHOW STATUS LIKE 'Column%compressions';
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
DROP TABLE t1;
--echo # VARCHAR2, multi-byte, no truncation
CREATE TABLE t1 (a VARCHAR(10000) COMPRESSED CHARACTER SET utf8mb3);
INSERT INTO t1 VALUES (f1(31,31));
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
FLUSH STATUS;
ALTER IGNORE TABLE t1 MODIFY a VARCHAR(10001) COMPRESSED CHARACTER SET utf8mb3;
SHOW STATUS LIKE 'Column%compressions';
SELECT LENGTH(a), LEFT(a,30), RIGHT(a,30) FROM t1;
DROP TABLE t1;
SET @@column_compression_threshold=DEFAULT;
DROP FUNCTION f1;
--echo #
--echo # MDEV-24797 Column Compression - ERROR 1265 (01000): Data truncated for column
--echo #
CREATE TABLE t1 (a VARCHAR(500) COMPRESSED CHARACTER SET utf8mb3) ENGINE=MyISAM;
INSERT INTO t1 SET a=REPEAT('x',127);
ALTER TABLE t1 FORCE, ALGORITHM=COPY;
DROP TABLE t1;
CREATE TABLE t1 (a VARCHAR(500) COMPRESSED CHARACTER SET utf8mb3) ENGINE=InnoDB;
INSERT INTO t1 SET a=REPEAT('x',127);
ALTER TABLE t1 FORCE, ALGORITHM=COPY;
DROP TABLE t1;
--echo # --echo #
--echo # Start of 10.5 tests --echo # End of 10.4 tests
--echo # --echo #
--echo # --echo #

View File

@@ -17,12 +17,15 @@ SELECT LENGTH(@@global.gtid_binlog_state) > 1;
LENGTH(@@global.gtid_binlog_state) > 1 LENGTH(@@global.gtid_binlog_state) > 1
1 1
connection node_1; connection node_1;
SELECT COUNT(*) AS EXPECT_1 FROM t1;
EXPECT_1
1
gtid_binlog_state_equal gtid_binlog_state_equal
0 0
connection node_2; connection node_2;
SELECT COUNT(*) AS EXPECT_0 FROM t1; SELECT COUNT(*) AS EXPECT_1 FROM t1;
EXPECT_0 EXPECT_1
0 1
gtid_binlog_state_equal gtid_binlog_state_equal
0 0
#cleanup #cleanup

View File

@@ -0,0 +1,58 @@
connection node_2;
connection node_1;
connection node_1;
connection node_2;
# Case 1 : MariaBackup SST
connection node_1;
CREATE TABLE t(i INT NOT NULL PRIMARY KEY) ENGINE INNODB;
INSERT INTO t VALUES(1);
# Restart node_2, force SST.
connection node_2;
connection node_1;
connection node_2;
Starting server ...
connection node_1;
# Both should return FOUND 2 as we have bootstrap and SST
FOUND 2 /Desyncing and pausing the provider/ in mysqld.1.err
FOUND 2 /Resuming and resyncing the provider/ in mysqld.1.err
connection node_1;
SET GLOBAL wsrep_mode = "BF_ABORT_MARIABACKUP";
# Restart node_2, force SST.
connection node_2;
connection node_1;
INSERT INTO t VALUES(2);
connection node_2;
Starting server ...
connection node_2;
connection node_1;
# Both should return FOUND 3 as we have 1 new SST
FOUND 3 /Desyncing and pausing the provider/ in mysqld.1.err
FOUND 3 /Resuming and resyncing the provider/ in mysqld.1.err
SET GLOBAL wsrep_mode = "";
DROP TABLE t;
# Case 2: MariaBackup backup from node_2
connection node_1;
CREATE TABLE t(i INT NOT NULL PRIMARY KEY) ENGINE INNODB;
INSERT INTO t VALUES(1),(2),(3),(4),(5);
connection node_2;
SET GLOBAL wsrep_mode = "";
SELECT @@wsrep_mode;
@@wsrep_mode
# Both should return FOUND 1 as we have backup
FOUND 1 /Desyncing and pausing the provider/ in mysqld.2.err
FOUND 1 /Resuming and resyncing the provider/ in mysqld.2.err
SET GLOBAL wsrep_mode = "BF_ABORT_MARIABACKUP";
SELECT @@wsrep_mode;
@@wsrep_mode
BF_ABORT_MARIABACKUP
# Both should return FOUND 1 as node should not desync
FOUND 1 /Desyncing and pausing the provider/ in mysqld.2.err
FOUND 1 /Resuming and resyncing the provider/ in mysqld.2.err
# Should return FOUND 1 because only last backup does not desync
FOUND 1 /Server not desynched from group because WSREP_MODE_BF_MARIABACKUP used./ in mysqld.2.err
SET GLOBAL wsrep_mode = "";
connection node_1;
DROP TABLE t;
disconnect node_2;
disconnect node_1;

View File

@@ -0,0 +1,122 @@
connection node_2;
connection node_1;
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
create user repl@'%' identified by 'repl';
grant all on *.* to repl@'%';
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
connection node_1;
connection node_2;
connection node_2;
START SLAVE;
connection node_3;
CREATE TABLE t1 (id bigint primary key, msg varchar(100)) engine=innodb;
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_2;
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_1;
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_2;
# Verify that graceful shutdown succeeds.
# Force SST
connection node_1;
# Waiting until node_2 is not part of cluster anymore
connection node_2;
# Start node_2 again
¤ Wait until node_2 is back on cluster
connection node_2;
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_1;
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_3;
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_3;
drop table t1;
connection node_2;
connection node_1;
connection node_3;
CREATE TABLE t1 (id bigint primary key, msg varchar(100)) engine=innodb;
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_2;
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_1;
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
EXPECT_10000
10000
connection node_2;
# Verify that graceful shutdown succeeds.
# Force SST
connection node_1;
# Waiting until node_2 is not part of cluster anymore
connection node_3;
SELECT COUNT(*) AS EXPECT_20000 FROM t1;
EXPECT_20000
20000
connection node_2;
# Start node_2 again
¤ Wait until node_2 is back on cluster
connection node_2;
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_20000 FROM t1;
EXPECT_20000
20000
connection node_1;
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
EXPECT_1
1
SELECT COUNT(*) AS EXPECT_20000 FROM t1;
EXPECT_20000
20000
connection node_3;
SELECT COUNT(*) AS EXPECT_20000 FROM t1;
EXPECT_20000
20000
connection node_3;
drop table t1;
connection node_2;
connection node_1;
connection node_2;
STOP SLAVE;
RESET SLAVE ALL;
connection node_3;
RESET MASTER;
connection node_1;
disconnect node_3;
disconnect node_2;
disconnect node_1;
# End of test

View File

@@ -4,3 +4,4 @@
log-bin=mysqld-bin log-bin=mysqld-bin
log-slave-updates log-slave-updates
binlog-format=ROW binlog-format=ROW
wsrep-replicate-myisam=ON

View File

@@ -44,12 +44,20 @@ SELECT LENGTH(@@global.gtid_binlog_state) > 1;
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1; --let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc --source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_1 FROM t1;
--disable_query_log --disable_query_log
--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal; --eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
--enable_query_log --enable_query_log
--connection node_2 --connection node_2
SELECT COUNT(*) AS EXPECT_0 FROM t1; --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 1 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) AS EXPECT_1 FROM t1;
--disable_query_log --disable_query_log
--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal; --eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal;
@@ -59,8 +67,6 @@ SELECT COUNT(*) AS EXPECT_0 FROM t1;
--connection node_3 --connection node_3
DROP TABLE t1; DROP TABLE t1;
--sleep 1
--connection node_1 --connection node_1
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc --source include/wait_condition.inc

View File

@@ -0,0 +1,16 @@
!include ../galera_2nodes.cnf
[mysqld]
wsrep_sst_method=mariabackup
wsrep_sst_auth="root:"
wsrep_debug=1
[mysqld.1]
wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true'
[mysqld.2]
wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true'
[sst]
transferfmt=@ENV.MTR_GALERA_TFMT
streamfmt=mbstream

View File

@@ -0,0 +1,136 @@
--source include/galera_cluster.inc
--source include/have_mariabackup.inc
# Save original auto_increment_offset values.
--let $node_1=node_1
--let $node_2=node_2
--source include/auto_increment_offset_save.inc
#
--echo # Case 1 : MariaBackup SST
#
--connection node_1
CREATE TABLE t(i INT NOT NULL PRIMARY KEY) ENGINE INNODB;
INSERT INTO t VALUES(1);
#
# In default settings donor should desync
#
--echo # Restart node_2, force SST.
--connection node_2
--source include/shutdown_mysqld.inc
--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
--connection node_1
--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 Starting server ...
let $restart_noprint=2;
--source include/start_mysqld.inc
--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 VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc
--connection node_1
let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err;
--echo # Both should return FOUND 2 as we have bootstrap and SST
let SEARCH_PATTERN = Desyncing and pausing the provider;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN = Resuming and resyncing the provider;
--source include/search_pattern_in_file.inc
#
# Now we set wsrep_mode = BF_ABORT_MARIABACKUP
#
--connection node_1
SET GLOBAL wsrep_mode = "BF_ABORT_MARIABACKUP";
--echo # Restart node_2, force SST.
--connection node_2
--source include/shutdown_mysqld.inc
--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
--connection node_1
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
--source include/wait_condition.inc
INSERT INTO t VALUES(2);
--connection node_2
--echo Starting server ...
let $restart_noprint=2;
--source include/start_mysqld.inc
--connection node_2
--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 VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc
# Restore original auto_increment_offset values.
--source include/auto_increment_offset_restore.inc
--connection node_1
let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err;
--echo # Both should return FOUND 3 as we have 1 new SST
let SEARCH_PATTERN = Desyncing and pausing the provider;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN = Resuming and resyncing the provider;
--source include/search_pattern_in_file.inc
SET GLOBAL wsrep_mode = "";
DROP TABLE t;
#
--echo # Case 2: MariaBackup backup from node_2
#
--connection node_1
CREATE TABLE t(i INT NOT NULL PRIMARY KEY) ENGINE INNODB;
INSERT INTO t VALUES(1),(2),(3),(4),(5);
--connection node_2
SET GLOBAL wsrep_mode = "";
SELECT @@wsrep_mode;
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
--let $backup_log=$MYSQLTEST_VARDIR/tmp/backup.log
--disable_result_log
--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.2 --backup --target-dir=$targetdir > $backup_log 2>&1;
--enable_result_log
let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.2.err;
--echo # Both should return FOUND 1 as we have backup
let SEARCH_PATTERN = Desyncing and pausing the provider;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN = Resuming and resyncing the provider;
--source include/search_pattern_in_file.inc
#
# Now we set wsrep_mode = BF_ABORT_MARIABACKUP
#
SET GLOBAL wsrep_mode = "BF_ABORT_MARIABACKUP";
SELECT @@wsrep_mode;
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup2;
--let $backup_log=$MYSQLTEST_VARDIR/tmp/backup2.log
--disable_result_log
--exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.2 --backup --target-dir=$targetdir --mysqld-args --wsrep-mode="BF_ABORT_MARIABACKUP" > $backup_log 2>&1;
--enable_result_log
let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.2.err;
--echo # Both should return FOUND 1 as node should not desync
let SEARCH_PATTERN = Desyncing and pausing the provider;
--source include/search_pattern_in_file.inc
let SEARCH_PATTERN = Resuming and resyncing the provider;
--source include/search_pattern_in_file.inc
--echo # Should return FOUND 1 because only last backup does not desync
let SEARCH_PATTERN = Server not desynched from group because WSREP_MODE_BF_MARIABACKUP used.;
--source include/search_pattern_in_file.inc
SET GLOBAL wsrep_mode = "";
--connection node_1
DROP TABLE t;
--source include/auto_increment_offset_restore.inc
--source include/galera_end.inc

View File

@@ -0,0 +1,20 @@
!include ../galera_2nodes_as_slave.cnf
[mysqld]
wsrep-debug=1
[mysqld.1]
server_id=15
wsrep_gtid_mode=1
wsrep_gtid_domain_id=16
gtid_domain_id=11
gtid_strict_mode=1
[mysqld.2]
skip-slave-start=OFF
server_id=15
wsrep_gtid_mode=1
wsrep_gtid_domain_id=16
gtid_domain_id=11
gtid_strict_mode=1

View File

@@ -0,0 +1,212 @@
#
# Test Galera as a replica to a MySQL async replication
#
# The galera/galera_2node_slave.cnf describes the setup of the nodes
#
--source include/big_test.inc
--source include/force_restart.inc
--source include/galera_cluster.inc
--source include/have_sequence.inc
# As node #3 is not a Galera node, and galera_cluster.inc does not open connetion to it
# we open the node_3 connection here
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
create user repl@'%' identified by 'repl';
grant all on *.* to repl@'%';
ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB;
--let $node_1 = node_1
--let $node_2 = node_2
--source include/auto_increment_offset_save.inc
--connection node_2
--disable_query_log
--eval CHANGE MASTER TO master_host='127.0.0.1', master_user='repl', master_password='repl', master_port=$NODE_MYPORT_3, master_use_gtid=slave_pos;
--enable_query_log
START SLAVE;
--connection node_3
CREATE TABLE t1 (id bigint primary key, msg varchar(100)) engine=innodb;
--disable_query_log
INSERT INTO t1 SELECT seq, 'test' from seq_1_to_10000;
--enable_query_log
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 10000 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 10000 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
--connection node_2
--echo # Verify that graceful shutdown succeeds.
--source include/shutdown_mysqld.inc
--echo # Force SST
--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
--connection node_1
--echo # Waiting until node_2 is not part of cluster anymore
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
--connection node_2
--echo # Start node_2 again
--source include/start_mysqld.inc
--echo ¤ Wait until node_2 is back on cluster
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
--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 VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc
--connection node_2
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
--connection node_1
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
--connection node_3
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
#
# Cleanup
#
--connection node_3
drop table t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
#
# Case 2 : While slave is down add writes to master
#
--connection node_3
CREATE TABLE t1 (id bigint primary key, msg varchar(100)) engine=innodb;
--disable_query_log
INSERT INTO t1 SELECT seq, 'test' from seq_1_to_10000;
--enable_query_log
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 10000 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--let $wait_condition = SELECT COUNT(*) = 10000 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
SELECT COUNT(*) AS EXPECT_10000 FROM t1;
--connection node_2
--echo # Verify that graceful shutdown succeeds.
--source include/shutdown_mysqld.inc
--echo # Force SST
--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat
--connection node_1
--echo # Waiting until node_2 is not part of cluster anymore
--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size';
--source include/wait_condition.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
# Add writes to master
--connection node_3
--disable_query_log
INSERT INTO t1 SELECT seq, 'test' from seq_20001_to_30000;
--enable_query_log
SELECT COUNT(*) AS EXPECT_20000 FROM t1;
--connection node_2
--echo # Start node_2 again
--source include/start_mysqld.inc
--echo ¤ Wait until node_2 is back on cluster
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
--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 VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready';
--source include/wait_condition.inc
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 20000 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
SELECT COUNT(*) AS EXPECT_20000 FROM t1;
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 20000 FROM t1;
--source include/wait_condition.inc
SELECT COUNT(*) > 0 AS EXPECT_1 FROM mysql.gtid_slave_pos;
SELECT COUNT(*) AS EXPECT_20000 FROM t1;
--connection node_3
SELECT COUNT(*) AS EXPECT_20000 FROM t1;
#
# Cleanup
#
--connection node_3
drop table t1;
--connection node_2
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--connection node_1
--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1';
--source include/wait_condition.inc
--connection node_2
STOP SLAVE;
RESET SLAVE ALL;
--connection node_3
RESET MASTER;
--connection node_1
--disconnect node_3
--source include/auto_increment_offset_restore.inc
--source include/galera_end.inc
--echo # End of test

View File

@@ -263,13 +263,34 @@ BEGIN;
START SLAVE IO_THREAD; START SLAVE IO_THREAD;
--source include/wait_for_slave_io_to_start.inc --source include/wait_for_slave_io_to_start.inc
# The following test sets the stop coordinate is set to inside the first event # The following test sets the stop coordinate to inside the first event
# of a relay log that holds events of a transaction started in an earlier log. # of a relay log that holds events of a transaction started in an earlier log.
# Peek the stop position in the middle of trx1, not even on a event boundary. # Peek the stop position in the middle of trx1, not even on a event boundary.
--let $pos_until=255 --let $pos_until=255
--let $file_rl=slave-relay-bin.000003 --let $file_rl=slave-relay-bin.000003
--let $binlog_file=$file_rl --let $binlog_file=$file_rl
# Wait for the IO thread to write the trx1 to the relaylog before querying it.
# (wait_for_slave_param.inc isn't flexible enough, so do it manually.)
--let $continue= 1
--let $count=600
while ($continue)
{
--let $cur_file= query_get_value(SHOW SLAVE STATUS, 'Master_Log_File', 1)
--let $cur_pos= query_get_value(SHOW SLAVE STATUS, 'Read_Master_Log_Pos', 1)
--let $continue= `SELECT '$cur_file' = '$fil_1' AND $cur_pos < $pos_trx1`
if ($continue)
{
--dec $count
if (!$count)
{
--echo **** ERROR: timeout waiting for Read_Master_Log_Pos($cur_pos) >= $pos_trx1 (file='$cur_file') ****"
--die Timeout waiting for IO thread to write master events to the relaylog
}
--sleep 0.1
}
}
--let $pos_xid=508 --let $pos_xid=508
--let $info= query_get_value(SHOW RELAYLOG EVENTS IN '$file_rl' FROM $pos_xid LIMIT 1, Info, 1) --let $info= query_get_value(SHOW RELAYLOG EVENTS IN '$file_rl' FROM $pos_xid LIMIT 1, Info, 1)

View File

@@ -276,7 +276,7 @@ SESSION_VALUE NULL
DEFAULT_VALUE full_crc32 DEFAULT_VALUE full_crc32
VARIABLE_SCOPE GLOBAL VARIABLE_SCOPE GLOBAL
VARIABLE_TYPE ENUM VARIABLE_TYPE ENUM
VARIABLE_COMMENT The algorithm InnoDB uses for page checksumming. Possible values are FULL_CRC32 for new files, always use CRC-32C; for old, see CRC32 below; STRICT_FULL_CRC32 for new files, always use CRC-32C; for old, see STRICT_CRC32 below; CRC32 write crc32, allow any of the other checksums to match when reading; STRICT_CRC32 write crc32, do not allow other algorithms to match when reading; INNODB write a software calculated checksum, allow any other checksums to match when reading; STRICT_INNODB write a software calculated checksum, do not allow other algorithms to match when reading; NONE write a constant magic number, do not do any checksum verification when reading; STRICT_NONE write a constant magic number, do not allow values other than that magic number when reading; Files updated when this option is set to crc32 or strict_crc32 will not be readable by MariaDB versions older than 10.0.4; new files created with full_crc32 are readable by MariaDB 10.4.3+ VARIABLE_COMMENT The algorithm InnoDB uses for page checksumming. Possible values are FULL_CRC32 for new files, always use CRC-32C; for old, see CRC32 below; STRICT_FULL_CRC32 for new files, always use CRC-32C; for old, see STRICT_CRC32 below; CRC32 write crc32, allow previously used algorithms to match when reading; STRICT_CRC32 write crc32, do not allow other algorithms to match when reading; New files created with full_crc32 are readable by MariaDB 10.4.3+
NUMERIC_MIN_VALUE NULL NUMERIC_MIN_VALUE NULL
NUMERIC_MAX_VALUE NULL NUMERIC_MAX_VALUE NULL
NUMERIC_BLOCK_SIZE NULL NUMERIC_BLOCK_SIZE NULL

View File

@@ -49,13 +49,6 @@ void thr_set_sync_wait_callback(void (*before_wait)(void),
(which is correct behaviour, if we know that the other thread synced the (which is correct behaviour, if we know that the other thread synced the
file before closing) file before closing)
MY_SYNC_FILESIZE is useful when syncing a file after it has been extended.
On Linux, fdatasync() on ext3/ext4 file systems does not properly flush
to disk the inode data required to preserve the added data across a crash
(this looks to be a bug). But when a file is extended, inode data will most
likely need flushing in any case, so passing MY_SYNC_FILESIZE as flags
is not likely to be any slower, and will be crash safe on Linux ext3/ext4.
RETURN RETURN
0 ok 0 ok
-1 error -1 error
@@ -88,12 +81,8 @@ int my_sync(File fd, myf my_flags)
DBUG_PRINT("info",("fcntl(F_FULLFSYNC) failed, falling back")); DBUG_PRINT("info",("fcntl(F_FULLFSYNC) failed, falling back"));
#endif #endif
#if defined(HAVE_FDATASYNC) && HAVE_DECL_FDATASYNC #if defined(HAVE_FDATASYNC) && HAVE_DECL_FDATASYNC
if (!(my_flags & MY_SYNC_FILESIZE)) res= fdatasync(fd);
res= fdatasync(fd); #elif defined(HAVE_FSYNC)
else
{
#endif
#if defined(HAVE_FSYNC)
res= fsync(fd); res= fsync(fd);
if (res == -1 && errno == ENOLCK) if (res == -1 && errno == ENOLCK)
res= 0; /* Result Bug in Old FreeBSD */ res= 0; /* Result Bug in Old FreeBSD */
@@ -102,9 +91,6 @@ int my_sync(File fd, myf my_flags)
#else #else
#error Cannot find a way to sync a file, durability in danger #error Cannot find a way to sync a file, durability in danger
res= 0; /* No sync (strange OS) */ res= 0; /* No sync (strange OS) */
#endif
#if defined(HAVE_FDATASYNC) && HAVE_DECL_FDATASYNC
}
#endif #endif
} while (res == -1 && errno == EINTR); } while (res == -1 && errno == EINTR);

View File

@@ -292,6 +292,7 @@ static bool backup_block_ddl(THD *thd)
thd->clear_error(); thd->clear_error();
#ifdef WITH_WSREP #ifdef WITH_WSREP
DBUG_ASSERT(thd->wsrep_desynced_backup_stage == false);
/* /*
if user is specifically choosing to allow BF aborting for BACKUP STAGE BLOCK_DDL lock if user is specifically choosing to allow BF aborting for BACKUP STAGE BLOCK_DDL lock
holder, then do not desync and pause the node from cluster replication. holder, then do not desync and pause the node from cluster replication.
@@ -303,6 +304,7 @@ static bool backup_block_ddl(THD *thd)
if (WSREP_NNULL(thd)) if (WSREP_NNULL(thd))
{ {
Wsrep_server_state &server_state= Wsrep_server_state::instance(); Wsrep_server_state &server_state= Wsrep_server_state::instance();
if (!wsrep_check_mode(WSREP_MODE_BF_MARIABACKUP) || if (!wsrep_check_mode(WSREP_MODE_BF_MARIABACKUP) ||
server_state.state() == Wsrep_server_state::s_donor) server_state.state() == Wsrep_server_state::s_donor)
{ {
@@ -352,17 +354,17 @@ static bool backup_block_ddl(THD *thd)
/* There can't be anything more that needs to be logged to ddl log */ /* There can't be anything more that needs to be logged to ddl log */
THD_STAGE_INFO(thd, org_stage); THD_STAGE_INFO(thd, org_stage);
stop_ddl_logging(); stop_ddl_logging();
#ifdef WITH_WSREP
// Allow tests to block the applier thread using the DBUG facilities // Allow tests to block the backup thread
DBUG_EXECUTE_IF("sync.wsrep_after_mdl_block_ddl", DBUG_EXECUTE_IF("sync.after_mdl_block_ddl",
{ {
const char act[]= const char act[]=
"now " "now "
"signal signal.wsrep_apply_toi"; "SIGNAL sync.after_mdl_block_ddl_reached "
"WAIT_FOR signal.after_mdl_block_ddl_continue";
DBUG_ASSERT(!debug_sync_set_action(thd, DBUG_ASSERT(!debug_sync_set_action(thd,
STRING_WITH_LEN(act))); STRING_WITH_LEN(act)));
};); };);
#endif /* WITH_WSREP */
DBUG_RETURN(0); DBUG_RETURN(0);
err: err:
@@ -391,8 +393,7 @@ static bool backup_block_commit(THD *thd)
if (mysql_bin_log.is_open()) if (mysql_bin_log.is_open())
{ {
mysql_mutex_lock(mysql_bin_log.get_log_lock()); mysql_mutex_lock(mysql_bin_log.get_log_lock());
mysql_file_sync(mysql_bin_log.get_log_file()->file, mysql_file_sync(mysql_bin_log.get_log_file()->file, MYF(MY_WME));
MYF(MY_WME|MY_SYNC_FILESIZE));
mysql_mutex_unlock(mysql_bin_log.get_log_lock()); mysql_mutex_unlock(mysql_bin_log.get_log_lock());
} }
thd->clear_error(); thd->clear_error();
@@ -423,8 +424,8 @@ bool backup_end(THD *thd)
thd->current_backup_stage= BACKUP_FINISHED; thd->current_backup_stage= BACKUP_FINISHED;
thd->mdl_context.release_lock(old_ticket); thd->mdl_context.release_lock(old_ticket);
#ifdef WITH_WSREP #ifdef WITH_WSREP
if (WSREP_NNULL(thd) && thd->wsrep_desynced_backup_stage && // If node was desynced, resume and resync
!wsrep_check_mode(WSREP_MODE_BF_MARIABACKUP)) if (thd->wsrep_desynced_backup_stage)
{ {
Wsrep_server_state &server_state= Wsrep_server_state::instance(); Wsrep_server_state &server_state= Wsrep_server_state::instance();
THD_STAGE_INFO(thd, stage_waiting_flow); THD_STAGE_INFO(thd, stage_waiting_flow);

View File

@@ -531,6 +531,40 @@ static void do_expand_string(Copy_field *copy)
} }
/*
Copy from a Field_varstring with length_bytes==1
into another Field_varstring with length_bytes==1
when the target column is not shorter than the source column.
We don't need to calculate the prefix in this case. It works for
- non-compressed and compressed columns
- single byte and multi-byte character sets
*/
static void do_varstring1_no_truncation(Copy_field *copy)
{
uint length= (uint) *(uchar*) copy->from_ptr;
DBUG_ASSERT(length <= copy->to_length - 1);
*(uchar*) copy->to_ptr= (uchar) length;
memcpy(copy->to_ptr+1, copy->from_ptr + 1, length);
}
/*
Copy from a Field_varstring with length_bytes==2
into another Field_varstring with length_bytes==2
when the target column is not shorter than the source column.
We don't need to calculate the prefix in this case. It works for
- non-compressed and compressed columns
- single byte and multi-byte character sets
*/
static void do_varstring2_no_truncation(Copy_field *copy)
{
uint length= uint2korr(copy->from_ptr);
DBUG_ASSERT(length <= copy->to_length - HA_KEY_BLOB_LENGTH);
int2store(copy->to_ptr, length);
memcpy(copy->to_ptr + HA_KEY_BLOB_LENGTH,
copy->from_ptr + HA_KEY_BLOB_LENGTH, length);
}
static void do_varstring1(Copy_field *copy) static void do_varstring1(Copy_field *copy)
{ {
uint length= (uint) *(uchar*) copy->from_ptr; uint length= (uint) *(uchar*) copy->from_ptr;
@@ -775,6 +809,21 @@ Field::Copy_func *Field_varstring::get_copy_func(const Field *from) const
length_bytes != ((const Field_varstring*) from)->length_bytes || length_bytes != ((const Field_varstring*) from)->length_bytes ||
!compression_method() != !from->compression_method()) !compression_method() != !from->compression_method())
return do_field_string; return do_field_string;
if (field_length >= from->field_length)
return length_bytes == 1 ? do_varstring1_no_truncation :
do_varstring2_no_truncation;
if (compression_method())
{
/*
Truncation is going to happen, so we need to calculate prefixes.
Can't calculate prefixes directly on compressed data,
need to go through val_str() to uncompress.
*/
return do_field_string;
}
return length_bytes == 1 ? return length_bytes == 1 ?
(from->charset()->mbmaxlen == 1 ? do_varstring1 : do_varstring1_mb) : (from->charset()->mbmaxlen == 1 ? do_varstring1 : do_varstring1_mb) :
(from->charset()->mbmaxlen == 1 ? do_varstring2 : do_varstring2_mb); (from->charset()->mbmaxlen == 1 ? do_varstring2 : do_varstring2_mb);

View File

@@ -4062,7 +4062,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
bytes_written+= description_event_for_queue->data_written; bytes_written+= description_event_for_queue->data_written;
} }
if (flush_io_cache(&log_file) || if (flush_io_cache(&log_file) ||
mysql_file_sync(log_file.file, MYF(MY_WME|MY_SYNC_FILESIZE))) mysql_file_sync(log_file.file, MYF(MY_WME)))
goto err; goto err;
my_off_t offset= my_b_tell(&log_file); my_off_t offset= my_b_tell(&log_file);
@@ -4100,7 +4100,7 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
strlen(log_file_name)) || strlen(log_file_name)) ||
my_b_write(&index_file, (uchar*) "\n", 1) || my_b_write(&index_file, (uchar*) "\n", 1) ||
flush_io_cache(&index_file) || flush_io_cache(&index_file) ||
mysql_file_sync(index_file.file, MYF(MY_WME|MY_SYNC_FILESIZE))) mysql_file_sync(index_file.file, MYF(MY_WME)))
goto err; goto err;
#ifdef HAVE_REPLICATION #ifdef HAVE_REPLICATION
@@ -4240,7 +4240,7 @@ static bool copy_up_file_and_fill(IO_CACHE *index_file, my_off_t offset)
} }
/* The following will either truncate the file or fill the end with \n' */ /* The following will either truncate the file or fill the end with \n' */
if (mysql_file_chsize(file, offset - init_offset, '\n', MYF(MY_WME)) || if (mysql_file_chsize(file, offset - init_offset, '\n', MYF(MY_WME)) ||
mysql_file_sync(file, MYF(MY_WME|MY_SYNC_FILESIZE))) mysql_file_sync(file, MYF(MY_WME)))
goto err; goto err;
/* Reset data in old index cache */ /* Reset data in old index cache */
@@ -5036,7 +5036,7 @@ int MYSQL_BIN_LOG::sync_purge_index_file()
if (unlikely((error= flush_io_cache(&purge_index_file))) || if (unlikely((error= flush_io_cache(&purge_index_file))) ||
unlikely((error= my_sync(purge_index_file.file, unlikely((error= my_sync(purge_index_file.file,
MYF(MY_WME | MY_SYNC_FILESIZE))))) MYF(MY_WME)))))
DBUG_RETURN(error); DBUG_RETURN(error);
DBUG_RETURN(error); DBUG_RETURN(error);
@@ -5748,7 +5748,7 @@ bool MYSQL_BIN_LOG::flush_and_sync(bool *synced)
if (sync_period && ++sync_counter >= sync_period) if (sync_period && ++sync_counter >= sync_period)
{ {
sync_counter= 0; sync_counter= 0;
err= mysql_file_sync(fd, MYF(MY_WME|MY_SYNC_FILESIZE)); err= mysql_file_sync(fd, MYF(MY_WME));
if (synced) if (synced)
*synced= 1; *synced= 1;
#ifndef DBUG_OFF #ifndef DBUG_OFF
@@ -6563,7 +6563,7 @@ MYSQL_BIN_LOG::write_state_to_file()
log_inited= false; log_inited= false;
if ((err= end_io_cache(&cache))) if ((err= end_io_cache(&cache)))
goto err; goto err;
if ((err= mysql_file_sync(file_no, MYF(MY_WME|MY_SYNC_FILESIZE)))) if ((err= mysql_file_sync(file_no, MYF(MY_WME))))
goto err; goto err;
goto end; goto end;
@@ -10332,7 +10332,7 @@ bool MYSQL_BIN_LOG::truncate_and_remove_binlogs(const char *file_name,
error= mysql_file_chsize(index_file.file, index_file_offset, '\n', error= mysql_file_chsize(index_file.file, index_file_offset, '\n',
MYF(MY_WME)); MYF(MY_WME));
if (!error) if (!error)
error= mysql_file_sync(index_file.file, MYF(MY_WME|MY_SYNC_FILESIZE)); error= mysql_file_sync(index_file.file, MYF(MY_WME));
if (error) if (error)
{ {
sql_print_error("Failed to truncate binlog index " sql_print_error("Failed to truncate binlog index "
@@ -10374,7 +10374,7 @@ bool MYSQL_BIN_LOG::truncate_and_remove_binlogs(const char *file_name,
/* Change binlog file size to truncate_pos */ /* Change binlog file size to truncate_pos */
error= mysql_file_chsize(file, pos, 0, MYF(MY_WME)); error= mysql_file_chsize(file, pos, 0, MYF(MY_WME));
if (!error) if (!error)
error= mysql_file_sync(file, MYF(MY_WME|MY_SYNC_FILESIZE)); error= mysql_file_sync(file, MYF(MY_WME));
if (error) if (error)
{ {
sql_print_error("Failed to truncate the " sql_print_error("Failed to truncate the "

View File

@@ -29,6 +29,10 @@
#include "rpl_rli.h" #include "rpl_rli.h"
#include "slave.h" #include "slave.h"
#include "log_event.h" #include "log_event.h"
#ifdef WITH_WSREP
#include "wsrep_mysqld.h" // wsrep_thd_is_local
#include "wsrep_trans_observer.h" // wsrep_start_trx_if_not_started
#endif
const LEX_CSTRING rpl_gtid_slave_state_table_name= const LEX_CSTRING rpl_gtid_slave_state_table_name=
{ STRING_WITH_LEN("gtid_slave_pos") }; { STRING_WITH_LEN("gtid_slave_pos") };
@@ -711,10 +715,18 @@ rpl_slave_state::record_gtid(THD *thd, const rpl_gtid *gtid, uint64 sub_id,
#ifdef WITH_WSREP #ifdef WITH_WSREP
/* /*
Updates in slave state table should not be appended to galera transaction We should replicate local gtid_slave_pos updates to other nodes.
writeset. In applier we should not append them to galera writeset.
*/ */
thd->wsrep_ignore_table= true; if (WSREP_ON_ && wsrep_thd_is_local(thd))
{
thd->wsrep_ignore_table= false;
wsrep_start_trx_if_not_started(thd);
}
else
{
thd->wsrep_ignore_table= true;
}
#endif #endif
if (!in_transaction) if (!in_transaction)
@@ -891,9 +903,20 @@ rpl_slave_state::gtid_delete_pending(THD *thd,
#ifdef WITH_WSREP #ifdef WITH_WSREP
/* /*
Updates in slave state table should not be appended to galera transaction We should replicate local gtid_slave_pos updates to other nodes.
writeset. In applier we should not append them to galera writeset.
*/ */
if (WSREP_ON_ && wsrep_thd_is_local(thd) &&
thd->wsrep_cs().state() != wsrep::client_state::s_none)
{
if (thd->wsrep_trx().active() == false)
{
if (thd->wsrep_next_trx_id() == WSREP_UNDEFINED_TRX_ID)
thd->set_query_id(next_query_id());
wsrep_start_transaction(thd, thd->wsrep_next_trx_id());
}
thd->wsrep_ignore_table= false;
}
thd->wsrep_ignore_table= true; thd->wsrep_ignore_table= true;
#endif #endif

View File

@@ -5632,6 +5632,8 @@ pthread_handler_t handle_slave_sql(void *arg)
mysql_mutex_unlock(&rli->data_lock); mysql_mutex_unlock(&rli->data_lock);
#ifdef WITH_WSREP #ifdef WITH_WSREP
wsrep_open(thd); wsrep_open(thd);
if (WSREP_ON_)
wsrep_wait_ready(thd);
if (wsrep_before_command(thd)) if (wsrep_before_command(thd))
{ {
WSREP_WARN("Slave SQL wsrep_before_command() failed"); WSREP_WARN("Slave SQL wsrep_before_command() failed");

View File

@@ -1,4 +1,4 @@
/* Copyright (c) 2008, 2022 Codership Oy <http://www.codership.com> /* Copyright (c) 2008, 2023 Codership Oy <http://www.codership.com>
Copyright (c) 2020, 2022, MariaDB Copyright (c) 2020, 2022, MariaDB
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
@@ -3825,6 +3825,30 @@ bool wsrep_consistency_check(THD *thd)
return thd->wsrep_consistency_check == CONSISTENCY_CHECK_RUNNING; return thd->wsrep_consistency_check == CONSISTENCY_CHECK_RUNNING;
} }
// Wait until wsrep has reached ready state
void wsrep_wait_ready(THD *thd)
{
mysql_mutex_lock(&LOCK_wsrep_ready);
while(!wsrep_ready)
{
WSREP_INFO("Waiting to reach ready state");
mysql_cond_wait(&COND_wsrep_ready, &LOCK_wsrep_ready);
}
WSREP_INFO("ready state reached");
mysql_mutex_unlock(&LOCK_wsrep_ready);
}
void wsrep_ready_set(bool ready_value)
{
WSREP_DEBUG("Setting wsrep_ready to %d", ready_value);
mysql_mutex_lock(&LOCK_wsrep_ready);
wsrep_ready= ready_value;
// Signal if we have reached ready state
if (wsrep_ready)
mysql_cond_signal(&COND_wsrep_ready);
mysql_mutex_unlock(&LOCK_wsrep_ready);
}
/* /*
Commit an empty transaction. Commit an empty transaction.

View File

@@ -1,4 +1,4 @@
/* Copyright 2008-2022 Codership Oy <http://www.codership.com> /* Copyright 2008-2023 Codership Oy <http://www.codership.com>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -598,6 +598,8 @@ enum wsrep::streaming_context::fragment_unit wsrep_fragment_unit(ulong unit);
wsrep::key wsrep_prepare_key_for_toi(const char* db, const char* table, wsrep::key wsrep_prepare_key_for_toi(const char* db, const char* table,
enum wsrep::key::type type); enum wsrep::key::type type);
void wsrep_wait_ready(THD *thd);
void wsrep_ready_set(bool ready_value);
#else /* !WITH_WSREP */ #else /* !WITH_WSREP */
/* These macros are needed to compile MariaDB without WSREP support /* These macros are needed to compile MariaDB without WSREP support

View File

@@ -1,4 +1,4 @@
/* Copyright 2010 Codership Oy <http://www.codership.com> /* Copyright 2010-2023 Codership Oy <http://www.codership.com>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@@ -22,8 +22,6 @@
#include "wsrep_api.h" #include "wsrep_api.h"
#include "wsrep/server_state.hpp" #include "wsrep/server_state.hpp"
my_bool wsrep_ready_set (my_bool x);
ssize_t wsrep_sst_prepare (void** msg); ssize_t wsrep_sst_prepare (void** msg);
wsrep_cb_status wsrep_sst_donate_cb (void* app_ctx, wsrep_cb_status wsrep_sst_donate_cb (void* app_ctx,
void* recv_ctx, void* recv_ctx,

View File

@@ -347,6 +347,7 @@ void Wsrep_server_service::log_state_change(
case Wsrep_server_state::s_synced: case Wsrep_server_state::s_synced:
wsrep_ready= TRUE; wsrep_ready= TRUE;
WSREP_INFO("Synchronized with group, ready for connections"); WSREP_INFO("Synchronized with group, ready for connections");
wsrep_ready_set(true);
/* fall through */ /* fall through */
case Wsrep_server_state::s_joined: case Wsrep_server_state::s_joined:
case Wsrep_server_state::s_donor: case Wsrep_server_state::s_donor:
@@ -354,16 +355,16 @@ void Wsrep_server_service::log_state_change(
break; break;
case Wsrep_server_state::s_connected: case Wsrep_server_state::s_connected:
wsrep_cluster_status= "non-Primary"; wsrep_cluster_status= "non-Primary";
wsrep_ready= FALSE; wsrep_ready_set(false);
wsrep_connected= TRUE; wsrep_connected= TRUE;
break; break;
case Wsrep_server_state::s_disconnected: case Wsrep_server_state::s_disconnected:
wsrep_ready= FALSE; wsrep_ready_set(false);
wsrep_connected= FALSE; wsrep_connected= FALSE;
wsrep_cluster_status= "Disconnected"; wsrep_cluster_status= "Disconnected";
break; break;
default: default:
wsrep_ready= FALSE; wsrep_ready_set(false);
wsrep_cluster_status= "non-Primary"; wsrep_cluster_status= "non-Primary";
break; break;
} }

View File

@@ -18773,24 +18773,10 @@ static MYSQL_SYSVAR_ENUM(checksum_algorithm, srv_checksum_algorithm,
" STRICT_FULL_CRC32" " STRICT_FULL_CRC32"
" for new files, always use CRC-32C; for old, see STRICT_CRC32 below;" " for new files, always use CRC-32C; for old, see STRICT_CRC32 below;"
" CRC32" " CRC32"
" write crc32, allow any of the other checksums to match when reading;" " write crc32, allow previously used algorithms to match when reading;"
" STRICT_CRC32" " STRICT_CRC32"
" write crc32, do not allow other algorithms to match when reading;" " write crc32, do not allow other algorithms to match when reading;"
" INNODB" " New files created with full_crc32 are readable by MariaDB 10.4.3+",
" write a software calculated checksum, allow any other checksums"
" to match when reading;"
" STRICT_INNODB"
" write a software calculated checksum, do not allow other algorithms"
" to match when reading;"
" NONE"
" write a constant magic number, do not do any checksum verification"
" when reading;"
" STRICT_NONE"
" write a constant magic number, do not allow values other than that"
" magic number when reading;"
" Files updated when this option is set to crc32 or strict_crc32 will"
" not be readable by MariaDB versions older than 10.0.4;"
" new files created with full_crc32 are readable by MariaDB 10.4.3+",
NULL, NULL, SRV_CHECKSUM_ALGORITHM_FULL_CRC32, NULL, NULL, SRV_CHECKSUM_ALGORITHM_FULL_CRC32,
&innodb_checksum_algorithm_typelib); &innodb_checksum_algorithm_typelib);