From 583b39811ce823abf9f6fe533bdee6aacde3e357 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 3 Feb 2025 15:00:35 +0400 Subject: [PATCH 001/134] MDEV-35620 UBSAN: runtime error: applying zero offset to null pointer in _ma_unique_hash, skip_trailing_space, my_hash_sort_mb_nopad_bin and my_strnncollsp_utf8mb4_bin UBSAN detected the nullptr-with-offset in a few places when handling empty blobs. Fix: - Adding DBUG_ASSERT(source_string) into all hash_sort() implementations to catch this problem in non-UBSAN debug builds. - Fixing mi_unique_hash(), mi_unique_comp(), _ma_unique_hash(), _ma_unique_comp() to replace NULL pointer to an empty string ponter.. Note, we should also add DBUG_ASSERT(source_string != NULL) into all implementations of strnncoll*(). But I'm afraid the patch is going to be too long and too dangerous for 10.5. --- mysql-test/main/long_unique.result | 22 ++++++++++++++++++++++ mysql-test/main/long_unique.test | 22 ++++++++++++++++++++++ plugin/versioning/versioning.cc | 1 - storage/maria/ma_unique.c | 6 ++++++ storage/myisam/mi_unique.c | 6 ++++++ strings/ctype-bin.c | 2 ++ strings/ctype-latin1.c | 3 ++- strings/ctype-mb.c | 2 ++ strings/ctype-simple.c | 2 ++ strings/ctype-uca.inl | 2 ++ strings/ctype-ucs2.c | 10 ++++++++++ strings/ctype-utf8.c | 4 ++++ strings/strings_def.h | 2 +- 13 files changed, 81 insertions(+), 3 deletions(-) diff --git a/mysql-test/main/long_unique.result b/mysql-test/main/long_unique.result index 7368b10fbbd..b4bd4a075c8 100644 --- a/mysql-test/main/long_unique.result +++ b/mysql-test/main/long_unique.result @@ -1451,4 +1451,26 @@ DROP TABLE t1, t2; # CREATE TABLE t1 (pk INT, a TEXT NOT NULL DEFAULT '', PRIMARY KEY (pk), b INT AUTO_INCREMENT, UNIQUE(b), UNIQUE (a,b)) ENGINE=myisam; ERROR HY000: AUTO_INCREMENT column `b` cannot be used in the UNIQUE index `a` +# +# MDEV-35620 UBSAN: runtime error: applying zero offset to null pointer in _ma_unique_hash, skip_trailing_space, my_hash_sort_mb_nopad_bin and my_strnncollsp_utf8mb4_bin +# +# Disable result log. The exact result is not important. +# We just need to make sure UBSAN nullptr-with-offset is not reported. +SELECT DISTINCT user,authentication_string FROM mysql.user; +SELECT DISTINCT USER,PASSWORD FROM mysql.user; +SELECT DISTINCT USER,plugin FROM mysql.user; +# Enabling result log again. +create or replace table t1 (t text) engine=aria; +insert into t1 values (''); +insert into t1 values (NULL); +select distinct t from t1; +t + +NULL +alter table t1 ENGINE=MyISAM; +select distinct t from t1; +t + +NULL +DROP TABLE t1; # End of 10.5 tests diff --git a/mysql-test/main/long_unique.test b/mysql-test/main/long_unique.test index fa49b6a5ad4..b3c1e8e9efc 100644 --- a/mysql-test/main/long_unique.test +++ b/mysql-test/main/long_unique.test @@ -551,4 +551,26 @@ DROP TABLE t1, t2; --error ER_NO_AUTOINCREMENT_WITH_UNIQUE CREATE TABLE t1 (pk INT, a TEXT NOT NULL DEFAULT '', PRIMARY KEY (pk), b INT AUTO_INCREMENT, UNIQUE(b), UNIQUE (a,b)) ENGINE=myisam; +--echo # +--echo # MDEV-35620 UBSAN: runtime error: applying zero offset to null pointer in _ma_unique_hash, skip_trailing_space, my_hash_sort_mb_nopad_bin and my_strnncollsp_utf8mb4_bin +--echo # + +--echo # Disable result log. The exact result is not important. +--echo # We just need to make sure UBSAN nullptr-with-offset is not reported. +--disable_result_log +SELECT DISTINCT user,authentication_string FROM mysql.user; +SELECT DISTINCT USER,PASSWORD FROM mysql.user; +SELECT DISTINCT USER,plugin FROM mysql.user; +--enable_result_log +--echo # Enabling result log again. + +create or replace table t1 (t text) engine=aria; +insert into t1 values (''); +insert into t1 values (NULL); +select distinct t from t1; +alter table t1 ENGINE=MyISAM; +select distinct t from t1; +DROP TABLE t1; + + --echo # End of 10.5 tests diff --git a/plugin/versioning/versioning.cc b/plugin/versioning/versioning.cc index 387dfa80ae9..9c6fad89f43 100644 --- a/plugin/versioning/versioning.cc +++ b/plugin/versioning/versioning.cc @@ -150,7 +150,6 @@ static const Native_func_registry func_array_vers[] = { { C_STRING_WITH_LEN("TRT_TRX_ID") }, BUILDER(Create_func_trt)}, { { C_STRING_WITH_LEN("TRT_TRX_SEES") }, BUILDER(Create_func_trt_trx_sees)}, { { C_STRING_WITH_LEN("TRT_TRX_SEES_EQ") }, BUILDER(Create_func_trt_trx_sees)}, - { {0, 0}, NULL} }; diff --git a/storage/maria/ma_unique.c b/storage/maria/ma_unique.c index 5e7925b937c..215afc7e063 100644 --- a/storage/maria/ma_unique.c +++ b/storage/maria/ma_unique.c @@ -139,6 +139,8 @@ ha_checksum _ma_unique_hash(MARIA_UNIQUEDEF *def, const uchar *record) { uint tmp_length= _ma_calc_blob_length(keyseg->bit_start,pos); memcpy((void*) &pos,pos+keyseg->bit_start,sizeof(char*)); + if (!pos) + pos= (const uchar*) ""; /* hash_sort does not support NULL ptr */ if (!length || length > tmp_length) length=tmp_length; /* The whole blob */ } @@ -236,6 +238,10 @@ my_bool _ma_unique_comp(MARIA_UNIQUEDEF *def, const uchar *a, const uchar *b, } memcpy((void*) &pos_a, pos_a+keyseg->bit_start, sizeof(char*)); memcpy((void*) &pos_b, pos_b+keyseg->bit_start, sizeof(char*)); + if (pos_a == 0) + pos_a= (const uchar *) ""; /* Avoid UBSAN nullptr-with-offset */ + if (pos_b == 0) + pos_b= (const uchar *) ""; /* Avoid UBSAN nullptr-with-offset */ } if (type == HA_KEYTYPE_TEXT/* the CHAR data type*/) { diff --git a/storage/myisam/mi_unique.c b/storage/myisam/mi_unique.c index ecc2b354849..9c6ed4d80b1 100644 --- a/storage/myisam/mi_unique.c +++ b/storage/myisam/mi_unique.c @@ -115,6 +115,8 @@ ha_checksum mi_unique_hash(MI_UNIQUEDEF *def, const uchar *record) { uint tmp_length=_mi_calc_blob_length(keyseg->bit_start,pos); memcpy((char**) &pos, pos+keyseg->bit_start, sizeof(char*)); + if (!pos) + pos= (const uchar*) ""; /* hash_sort does not support NULL ptr */ if (!length || length > tmp_length) length=tmp_length; /* The whole blob */ } @@ -211,6 +213,10 @@ int mi_unique_comp(MI_UNIQUEDEF *def, const uchar *a, const uchar *b, } memcpy((char**) &pos_a, pos_a+keyseg->bit_start, sizeof(char*)); memcpy((char**) &pos_b, pos_b+keyseg->bit_start, sizeof(char*)); + if (pos_a == 0) + pos_a= (const uchar *) ""; /* Avoid UBSAN nullptr-with-offset */ + if (pos_b == 0) + pos_b= (const uchar *) ""; /* Avoid UBSAN nullptr-with-offset */ } if (type == HA_KEYTYPE_TEXT/*The CHAR data type*/) { diff --git a/strings/ctype-bin.c b/strings/ctype-bin.c index a4b20ebd6d3..422606ed967 100644 --- a/strings/ctype-bin.c +++ b/strings/ctype-bin.c @@ -294,6 +294,7 @@ void my_hash_sort_bin(CHARSET_INFO *cs __attribute__((unused)), const uchar *end = key + len; ulong tmp1= *nr1; ulong tmp2= *nr2; + DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */ for (; key < end ; key++) { @@ -314,6 +315,7 @@ void my_hash_sort_8bit_bin(CHARSET_INFO *cs __attribute__((unused)), 'A ' and 'A' as identical */ const uchar *end= skip_trailing_space(key, len); + DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */ my_hash_sort_bin(cs, key, end - key, nr1, nr2); } diff --git a/strings/ctype-latin1.c b/strings/ctype-latin1.c index d76a4928030..e639e24b91f 100644 --- a/strings/ctype-latin1.c +++ b/strings/ctype-latin1.c @@ -703,7 +703,8 @@ void my_hash_sort_latin1_de(CHARSET_INFO *cs __attribute__((unused)), { const uchar *end; register ulong m1= *nr1, m2= *nr2; - + DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */ + /* Remove end space. We have to do this to be able to compare 'AE' and 'Ä' as identical diff --git a/strings/ctype-mb.c b/strings/ctype-mb.c index f26c9fe10d2..d5764d5c8bf 100644 --- a/strings/ctype-mb.c +++ b/strings/ctype-mb.c @@ -618,6 +618,7 @@ my_hash_sort_mb_nopad_bin(CHARSET_INFO *cs __attribute__((unused)), { register ulong m1= *nr1, m2= *nr2; const uchar *end= key + len; + DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */ for (; key < end ; key++) { MY_HASH_ADD(m1, m2, (uint)*key); @@ -636,6 +637,7 @@ my_hash_sort_mb_bin(CHARSET_INFO *cs __attribute__((unused)), 'A ' and 'A' as identical */ const uchar *end= skip_trailing_space(key, len); + DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */ my_hash_sort_mb_nopad_bin(cs, key, end - key, nr1, nr2); } diff --git a/strings/ctype-simple.c b/strings/ctype-simple.c index d40e3abdcc5..cc97ac741be 100644 --- a/strings/ctype-simple.c +++ b/strings/ctype-simple.c @@ -347,6 +347,7 @@ void my_hash_sort_simple_nopad(CHARSET_INFO *cs, register const uchar *sort_order=cs->sort_order; const uchar *end= key + len; register ulong m1= *nr1, m2= *nr2; + DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */ for (; key < (uchar*) end ; key++) { MY_HASH_ADD(m1, m2, (uint) sort_order[(uint) *key]); @@ -363,6 +364,7 @@ void my_hash_sort_simple(CHARSET_INFO *cs, register const uchar *sort_order=cs->sort_order; const uchar *end; uint16 space_weight= sort_order[' ']; + DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */ /* Remove all trailing characters that are equal to space. diff --git a/strings/ctype-uca.inl b/strings/ctype-uca.inl index 70d2f180e15..3bad40e0f2b 100644 --- a/strings/ctype-uca.inl +++ b/strings/ctype-uca.inl @@ -537,6 +537,7 @@ MY_FUNCTION_NAME(hash_sort)(CHARSET_INFO *cs, my_uca_scanner scanner; int space_weight= my_space_weight(&cs->uca->level[0]); register ulong m1= *nr1, m2= *nr2; + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ my_uca_scanner_init_any(&scanner, cs, &cs->uca->level[0], s, slen); @@ -590,6 +591,7 @@ MY_FUNCTION_NAME(hash_sort_nopad)(CHARSET_INFO *cs, int s_res; my_uca_scanner scanner; register ulong m1= *nr1, m2= *nr2; + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ my_uca_scanner_init_any(&scanner, cs, &cs->uca->level[0], s, slen); diff --git a/strings/ctype-ucs2.c b/strings/ctype-ucs2.c index 99f4f73ff78..c8187fb3e63 100644 --- a/strings/ctype-ucs2.c +++ b/strings/ctype-ucs2.c @@ -1359,6 +1359,7 @@ my_hash_sort_utf16_nopad(CHARSET_INFO *cs, const uchar *e= s + slen; MY_UNICASE_INFO *uni_plane= cs->caseinfo; register ulong m1= *nr1, m2= *nr2; + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ while ((s < e) && (res= mb_wc(cs, &wc, (uchar *) s, (uchar *) e)) > 0) { @@ -1376,6 +1377,7 @@ my_hash_sort_utf16(CHARSET_INFO *cs, const uchar *s, size_t slen, ulong *nr1, ulong *nr2) { size_t lengthsp= my_ci_lengthsp(cs, (const char *) s, slen); + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ my_hash_sort_utf16_nopad(cs, s, lengthsp, nr1, nr2); } @@ -1486,6 +1488,7 @@ my_hash_sort_utf16_nopad_bin(CHARSET_INFO *cs __attribute__((unused)), { const uchar *end= pos + len; register ulong m1= *nr1, m2= *nr2; + DBUG_ASSERT(pos); /* Avoid UBSAN nullptr-with-offset */ for ( ; pos < end ; pos++) { @@ -1501,6 +1504,7 @@ my_hash_sort_utf16_bin(CHARSET_INFO *cs, const uchar *pos, size_t len, ulong *nr1, ulong *nr2) { size_t lengthsp= my_ci_lengthsp(cs, (const char *) pos, len); + DBUG_ASSERT(pos); /* Avoid UBSAN nullptr-with-offset */ my_hash_sort_utf16_nopad_bin(cs, pos, lengthsp, nr1, nr2); } @@ -2250,6 +2254,7 @@ my_hash_sort_utf32_nopad(CHARSET_INFO *cs, const uchar *s, size_t slen, const uchar *e= s + slen; MY_UNICASE_INFO *uni_plane= cs->caseinfo; register ulong m1= *nr1, m2= *nr2; + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ while ((res= my_utf32_uni(cs, &wc, (uchar*) s, (uchar*) e)) > 0) { @@ -2270,6 +2275,7 @@ my_hash_sort_utf32(CHARSET_INFO *cs, const uchar *s, size_t slen, ulong *nr1, ulong *nr2) { size_t lengthsp= my_lengthsp_utf32(cs, (const char *) s, slen); + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ my_hash_sort_utf32_nopad(cs, s, lengthsp, nr1, nr2); } @@ -3139,6 +3145,7 @@ my_hash_sort_ucs2_nopad(CHARSET_INFO *cs, const uchar *s, size_t slen, const uchar *e=s+slen; MY_UNICASE_INFO *uni_plane= cs->caseinfo; register ulong m1= *nr1, m2= *nr2; + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ while ((s < e) && (res=my_ucs2_uni(cs,&wc, (uchar *)s, (uchar*)e)) >0) { @@ -3155,6 +3162,7 @@ static void my_hash_sort_ucs2(CHARSET_INFO *cs, const uchar *s, size_t slen, ulong *nr1, ulong *nr2) { size_t lengthsp= my_lengthsp_mb2(cs, (const char *) s, slen); + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ my_hash_sort_ucs2_nopad(cs, s, lengthsp, nr1, nr2); } @@ -3279,6 +3287,7 @@ my_hash_sort_ucs2_nopad_bin(CHARSET_INFO *cs __attribute__((unused)), { const uchar *end= key + len; register ulong m1= *nr1, m2= *nr2; + DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */ for ( ; key < end ; key++) { MY_HASH_ADD(m1, m2, (uint)*key); @@ -3293,6 +3302,7 @@ my_hash_sort_ucs2_bin(CHARSET_INFO *cs, const uchar *key, size_t len, ulong *nr1, ulong *nr2) { size_t lengthsp= my_lengthsp_mb2(cs, (const char *) key, len); + DBUG_ASSERT(key); /* Avoid UBSAN nullptr-with-offset */ my_hash_sort_ucs2_nopad_bin(cs, key, lengthsp, nr1, nr2); } diff --git a/strings/ctype-utf8.c b/strings/ctype-utf8.c index 88650e9611c..33d6d49a93a 100644 --- a/strings/ctype-utf8.c +++ b/strings/ctype-utf8.c @@ -4977,6 +4977,7 @@ static void my_hash_sort_utf8mb3_nopad(CHARSET_INFO *cs, const uchar *s, size_t const uchar *e= s+slen; MY_UNICASE_INFO *uni_plane= cs->caseinfo; register ulong m1= *nr1, m2= *nr2; + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ while ((s < e) && (res=my_utf8mb3_uni(cs,&wc, (uchar *)s, (uchar*)e))>0 ) { @@ -4997,6 +4998,7 @@ static void my_hash_sort_utf8mb3(CHARSET_INFO *cs, const uchar *s, size_t slen, 'A ' and 'A' as identical */ const uchar *e= skip_trailing_space(s, slen); + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ my_hash_sort_utf8mb3_nopad(cs, s, e - s, nr1, nr2); } @@ -7414,6 +7416,7 @@ my_hash_sort_utf8mb4_nopad(CHARSET_INFO *cs, const uchar *s, size_t slen, const uchar *e= s + slen; MY_UNICASE_INFO *uni_plane= cs->caseinfo; register ulong m1= *nr1, m2= *nr2; + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ while ((res= my_mb_wc_utf8mb4(cs, &wc, (uchar*) s, (uchar*) e)) > 0) { @@ -7446,6 +7449,7 @@ my_hash_sort_utf8mb4(CHARSET_INFO *cs, const uchar *s, size_t slen, 'A ' and 'A' as identical */ const uchar *e= skip_trailing_space(s, slen); + DBUG_ASSERT(s); /* Avoid UBSAN nullptr-with-offset */ my_hash_sort_utf8mb4_nopad(cs, s, e - s, nr1, nr2); } diff --git a/strings/strings_def.h b/strings/strings_def.h index f3602f390a2..55376c37c7f 100644 --- a/strings/strings_def.h +++ b/strings/strings_def.h @@ -81,7 +81,7 @@ static inline const uchar *skip_trailing_space(const uchar *ptr,size_t len) { const uchar *end= ptr + len; - + DBUG_ASSERT(ptr); /* Avoid UBSAN nullptr-with-offset */ if (len > 20) { const uchar *end_words= (const uchar *)(intptr) From 0ca98e834dbeb00a2dae5cb1406d0efc31ba6655 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 3 Feb 2025 19:52:50 +1100 Subject: [PATCH 002/134] MDEV-35959 Store the error message at the net layer when reading a packet from the server This ensures that the error message is populated when the reading fails with ER_NET_READ_INTERRUPTED, which at the client layer returns without storing any error message as there is no corresponding CR_ error code. Patch originally by Sergei Golubchik --- sql/net_serv.cc | 3 ++ .../spider/bugfix/r/mdev_35959.result | 25 +++++++++++++++++ .../spider/bugfix/t/mdev_35959.test | 28 +++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 storage/spider/mysql-test/spider/bugfix/r/mdev_35959.result create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_35959.test diff --git a/sql/net_serv.cc b/sql/net_serv.cc index 56757b96ee1..86d4de5980b 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -1065,6 +1065,9 @@ retry: net->last_errno= (vio_was_timeout(net->vio) ? ER_NET_READ_INTERRUPTED : ER_NET_READ_ERROR); +#ifdef MYSQL_SERVER + strmake_buf(net->last_error, ER(net->last_errno)); +#endif /* MYSQL_SERVER */ MYSQL_SERVER_my_error(net->last_errno, MYF(0)); goto end; } diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_35959.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_35959.result new file mode 100644 index 00000000000..6be0610b6d8 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_35959.result @@ -0,0 +1,25 @@ +# +# MDEV-35959 Assertion `*str != '\0'' failed in my_message_sql after a Spider error +# +for master_1 +for child2 +for child3 +SET spider_same_server_link=ON, spider_net_read_timeout=1; +CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +CREATE TABLE t_remote (a INT); +CREATE TABLE t (a INT) ENGINE=SPIDER COMMENT = 'wrapper "mysql", srv "srv", table "t_remote"'; +CREATE OR REPLACE TABLE t_remote LIKE t; +ERROR 08S01: Got timeout reading communication packets +SHOW WARNINGS; +Level Code Message +Error 1159 Got timeout reading communication packets +Error 1159 Got timeout reading communication packets +Error 1159 Got timeout reading communication packets +Error 1159 Got timeout reading communication packets +Error 1159 Got timeout reading communication packets +drop table t; +drop server srv; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_35959.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_35959.test new file mode 100644 index 00000000000..9beebaa8c1d --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_35959.test @@ -0,0 +1,28 @@ +--echo # +--echo # MDEV-35959 Assertion `*str != '\0'' failed in my_message_sql after a Spider error +--echo # + +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log + +SET spider_same_server_link=ON, spider_net_read_timeout=1; +evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); + +CREATE TABLE t_remote (a INT); +CREATE TABLE t (a INT) ENGINE=SPIDER COMMENT = 'wrapper "mysql", srv "srv", table "t_remote"'; +--error ER_NET_READ_INTERRUPTED +CREATE OR REPLACE TABLE t_remote LIKE t; +SHOW WARNINGS; + +drop table t; +drop server srv; + +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log From 3a1f9dfda98fd1b6bc577918267ee42b7e1469aa Mon Sep 17 00:00:00 2001 From: Daniel Bartholomew Date: Tue, 4 Feb 2025 07:50:30 -0500 Subject: [PATCH 003/134] bump the VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 43c84795651..1bc6b594a5e 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=5 -MYSQL_VERSION_PATCH=28 +MYSQL_VERSION_PATCH=29 SERVER_MATURITY=stable From fbb6b50499a258b0e015e5b5c5b1e4effededb25 Mon Sep 17 00:00:00 2001 From: Dave Gosselin Date: Wed, 18 Dec 2024 12:02:10 -0500 Subject: [PATCH 004/134] MDEV-35117 Improve error message on unexpected geometries for st_distance_sphere When invoking st_distance_sphere with unexpected geometries, the error message now given is: ERROR HY000: Internal error: Point or multipoint geometries expected This commit fixes a few formatting issues in the affected function. --- mysql-test/main/gis-precise.result | 8 ++++---- mysql-test/main/gis-precise.test | 8 ++++---- mysql-test/main/gis.result | 5 +++++ mysql-test/main/gis.test | 6 ++++++ sql/item_geofunc.cc | 17 +++++++++-------- 5 files changed, 28 insertions(+), 16 deletions(-) diff --git a/mysql-test/main/gis-precise.result b/mysql-test/main/gis-precise.result index a75b71f4c8b..ca1fa666530 100644 --- a/mysql-test/main/gis-precise.result +++ b/mysql-test/main/gis-precise.result @@ -776,7 +776,7 @@ SELECT ST_DISTANCE_SPHERE(1, 1, NULL); ST_DISTANCE_SPHERE(1, 1, NULL) NULL SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)')) as result; -ERROR HY000: Internal error: st_distance_sphere +ERROR HY000: Calling geometry function st_distance_sphere with unsupported types of arguments. # Test Points and radius SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)')) as result; result @@ -788,9 +788,9 @@ SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT( result 0.024682056391766436 SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 0) as result; -ERROR HY000: Internal error: Radius must be greater than zero. +ERROR HY000: Calling geometry function st_distance_sphere with unsupported types of arguments. SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), -1) as result; -ERROR HY000: Internal error: Radius must be greater than zero. +ERROR HY000: Calling geometry function st_distance_sphere with unsupported types of arguments. # Test longitude/lattitude SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 1)'), ST_GEOMFROMTEXT('POINT(1 2)')), 10) as result; result @@ -843,7 +843,7 @@ SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_G result 0.04933028646581131 SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),0) as result; -ERROR HY000: Internal error: Radius must be greater than zero. +ERROR HY000: Calling geometry function st_distance_sphere with unsupported types of arguments. set @pt1 = ST_GeomFromText('POINT(190 -30)'); set @pt2 = ST_GeomFromText('POINT(-30 50)'); SELECT ST_Distance_Sphere(@pt1, @pt2); diff --git a/mysql-test/main/gis-precise.test b/mysql-test/main/gis-precise.test index 666c443e5fe..e135bedc38d 100644 --- a/mysql-test/main/gis-precise.test +++ b/mysql-test/main/gis-precise.test @@ -422,7 +422,7 @@ SELECT ST_DISTANCE_SPHERE(1, 1, 3); # Return NULL if radius is NULL SELECT ST_DISTANCE_SPHERE(1, 1, NULL); # Wrong geometry ---error ER_INTERNAL_ERROR +--error ER_GIS_UNSUPPORTED_ARGUMENT SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(1 0)'), ST_GEOMFROMTEXT('LINESTRING(0 0, 1 1)')) as result; --echo # Test Points and radius @@ -430,9 +430,9 @@ SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT( # make bb x86 happy SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(-1 -1)'), ST_GEOMFROMTEXT('POINT(-2 -2)')), 10) as result; SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 1) as result; ---error ER_INTERNAL_ERROR +--error ER_GIS_UNSUPPORTED_ARGUMENT SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), 0) as result; ---error ER_INTERNAL_ERROR +--error ER_GIS_UNSUPPORTED_ARGUMENT SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('POINT(0 0)'), ST_GEOMFROMTEXT('POINT(1 1)'), -1) as result; --echo # Test longitude/lattitude # make bb x86 happy @@ -456,7 +456,7 @@ SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_G SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )')), 10) as result; # make bb x86 happy SELECT TRUNCATE(ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),1), 17) as result; ---error ER_INTERNAL_ERROR +--error ER_GIS_UNSUPPORTED_ARGUMENT SELECT ST_DISTANCE_SPHERE(ST_GEOMFROMTEXT('MULTIPOINT(1 2,1 1 )'), ST_GEOMFROMTEXT('MULTIPOINT(8 9,3 4 )'),0) as result; # Longitude out of range [-180,180] diff --git a/mysql-test/main/gis.result b/mysql-test/main/gis.result index 5fa310e93ed..cbae1745e21 100644 --- a/mysql-test/main/gis.result +++ b/mysql-test/main/gis.result @@ -5501,4 +5501,9 @@ MULTIPOLYGON(POLYGON(LINESTRING(POINT(4, 3), POINT(4, 4), POINT(3, 4), POINT(4, ) AS t; ST_SRID(g1) ST_SRID(ST_GeomFromWKB(g1, 4326)) ST_SRID(ST_GeomFromWKB(g1)) ST_AsText(g1) ST_SRID(ST_PointFromWKB(g2, 4326)) ST_SRID(g2) ST_SRID(ST_LineStringFromWKB(g3, 3)) ST_SRID(ST_PolygonFromWKB(g4, 4)) ST_SRID(ST_MultiPointFromWKB(g5, 5)) ST_SRID(ST_MultiLineStringFromWKB(g6, 6)) ST_SRID(ST_MultiPolygonFromWKB(g7, 7)) 0 4326 0 POINT(1 2) 4326 0 3 4 5 6 7 +# +# MDEV-35117 Error message "ERROR 1815 (HY000): Internal error: st_distance_sphere' could be improved +# +SELECT ST_DISTANCE_SPHERE(st_geomfromtext('linestring( 2 2, 2 8) '), ST_GeomFromText('POINT(18.413076 43.856258)')) ; +ERROR HY000: Calling geometry function st_distance_sphere with unsupported types of arguments. # End of 10.5 tests diff --git a/mysql-test/main/gis.test b/mysql-test/main/gis.test index 03c1df94d1f..a412cf7d690 100644 --- a/mysql-test/main/gis.test +++ b/mysql-test/main/gis.test @@ -3508,4 +3508,10 @@ FROM ( MULTIPOLYGON(POLYGON(LINESTRING(POINT(4, 3), POINT(4, 4), POINT(3, 4), POINT(4, 3)))) AS g7 ) AS t; +--echo # +--echo # MDEV-35117 Error message "ERROR 1815 (HY000): Internal error: st_distance_sphere' could be improved +--echo # +--error ER_GIS_UNSUPPORTED_ARGUMENT +SELECT ST_DISTANCE_SPHERE(st_geomfromtext('linestring( 2 2, 2 8) '), ST_GeomFromText('POINT(18.413076 43.856258)')) ; + --echo # End of 10.5 tests diff --git a/sql/item_geofunc.cc b/sql/item_geofunc.cc index 81cd1268f64..5b1ed286146 100644 --- a/sql/item_geofunc.cc +++ b/sql/item_geofunc.cc @@ -2535,7 +2535,7 @@ double Item_func_sphere_distance::val_real() String *arg2= args[1]->val_str(&bak2); double distance= 0.0; double sphere_radius= 6370986.0; // Default radius equals Earth radius - + null_value= (args[0]->null_value || args[1]->null_value); if (null_value) { @@ -2553,7 +2553,7 @@ double Item_func_sphere_distance::val_real() } if (sphere_radius <= 0) { - my_error(ER_INTERNAL_ERROR, MYF(0), "Radius must be greater than zero."); + my_error(ER_GIS_UNSUPPORTED_ARGUMENT, MYF(0), func_name()); return 1; } } @@ -2565,26 +2565,27 @@ double Item_func_sphere_distance::val_real() my_error(ER_GIS_INVALID_DATA, MYF(0), "ST_Distance_Sphere"); goto handle_errors; } -// Method allowed for points and multipoints + // Method allowed for points and multipoints if (!(g1->get_class_info()->m_type_id == Geometry::wkb_point || g1->get_class_info()->m_type_id == Geometry::wkb_multipoint) || !(g2->get_class_info()->m_type_id == Geometry::wkb_point || g2->get_class_info()->m_type_id == Geometry::wkb_multipoint)) { - // Generate error message in case different geometry is used? - my_error(ER_INTERNAL_ERROR, MYF(0), func_name()); + // Generate error message in case of unexpected geometry. + my_error(ER_GIS_UNSUPPORTED_ARGUMENT, MYF(0), func_name()); return 0; } distance= spherical_distance_points(g1, g2, sphere_radius); if (distance < 0) { - my_error(ER_INTERNAL_ERROR, MYF(0), "Returned distance cannot be negative."); + my_error(ER_INTERNAL_ERROR, MYF(0), + "Returned distance cannot be negative."); return 1; } return distance; - handle_errors: - return 0; +handle_errors: + return 0; } From cd7513995dd67bf9376681c0986b8a5c484188c8 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 10 Feb 2025 15:25:09 +0100 Subject: [PATCH 005/134] MDEV-36026 Problem with INSERT SELECT on NOT NULL columns while having BEFORE UPDATE trigger MDEV-8605 and MDEV-19761 didn't handle INSERT (columns) SELECT followup for a69da0c31e9 --- mysql-test/main/trigger_null.result | 15 +++++++++++++++ mysql-test/main/trigger_null.test | 11 +++++++++++ sql/sql_insert.cc | 1 + 3 files changed, 27 insertions(+) diff --git a/mysql-test/main/trigger_null.result b/mysql-test/main/trigger_null.result index 91bae7e3b0e..a99936bf2f3 100644 --- a/mysql-test/main/trigger_null.result +++ b/mysql-test/main/trigger_null.result @@ -399,4 +399,19 @@ Warnings: Warning 1364 Field 'c5' doesn't have a default value drop table t1; set sql_mode=default; +# +# MDEV-36026 Problem with INSERT SELECT on NOT NULL columns while having BEFORE UPDATE trigger +# +create table t1 (b int(11) not null); +create trigger t1bu before update on t1 for each row begin end; +insert t1 (b) select 1 union select 2; +create trigger trgi before insert on t1 for each row set new.b=ifnull(new.b,10); +insert t1 (b) select NULL union select 11; +select * from t1; +b +1 +2 +10 +11 +drop table t1; # End of 10.5 tests diff --git a/mysql-test/main/trigger_null.test b/mysql-test/main/trigger_null.test index d3b74af49b3..197e7cdf86a 100644 --- a/mysql-test/main/trigger_null.test +++ b/mysql-test/main/trigger_null.test @@ -425,4 +425,15 @@ insert into t1 (c) values (1); drop table t1; set sql_mode=default; +--echo # +--echo # MDEV-36026 Problem with INSERT SELECT on NOT NULL columns while having BEFORE UPDATE trigger +--echo # +create table t1 (b int(11) not null); +create trigger t1bu before update on t1 for each row begin end; +insert t1 (b) select 1 union select 2; +create trigger trgi before insert on t1 for each row set new.b=ifnull(new.b,10); +insert t1 (b) select NULL union select 11; +select * from t1; +drop table t1; + --echo # End of 10.5 tests diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 26adcf3d228..34b71fcabe3 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -4126,6 +4126,7 @@ select_insert::prepare(List &values, SELECT_LEX_UNIT *u) int select_insert::prepare2(JOIN *) { DBUG_ENTER("select_insert::prepare2"); + switch_to_nullable_trigger_fields(*fields, table); if (table->validate_default_values_of_unset_fields(thd)) DBUG_RETURN(1); if (thd->lex->describe) From feadfd9d9cc1614beba667e957f9428b1be245ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 11 Feb 2025 14:06:15 +0200 Subject: [PATCH 006/134] MDEV-27769 fixup: conditionally define a function --- sql/sql_base.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 149cd541341..95b650c33d3 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -760,6 +760,7 @@ close_all_tables_for_name(THD *thd, TABLE_SHARE *share, } } +#ifdef DBUG_ASSERT_EXISTS static inline bool check_field_pointers(const TABLE *table) { for (Field **pf= table->field; *pf; pf++) @@ -775,6 +776,7 @@ static inline bool check_field_pointers(const TABLE *table) } return true; } +#endif /* From c43d0a015f974c5a0142e6779332089a7a979853 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Wed, 29 Jan 2025 20:08:41 +0200 Subject: [PATCH 007/134] MDEV-35951 : Complete freeze during MW-329 test Rewrite test not to use infinite procedure, it is not necessary to test. Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera/r/MW-329.result | 1 + mysql-test/suite/galera/r/MW-329F.result | 25 ++++++ mysql-test/suite/galera/t/MW-329.cnf | 3 - mysql-test/suite/galera/t/MW-329.test | 12 ++- mysql-test/suite/galera/t/MW-329F.cnf | 6 ++ mysql-test/suite/galera/t/MW-329F.test | 105 +++++++++++++++++++++++ 6 files changed, 146 insertions(+), 6 deletions(-) create mode 100644 mysql-test/suite/galera/r/MW-329F.result create mode 100644 mysql-test/suite/galera/t/MW-329F.cnf create mode 100644 mysql-test/suite/galera/t/MW-329F.test diff --git a/mysql-test/suite/galera/r/MW-329.result b/mysql-test/suite/galera/r/MW-329.result index 16afcc15996..37a97f57f98 100644 --- a/mysql-test/suite/galera/r/MW-329.result +++ b/mysql-test/suite/galera/r/MW-329.result @@ -18,5 +18,6 @@ connection node_1b; connection node_1; DROP PROCEDURE proc_insert; DROP TABLE t1; +disconnect node_1b; CALL mtr.add_suppression("WSREP: .* conflict state after post commit "); set global innodb_status_output=Default; diff --git a/mysql-test/suite/galera/r/MW-329F.result b/mysql-test/suite/galera/r/MW-329F.result new file mode 100644 index 00000000000..bdde55cba63 --- /dev/null +++ b/mysql-test/suite/galera/r/MW-329F.result @@ -0,0 +1,25 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB; +INSERT INTO t1 (f1) VALUES (1),(65535); +CREATE PROCEDURE proc_insert (repeat_count int) +BEGIN +DECLARE current_num int; +DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; +SET current_num = 0; +SET SESSION wsrep_sync_wait = 0; +WHILE current_num < repeat_count do +INSERT INTO t1 (f1) VALUES (FLOOR( 1 + RAND( ) * 65535 )); +SELECT SLEEP(0.1); +SET current_num = current_num + 1; +END WHILE; +END| +connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1b; +connection node_1b; +connection node_1; +DROP PROCEDURE proc_insert; +DROP TABLE t1; +disconnect node_1b; +CALL mtr.add_suppression("WSREP: .* conflict state after post commit "); +set global innodb_status_output=Default; diff --git a/mysql-test/suite/galera/t/MW-329.cnf b/mysql-test/suite/galera/t/MW-329.cnf index 10870a81547..b35f0a5cfe5 100644 --- a/mysql-test/suite/galera/t/MW-329.cnf +++ b/mysql-test/suite/galera/t/MW-329.cnf @@ -4,6 +4,3 @@ wsrep-retry-autocommit=0 [mysqld.2] - - - diff --git a/mysql-test/suite/galera/t/MW-329.test b/mysql-test/suite/galera/t/MW-329.test index 38f2007f6b6..7d132a7bfc0 100644 --- a/mysql-test/suite/galera/t/MW-329.test +++ b/mysql-test/suite/galera/t/MW-329.test @@ -1,5 +1,5 @@ # -# #MW-329 Fix incorrect affected rows count after replay +# MW-329 Fix incorrect affected rows count after replay. # --source include/galera_cluster.inc @@ -11,7 +11,7 @@ CREATE TABLE t1 (f1 INTEGER, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB; INSERT INTO t1 (f1) VALUES (1),(65535); # -# Run concurrent INSERTs +# Run concurrent INSERTs # DELIMITER |; @@ -86,8 +86,12 @@ while ($count) --eval KILL CONNECTION $connection_id --enable_query_log +# +# getting execution results for --send +# + --connection node_1b ---error 0,2013,1317 +--error 0,1317,2013,2026 --reap --enable_query_log --enable_result_log @@ -96,6 +100,8 @@ while ($count) DROP PROCEDURE proc_insert; DROP TABLE t1; +--disconnect node_1b + # Due to MW-330, Multiple "conflict state 3 after post commit" warnings if table is dropped while SP is running CALL mtr.add_suppression("WSREP: .* conflict state after post commit "); diff --git a/mysql-test/suite/galera/t/MW-329F.cnf b/mysql-test/suite/galera/t/MW-329F.cnf new file mode 100644 index 00000000000..b35f0a5cfe5 --- /dev/null +++ b/mysql-test/suite/galera/t/MW-329F.cnf @@ -0,0 +1,6 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +wsrep-retry-autocommit=0 + +[mysqld.2] diff --git a/mysql-test/suite/galera/t/MW-329F.test b/mysql-test/suite/galera/t/MW-329F.test new file mode 100644 index 00000000000..77370dabbe3 --- /dev/null +++ b/mysql-test/suite/galera/t/MW-329F.test @@ -0,0 +1,105 @@ +# +# MW-329F Fix incorrect affected rows count after replay. +# +# This is a version of MW-329 without the infinite loop that +# in the original test is closed by killing the connection. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +CREATE TABLE t1 (f1 INTEGER, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB; + +# We start with a populated table +INSERT INTO t1 (f1) VALUES (1),(65535); + +# +# Run concurrent INSERTs +# + +DELIMITER |; +CREATE PROCEDURE proc_insert (repeat_count int) +BEGIN + DECLARE current_num int; + DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; + SET current_num = 0; + SET SESSION wsrep_sync_wait = 0; + WHILE current_num < repeat_count do + INSERT INTO t1 (f1) VALUES (FLOOR( 1 + RAND( ) * 65535 )); + SELECT SLEEP(0.1); + SET current_num = current_num + 1; + END WHILE; +END| +DELIMITER ;| + +--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1b +--let $connection_id = `SELECT CONNECTION_ID()` +--disable_query_log +--disable_result_log +--send CALL proc_insert(500); + +# +# Run concurrent UPDATEs. We expect that each UPDATE will report that +# some rows were matched and updated +# + +--connection node_2 +--let $count = 2 +--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` + +while ($count) +{ + --let $signature = `SELECT LEFT(MD5(RAND()), 10)` + --disable_query_log + --error 0,ER_LOCK_DEADLOCK + --eval UPDATE t1 SET f2 = '$signature' + --enable_query_log + --let $row_count = `SELECT ROW_COUNT()` + if (`SELECT @@error_count = 0`) { + if (`SELECT $row_count = 0`) { + --die ROW_COUNT() = 0 + } + } + + # + # Ensure at least one replay happens + # + + --let $wsrep_replays = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` + --disable_query_log + if (`SELECT $wsrep_replays - $wsrep_local_replays_old > 0`) { + --dec $count + } + --enable_query_log +} + +# +# Confirm that some transaction replays occurred +# + +--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` +--disable_query_log +--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old > 0 AS wsrep_local_replays; +--enable_query_log + +# +# getting execution results for --send +# + +--connection node_1b +--error 0,1317,2013,2026 +--reap +--enable_query_log +--enable_result_log + +--connection node_1 +DROP PROCEDURE proc_insert; +DROP TABLE t1; + +--disconnect node_1b + +# Due to MW-330, Multiple "conflict state 3 after post commit" warnings if table is dropped while SP is running +CALL mtr.add_suppression("WSREP: .* conflict state after post commit "); + +set global innodb_status_output=Default; From 65545a3df20cf963429ae5522e319f1d15026c28 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 5 Dec 2023 01:24:09 +0100 Subject: [PATCH 008/134] galera: root certificate renewed --- .../std_data/galera_certs/galera.root.crt | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/mysql-test/std_data/galera_certs/galera.root.crt b/mysql-test/std_data/galera_certs/galera.root.crt index e965d5a26d6..70f1265426c 100644 --- a/mysql-test/std_data/galera_certs/galera.root.crt +++ b/mysql-test/std_data/galera_certs/galera.root.crt @@ -2,7 +2,7 @@ MIIFlTCCA32gAwIBAgIUKCF88W+48rZzdfgYpE2dXVMGSKgwDQYJKoZIhvcNAQEL BQAwWjELMAkGA1UEBhMCRkkxETAPBgNVBAgMCEhlbHNpbmtpMREwDwYDVQQHDAhI ZWxzaW5raTEPMA0GA1UECgwGR2FsZXJhMRQwEgYDVQQDDAtnYWxlcmEucm9vdDAe -Fw0yMTAyMDQxMzE3MDJaFw0yMzExMjUxMzE3MDJaMFoxCzAJBgNVBAYTAkZJMREw +Fw0yMzEyMDExMzQzNDBaFw0zMzExMjgxMzQzNDBaMFoxCzAJBgNVBAYTAkZJMREw DwYDVQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVsc2lua2kxDzANBgNVBAoMBkdh bGVyYTEUMBIGA1UEAwwLZ2FsZXJhLnJvb3QwggIiMA0GCSqGSIb3DQEBAQUAA4IC DwAwggIKAoICAQDKqL45jbaq8RLOj+DeilPcEnBN5gn/y9V3IfZ0BQCd4bR09zLz @@ -18,15 +18,15 @@ dl5QYYMbmyNedNKdwV4idhGCy+Zq7VAX4lBXazI1rD9vQb+oTcPGQiy4i/Vi/g6i F+XZTdTiaOWPEmvFFGLLUQxKl4w872hJaupqfteqdiZ+3ICVIUI8qnXHmwIDAQAB o1MwUTAdBgNVHQ4EFgQUs75v/MgjJ5RHGE6+0qdiVo4BwlowHwYDVR0jBBgwFoAU s75v/MgjJ5RHGE6+0qdiVo4BwlowDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0B -AQsFAAOCAgEAOVhBs28dwwvD5q2r7oVVcxLc+tb8zu4XxpXT1p6hiZYUyPguCh00 -GVdXCgR4JMI/NcyM5fBAbF3S8oK3+9rw2kW09afVV06Qf/8o3nIyOiDl7598tGIP -CCK4QsUW/dGajx5kvhtQ7qce+u9KfFTof6lq2xkYtFBBhmBdSv9A1jAZJMw2x3bc -nr99PS8XZMphS0MIExHKj6Ry5DdYm722zZHyIEiiEGyMViDm2m1iug5r/LPH5Z56 -BjQiH4VP+0y5mevBOUGuH8ID+J9Hu9BeoXLhkv+W2Ljs/S6wqzjinMBqVG+wwe0Y -a8F5pABkl5uX38nMQ7CikSbLxSbn7nRf+sux1sbzqjMldeCSqiv9mI5Ysq97+Ni1 -5qMxNxNc0u/wGRnrXH8fWfxBKPP5moA7DQfVcUWPgDGQwDpA8kn8RlJxFk3g4yaK -+NMwk5MORKyx3tz/A3Yhs9AUXk3okvmQCT2YVSHcKUB8PAU+TaKqbr3wk07Y/tL/ -jFPHS+t3eD91Y05KGUXjdtGi+33zpV0biHmTWAZT78VQowDNvEpTnXhkSx8HGHYR -nqSMU2m2LboHSatY113RYznx0LJ1azczRlJdGs8oyPWLPDD2JCesZaQqGZVRJoms -lK4EzYEb5mZTCRgtgoiO+iKcf6XifuOCrWZXoLm4FlLEfOQ3b8yAFlo= +AQsFAAOCAgEAKLV6mkWb88HEJXo1XlmAzznIYNfilrvvxwcjhceluDE8s8sPSpYM +Bz5ebWlHCgEkC/ezhA/PDtZsZlQKwv4jb++lAlFSlebT1GW77xKkdRBTKgkFAaOA +pF5eZao6IP8l76fA4OoI2Tttw5jeb23kOoklDp/8VS0JEAT3wm/hZiE20aUbAFC+ +kPiCucBztzaTHQud9CgtxRH/B3D9FaPuwae/H6FYrvQVNVjcaHTIUh9fTcyKRXYm +oYbvK7fIhCjZkG2LRWRU9Kirivb+ktO4POsuK4BgYrsFaOBf9HYsojA7llyGDopN +cfw9jtb27Qb/uMKJnClFg14u685CU5JAzY31E5OQPPUUx9PqP4Z9PgXRQ0xI6H/4 +sejlcQuqGCDKiL2lOzUjbT86EjO4ZfiKHR+lKOIuT5mXiR8cbS1JeyX3Mrv1Ds4r +UVcdtSXTy6/XYWFIzhu+MrsFon6VX0HkmSH1HjSoLMOZcHAZIFZZ/uAahLmMNaEG +lV15fD5+t5QRKwqmdFUW2ETiqSJxRs6Y++ptxpiiH38QVWPvBWeRgcPpf3A478Bl +iGO0xn0N57TnhFs3g0C0xyZgTBMozfVostYpps1Tqqz0VOhtmURxTZm9JZgTb7qv +nMURY0SIQKXpHCcJuNtxZcDSu8uxgUcMsLSSC7Zmk7/cSeUfmOgZVzU= -----END CERTIFICATE----- From c9a6adba1e60f874ea0ff4416dd112ee0240b428 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 20 Feb 2024 00:57:55 +0100 Subject: [PATCH 009/134] galera mtr tests: synchronization of tests between branches --- mysql-test/suite/galera/disabled.def | 3 ++ .../r/galera_binlog_stmt_autoinc.result | 4 +- .../suite/galera/r/galera_defaults.result | 4 +- .../r/galera_gcache_recover_manytrx.result | 14 ++--- .../r/galera_parallel_apply_lock_table.result | 34 ++++++------ .../galera/r/galera_sequence_engine.result | 8 ++- .../suite/galera/r/galera_sequences.result | 5 +- .../galera/r/galera_toi_ddl_fk_insert.result | 16 ++++++ mysql-test/suite/galera/r/galera_wan.result | 12 ++--- .../galera/r/galera_wan_restart_sst.result | 9 +++- ...alera_wsrep_provider_options_syntax.result | 4 +- .../r/galera_wsrep_schema_detached.result | 9 +++- .../suite/galera/r/mysql-wsrep#198.result | 3 ++ mysql-test/suite/galera/t/MDEV-18832.test | 1 + mysql-test/suite/galera/t/MDEV-27862.test | 1 + mysql-test/suite/galera/t/MDEV-32549.test | 1 + mysql-test/suite/galera/t/MDEV-33828.cnf | 9 ++++ mysql-test/suite/galera/t/MDEV-33828.test | 1 - mysql-test/suite/galera/t/MDEV-34647.cnf | 13 +++++ mysql-test/suite/galera/t/MDEV-34647.test | 4 +- mysql-test/suite/galera/t/MW-416.test | 23 ++++---- mysql-test/suite/galera/t/galera#500.test | 5 ++ mysql-test/suite/galera/t/galera_admin.test | 9 +--- .../suite/galera/t/galera_backup_stage.test | 6 +-- .../galera/t/galera_binlog_stmt_autoinc.test | 8 +-- .../suite/galera/t/galera_cache_index.test | 1 + .../suite/galera/t/galera_can_run_toi.test | 1 + .../suite/galera/t/galera_create_trigger.test | 1 - mysql-test/suite/galera/t/galera_ctas.test | 3 +- .../suite/galera/t/galera_defaults.test | 4 +- .../t/galera_gcache_recover_manytrx.test | 14 ++--- .../t/galera_parallel_apply_lock_table.test | 14 ++--- .../galera/t/galera_parallel_simple.test | 2 +- .../suite/galera/t/galera_pc_recovery.test | 4 +- .../suite/galera/t/galera_read_only.test | 1 - .../galera/t/galera_sequence_engine.test | 13 ++++- .../suite/galera/t/galera_sequences.test | 4 ++ .../galera/t/galera_toi_ddl_fk_insert.test | 14 +++-- .../galera/t/galera_var_reject_queries.test | 4 +- .../galera/t/galera_var_retry_autocommit.test | 1 + mysql-test/suite/galera/t/galera_wan.cnf | 1 - mysql-test/suite/galera/t/galera_wan.test | 12 ++--- .../suite/galera/t/galera_wan_restart_ist.cnf | 1 - .../galera/t/galera_wan_restart_sst.test | 39 ++++++++++++-- .../galera_wsrep_provider_options_syntax.test | 4 +- .../t/galera_wsrep_schema_detached.test | 13 ++++- .../suite/galera/t/mysql-wsrep#198.test | 5 ++ .../suite/galera/t/mysql_tzinfo_to_sql.test | 1 + .../suite/galera/t/wsrep_strict_ddl.test | 1 + mysql-test/suite/galera_3nodes/disabled.def | 1 - .../r/galera_safe_to_bootstrap.result | 4 +- .../galera_3nodes/t/galera_2_cluster.test | 2 +- .../galera_3nodes/t/galera_gtid_2_cluster.cnf | 1 + .../t/galera_ipv6_mysqldump.test | 1 - .../t/galera_safe_to_bootstrap.test | 4 +- .../suite/galera_3nodes_sr/r/GCF-832.result | 12 +++-- .../galera_sr_kill_slave_before_apply.result | 1 + .../suite/galera_3nodes_sr/t/GCF-832.test | 19 +++++-- .../t/galera_sr_kill_slave_before_apply.test | 3 ++ mysql-test/suite/galera_sr/disabled.def | 2 - mysql-test/suite/galera_sr/r/GCF-572.result | 5 +- .../suite/galera_sr/r/MDEV-18585.result | 38 ++++++------- .../suite/galera_sr/r/MDEV-27615.result | 2 +- mysql-test/suite/galera_sr/r/MENT-2042.result | 24 +++++++++ .../galera_sr/r/galera_sr_cc_master.result | 2 +- mysql-test/suite/galera_sr/t/GCF-572.test | 2 +- mysql-test/suite/galera_sr/t/MDEV-18585.test | 5 +- mysql-test/suite/galera_sr/t/MDEV-27615.test | 3 +- mysql-test/suite/galera_sr/t/MDEV-28971.test | 1 + mysql-test/suite/galera_sr/t/MENT-2042.test | 54 +++++++++++++++++++ .../galera_sr/t/galera_sr_cc_master.test | 2 +- .../galera_sr/t/galera_sr_mysqldump_sst.test | 1 - mysql-test/suite/wsrep/t/pool_of_threads.test | 1 + mysql-test/suite/wsrep/t/variables.test | 1 - mysql-test/suite/wsrep/t/variables_debug.test | 3 +- 75 files changed, 394 insertions(+), 164 deletions(-) create mode 100644 mysql-test/suite/galera/t/MDEV-34647.cnf create mode 100644 mysql-test/suite/galera_sr/r/MENT-2042.result create mode 100644 mysql-test/suite/galera_sr/t/MENT-2042.test diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 3d3ef86f04a..80dc730250b 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -11,3 +11,6 @@ ############################################################################## galera_sequences : MDEV-35934/MDEV-33850 For Galera, create sequence with low cache got signal 6 error: [ERROR] WSREP: FSM: no such a transition REPLICATING -> COMMITTED +galera_wan : MDEV-35940 Unallowed state transition: donor -> synced in galera_wan +galera_bf_abort_lock_table : MDEV-35941 galera_bf_abort_lock_table fails with wait for metadata lock +mysql-wsrep#198 : MDEV-35941 galera_bf_abort_lock_table fails with wait for metadata lock diff --git a/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result b/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result index 4fe33674701..78f3bd6f9d3 100644 --- a/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result +++ b/mysql-test/suite/galera/r/galera_binlog_stmt_autoinc.result @@ -1,11 +1,11 @@ connection node_2; connection node_1; connection node_1; +connection node_2; +connection node_1; SET GLOBAL auto_increment_offset=1; connection node_2; SET GLOBAL auto_increment_offset=2; -connection node_1; -connection node_2; connection node_2; SET GLOBAL wsrep_forced_binlog_format='STATEMENT'; connection node_1; diff --git a/mysql-test/suite/galera/r/galera_defaults.result b/mysql-test/suite/galera/r/galera_defaults.result index e474c885473..ba153669ad9 100644 --- a/mysql-test/suite/galera/r/galera_defaults.result +++ b/mysql-test/suite/galera/r/galera_defaults.result @@ -1,8 +1,8 @@ connection node_2; connection node_1; # Correct Galera library found -SELECT COUNT(*) `expect 49` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%'; -expect 49 +SELECT COUNT(*) `expect 50` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%'; +expect 50 50 SELECT VARIABLE_NAME, VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES diff --git a/mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result b/mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result index 8c6da8f8f46..5338c096be8 100644 --- a/mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result +++ b/mysql-test/suite/galera/r/galera_gcache_recover_manytrx.result @@ -99,19 +99,19 @@ Killing server ... connection node_1; Killing server ... connection node_1_insert_simple; -ERROR HY000: Lost connection to MySQL server during query +Got one of the listed errors connection node_1_insert_multi; -ERROR HY000: Lost connection to MySQL server during query +Got one of the listed errors connection node_1_insert_transaction; -ERROR HY000: Lost connection to MySQL server during query +Got one of the listed errors connection node_1_update_simple; -ERROR HY000: Lost connection to MySQL server during query +Got one of the listed errors connection node_1_insert_1k; -ERROR HY000: Lost connection to MySQL server during query +Got one of the listed errors connection node_1_insert_1m; -ERROR HY000: Lost connection to MySQL server during query +Got one of the listed errors connection node_1_insert_10m; -ERROR HY000: Lost connection to MySQL server during query +Got one of the listed errors connection node_1; Performing --wsrep-recover ... Using --wsrep-start-position when starting mysqld ... diff --git a/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result b/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result index 48625b3ba4a..a15b0c7df69 100644 --- a/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result +++ b/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result @@ -10,31 +10,31 @@ INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (1); connection node_2a; SET SESSION wsrep_sync_wait=0; -SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%committing%'; -COUNT(*) = 1 +SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE LIKE '%committing%' or STATE = 'Waiting for certification'); +EXPECT_1 1 -SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Waiting for table metadata lock%'; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM t1; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM t2; -COUNT(*) = 0 +SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Waiting for table metadata lock%'; +EXPECT_1 1 +SELECT COUNT(*) AS EXPECT_0 FROM t1; +EXPECT_0 +0 +SELECT COUNT(*) AS EXPECT_0 FROM t2; +EXPECT_0 +0 connection node_2; UNLOCK TABLES; connection node_2a; SET SESSION wsrep_sync_wait = 15;; -SELECT COUNT(*) = 1 FROM t1; -COUNT(*) = 1 +SELECT COUNT(*) AS EXPECT_1 FROM t1; +EXPECT_1 1 -SELECT COUNT(*) = 1 FROM t2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%committed%'; -COUNT(*) = 2 +SELECT COUNT(*) AS EXPECT_1 FROM t2; +EXPECT_1 1 +SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE LIKE '%committed%' or STATE = 'Waiting for certification'); +EXPECT_2 +2 SET GLOBAL wsrep_slave_threads = 1;; DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/suite/galera/r/galera_sequence_engine.result b/mysql-test/suite/galera/r/galera_sequence_engine.result index 93e6c46bd7a..4539d63621b 100644 --- a/mysql-test/suite/galera/r/galera_sequence_engine.result +++ b/mysql-test/suite/galera/r/galera_sequence_engine.result @@ -1,5 +1,10 @@ connection node_2; connection node_1; +connection node_2; +SET GLOBAL wsrep_ignore_apply_errors=0; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2a; +SET SESSION wsrep_sync_wait=0; SET GLOBAL wsrep_ignore_apply_errors=0; SET SESSION AUTOCOMMIT=0; SET SESSION max_error_count=0; @@ -8,5 +13,4 @@ ERROR 42000: This version of MariaDB doesn't yet support 'non-InnoDB sequences i connection node_2; SHOW CREATE TABLE t0; ERROR 42S02: Table 'test.t0' doesn't exist -connection node_1; -SET GLOBAL wsrep_ignore_apply_errors=DEFAULT; +disconnect node_2a; diff --git a/mysql-test/suite/galera/r/galera_sequences.result b/mysql-test/suite/galera/r/galera_sequences.result index 1f6b2bd6637..b262ab6d1be 100644 --- a/mysql-test/suite/galera/r/galera_sequences.result +++ b/mysql-test/suite/galera/r/galera_sequences.result @@ -249,10 +249,13 @@ CREATE SEQUENCE t INCREMENT BY 0 CACHE=20 ENGINE=INNODB; ALTER TABLE t ENGINE=MYISAM; ERROR 42000: This version of MariaDB doesn't yet support 'non-InnoDB sequences in Galera cluster' ALTER SEQUENCE t INCREMENT BY 1 CACHE=10; -ERROR 42000: This version of MariaDB doesn't yet support 'CACHE without INCREMENT BY 0 in Galera cluster' +ERROR 42000: This version of MariaDB doesn't yet support 'non-InnoDB sequences in Galera cluster' ALTER SEQUENCE t INCREMENT BY 1 NOCACHE; +ERROR 42000: This version of MariaDB doesn't yet support 'non-InnoDB sequences in Galera cluster' ALTER SEQUENCE t INCREMENT BY 0 NOCACHE; +ERROR 42000: This version of MariaDB doesn't yet support 'non-InnoDB sequences in Galera cluster' ALTER SEQUENCE t INCREMENT BY 0 CACHE=10; +ERROR 42000: This version of MariaDB doesn't yet support 'non-InnoDB sequences in Galera cluster' DROP SEQUENCE t; CREATE SEQUENCE t INCREMENT BY 0 CACHE=20 ENGINE=INNODB; CREATE TABLE t1(a int not null primary key default nextval(t), b int) engine=innodb; diff --git a/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result b/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result index 2493075b635..6e55c59ad15 100644 --- a/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result +++ b/mysql-test/suite/galera/r/galera_toi_ddl_fk_insert.result @@ -23,6 +23,22 @@ connection node_1a; connection node_1b; connection node_2; connection node_2a; +connection node_1; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) FROM parent; +COUNT(*) +20001 +SELECT COUNT(*) FROM child; +COUNT(*) +10000 +connection node_2; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) FROM parent; +COUNT(*) +20001 +SELECT COUNT(*) FROM child; +COUNT(*) +10000 DROP TABLE child; DROP TABLE parent; DROP TABLE ten; diff --git a/mysql-test/suite/galera/r/galera_wan.result b/mysql-test/suite/galera/r/galera_wan.result index 3904c1dc517..1fa36456c4d 100644 --- a/mysql-test/suite/galera/r/galera_wan.result +++ b/mysql-test/suite/galera/r/galera_wan.result @@ -1,9 +1,9 @@ connection node_2; connection node_1; -CALL mtr.add_suppression("WSREP: Stray state UUID msg:"); -CALL mtr.add_suppression("Sending JOIN failed: "); -CALL mtr.add_suppression("WSREP: .* sending install message failed: Socket is not connected"); -CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); +CALL mtr.add_suppression("WSREP: Stray state UUID msg: "); +CALL mtr.add_suppression("WSREP: .*Sending JOIN failed: "); +CALL mtr.add_suppression("WSREP: .*sending install message failed: Socket is not connected"); +CALL mtr.add_suppression("WSREP: .*There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 4 1 @@ -36,8 +36,8 @@ VARIABLE_VALUE LIKE '%gmcast.segment = 3%' 1 DROP TABLE t1; connection node_1; -call mtr.add_suppression("WSREP: read_completion_condition.*"); -call mtr.add_suppression("WSREP: read_handler.*"); +call mtr.add_suppression("WSREP: read_completion_condition"); +call mtr.add_suppression("WSREP: read_handler"); disconnect node_3; disconnect node_4; disconnect node_2; diff --git a/mysql-test/suite/galera/r/galera_wan_restart_sst.result b/mysql-test/suite/galera/r/galera_wan_restart_sst.result index 2433a1d9c48..edaefe0e563 100644 --- a/mysql-test/suite/galera/r/galera_wan_restart_sst.result +++ b/mysql-test/suite/galera/r/galera_wan_restart_sst.result @@ -10,7 +10,7 @@ SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VA EXPECT_4 4 connection node_1; -CREATE TABLE t1 (f1 INTEGER); +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=INNODB; INSERT INTO t1 VALUES (1); connection node_2; INSERT INTO t1 VALUES (2); @@ -20,6 +20,8 @@ connection node_4; INSERT INTO t1 VALUES (4); connection node_3; INSERT INTO t1 VALUES (13); +connection node_1; +connection node_3; Killing server ... connection node_1; INSERT INTO t1 VALUES (11); @@ -29,8 +31,11 @@ connection node_4; INSERT INTO t1 VALUES (14); connection node_3; INSERT INTO t1 VALUES (131); +connection node_1; connection node_2; INSERT INTO t1 VALUES (22); +connection node_1; +connection node_2; Killing server ... connection node_1; INSERT INTO t1 VALUES (21); @@ -42,6 +47,8 @@ connection node_2; INSERT INTO t1 VALUES (221); connection node_4; INSERT INTO t1 VALUES (34); +connection node_1; +connection node_4; Killing server ... connection node_1; INSERT INTO t1 VALUES (31); diff --git a/mysql-test/suite/galera/r/galera_wsrep_provider_options_syntax.result b/mysql-test/suite/galera/r/galera_wsrep_provider_options_syntax.result index 5b35bdcef10..36253c5fae9 100644 --- a/mysql-test/suite/galera/r/galera_wsrep_provider_options_syntax.result +++ b/mysql-test/suite/galera/r/galera_wsrep_provider_options_syntax.result @@ -1,7 +1,7 @@ connection node_2; connection node_1; -call mtr.add_suppression("WSREP\: Unknown parameter 'gmcasts\\.segment'"); -call mtr.add_suppression("WSREP\: Set options returned 7"); +call mtr.add_suppression("WSREP: Unknown parameter 'gmcasts\\.segment'"); +call mtr.add_suppression("WSREP: Set options returned 7"); SET GLOBAL wsrep_provider_options="gmcasts.segment=1"; ERROR HY000: Incorrect arguments to SET Unhandled exceptions: 0 diff --git a/mysql-test/suite/galera/r/galera_wsrep_schema_detached.result b/mysql-test/suite/galera/r/galera_wsrep_schema_detached.result index 4667aa98ccc..fbdc7dd7631 100644 --- a/mysql-test/suite/galera/r/galera_wsrep_schema_detached.result +++ b/mysql-test/suite/galera/r/galera_wsrep_schema_detached.result @@ -3,10 +3,17 @@ connection node_1; connection node_1; connection node_2; connection node_1; -call mtr.add_suppression("WSREP:.*"); +call mtr.add_suppression("WSREP: async IST sender failed to serve"); +call mtr.add_suppression("WSREP: Failed to establish connection: Connection refused"); +call mtr.add_suppression("WSREP: IST failed: IST sender, failed to connect"); +call mtr.add_suppression("WSREP: .*State transfer.* failed: Protocol error"); SET @wsrep_provider_options_orig = @@GLOBAL.wsrep_provider_options; SET GLOBAL wsrep_provider_options ='pc.ignore_sb=true;pc.weight=2'; connection node_2; +call mtr.add_suppression("WSREP: async IST sender failed to serve"); +call mtr.add_suppression("WSREP: Failed to establish connection: Connection refused"); +call mtr.add_suppression("WSREP: IST failed: IST sender, failed to connect"); +call mtr.add_suppression("WSREP: .*State transfer.* failed: Protocol error"); SET @wsrep_cluster_address_orig = @@GLOBAL.wsrep_cluster_address; SET GLOBAL WSREP_ON=0; SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; diff --git a/mysql-test/suite/galera/r/mysql-wsrep#198.result b/mysql-test/suite/galera/r/mysql-wsrep#198.result index 5b569ffae27..7759c4f1982 100644 --- a/mysql-test/suite/galera/r/mysql-wsrep#198.result +++ b/mysql-test/suite/galera/r/mysql-wsrep#198.result @@ -31,3 +31,6 @@ test.t1 repair note The storage engine for the table doesn't support repair test.t2 repair note The storage engine for the table doesn't support repair DROP TABLE t1; DROP TABLE t2; +connection node_1; +disconnect node_2a; +disconnect node_2b; diff --git a/mysql-test/suite/galera/t/MDEV-18832.test b/mysql-test/suite/galera/t/MDEV-18832.test index d60be151142..eec8e7dc28a 100644 --- a/mysql-test/suite/galera/t/MDEV-18832.test +++ b/mysql-test/suite/galera/t/MDEV-18832.test @@ -1,5 +1,6 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/have_sequence.inc CREATE SEQUENCE Seq1_1 START WITH 1 INCREMENT BY 1 NOCACHE; CREATE TABLE t1 (Id int(11) NOT NULL, PRIMARY KEY (Id)); diff --git a/mysql-test/suite/galera/t/MDEV-27862.test b/mysql-test/suite/galera/t/MDEV-27862.test index f19d6b5db42..f8dd8d0cff6 100644 --- a/mysql-test/suite/galera/t/MDEV-27862.test +++ b/mysql-test/suite/galera/t/MDEV-27862.test @@ -1,5 +1,6 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/have_sequence.inc --disable_ps2_protocol diff --git a/mysql-test/suite/galera/t/MDEV-32549.test b/mysql-test/suite/galera/t/MDEV-32549.test index a2faa46da5f..b8e58fa4ff9 100644 --- a/mysql-test/suite/galera/t/MDEV-32549.test +++ b/mysql-test/suite/galera/t/MDEV-32549.test @@ -3,6 +3,7 @@ # statement is rolled back # --source include/galera_cluster.inc +--source include/have_aria.inc CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) engine=innodb; CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) engine=aria; diff --git a/mysql-test/suite/galera/t/MDEV-33828.cnf b/mysql-test/suite/galera/t/MDEV-33828.cnf index 4c62448fe3d..1b8791ae398 100644 --- a/mysql-test/suite/galera/t/MDEV-33828.cnf +++ b/mysql-test/suite/galera/t/MDEV-33828.cnf @@ -2,3 +2,12 @@ [mysqld] log-bin +log-slave-updates + +[mysqld.1] +auto-increment-increment=2 +auto-increment-offset=1 + +[mysqld.2] +auto-increment-increment=2 +auto-increment-offset=2 diff --git a/mysql-test/suite/galera/t/MDEV-33828.test b/mysql-test/suite/galera/t/MDEV-33828.test index 8e30481beee..b7eb2ee7d02 100644 --- a/mysql-test/suite/galera/t/MDEV-33828.test +++ b/mysql-test/suite/galera/t/MDEV-33828.test @@ -1,6 +1,5 @@ --source include/galera_cluster.inc --source include/have_innodb.inc ---source include/have_aria.inc SET AUTOCOMMIT=ON; SELECT @@autocommit; diff --git a/mysql-test/suite/galera/t/MDEV-34647.cnf b/mysql-test/suite/galera/t/MDEV-34647.cnf new file mode 100644 index 00000000000..1b8791ae398 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-34647.cnf @@ -0,0 +1,13 @@ +!include ../galera_2nodes.cnf + +[mysqld] +log-bin +log-slave-updates + +[mysqld.1] +auto-increment-increment=2 +auto-increment-offset=1 + +[mysqld.2] +auto-increment-increment=2 +auto-increment-offset=2 diff --git a/mysql-test/suite/galera/t/MDEV-34647.test b/mysql-test/suite/galera/t/MDEV-34647.test index 1697bf05f28..31488b1a4d1 100644 --- a/mysql-test/suite/galera/t/MDEV-34647.test +++ b/mysql-test/suite/galera/t/MDEV-34647.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_aria.inc create table t1(id serial, val varchar(100)) engine=myisam; @@ -38,7 +39,6 @@ insert into t5 select null, 'c'; insert into t5 select null, 'd' from t5; select * from t2; - --connection node_2 select * from t1; select * from t2; @@ -46,8 +46,6 @@ select * from t3; select * from t4; select * from t5; - --connection node_1 drop table t1,t2,t3,t4,t5; set global wsrep_replicate_myisam=default; - diff --git a/mysql-test/suite/galera/t/MW-416.test b/mysql-test/suite/galera/t/MW-416.test index f9a1b47e2ff..9d876233eb4 100644 --- a/mysql-test/suite/galera/t/MW-416.test +++ b/mysql-test/suite/galera/t/MW-416.test @@ -17,30 +17,30 @@ ALTER DATABASE db CHARACTER SET = utf8; ALTER EVENT ev1 RENAME TO ev2; --error 1370 ALTER FUNCTION fun1 COMMENT 'foo'; -#--error 1044,1227 +#--error 1044,1142,1227,1370 #ALTER INSTANCE ROTATE INNODB MASTER KEY; ---error 1044,1227 +--error 1044,1142,1227,1370 ALTER LOGFILE GROUP lfg ADD UNDOFILE 'file' ENGINE=InnoDB; ---error 1044,1227,1370 +--error 1044,1142,1227,1370 ALTER PROCEDURE proc1 COMMENT 'foo'; ---error 1044,1227,1370 +--error 1044,1142,1227,1370 ALTER SERVER srv OPTIONS (USER 'sally'); --error 1044,1142,1227,1370 ALTER TABLE tbl DROP COLUMN col; ---error 1044,1227,1370 +--error 1044,1142,1227,1370 ALTER TABLESPACE tblspc DROP DATAFILE 'file' ENGINE=innodb; --error 1044,1142,1227,1370 ALTER VIEW vw AS SELECT 1; ---error 1044,1227,1370 +--error 1044,1142,1227,1370 CREATE DATABASE db; ---error 1044,1227,1370 +--error 1044,1142,1227,1370 CREATE EVENT ev1 ON SCHEDULE AT CURRENT_TIMESTAMP DO SELECT 1; ---error 1044,1227,1370 +--error 1044,1142,1227,1370 CREATE FUNCTION fun1() RETURNS int RETURN(1); ---error 1044,1227,1370 +--error 1044,1142,1227,1370 CREATE FUNCTION fun1 RETURNS STRING SONAME 'funlib.so'; ---error 1044,1227,1370 +--error 1044,1142,1227,1370 CREATE PROCEDURE proc1() BEGIN END; --error 1044,1142,1227,1370 CREATE INDEX idx ON tbl(id); @@ -57,8 +57,6 @@ CREATE TRIGGER trg BEFORE UPDATE ON t FOR EACH ROW BEGIN END; --error 1044,1142,1227,1370 CREATE VIEW vw AS SELECT 1; - - --error 1044,1142,1227,1370 DROP DATABASE db; --error 1044,1142,1227,1370 @@ -129,4 +127,3 @@ UNINSTALL PLUGIN plg; --connection node_1 DROP USER 'userMW416'@'localhost'; SHOW DATABASES; - diff --git a/mysql-test/suite/galera/t/galera#500.test b/mysql-test/suite/galera/t/galera#500.test index c393b7fd056..cc814af6d31 100644 --- a/mysql-test/suite/galera/t/galera#500.test +++ b/mysql-test/suite/galera/t/galera#500.test @@ -3,7 +3,12 @@ # thrown from gcomm background thread, the provider terminates properly # and wsrep_ready becomes 0. # +# Not to be run with ASAN. Provider leaks memory when gcomm +# thread is aborted forcifully and ASAN crashes during leak report +# after provider is unloaded. +# +--source include/not_asan.inc --source include/have_innodb.inc --source include/galera_cluster.inc --source include/galera_have_debug_sync.inc diff --git a/mysql-test/suite/galera/t/galera_admin.test b/mysql-test/suite/galera/t/galera_admin.test index e3c43256ad5..114208aef3e 100644 --- a/mysql-test/suite/galera/t/galera_admin.test +++ b/mysql-test/suite/galera/t/galera_admin.test @@ -5,7 +5,6 @@ # --source include/galera_cluster.inc ---source include/have_innodb.inc --disable_warnings DROP TABLE IF EXISTS t1, t2; @@ -34,7 +33,6 @@ INSERT INTO x2 (f2) VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); --let $wait_condition = SELECT COUNT(*) = 10000 FROM t2; --source include/wait_condition.inc - --echo # ANALYZE test --connection node_2 --let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` @@ -46,8 +44,6 @@ ANALYZE TABLE t1, t2; --let $wait_condition = SELECT VARIABLE_VALUE = $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' --source include/wait_condition.inc - - --echo # OPTIMIZE test --connection node_2 --let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` @@ -59,8 +55,6 @@ OPTIMIZE TABLE t1, t2; --let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' --source include/wait_condition.inc - - --echo # REPAIR test --connection node_2 --let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` @@ -72,8 +66,6 @@ REPAIR TABLE x1, x2; --let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' --source include/wait_condition.inc - - --connection node_2 SELECT COUNT(*) = 10 FROM t1; SELECT COUNT(*) = 10 FROM x1; @@ -83,4 +75,5 @@ SELECT COUNT(*) = 10 FROM x2; --connection node_1 DROP TABLE t1, t2; DROP TABLE x1, x2; + SET GLOBAL wsrep_replicate_myisam = FALSE; diff --git a/mysql-test/suite/galera/t/galera_backup_stage.test b/mysql-test/suite/galera/t/galera_backup_stage.test index 31d76816355..ef0706f9ab1 100644 --- a/mysql-test/suite/galera/t/galera_backup_stage.test +++ b/mysql-test/suite/galera/t/galera_backup_stage.test @@ -56,7 +56,7 @@ ALTER TABLE t1 ADD COLUMN (f4 int(10)); # reach commit stage. In the unlikely case the interleaving is different, the # result of the test should not change. --connection node_1c ---let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.processlist WHERE State='Commit' AND ID=$insert_id +--let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.processlist WHERE (State='Commit' OR State='Waiting for certification') AND ID=$insert_id --source include/wait_condition.inc --let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.metadata_lock_info WHERE TABLE_NAME='t1' AND THREAD_ID=$insert_id --source include/wait_condition.inc @@ -83,11 +83,11 @@ ALTER TABLE t1 ADD COLUMN (f4 int(10)); # wait for insert to get blocked --connection node_1c ---let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.processlist WHERE State='Commit' AND ID=$insert_id +--let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.processlist WHERE (State='Commit' OR State='Waiting for certification') AND ID=$insert_id --source include/wait_condition.inc --let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.metadata_lock_info WHERE TABLE_NAME='t1' AND THREAD_ID=$insert_id --source include/wait_condition.inc ---let $wait_condition = SELECT COUNT(*)=2 FROM information_schema.processlist WHERE Info like 'INSERT INTO t1 (f1) values("node1%")' AND State = 'Commit' +--let $wait_condition = SELECT COUNT(*)=2 FROM information_schema.processlist WHERE Info like 'INSERT INTO t1 (f1) values("node1%")' AND (State='Commit' or State='Waiting for certification') --source include/wait_condition.inc # nothing after BLOCK_DDL is applied diff --git a/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test b/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test index 994f7695fc6..81bf6738086 100644 --- a/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test +++ b/mysql-test/suite/galera/t/galera_binlog_stmt_autoinc.test @@ -5,15 +5,15 @@ --source include/galera_cluster.inc --source include/force_restart.inc +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + --connection node_1 SET GLOBAL auto_increment_offset=1; --connection node_2 SET GLOBAL auto_increment_offset=2; ---let $node_1=node_1 ---let $node_2=node_2 ---source include/auto_increment_offset_save.inc - ## ## Verify the correct operation of the auto-increment when the binlog ## format artificially set to the 'STATEMENT' (although this mode is diff --git a/mysql-test/suite/galera/t/galera_cache_index.test b/mysql-test/suite/galera/t/galera_cache_index.test index b373a173894..294a13295c4 100644 --- a/mysql-test/suite/galera/t/galera_cache_index.test +++ b/mysql-test/suite/galera/t/galera_cache_index.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/have_innodb.inc CREATE TABLE t1 (c1 int, UNIQUE INDEX (c1)) engine=innodb; INSERT INTO t1 VALUES (1),(2),(3),(4),(5); diff --git a/mysql-test/suite/galera/t/galera_can_run_toi.test b/mysql-test/suite/galera/t/galera_can_run_toi.test index a0087be4304..ea6a34dae30 100644 --- a/mysql-test/suite/galera/t/galera_can_run_toi.test +++ b/mysql-test/suite/galera/t/galera_can_run_toi.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/have_innodb.inc # # MDEV-24833 : Signal 11 on wsrep_can_run_in_toi at wsrep_mysqld.cc:1994 # diff --git a/mysql-test/suite/galera/t/galera_create_trigger.test b/mysql-test/suite/galera/t/galera_create_trigger.test index 6708e30bf0f..1d0d0f846fc 100644 --- a/mysql-test/suite/galera/t/galera_create_trigger.test +++ b/mysql-test/suite/galera/t/galera_create_trigger.test @@ -40,4 +40,3 @@ DROP TABLE definer_root; DROP TABLE definer_default; DROP USER 'user1'; - diff --git a/mysql-test/suite/galera/t/galera_ctas.test b/mysql-test/suite/galera/t/galera_ctas.test index 8b9ad9c4a20..05561204123 100644 --- a/mysql-test/suite/galera/t/galera_ctas.test +++ b/mysql-test/suite/galera/t/galera_ctas.test @@ -1,4 +1,6 @@ --source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_aria.inc --connection node_1 create table t1_Aria(a int, count int, b int, key(b)) engine=Aria; @@ -36,4 +38,3 @@ SHOW CREATE TABLE t4; DROP TABLE t2, t3,t4; DROP TABLE t1_MyISAM, t1_Aria,t1_InnoDB; - diff --git a/mysql-test/suite/galera/t/galera_defaults.test b/mysql-test/suite/galera/t/galera_defaults.test index 74022a40b3a..c43dbe7a705 100644 --- a/mysql-test/suite/galera/t/galera_defaults.test +++ b/mysql-test/suite/galera/t/galera_defaults.test @@ -13,12 +13,12 @@ --source include/force_restart.inc # Make sure that the test is operating on the right version of galera library. ---let $galera_version=26.4.8 +--let $galera_version=26.4.11 source ../wsrep/include/check_galera_version.inc; # Global Variables -SELECT COUNT(*) `expect 49` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%'; +SELECT COUNT(*) `expect 50` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%'; SELECT VARIABLE_NAME, VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES diff --git a/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test index 532de6d5d10..3834607ce86 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test +++ b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test @@ -141,31 +141,31 @@ SET SESSION wsrep_sync_wait = 0; --source include/kill_galera.inc --connection node_1_insert_simple ---error 2013 +--error 2013, 2026 --reap --connection node_1_insert_multi ---error 2013 +--error 2013, 2026 --reap --connection node_1_insert_transaction ---error 2013 +--error 2013, 2026 --reap --connection node_1_update_simple ---error 2013 +--error 2013, 2026 --reap --connection node_1_insert_1k ---error 2013 +--error 2013, 2026 --reap --connection node_1_insert_1m ---error 2013 +--error 2013, 2026 --reap --connection node_1_insert_10m ---error 2013 +--error 2013, 2026 --reap --connection node_1 diff --git a/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test b/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test index 5a33c16c86e..2e9f05cb4af 100644 --- a/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test +++ b/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test @@ -32,19 +32,19 @@ INSERT INTO t2 VALUES (1); --connection node_2a --sleep 1 SET SESSION wsrep_sync_wait=0; -SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%committing%'; -SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Waiting for table metadata lock%'; -SELECT COUNT(*) = 0 FROM t1; -SELECT COUNT(*) = 0 FROM t2; +SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE LIKE '%committing%' or STATE = 'Waiting for certification'); +SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Waiting for table metadata lock%'; +SELECT COUNT(*) AS EXPECT_0 FROM t1; +SELECT COUNT(*) AS EXPECT_0 FROM t2; --connection node_2 UNLOCK TABLES; --connection node_2a --eval SET SESSION wsrep_sync_wait = $wsrep_sync_wait_orig; -SELECT COUNT(*) = 1 FROM t1; -SELECT COUNT(*) = 1 FROM t2; -SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%committed%'; +SELECT COUNT(*) AS EXPECT_1 FROM t1; +SELECT COUNT(*) AS EXPECT_1 FROM t2; +SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE LIKE '%committed%' or STATE = 'Waiting for certification'); --eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_parallel_simple.test b/mysql-test/suite/galera/t/galera_parallel_simple.test index d49dc0ae876..a305473dbbb 100644 --- a/mysql-test/suite/galera/t/galera_parallel_simple.test +++ b/mysql-test/suite/galera/t/galera_parallel_simple.test @@ -51,7 +51,7 @@ SET SESSION wsrep_sync_wait = 0; --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for table metadata lock%'; --source include/wait_condition.inc ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'committing%'; +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE LIKE '%committing%' or STATE = 'Waiting for certification'); --source include/wait_condition.inc UNLOCK TABLES; diff --git a/mysql-test/suite/galera/t/galera_pc_recovery.test b/mysql-test/suite/galera/t/galera_pc_recovery.test index 631054103a3..4489db63a91 100644 --- a/mysql-test/suite/galera/t/galera_pc_recovery.test +++ b/mysql-test/suite/galera/t/galera_pc_recovery.test @@ -33,8 +33,8 @@ SELECT COUNT(*) = 1 FROM t1; # Perform --wsrep-recover and preserve the positions into variables by placing them in $MYSQL_TMP_DIR/galera_wsrep_start_position.inc and then --source'ing it ---exec $MYSQLD --defaults-group-suffix=.1 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --innodb --wsrep-recover --log-error=$MYSQL_TMP_DIR/galera_wsrep_recover.1.log > $MYSQL_TMP_DIR/galera_wsrep_recover.1.log 2>&1 ---exec $MYSQLD --defaults-group-suffix=.2 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --innodb --wsrep-recover --log-error=$MYSQL_TMP_DIR/galera_wsrep_recover.2.log > $MYSQL_TMP_DIR/galera_wsrep_recover.2.log 2>&1 +--exec $MYSQLD --defaults-group-suffix=.1 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --wsrep-recover --loose-innodb --log-error=$MYSQL_TMP_DIR/galera_wsrep_recover.1.log > $MYSQL_TMP_DIR/galera_wsrep_recover.1.log 2>&1 +--exec $MYSQLD --defaults-group-suffix=.2 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --wsrep-recover --loose-innodb --log-error=$MYSQL_TMP_DIR/galera_wsrep_recover.2.log > $MYSQL_TMP_DIR/galera_wsrep_recover.2.log 2>&1 --perl use strict; diff --git a/mysql-test/suite/galera/t/galera_read_only.test b/mysql-test/suite/galera/t/galera_read_only.test index 56fe2fdd910..14d05322859 100644 --- a/mysql-test/suite/galera/t/galera_read_only.test +++ b/mysql-test/suite/galera/t/galera_read_only.test @@ -47,4 +47,3 @@ DROP TABLE t2; SET GLOBAL read_only=FALSE; DROP TABLE t1; DROP USER foo@localhost; - diff --git a/mysql-test/suite/galera/t/galera_sequence_engine.test b/mysql-test/suite/galera/t/galera_sequence_engine.test index 47107dcce84..affdfaa9d2a 100644 --- a/mysql-test/suite/galera/t/galera_sequence_engine.test +++ b/mysql-test/suite/galera/t/galera_sequence_engine.test @@ -1,6 +1,13 @@ --source include/galera_cluster.inc --source include/have_sequence.inc +--connection node_2 +let $restore_wsrep_ignore_apply_errors=`SELECT @@GLOBAL.wsrep_ignore_apply_errors`; +SET GLOBAL wsrep_ignore_apply_errors=0; + +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--connection node_2a +SET SESSION wsrep_sync_wait=0; SET GLOBAL wsrep_ignore_apply_errors=0; SET SESSION AUTOCOMMIT=0; SET SESSION max_error_count=0; @@ -11,6 +18,8 @@ CREATE TABLE t0 (id GEOMETRY,parent_id GEOMETRY)ENGINE=SEQUENCE; --error ER_NO_SUCH_TABLE SHOW CREATE TABLE t0; ---connection node_1 -SET GLOBAL wsrep_ignore_apply_errors=DEFAULT; +--disable_query_log +--eval SET GLOBAL wsrep_ignore_apply_errors=$restore_wsrep_ignore_apply_errors +--enable_query_log +--disconnect node_2a diff --git a/mysql-test/suite/galera/t/galera_sequences.test b/mysql-test/suite/galera/t/galera_sequences.test index 75a31b224b9..2c7929e15b2 100644 --- a/mysql-test/suite/galera/t/galera_sequences.test +++ b/mysql-test/suite/galera/t/galera_sequences.test @@ -1,5 +1,6 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/have_sequence.inc # # MDEV-19353 : Alter Sequence do not replicate to another nodes with in Galera Cluster @@ -283,8 +284,11 @@ CREATE SEQUENCE t INCREMENT BY 0 CACHE=20 ENGINE=INNODB; ALTER TABLE t ENGINE=MYISAM; --error ER_NOT_SUPPORTED_YET ALTER SEQUENCE t INCREMENT BY 1 CACHE=10; +--error ER_NOT_SUPPORTED_YET ALTER SEQUENCE t INCREMENT BY 1 NOCACHE; +--error ER_NOT_SUPPORTED_YET ALTER SEQUENCE t INCREMENT BY 0 NOCACHE; +--error ER_NOT_SUPPORTED_YET ALTER SEQUENCE t INCREMENT BY 0 CACHE=10; DROP SEQUENCE t; diff --git a/mysql-test/suite/galera/t/galera_toi_ddl_fk_insert.test b/mysql-test/suite/galera/t/galera_toi_ddl_fk_insert.test index 3b4b427f551..fadc94d78ff 100644 --- a/mysql-test/suite/galera/t/galera_toi_ddl_fk_insert.test +++ b/mysql-test/suite/galera/t/galera_toi_ddl_fk_insert.test @@ -54,11 +54,15 @@ INSERT INTO parent VALUES (1, 0); --connection node_2a --reap -# -# ALTER TABLE could bf kill one or more of INSERTs to parent, so -# the actual number of rows in PARENT depends on whether -# the INSERT is committed before ALTER TABLE is executed -# +--connection node_1 +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) FROM parent; +SELECT COUNT(*) FROM child; + +--connection node_2 +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) FROM parent; +SELECT COUNT(*) FROM child; DROP TABLE child; DROP TABLE parent; diff --git a/mysql-test/suite/galera/t/galera_var_reject_queries.test b/mysql-test/suite/galera/t/galera_var_reject_queries.test index 60aabe9bc17..6584eb1f736 100644 --- a/mysql-test/suite/galera/t/galera_var_reject_queries.test +++ b/mysql-test/suite/galera/t/galera_var_reject_queries.test @@ -22,11 +22,11 @@ SELECT * FROM t1; # Original behavior was lost connection, # but since 10.1, we allow controlling connection to remain alive # ---error 0,2013 +--error 0,2013,2026 SET GLOBAL wsrep_reject_queries = ALL_KILL; --connection node_1a ---error ER_CONNECTION_KILLED,2013,2006 +--error ER_CONNECTION_KILLED,2013,2006,2026 SELECT * FROM t1; --connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1 diff --git a/mysql-test/suite/galera/t/galera_var_retry_autocommit.test b/mysql-test/suite/galera/t/galera_var_retry_autocommit.test index c58eba1410e..8009fe88c65 100644 --- a/mysql-test/suite/galera/t/galera_var_retry_autocommit.test +++ b/mysql-test/suite/galera/t/galera_var_retry_autocommit.test @@ -64,6 +64,7 @@ SELECT COUNT(*) FROM t1; SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue'; --connection node_1 +--error 0,ER_LOCK_DEADLOCK --reap SELECT COUNT(*) FROM t1; diff --git a/mysql-test/suite/galera/t/galera_wan.cnf b/mysql-test/suite/galera/t/galera_wan.cnf index df1d55928dc..5f86e1cb61e 100644 --- a/mysql-test/suite/galera/t/galera_wan.cnf +++ b/mysql-test/suite/galera/t/galera_wan.cnf @@ -14,4 +14,3 @@ wsrep_provider_options='base_port=@mysqld.3.#galera_port;gcache.size=10M;gmcast. [mysqld.4] wsrep_provider_options='base_port=@mysqld.4.#galera_port;gcache.size=10M;gmcast.segment=3' - diff --git a/mysql-test/suite/galera/t/galera_wan.test b/mysql-test/suite/galera/t/galera_wan.test index ab2346ebe94..d148569d2cc 100644 --- a/mysql-test/suite/galera/t/galera_wan.test +++ b/mysql-test/suite/galera/t/galera_wan.test @@ -10,10 +10,10 @@ --source include/have_innodb.inc --source include/force_restart.inc -CALL mtr.add_suppression("WSREP: Stray state UUID msg:"); -CALL mtr.add_suppression("Sending JOIN failed: "); -CALL mtr.add_suppression("WSREP: .* sending install message failed: Socket is not connected"); -CALL mtr.add_suppression("There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); +CALL mtr.add_suppression("WSREP: Stray state UUID msg: "); +CALL mtr.add_suppression("WSREP: .*Sending JOIN failed: "); +CALL mtr.add_suppression("WSREP: .*sending install message failed: Socket is not connected"); +CALL mtr.add_suppression("WSREP: .*There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); --let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; --source include/wait_condition.inc @@ -42,8 +42,8 @@ SELECT VARIABLE_VALUE LIKE '%gmcast.segment = 3%' FROM INFORMATION_SCHEMA.GLOBAL DROP TABLE t1; --connection node_1 -call mtr.add_suppression("WSREP: read_completion_condition.*"); -call mtr.add_suppression("WSREP: read_handler.*"); +call mtr.add_suppression("WSREP: read_completion_condition"); +call mtr.add_suppression("WSREP: read_handler"); --disconnect node_3 --disconnect node_4 diff --git a/mysql-test/suite/galera/t/galera_wan_restart_ist.cnf b/mysql-test/suite/galera/t/galera_wan_restart_ist.cnf index 0a230f5324f..941ce694f0b 100644 --- a/mysql-test/suite/galera/t/galera_wan_restart_ist.cnf +++ b/mysql-test/suite/galera/t/galera_wan_restart_ist.cnf @@ -14,4 +14,3 @@ wsrep_provider_options='base_port=@mysqld.3.#galera_port;gmcast.segment=2' [mysqld.4] wsrep_provider_options='base_port=@mysqld.4.#galera_port;gmcast.segment=2' - diff --git a/mysql-test/suite/galera/t/galera_wan_restart_sst.test b/mysql-test/suite/galera/t/galera_wan_restart_sst.test index 8485c0db2a7..eca59bd9165 100644 --- a/mysql-test/suite/galera/t/galera_wan_restart_sst.test +++ b/mysql-test/suite/galera/t/galera_wan_restart_sst.test @@ -29,7 +29,7 @@ SELECT VARIABLE_VALUE AS EXPECT_4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; --connection node_1 -CREATE TABLE t1 (f1 INTEGER); +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=INNODB; INSERT INTO t1 VALUES (1); --connection node_2 @@ -47,10 +47,20 @@ INSERT INTO t1 VALUES (4); --connection node_3 INSERT INTO t1 VALUES (13); - ---source include/kill_galera.inc +--let $wait_condition = SELECT COUNT(*) = 5 FROM t1; +--source include/wait_condition.inc --connection node_1 +--let $wait_condition = SELECT COUNT(*) = 5 FROM t1; +--source include/wait_condition.inc + +--connection node_3 +--source include/kill_galera.inc +--remove_file $MYSQLTEST_VARDIR/mysqld.3/data/grastate.dat + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc INSERT INTO t1 VALUES (11); --connection node_2 @@ -64,6 +74,10 @@ INSERT INTO t1 VALUES (14); INSERT INTO t1 VALUES (131); +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + # # Restart node #2 # @@ -71,9 +85,17 @@ INSERT INTO t1 VALUES (131); --connection node_2 INSERT INTO t1 VALUES (22); +--connection node_1 +--let $wait_condition = SELECT COUNT(*) = 10 FROM t1; +--source include/wait_condition.inc + +--connection node_2 --source include/kill_galera.inc +--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat --connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc INSERT INTO t1 VALUES (21); --connection node_3 @@ -92,11 +114,21 @@ INSERT INTO t1 VALUES (221); # --connection node_4 +--let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc INSERT INTO t1 VALUES (34); +--connection node_1 +--let $wait_condition = SELECT COUNT(*) = 15 FROM t1; +--source include/wait_condition.inc + +--connection node_4 --source include/kill_galera.inc +--remove_file $MYSQLTEST_VARDIR/mysqld.4/data/grastate.dat --connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc INSERT INTO t1 VALUES (31); --connection node_2 @@ -107,6 +139,7 @@ INSERT INTO t1 VALUES (33); --connection node_4 --source include/start_mysqld.inc +--remove_file $MYSQLTEST_VARDIR/mysqld.4/data/grastate.dat INSERT INTO t1 VALUES (341); diff --git a/mysql-test/suite/galera/t/galera_wsrep_provider_options_syntax.test b/mysql-test/suite/galera/t/galera_wsrep_provider_options_syntax.test index 04d78a306a8..c70dede09a3 100644 --- a/mysql-test/suite/galera/t/galera_wsrep_provider_options_syntax.test +++ b/mysql-test/suite/galera/t/galera_wsrep_provider_options_syntax.test @@ -5,8 +5,8 @@ --source include/have_innodb.inc --let LOGF=$MYSQLTEST_VARDIR/log/mysqld.1.err --disable_info -call mtr.add_suppression("WSREP\: Unknown parameter 'gmcasts\\.segment'"); -call mtr.add_suppression("WSREP\: Set options returned 7"); +call mtr.add_suppression("WSREP: Unknown parameter 'gmcasts\\.segment'"); +call mtr.add_suppression("WSREP: Set options returned 7"); --error ER_WRONG_ARGUMENTS SET GLOBAL wsrep_provider_options="gmcasts.segment=1"; # Search for unhandled exception message. diff --git a/mysql-test/suite/galera/t/galera_wsrep_schema_detached.test b/mysql-test/suite/galera/t/galera_wsrep_schema_detached.test index cddf4d6315a..383931539da 100644 --- a/mysql-test/suite/galera/t/galera_wsrep_schema_detached.test +++ b/mysql-test/suite/galera/t/galera_wsrep_schema_detached.test @@ -6,11 +6,22 @@ --source include/auto_increment_offset_save.inc --connection node_1 -call mtr.add_suppression("WSREP:.*"); + +call mtr.add_suppression("WSREP: async IST sender failed to serve"); +call mtr.add_suppression("WSREP: Failed to establish connection: Connection refused"); +call mtr.add_suppression("WSREP: IST failed: IST sender, failed to connect"); +call mtr.add_suppression("WSREP: .*State transfer.* failed: Protocol error"); + SET @wsrep_provider_options_orig = @@GLOBAL.wsrep_provider_options; SET GLOBAL wsrep_provider_options ='pc.ignore_sb=true;pc.weight=2'; --connection node_2 + +call mtr.add_suppression("WSREP: async IST sender failed to serve"); +call mtr.add_suppression("WSREP: Failed to establish connection: Connection refused"); +call mtr.add_suppression("WSREP: IST failed: IST sender, failed to connect"); +call mtr.add_suppression("WSREP: .*State transfer.* failed: Protocol error"); + SET @wsrep_cluster_address_orig = @@GLOBAL.wsrep_cluster_address; SET GLOBAL WSREP_ON=0; SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; diff --git a/mysql-test/suite/galera/t/mysql-wsrep#198.test b/mysql-test/suite/galera/t/mysql-wsrep#198.test index 2c89f859328..aba05ed8bf9 100644 --- a/mysql-test/suite/galera/t/mysql-wsrep#198.test +++ b/mysql-test/suite/galera/t/mysql-wsrep#198.test @@ -39,3 +39,8 @@ UNLOCK TABLES; DROP TABLE t1; DROP TABLE t2; + +--connection node_1 + +--disconnect node_2a +--disconnect node_2b diff --git a/mysql-test/suite/galera/t/mysql_tzinfo_to_sql.test b/mysql-test/suite/galera/t/mysql_tzinfo_to_sql.test index 6bfad2f18b5..4ee07044c3d 100644 --- a/mysql-test/suite/galera/t/mysql_tzinfo_to_sql.test +++ b/mysql-test/suite/galera/t/mysql_tzinfo_to_sql.test @@ -9,6 +9,7 @@ --echo # MDEV-28263: mariadb-tzinfo-to-sql improve wsrep and binlog cases --echo # +--exec rm -rf $MYSQLTEST_VARDIR/zoneinfo --exec mkdir $MYSQLTEST_VARDIR/zoneinfo --exec ln -s $MYSQLTEST_VARDIR/zoneinfo $MYSQLTEST_VARDIR/zoneinfo/posix --copy_file std_data/zoneinfo/GMT $MYSQLTEST_VARDIR/zoneinfo/GMT diff --git a/mysql-test/suite/galera/t/wsrep_strict_ddl.test b/mysql-test/suite/galera/t/wsrep_strict_ddl.test index c0a0cd756ba..ecec23b8fa7 100644 --- a/mysql-test/suite/galera/t/wsrep_strict_ddl.test +++ b/mysql-test/suite/galera/t/wsrep_strict_ddl.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/have_aria.inc call mtr.add_suppression("WSREP: ALTER TABLE isolation failure"); diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def index bb9d7cbd7b8..6fbfda9a07f 100644 --- a/mysql-test/suite/galera_3nodes/disabled.def +++ b/mysql-test/suite/galera_3nodes/disabled.def @@ -11,4 +11,3 @@ ############################################################################## galera_2_cluster : MDEV-32631 galera_2_cluster: before_rollback(): Assertion `0' failed -galera_nbo_master_phase_two_crash : MENT-2215 Test failure on galera_3nodes.galera_nbo_master_non_prim_failure diff --git a/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result b/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result index e966a36fb79..f6468910992 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result +++ b/mysql-test/suite/galera_3nodes/r/galera_safe_to_bootstrap.result @@ -47,7 +47,7 @@ CALL mtr.add_suppression("Plugin 'wsrep' init function returned error\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a FUNCTION failed\\."); CALL mtr.add_suppression("Failed to initialize plugins\\."); -CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\)"); +CALL mtr.add_suppression("WSREP: gcs/src/gcs_core\\.cpp:core_handle_uuid_msg\\(\\)"); connection node_3; CALL mtr.add_suppression("WSREP: no nodes coming from prim view, prim not possible"); CALL mtr.add_suppression("WSREP: It may not be safe to bootstrap the cluster from this node"); @@ -61,7 +61,7 @@ CALL mtr.add_suppression("Plugin 'wsrep' init function returned error\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a FUNCTION failed\\."); CALL mtr.add_suppression("Failed to initialize plugins\\."); -CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\)"); +CALL mtr.add_suppression("WSREP: gcs/src/gcs_core\\.cpp:core_handle_uuid_msg\\(\\)"); SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( diff --git a/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test b/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test index 8fc9e492342..e59fcfb2100 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test +++ b/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test @@ -11,8 +11,8 @@ --source include/have_innodb.inc --connect node_5, 127.0.0.1, root, , test, $NODE_MYPORT_5 - --connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 + --connection node_4 --replace_result $NODE_MYPORT_1 NODE_MYPORT_1 diff --git a/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.cnf b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.cnf index bc64d114275..dc4f414d2c4 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.cnf @@ -3,6 +3,7 @@ # following tests such as galera_3nodes.galera_var_dirty_reads2 !include ../galera_2x3nodes.cnf + [mysqld.1] wsrep_gtid_domain_id=1 server-id=11 diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test index 0e0112f86c7..12399840896 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.test @@ -20,7 +20,6 @@ call mtr.add_suppression("Failed to load slave replication state from table mysq CREATE USER 'sst'; GRANT ALL PRIVILEGES ON *.* TO 'sst'; ---let $wsrep_sst_auth_orig = `SELECT @@wsrep_sst_auth` SET GLOBAL wsrep_sst_auth = 'sst:'; --connection node_2 diff --git a/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test index eb41137b8b3..71ca82be1d5 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test +++ b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test @@ -195,7 +195,7 @@ CALL mtr.add_suppression("Plugin 'wsrep' init function returned error\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a FUNCTION failed\\."); CALL mtr.add_suppression("Failed to initialize plugins\\."); -CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\)"); +CALL mtr.add_suppression("WSREP: gcs/src/gcs_core\\.cpp:core_handle_uuid_msg\\(\\)"); --connection node_3 CALL mtr.add_suppression("WSREP: no nodes coming from prim view, prim not possible"); @@ -210,7 +210,7 @@ CALL mtr.add_suppression("Plugin 'wsrep' init function returned error\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a STORAGE ENGINE failed\\."); CALL mtr.add_suppression("Plugin 'wsrep' registration as a FUNCTION failed\\."); CALL mtr.add_suppression("Failed to initialize plugins\\."); -CALL mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\)"); +CALL mtr.add_suppression("WSREP: gcs/src/gcs_core\\.cpp:core_handle_uuid_msg\\(\\)"); SHOW CREATE TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/r/GCF-832.result b/mysql-test/suite/galera_3nodes_sr/r/GCF-832.result index 8333fff98db..ef21e4ca347 100644 --- a/mysql-test/suite/galera_3nodes_sr/r/GCF-832.result +++ b/mysql-test/suite/galera_3nodes_sr/r/GCF-832.result @@ -6,20 +6,26 @@ connection node_2; connection node_3; connection node_2; SET GLOBAL debug_dbug="d,crash_last_fragment_commit_after_fragment_removal"; -CREATE TABLE t1 (f1 VARCHAR(30)) ENGINE=InnoDB; +CREATE TABLE t1 (f1 VARCHAR(30) not null primary key) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; SET SESSION wsrep_trx_fragment_size=1; START TRANSACTION; -INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); +INSERT INTO t1 VALUES ('primary1'),('primary2'),('primary3'),('primary4'),('primary5'); COMMIT; -ERROR HY000: Lost connection to MySQL server during query +Got one of the listed errors +connection node_1; +connection node_2; # restart connection node_1; SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; COUNT(*) = 0 1 +SELECT * FROM t1; +f1 connection node_2; SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; COUNT(*) = 0 1 +SELECT * FROM t1; +f1 DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_before_apply.result b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_before_apply.result index ef2bd7a45e1..08e3fc6c3e3 100644 --- a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_before_apply.result +++ b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_before_apply.result @@ -44,6 +44,7 @@ connection node_2; SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; EXPECT_0 0 +call mtr.add_suppression("WSREP: node uuid:.*"); connection node_1; DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test index d18ec470c50..700b3c38b6b 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test +++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test @@ -4,6 +4,7 @@ # --source include/galera_cluster.inc --source include/have_debug_sync.inc +--source include/force_restart.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 # Save original auto_increment_offset values. @@ -13,30 +14,42 @@ --source ../galera/include/auto_increment_offset_save.inc --connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + SET GLOBAL debug_dbug="d,crash_last_fragment_commit_after_fragment_removal"; --let $_expect_file_name= `select regexp_replace(@@tmpdir, '^.*/','')` --let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/$_expect_file_name.expect --write_line wait $_expect_file_name -CREATE TABLE t1 (f1 VARCHAR(30)) ENGINE=InnoDB; +CREATE TABLE t1 (f1 VARCHAR(30) not null primary key) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; SET SESSION wsrep_trx_fragment_size=1; START TRANSACTION; -INSERT INTO t1 VALUES ('primary'),('primary'),('primary'),('primary'),('primary'); ---error 2013 +INSERT INTO t1 VALUES ('primary1'),('primary2'),('primary3'),('primary4'),('primary5'); +--error 2013,2026 COMMIT; +--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 + +--connection node_2 --source include/start_mysqld.inc --connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +SELECT * FROM t1; --connection node_2 --enable_reconnect SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; +SELECT * FROM t1; DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test index 355db2de456..58d744e704d 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test @@ -6,6 +6,7 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/force_restart.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 # Save original auto_increment_offset values. @@ -86,6 +87,8 @@ SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; --connection node_2 SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +# As noted above sometimes node delivers the same view twice +call mtr.add_suppression("WSREP: node uuid:.*"); --connection node_1 DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/disabled.def b/mysql-test/suite/galera_sr/disabled.def index 0371f0f589f..fcaf38a3d7b 100644 --- a/mysql-test/suite/galera_sr/disabled.def +++ b/mysql-test/suite/galera_sr/disabled.def @@ -9,5 +9,3 @@ # Do not use any TAB characters for whitespace. # ############################################################################## - -GCF-1060 : MDEV-32160 GCF-1060 test failure due to wsrep MDL conflict diff --git a/mysql-test/suite/galera_sr/r/GCF-572.result b/mysql-test/suite/galera_sr/r/GCF-572.result index 41ae2378a3f..8bffe4fcc25 100644 --- a/mysql-test/suite/galera_sr/r/GCF-572.result +++ b/mysql-test/suite/galera_sr/r/GCF-572.result @@ -37,8 +37,9 @@ f1 f2 SET SESSION wsrep_trx_fragment_size = 10000; START TRANSACTION; INSERT INTO t1 VALUE (10, 'node1'); -SELECT * FROM mysql.wsrep_streaming_log; -node_uuid trx_id seqno flags frag +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; +COUNT(*) +0 connection node_1a; INSERT INTO t1 VALUES(15, 'node2'); connection node_1; diff --git a/mysql-test/suite/galera_sr/r/MDEV-18585.result b/mysql-test/suite/galera_sr/r/MDEV-18585.result index d30def1ea63..35a1e8d1d11 100644 --- a/mysql-test/suite/galera_sr/r/MDEV-18585.result +++ b/mysql-test/suite/galera_sr/r/MDEV-18585.result @@ -14,23 +14,23 @@ SET SESSION wsrep_trx_fragment_unit=default; SET SESSION wsrep_trx_fragment_size=default; SHOW BINLOG EVENTS IN 'mysqld-bin.000002' FROM 518; Log_name Pos Event_type Server_id End_log_pos Info -mysqld-bin.000002 518 Gtid 1 560 BEGIN GTID 0-1-2 -mysqld-bin.000002 560 Annotate_rows 1 613 INSERT INTO t1 VALUES (1), (2) -mysqld-bin.000002 613 Table_map 1 658 table_id: # (test.t1) -mysqld-bin.000002 658 Write_rows_v1 1 696 table_id: # flags: STMT_END_F -mysqld-bin.000002 696 Table_map 1 741 table_id: # (test.t1) -mysqld-bin.000002 741 Write_rows_v1 1 779 table_id: # flags: STMT_END_F -mysqld-bin.000002 779 Xid 1 810 COMMIT /* xid=# */ -mysqld-bin.000002 810 Gtid 1 852 BEGIN GTID 0-1-3 -mysqld-bin.000002 852 Annotate_rows 1 905 INSERT INTO t1 VALUES (3), (4) -mysqld-bin.000002 905 Table_map 1 950 table_id: # (test.t1) -mysqld-bin.000002 950 Write_rows_v1 1 988 table_id: # flags: STMT_END_F -mysqld-bin.000002 988 Table_map 1 1033 table_id: # (test.t1) -mysqld-bin.000002 1033 Write_rows_v1 1 1071 table_id: # flags: STMT_END_F -mysqld-bin.000002 1071 Xid 1 1102 COMMIT /* xid=# */ -mysqld-bin.000002 1102 Gtid 1 1144 BEGIN GTID 0-1-4 -mysqld-bin.000002 1144 Annotate_rows 1 1197 INSERT INTO t1 VALUES (5), (6) -mysqld-bin.000002 1197 Table_map 1 1242 table_id: # (test.t1) -mysqld-bin.000002 1242 Write_rows_v1 1 1285 table_id: # flags: STMT_END_F -mysqld-bin.000002 1285 Xid 1 1316 COMMIT /* xid=# */ +mysqld-bin.000002 # Gtid 1 # BEGIN GTID 0-1-2 +mysqld-bin.000002 # Annotate_rows 1 # INSERT INTO t1 VALUES (1), (2) +mysqld-bin.000002 # Table_map 1 # table_id: # (test.t1) +mysqld-bin.000002 # Write_rows_v1 1 # table_id: # flags: STMT_END_F +mysqld-bin.000002 # Table_map 1 # table_id: # (test.t1) +mysqld-bin.000002 # Write_rows_v1 1 # table_id: # flags: STMT_END_F +mysqld-bin.000002 # Xid 1 # COMMIT /* xid=# */ +mysqld-bin.000002 # Gtid 1 # BEGIN GTID 0-1-3 +mysqld-bin.000002 # Annotate_rows 1 # INSERT INTO t1 VALUES (3), (4) +mysqld-bin.000002 # Table_map 1 # table_id: # (test.t1) +mysqld-bin.000002 # Write_rows_v1 1 # table_id: # flags: STMT_END_F +mysqld-bin.000002 # Table_map 1 # table_id: # (test.t1) +mysqld-bin.000002 # Write_rows_v1 1 # table_id: # flags: STMT_END_F +mysqld-bin.000002 # Xid 1 # COMMIT /* xid=# */ +mysqld-bin.000002 # Gtid 1 # BEGIN GTID 0-1-4 +mysqld-bin.000002 # Annotate_rows 1 # INSERT INTO t1 VALUES (5), (6) +mysqld-bin.000002 # Table_map 1 # table_id: # (test.t1) +mysqld-bin.000002 # Write_rows_v1 1 # table_id: # flags: STMT_END_F +mysqld-bin.000002 # Xid 1 # COMMIT /* xid=# */ DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/r/MDEV-27615.result b/mysql-test/suite/galera_sr/r/MDEV-27615.result index a3475811285..8965cc8e99e 100644 --- a/mysql-test/suite/galera_sr/r/MDEV-27615.result +++ b/mysql-test/suite/galera_sr/r/MDEV-27615.result @@ -15,7 +15,7 @@ SET DEBUG_SYNC='now WAIT_FOR before_fragment'; SET GLOBAL wsrep_cluster_address = ''; SET DEBUG_SYNC = 'now SIGNAL continue'; connection node_2; -ERROR HY000: Lost connection to MySQL server during query +Got one of the listed errors connection node_2a; SELECT * FROM mysql.wsrep_streaming_log; node_uuid trx_id seqno flags frag diff --git a/mysql-test/suite/galera_sr/r/MENT-2042.result b/mysql-test/suite/galera_sr/r/MENT-2042.result new file mode 100644 index 00000000000..a2b63cc6fa6 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/MENT-2042.result @@ -0,0 +1,24 @@ +connection node_2; +connection node_1; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); +SET DEBUG_SYNC='trans_xa_commit_after_acquire_commit_lock SIGNAL before_commit WAIT_FOR continue'; +XA START 'a'; +INSERT INTO t1 VALUES(1); +XA END 'a'; +XA PREPARE 'a'; +XA COMMIT 'a';; +connection node_1a; +SET DEBUG_SYNC='now WAIT_FOR before_commit'; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection node_1; +ERROR 70100: Query execution was interrupted +Expect transaction 'a' in prepared state +XA RECOVER; +formatID gtrid_length bqual_length data +1 1 0 a +XA ROLLBACK 'a'; +DROP TABLE t1; +SET DEBUG_SYNC = 'RESET'; +disconnect node_1a; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result b/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result index 5d1416d3fa7..433cfa4e459 100644 --- a/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result +++ b/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result @@ -27,7 +27,7 @@ SET GLOBAL wsrep_cluster_address = ''; SET SESSION wsrep_sync_wait = DEFAULT; connection node_2; INSERT INTO t1 VALUES (6); -ERROR HY000: Lost connection to MySQL server during query +Got one of the listed errors connection node_1; SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; EXPECT_0 diff --git a/mysql-test/suite/galera_sr/t/GCF-572.test b/mysql-test/suite/galera_sr/t/GCF-572.test index be77451a332..bba68c1d822 100644 --- a/mysql-test/suite/galera_sr/t/GCF-572.test +++ b/mysql-test/suite/galera_sr/t/GCF-572.test @@ -61,7 +61,7 @@ SET SESSION wsrep_trx_fragment_size = 10000; START TRANSACTION; INSERT INTO t1 VALUE (10, 'node1'); -SELECT * FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) FROM mysql.wsrep_streaming_log; --connection node_1a INSERT INTO t1 VALUES(15, 'node2'); diff --git a/mysql-test/suite/galera_sr/t/MDEV-18585.test b/mysql-test/suite/galera_sr/t/MDEV-18585.test index 18bbbe8f7e0..7535b524a6d 100644 --- a/mysql-test/suite/galera_sr/t/MDEV-18585.test +++ b/mysql-test/suite/galera_sr/t/MDEV-18585.test @@ -12,6 +12,8 @@ CREATE TABLE t1 (f1 INT PRIMARY KEY); SET SESSION wsrep_trx_fragment_unit='ROWS'; SET SESSION wsrep_trx_fragment_size=1; +--let $start_pos= query_get_value(SHOW MASTER STATUS, Position, 1) + INSERT INTO t1 VALUES (1), (2); # @@ -37,6 +39,7 @@ SET SESSION wsrep_trx_fragment_unit=default; SET SESSION wsrep_trx_fragment_size=default; --replace_regex /table_id: [0-9]+/table_id: #/ /xid=[0-9]+/xid=#/ -SHOW BINLOG EVENTS IN 'mysqld-bin.000002' FROM 518; +--replace_column 2 # 5 # +--eval SHOW BINLOG EVENTS IN 'mysqld-bin.000002' FROM $start_pos DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/MDEV-27615.test b/mysql-test/suite/galera_sr/t/MDEV-27615.test index 121a85fb20c..8cc425aa7e1 100644 --- a/mysql-test/suite/galera_sr/t/MDEV-27615.test +++ b/mysql-test/suite/galera_sr/t/MDEV-27615.test @@ -43,7 +43,8 @@ SET DEBUG_SYNC = 'now SIGNAL continue'; # Disconnect causes connection to node_2 to be closed # --connection node_2 ---error 2013 # CR_SERVER_LOST +# CR_SERVER_LOST, CR_SSL_CONNECTION_ERROR +--error 2013,2026 --reap diff --git a/mysql-test/suite/galera_sr/t/MDEV-28971.test b/mysql-test/suite/galera_sr/t/MDEV-28971.test index 81238f94b4a..8fdcf4aa780 100644 --- a/mysql-test/suite/galera_sr/t/MDEV-28971.test +++ b/mysql-test/suite/galera_sr/t/MDEV-28971.test @@ -4,6 +4,7 @@ # --source include/galera_cluster.inc +--source include/have_sequence.inc CREATE SEQUENCE SEQ NOCACHE ENGINE=InnoDB; SET SESSION wsrep_trx_fragment_size=1; diff --git a/mysql-test/suite/galera_sr/t/MENT-2042.test b/mysql-test/suite/galera_sr/t/MENT-2042.test new file mode 100644 index 00000000000..34e8ee45551 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/MENT-2042.test @@ -0,0 +1,54 @@ +# +# MENT-2042 Assertion `bf_aborted()' failed in wsrep::transaction::xa_replay_common() +# + +--source include/galera_cluster.inc +--source include/have_debug_sync.inc + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 + +--connection node_1 +--let connection_id = `SELECT CONNECTION_ID()` + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); + +# +# Execute XA transaction up to COMMIT +# + +SET DEBUG_SYNC='trans_xa_commit_after_acquire_commit_lock SIGNAL before_commit WAIT_FOR continue'; +XA START 'a'; +INSERT INTO t1 VALUES(1); +XA END 'a'; +XA PREPARE 'a'; +--send XA COMMIT 'a'; + +# +# Kill the XA COMMIT statement. If bug is present the +# assertion fires. +# +--connection node_1a +SET DEBUG_SYNC='now WAIT_FOR before_commit'; +--disable_query_log +--eval KILL QUERY $connection_id +--enable_query_log +SET DEBUG_SYNC = 'now SIGNAL continue'; + +# +# Expect that the query is interrupted, and the transaction +# is still in prepared state +# +--connection node_1 +--error ER_QUERY_INTERRUPTED +--reap + +--echo Expect transaction 'a' in prepared state +XA RECOVER; + +# +# Cleanup +# +XA ROLLBACK 'a'; +DROP TABLE t1; +SET DEBUG_SYNC = 'RESET'; +--disconnect node_1a diff --git a/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test b/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test index 25cd8f3005b..563f115ecf1 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test +++ b/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test @@ -51,7 +51,7 @@ SET GLOBAL wsrep_cluster_address = ''; SET SESSION wsrep_sync_wait = DEFAULT; --connection node_2 ---error 2013 # CR_SERVER_LOST +--error 2013,2026 INSERT INTO t1 VALUES (6); --connection node_1 diff --git a/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.test b/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.test index 50378b2a9bd..9df4392375a 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.test +++ b/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.test @@ -85,4 +85,3 @@ SET SESSION wsrep_trx_fragment_size=0; # Restore original auto_increment_offset values. --source ../galera/include/auto_increment_offset_restore.inc - diff --git a/mysql-test/suite/wsrep/t/pool_of_threads.test b/mysql-test/suite/wsrep/t/pool_of_threads.test index 8e95d0ca495..f035236da0e 100644 --- a/mysql-test/suite/wsrep/t/pool_of_threads.test +++ b/mysql-test/suite/wsrep/t/pool_of_threads.test @@ -1,3 +1,4 @@ +--source include/have_innodb.inc --source include/have_wsrep_enabled.inc --source include/have_binlog_format_row.inc diff --git a/mysql-test/suite/wsrep/t/variables.test b/mysql-test/suite/wsrep/t/variables.test index 3f3363d8f26..762d783a09c 100644 --- a/mysql-test/suite/wsrep/t/variables.test +++ b/mysql-test/suite/wsrep/t/variables.test @@ -23,4 +23,3 @@ SHOW STATUS LIKE 'wsrep_thread_count'; --echo # variables SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE "wsrep%" ORDER BY VARIABLE_NAME; - diff --git a/mysql-test/suite/wsrep/t/variables_debug.test b/mysql-test/suite/wsrep/t/variables_debug.test index 4d0de10ed0a..e55dbd4fa1f 100644 --- a/mysql-test/suite/wsrep/t/variables_debug.test +++ b/mysql-test/suite/wsrep/t/variables_debug.test @@ -8,7 +8,7 @@ --let $galera_version=26.4.21 source include/check_galera_version.inc; -source include/galera_variables_ok.inc; +source include/galera_variables_ok_debug.inc; --replace_column 2 # SHOW GLOBAL STATUS LIKE 'wsrep%'; @@ -25,4 +25,3 @@ SHOW STATUS LIKE 'wsrep_thread_count'; --echo # variables SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE "wsrep%" ORDER BY VARIABLE_NAME; - From 96040fbd5314bd7942933472f06d64f983248a90 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Sat, 25 Jan 2025 17:16:13 +0100 Subject: [PATCH 010/134] galera: correction for MENT-2042 test Removed major part of test because XA transactions are not supported in galera on 10.5 branch. --- mysql-test/suite/galera_sr/r/MENT-2042.result | 17 +--------- mysql-test/suite/galera_sr/t/MENT-2042.test | 33 +------------------ 2 files changed, 2 insertions(+), 48 deletions(-) diff --git a/mysql-test/suite/galera_sr/r/MENT-2042.result b/mysql-test/suite/galera_sr/r/MENT-2042.result index a2b63cc6fa6..297ad808356 100644 --- a/mysql-test/suite/galera_sr/r/MENT-2042.result +++ b/mysql-test/suite/galera_sr/r/MENT-2042.result @@ -3,22 +3,7 @@ connection node_1; connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); -SET DEBUG_SYNC='trans_xa_commit_after_acquire_commit_lock SIGNAL before_commit WAIT_FOR continue'; XA START 'a'; -INSERT INTO t1 VALUES(1); -XA END 'a'; -XA PREPARE 'a'; -XA COMMIT 'a';; -connection node_1a; -SET DEBUG_SYNC='now WAIT_FOR before_commit'; -SET DEBUG_SYNC = 'now SIGNAL continue'; -connection node_1; -ERROR 70100: Query execution was interrupted -Expect transaction 'a' in prepared state -XA RECOVER; -formatID gtrid_length bqual_length data -1 1 0 a -XA ROLLBACK 'a'; +ERROR 42000: This version of MariaDB doesn't yet support 'XA transactions with Galera replication' DROP TABLE t1; -SET DEBUG_SYNC = 'RESET'; disconnect node_1a; diff --git a/mysql-test/suite/galera_sr/t/MENT-2042.test b/mysql-test/suite/galera_sr/t/MENT-2042.test index 34e8ee45551..fc047ba33ef 100644 --- a/mysql-test/suite/galera_sr/t/MENT-2042.test +++ b/mysql-test/suite/galera_sr/t/MENT-2042.test @@ -16,39 +16,8 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); # Execute XA transaction up to COMMIT # -SET DEBUG_SYNC='trans_xa_commit_after_acquire_commit_lock SIGNAL before_commit WAIT_FOR continue'; +--error ER_NOT_SUPPORTED_YET XA START 'a'; -INSERT INTO t1 VALUES(1); -XA END 'a'; -XA PREPARE 'a'; ---send XA COMMIT 'a'; -# -# Kill the XA COMMIT statement. If bug is present the -# assertion fires. -# ---connection node_1a -SET DEBUG_SYNC='now WAIT_FOR before_commit'; ---disable_query_log ---eval KILL QUERY $connection_id ---enable_query_log -SET DEBUG_SYNC = 'now SIGNAL continue'; - -# -# Expect that the query is interrupted, and the transaction -# is still in prepared state -# ---connection node_1 ---error ER_QUERY_INTERRUPTED ---reap - ---echo Expect transaction 'a' in prepared state -XA RECOVER; - -# -# Cleanup -# -XA ROLLBACK 'a'; DROP TABLE t1; -SET DEBUG_SYNC = 'RESET'; --disconnect node_1a From a7e59c8a5497a3600c93a7013d6d66e6ad328714 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Mon, 27 Jan 2025 14:35:14 +0100 Subject: [PATCH 011/134] galera mtr tests: remove unused .result file --- .../r/galera_bf_abort_group_commit.result | 685 ------------------ 1 file changed, 685 deletions(-) delete mode 100644 mysql-test/suite/galera/r/galera_bf_abort_group_commit.result diff --git a/mysql-test/suite/galera/r/galera_bf_abort_group_commit.result b/mysql-test/suite/galera/r/galera_bf_abort_group_commit.result deleted file mode 100644 index 2a2ddd519f4..00000000000 --- a/mysql-test/suite/galera/r/galera_bf_abort_group_commit.result +++ /dev/null @@ -1,685 +0,0 @@ -SET SESSION wsrep_sync_wait = 0; -galera_sr_bf_abort_at_commit = 0 -after_replicate_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 1; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync'; -INSERT INTO t1 VALUES (3); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync'; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -local_monitor_master_enter_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 1; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; -INSERT INTO t1 VALUES (3); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -apply_monitor_master_enter_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 1; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_master_enter_sync'; -INSERT INTO t1 VALUES (3); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_master_enter_sync'; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -commit_monitor_master_enter_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 1; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync'; -INSERT INTO t1 VALUES (3); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync'; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -galera_sr_bf_abort_at_commit = 1 -after_replicate_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 1; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync'; -COMMIT; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync'; -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -local_monitor_master_enter_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 1; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; -COMMIT; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -apply_monitor_master_enter_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 1; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_master_enter_sync'; -COMMIT; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_master_enter_sync'; -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -commit_monitor_master_enter_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 1; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync'; -COMMIT; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync'; -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -galera_sr_bf_abort_at_commit = 1 -after_replicate_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 0; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,after_replicate_sync'; -COMMIT; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=after_replicate_sync'; -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -local_monitor_master_enter_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 0; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,local_monitor_master_enter_sync'; -COMMIT; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=local_monitor_master_enter_sync'; -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -apply_monitor_master_enter_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 0; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_master_enter_sync'; -COMMIT; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_master_enter_sync'; -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -commit_monitor_master_enter_sync -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; -SET SESSION wsrep_trx_fragment_size = 0; -SET AUTOCOMMIT=OFF; -INSERT INTO t1 VALUES (1); -SELECT * FROM t1 FOR UPDATE; -f1 -1 -SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; -SET AUTOCOMMIT=ON; -INSERT INTO t1 VALUES (2); -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync'; -COMMIT; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync'; -ROLLBACK; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT * FROM t1; -f1 -1 -2 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log; -COUNT(*) = 0 -1 -SET AUTOCOMMIT=ON; -SET SESSION wsrep_trx_fragment_size = 0; -DELETE FROM t1; -DROP TABLE t1; -CALL mtr.add_suppression("WSREP: fragment replication failed: 1"); From a382b695d2383ee304695dff0bc239569cd978db Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Mon, 27 Jan 2025 16:08:58 +0100 Subject: [PATCH 012/134] galera: disable problematic test (galera_vote_rejoin_ddl) --- mysql-test/suite/galera/disabled.def | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 80dc730250b..5f67258bf26 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -12,5 +12,6 @@ galera_sequences : MDEV-35934/MDEV-33850 For Galera, create sequence with low cache got signal 6 error: [ERROR] WSREP: FSM: no such a transition REPLICATING -> COMMITTED galera_wan : MDEV-35940 Unallowed state transition: donor -> synced in galera_wan +galera_vote_rejoin_ddl : MDEV-35940 Unallowed state transition: donor -> synced in galera_wan galera_bf_abort_lock_table : MDEV-35941 galera_bf_abort_lock_table fails with wait for metadata lock mysql-wsrep#198 : MDEV-35941 galera_bf_abort_lock_table fails with wait for metadata lock From 1456d9ea0a646c37237571df4abd9010cbb441c5 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 28 Jan 2025 03:43:41 +0100 Subject: [PATCH 013/134] galera: disable problematic test (MW-329) --- mysql-test/suite/galera/disabled.def | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 5f67258bf26..250cedced07 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -15,3 +15,4 @@ galera_wan : MDEV-35940 Unallowed state transition: donor -> synced in galera_wa galera_vote_rejoin_ddl : MDEV-35940 Unallowed state transition: donor -> synced in galera_wan galera_bf_abort_lock_table : MDEV-35941 galera_bf_abort_lock_table fails with wait for metadata lock mysql-wsrep#198 : MDEV-35941 galera_bf_abort_lock_table fails with wait for metadata lock +MW-329 : MDEV-35951 Complete freeze during MW-329 test From eb1811c2ce007e380010b4c38bfa5c3f5b8ace5f Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Wed, 29 Jan 2025 01:49:44 +0100 Subject: [PATCH 014/134] galera: disable problematic test (galera_vote_rejoin_dml) --- mysql-test/suite/galera/disabled.def | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 250cedced07..72caea32867 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -16,3 +16,4 @@ galera_vote_rejoin_ddl : MDEV-35940 Unallowed state transition: donor -> synced galera_bf_abort_lock_table : MDEV-35941 galera_bf_abort_lock_table fails with wait for metadata lock mysql-wsrep#198 : MDEV-35941 galera_bf_abort_lock_table fails with wait for metadata lock MW-329 : MDEV-35951 Complete freeze during MW-329 test +galera_vote_rejoin_dml : MDEV-35964 Assertion `ist_seqno >= cc_seqno' failed in galera_vote_rejoin_dml From dd5dc92a198a128c7ee306366d29bebbd362131d Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 28 Jan 2025 03:29:16 +0100 Subject: [PATCH 015/134] galera_sequences test: post-fix after MDEV-33245 --- mysql-test/suite/galera/r/galera_sequences.result | 5 +---- mysql-test/suite/galera/t/galera_sequences.test | 3 --- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/mysql-test/suite/galera/r/galera_sequences.result b/mysql-test/suite/galera/r/galera_sequences.result index b262ab6d1be..1f6b2bd6637 100644 --- a/mysql-test/suite/galera/r/galera_sequences.result +++ b/mysql-test/suite/galera/r/galera_sequences.result @@ -249,13 +249,10 @@ CREATE SEQUENCE t INCREMENT BY 0 CACHE=20 ENGINE=INNODB; ALTER TABLE t ENGINE=MYISAM; ERROR 42000: This version of MariaDB doesn't yet support 'non-InnoDB sequences in Galera cluster' ALTER SEQUENCE t INCREMENT BY 1 CACHE=10; -ERROR 42000: This version of MariaDB doesn't yet support 'non-InnoDB sequences in Galera cluster' +ERROR 42000: This version of MariaDB doesn't yet support 'CACHE without INCREMENT BY 0 in Galera cluster' ALTER SEQUENCE t INCREMENT BY 1 NOCACHE; -ERROR 42000: This version of MariaDB doesn't yet support 'non-InnoDB sequences in Galera cluster' ALTER SEQUENCE t INCREMENT BY 0 NOCACHE; -ERROR 42000: This version of MariaDB doesn't yet support 'non-InnoDB sequences in Galera cluster' ALTER SEQUENCE t INCREMENT BY 0 CACHE=10; -ERROR 42000: This version of MariaDB doesn't yet support 'non-InnoDB sequences in Galera cluster' DROP SEQUENCE t; CREATE SEQUENCE t INCREMENT BY 0 CACHE=20 ENGINE=INNODB; CREATE TABLE t1(a int not null primary key default nextval(t), b int) engine=innodb; diff --git a/mysql-test/suite/galera/t/galera_sequences.test b/mysql-test/suite/galera/t/galera_sequences.test index 2c7929e15b2..f99796264b6 100644 --- a/mysql-test/suite/galera/t/galera_sequences.test +++ b/mysql-test/suite/galera/t/galera_sequences.test @@ -284,11 +284,8 @@ CREATE SEQUENCE t INCREMENT BY 0 CACHE=20 ENGINE=INNODB; ALTER TABLE t ENGINE=MYISAM; --error ER_NOT_SUPPORTED_YET ALTER SEQUENCE t INCREMENT BY 1 CACHE=10; ---error ER_NOT_SUPPORTED_YET ALTER SEQUENCE t INCREMENT BY 1 NOCACHE; ---error ER_NOT_SUPPORTED_YET ALTER SEQUENCE t INCREMENT BY 0 NOCACHE; ---error ER_NOT_SUPPORTED_YET ALTER SEQUENCE t INCREMENT BY 0 CACHE=10; DROP SEQUENCE t; From 1b146e8220fc6cae845502e656959ffc48fbdd1d Mon Sep 17 00:00:00 2001 From: Teemu Ollakka Date: Sun, 26 Feb 2023 12:44:49 +0200 Subject: [PATCH 016/134] galera fix: Donor in non-Primary causes assertion in wsrep-lib Constructed a test which makes donor to go into non-Primary configuration before `sst_sent()` is called, causing an assertion in wsrep-lib if the bug is present. Updated wsrep-lib to version which contains the fix. Signed-off-by: Julius Goryavsky --- .../suite/galera_3nodes/galera_3nodes.cnf | 3 + .../r/galera_sst_donor_non_prim.result | 26 ++++++++ .../t/galera_sst_donor_non_prim.cnf | 4 ++ .../t/galera_sst_donor_non_prim.test | 64 +++++++++++++++++++ sql/wsrep_sst.cc | 9 +++ 5 files changed, 106 insertions(+) create mode 100644 mysql-test/suite/galera_3nodes/r/galera_sst_donor_non_prim.result create mode 100644 mysql-test/suite/galera_3nodes/t/galera_sst_donor_non_prim.cnf create mode 100644 mysql-test/suite/galera_3nodes/t/galera_sst_donor_non_prim.test diff --git a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf index f23e1c65008..12ddc8621d1 100644 --- a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf +++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf @@ -23,6 +23,7 @@ wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#gale wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' +wsrep_node_name=node1 [mysqld.2] wsrep-on=1 @@ -34,6 +35,7 @@ wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#gale wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' +wsrep_node_name=node2 [mysqld.3] wsrep-on=1 @@ -45,6 +47,7 @@ wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#gale wsrep_node_address='127.0.0.1:@mysqld.3.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' +wsrep_node_name=node3 [sst] sst-log-archive-dir=@ENV.MYSQLTEST_VARDIR/log diff --git a/mysql-test/suite/galera_3nodes/r/galera_sst_donor_non_prim.result b/mysql-test/suite/galera_3nodes/r/galera_sst_donor_non_prim.result new file mode 100644 index 00000000000..6f372463b15 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera_sst_donor_non_prim.result @@ -0,0 +1,26 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +connection node_2; +connection node_1; +SET GLOBAL debug_dbug = '+d,sync.wsrep_sst_donor_after_donation'; +connection node_2; +# restart +connection node_1; +SET DEBUG_SYNC = 'now WAIT_FOR sync.wsrep_sst_donor_after_donation_reached'; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; +SET SESSION wsrep_sync_wait=0; +SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_sst_donor_after_donation_continue'; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL debug_dbug = ''; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +SET SESSION wsrep_sync_wait=15; +connection node_1; +connection node_2; +connection node_3; +connection node_1; +connection node_1; +CALL mtr.add_suppression("WSREP: sst sent called when not SST donor, state CONNECTED"); +CALL mtr.add_suppression("WSREP: .* returned an error: Not connected to Primary Component"); diff --git a/mysql-test/suite/galera_3nodes/t/galera_sst_donor_non_prim.cnf b/mysql-test/suite/galera_3nodes/t/galera_sst_donor_non_prim.cnf new file mode 100644 index 00000000000..ecb568672fe --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_sst_donor_non_prim.cnf @@ -0,0 +1,4 @@ +!include ../galera_3nodes.cnf + +[mysqld.2] +wsrep_sst_donor=node1 diff --git a/mysql-test/suite/galera_3nodes/t/galera_sst_donor_non_prim.test b/mysql-test/suite/galera_3nodes/t/galera_sst_donor_non_prim.test new file mode 100644 index 00000000000..22c4f75b601 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_sst_donor_non_prim.test @@ -0,0 +1,64 @@ +# +# Construct a situation where Donor node partitions in the +# middle of SST. The Donor should stay in non-Primary state instead of +# crashing in assertion in wsrep-lib. +# +# In the test, node_2 is restarted and node_1 configured to be +# the donor. Node_1 execution is stopped before sst_sent() is +# called and node_1 is made to partition from the cluster. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/big_test.inc + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +--connection node_2 +--source include/shutdown_mysqld.inc +--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat + +--connection node_1 +SET GLOBAL debug_dbug = '+d,sync.wsrep_sst_donor_after_donation'; + +--connection node_2 +--source include/start_mysqld.inc + +--connection node_1 +SET DEBUG_SYNC = 'now WAIT_FOR sync.wsrep_sst_donor_after_donation_reached'; +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; +SET SESSION wsrep_sync_wait=0; +--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_status' +--source include/wait_condition.inc + +SET DEBUG_SYNC = 'now SIGNAL signal.wsrep_sst_donor_after_donation_continue'; +SET DEBUG_SYNC = 'RESET'; +SET GLOBAL debug_dbug = ''; + +SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; +SET SESSION wsrep_sync_wait=15; + +--let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--connection node_1 +--source include/wait_condition.inc +--connection node_2 +--source include/wait_condition.inc +--connection node_3 + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM information_schema.global_status WHERE VARIABLE_NAME = 'wsrep_ready' +--source include/wait_condition.inc + +--source ../galera/include/auto_increment_offset_restore.inc + +--connection node_1 +CALL mtr.add_suppression("WSREP: sst sent called when not SST donor, state CONNECTED"); +CALL mtr.add_suppression("WSREP: .* returned an error: Not connected to Primary Component"); diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index cb2d61b7543..504510fbbf6 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -1874,6 +1874,15 @@ wait_signal: wsrep::seqno(err ? wsrep::seqno::undefined() : wsrep::seqno(ret_seqno))); +#ifdef ENABLED_DEBUG_SYNC + DBUG_EXECUTE_IF("sync.wsrep_sst_donor_after_donation", { + const char act[]= "now " + "SIGNAL sync.wsrep_sst_donor_after_donation_reached " + "WAIT_FOR signal.wsrep_sst_donor_after_donation_continue"; + DBUG_ASSERT(!debug_sync_set_action(thd.ptr, STRING_WITH_LEN(act))); + }); +#endif /* ENABLED_DEBUG_SYNC */ + Wsrep_server_state::instance().sst_sent(gtid, err); proc.wait(); From c35b6f133aa8c7c88d14a13593ac2a57d51aa137 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 28 Jan 2025 20:47:38 +0100 Subject: [PATCH 017/134] galera mtr tests: synchronization between editions/branches (10.5) --- mysql-test/suite/galera/r/MW-416.result | 5 +- .../suite/galera/r/galera_bf_kill,debug.rdiff | 4 +- .../r/galera_ist_MDEV-28423,debug.rdiff | 2 +- .../r/galera_ist_MDEV-28583,debug.rdiff | 2 +- .../r/galera_ist_mariabackup,debug.rdiff | 4 +- ..._mariabackup_innodb_flush_logs,debug.rdiff | 4 +- .../galera/r/galera_ist_mysqldump,debug.rdiff | 4 +- .../galera/r/galera_ist_rsync,debug.rdiff | 4 +- .../r/galera_sst_mariabackup,debug.rdiff | 2 +- ...alera_sst_mariabackup_data_dir,debug.rdiff | 4 +- ...sst_mariabackup_force_recovery,debug.rdiff | 4 +- ...era_sst_mariabackup_logarchive,debug.rdiff | 2 +- .../galera/r/galera_sst_mysqldump,debug.rdiff | 4 +- .../galera_sst_mysqldump_with_key,debug.rdiff | 4 +- .../galera/r/galera_sst_rsync,debug.rdiff | 2 +- .../galera/r/galera_sst_rsync2,debug.rdiff | 4 +- .../r/galera_sst_rsync_data_dir,debug.rdiff | 4 +- .../r/galera_sst_rsync_recv_auto,debug.rdiff | 2 + .../suite/galera/r/mysql-wsrep#33,debug.rdiff | 4 +- mysql-test/suite/galera/suite.pm | 30 +++--- mysql-test/suite/galera/t/MW-416.test | 94 ++++++++++--------- .../r/galera-features#115.result | 41 ++++++++ .../galera_3nodes/r/galera_2_cluster.result | 1 - .../r/galera_gtid_2_cluster.result | 8 +- mysql-test/suite/galera_3nodes/suite.pm | 32 ++++--- .../galera_3nodes/t/galera-features#115.cnf | 4 + .../galera_3nodes/t/galera-features#115.test | 89 ++++++++++++++++++ .../galera_3nodes/t/galera_2_cluster.test | 3 +- .../t/galera_gtid_2_cluster.test | 16 +++- mysql-test/suite/galera_3nodes_sr/suite.pm | 22 ++--- mysql-test/suite/galera_sr/suite.pm | 30 +++--- 31 files changed, 293 insertions(+), 142 deletions(-) create mode 100644 mysql-test/suite/galera_3nodes/r/galera-features#115.result create mode 100644 mysql-test/suite/galera_3nodes/t/galera-features#115.cnf create mode 100644 mysql-test/suite/galera_3nodes/t/galera-features#115.test diff --git a/mysql-test/suite/galera/r/MW-416.result b/mysql-test/suite/galera/r/MW-416.result index 68406c4dcf4..e5f69caa413 100644 --- a/mysql-test/suite/galera/r/MW-416.result +++ b/mysql-test/suite/galera/r/MW-416.result @@ -24,13 +24,13 @@ ALTER VIEW vw AS SELECT 1; Got one of the listed errors CREATE DATABASE db; Got one of the listed errors -CREATE EVENT ev1 ON SCHEDULE AT CURRENT_TIMESTAMP DO SELECT 1; +CREATE EVENT ev1 ON SCHEDULE AT CURRENT_TIMESTAMP DO SELECT 1; Got one of the listed errors CREATE FUNCTION fun1() RETURNS int RETURN(1); Got one of the listed errors CREATE FUNCTION fun1 RETURNS STRING SONAME 'funlib.so'; Got one of the listed errors -CREATE PROCEDURE proc1() BEGIN END; +CREATE PROCEDURE proc1() BEGIN END; Got one of the listed errors CREATE INDEX idx ON tbl(id); Got one of the listed errors @@ -111,3 +111,4 @@ mtr mysql performance_schema test +disconnect userMW416; diff --git a/mysql-test/suite/galera/r/galera_bf_kill,debug.rdiff b/mysql-test/suite/galera/r/galera_bf_kill,debug.rdiff index e02acc3de08..098ce2b28a1 100644 --- a/mysql-test/suite/galera/r/galera_bf_kill,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_bf_kill,debug.rdiff @@ -1,5 +1,5 @@ ---- a/home/panda/mariadb-10.5/mysql-test/suite/galera/r/galera_bf_kill.result -+++ b/home/panda/mariadb-10.5/mysql-test/suite/galera/r/galera_bf_kill.reject +--- r/galera_bf_kill.result ++++ r/galera_bf_kill,debug.reject @@ -77,4 +77,34 @@ a b 5 2 disconnect node_2a; diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff index 96e5def88ff..8c84321e774 100644 --- a/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28423,debug.rdiff @@ -1,5 +1,5 @@ --- r/galera_ist_MDEV-28423.result -+++ r/galera_ist_MDEV-28423.reject ++++ r/galera_ist_MDEV-28423,debug.reject @@ -517,3 +517,187 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff index 9e6530aa9f7..51d2a6bf157 100644 --- a/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_ist_MDEV-28583,debug.rdiff @@ -1,5 +1,5 @@ --- r/galera_ist_MDEV-28583.result -+++ r/galera_ist_MDEV-28583.reject ++++ r/galera_ist_MDEV-28583,debug.reject @@ -517,3 +517,187 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_ist_mariabackup,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_mariabackup,debug.rdiff index adf12c23e4a..243b2a50b2a 100644 --- a/mysql-test/suite/galera/r/galera_ist_mariabackup,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_ist_mariabackup,debug.rdiff @@ -1,5 +1,5 @@ ---- r/galera_ist_mariabackup.result 2021-04-10 14:21:16.141724901 +0300 -+++ r/galera_ist_mariabackup,debug.reject 2021-04-10 14:49:04.455785652 +0300 +--- r/galera_ist_mariabackup.result ++++ r/galera_ist_mariabackup,debug.reject @@ -517,3 +517,187 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_ist_mariabackup_innodb_flush_logs,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_mariabackup_innodb_flush_logs,debug.rdiff index c9457d70812..b7a91b010fe 100644 --- a/mysql-test/suite/galera/r/galera_ist_mariabackup_innodb_flush_logs,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_ist_mariabackup_innodb_flush_logs,debug.rdiff @@ -1,5 +1,5 @@ ---- r/galera_ist_mariabackup_innodb_flush_logs.result 2021-04-10 14:21:52.661886653 +0300 -+++ r/galera_ist_mariabackup_innodb_flush_logs,debug.reject 2021-04-10 14:49:56.740062774 +0300 +--- r/galera_ist_mariabackup_innodb_flush_logs.result ++++ r/galera_ist_mariabackup_innodb_flush_logs,debug.reject @@ -172,3 +172,187 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_ist_mysqldump,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_mysqldump,debug.rdiff index e4e255deea2..2ba60eff7b4 100644 --- a/mysql-test/suite/galera/r/galera_ist_mysqldump,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_ist_mysqldump,debug.rdiff @@ -1,5 +1,5 @@ ---- r/galera_ist_mysqldump.result 2021-04-10 14:23:23.158282307 +0300 -+++ r/galera_ist_mysqldump,debug.reject 2021-04-10 15:27:13.316299695 +0300 +--- r/galera_ist_mysqldump.result ++++ r/galera_ist_mysqldump,debug.reject @@ -354,6 +354,190 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_ist_rsync,debug.rdiff b/mysql-test/suite/galera/r/galera_ist_rsync,debug.rdiff index e76b37838fb..f3df998be95 100644 --- a/mysql-test/suite/galera/r/galera_ist_rsync,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_ist_rsync,debug.rdiff @@ -1,5 +1,5 @@ ---- r/galera_ist_rsync.result 2021-04-10 14:24:05.942467091 +0300 -+++ r/galera_ist_rsync,debug.reject 2021-04-10 14:52:14.236776538 +0300 +--- r/galera_ist_rsync.result ++++ r/galera_ist_rsync,debug.reject @@ -517,3 +517,187 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff index 3aad611cacb..da294317c27 100644 --- a/mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_sst_mariabackup,debug.rdiff @@ -1,5 +1,5 @@ --- r/galera_sst_mariabackup.result -+++ r/galera_sst_mariabackup.reject ++++ r/galera_sst_mariabackup,debug.reject @@ -516,5 +516,189 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_data_dir,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mariabackup_data_dir,debug.rdiff index 870b12de3c9..875d53addd8 100644 --- a/mysql-test/suite/galera/r/galera_sst_mariabackup_data_dir,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_data_dir,debug.rdiff @@ -1,5 +1,5 @@ ---- r/galera_sst_mariabackup_data_dir.result 2021-04-10 14:26:02.798965488 +0300 -+++ r/galera_sst_mariabackup_data_dir,debug.reject 2021-04-10 14:54:44.825538224 +0300 +--- r/galera_sst_mariabackup_data_dir.result ++++ r/galera_sst_mariabackup_data_dir,debug.reject @@ -516,5 +516,189 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_force_recovery,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mariabackup_force_recovery,debug.rdiff index bad8355b514..b8469370b0d 100644 --- a/mysql-test/suite/galera/r/galera_sst_mariabackup_force_recovery,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_force_recovery,debug.rdiff @@ -1,5 +1,5 @@ ---- r/galera_sst_mariabackup.result 2021-04-10 14:25:04.142716409 +0300 -+++ r/galera_sst_mariabackup,debug.reject 2021-04-10 14:53:30.033162191 +0300 +--- r/galera_sst_mariabackup_force_recovery.result ++++ r/galera_sst_mariabackup_force_recovery,debug.reject @@ -516,5 +516,189 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_logarchive,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mariabackup_logarchive,debug.rdiff index a9c796da607..0c08f38c138 100644 --- a/mysql-test/suite/galera/r/galera_sst_mariabackup_logarchive,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_logarchive,debug.rdiff @@ -1,5 +1,5 @@ --- r/galera_sst_mariabackup_logarchive.result -+++ r/galera_sst_mariabackup_logarchive.reject ++++ r/galera_sst_mariabackup_logarchive,debug.reject @@ -516,5 +516,189 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mysqldump,debug.rdiff index e73a27ad0ac..d43067b4be0 100644 --- a/mysql-test/suite/galera/r/galera_sst_mysqldump,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_sst_mysqldump,debug.rdiff @@ -1,5 +1,5 @@ ---- r/galera_sst_mysqldump.result 2021-04-18 13:15:29.909314729 +0300 -+++ r/galera_sst_mysqldump.reject 2021-04-18 13:50:47.096965646 +0300 +--- r/galera_sst_mysqldump.result ++++ r/galera_sst_mysqldump,debug.reject @@ -698,6 +698,190 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key,debug.rdiff index 7d73f7a6ae6..2f18ca4772e 100644 --- a/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_sst_mysqldump_with_key,debug.rdiff @@ -1,5 +1,5 @@ ---- r/galera_sst_mysqldump_with_key.result 2021-04-10 14:33:29.441606621 +0300 -+++ r/galera_sst_mysqldump_with_key,debug.reject 2021-04-10 15:02:45.367881573 +0300 +--- r/galera_sst_mysqldump_with_key.result ++++ r/galera_sst_mysqldump_with_key,debug.reject @@ -358,6 +358,190 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_sst_rsync,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_rsync,debug.rdiff index 87f8a463bd0..157a4db3204 100644 --- a/mysql-test/suite/galera/r/galera_sst_rsync,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_sst_rsync,debug.rdiff @@ -1,5 +1,5 @@ --- galera_sst_rsync.result -+++ galera_sst_rsync.reject ++++ galera_sst_rsync,debug.reject @@ -516,3 +516,187 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_sst_rsync2,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_rsync2,debug.rdiff index 14f67770572..ae242e2b216 100644 --- a/mysql-test/suite/galera/r/galera_sst_rsync2,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_sst_rsync2,debug.rdiff @@ -1,5 +1,5 @@ ---- r/galera_sst_rsync2.result 2021-04-10 14:34:48.646288119 +0300 -+++ r/galera_sst_rsync2,debug.reject 2021-04-10 15:04:10.276286996 +0300 +--- r/galera_sst_rsync2.result ++++ r/galera_sst_rsync2,debug.reject @@ -516,3 +516,187 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_data_dir,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_rsync_data_dir,debug.rdiff index 00b42d53b51..558a8e7cd07 100644 --- a/mysql-test/suite/galera/r/galera_sst_rsync_data_dir,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_sst_rsync_data_dir,debug.rdiff @@ -1,5 +1,5 @@ ---- r/galera_sst_rsync_data_dir.result 2021-04-10 14:35:28.090610315 +0300 -+++ r/galera_sst_rsync_data_dir,debug.reject 2021-04-10 15:50:26.945234998 +0300 +--- r/galera_sst_rsync_data_dir.result ++++ r/galera_sst_rsync_data_dir,debug.reject @@ -516,3 +516,187 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_recv_auto,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_rsync_recv_auto,debug.rdiff index 5bc47c58303..0b1e2f2169c 100644 --- a/mysql-test/suite/galera/r/galera_sst_rsync_recv_auto,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_sst_rsync_recv_auto,debug.rdiff @@ -1,3 +1,5 @@ +--- r/galera_sst_rsync_recv_auto.result ++++ r/galera_sst_rsync_recv_auto,debug.reject @@ -516,3 +516,187 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/mysql-wsrep#33,debug.rdiff b/mysql-test/suite/galera/r/mysql-wsrep#33,debug.rdiff index 971f11bb8ec..f75f92a3d7d 100644 --- a/mysql-test/suite/galera/r/mysql-wsrep#33,debug.rdiff +++ b/mysql-test/suite/galera/r/mysql-wsrep#33,debug.rdiff @@ -1,5 +1,5 @@ ---- r/mysql-wsrep#33.result 2021-04-10 14:36:42.663191908 +0300 -+++ r/mysql-wsrep#33,debug.reject 2021-04-10 15:43:02.420168969 +0300 +--- r/mysql-wsrep#33.result ++++ r/mysql-wsrep#33,debug.reject @@ -698,6 +698,190 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/suite.pm b/mysql-test/suite/galera/suite.pm index 4c4d26db4c5..825525765ca 100644 --- a/mysql-test/suite/galera/suite.pm +++ b/mysql-test/suite/galera/suite.pm @@ -10,20 +10,20 @@ return wsrep_not_ok() if wsrep_not_ok(); push @::global_suppressions, ( - qr(WSREP: wsrep_sst_receive_address is set to '127.0.0.1), + qr(WSREP: wsrep_sst_receive_address is set to '127\.0\.0\.1), qr(WSREP: Could not open saved state file for reading: .*), qr(WSREP: Could not open state file for reading: .*), - qr(WSREP: Gap in state sequence. Need state transfer.), + qr(WSREP: Gap in state sequence\. Need state transfer\.), qr(WSREP: Failed to prepare for incremental state transfer:), - qr(WSREP:.*down context.*), + qr(WSREP: .*down context.*), qr(WSREP: Failed to send state UUID:), qr(WSREP: last inactive check more than .* skipping check), - qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned.), + qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned\.), qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|, qr(WSREP: Quorum: No node with complete state), qr(WSREP: Initial position was provided by configuration or SST, avoiding override), qr|WSREP: discarding established \(time wait\) .*|, - qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside. Will use that one.), + qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside\. Will use that one\.), qr(WSREP: evs::proto.*), qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:.*|, qr(WSREP: no nodes coming from prim view, prim not possible), @@ -46,25 +46,25 @@ push @::global_suppressions, qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*), qr(WSREP: gcs connect failed: Connection timed out), qr|WSREP: wsrep::connect\(.*\) failed: 7|, - qr(WSREP: SYNC message from member .* in non-primary configuration. Ignored.), + qr(WSREP: SYNC message from member .* in non-primary configuration\. Ignored\.), qr(WSREP: Could not find peer:), qr(WSREP: TO isolation failed for: .*), qr|WSREP: gcs_caused\(\) returned .*|, - qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(SYNCED\). Message ignored.|, - qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(JOINED\). Message ignored.|, - qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled. Expect abort.|, + qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(SYNCED\). Message ignored\.|, + qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(JOINED\). Message ignored\.|, + qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled\. Expect abort\.|, qr(WSREP: Action message in non-primary configuration from member [0-9]*), qr(WSREP: Last Applied Action message in non-primary configuration from member [0-9]*), qr(WSREP: discarding established .*), qr|WSREP: .*core_handle_uuid_msg.*|, - qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0. WSREP_SYNC_WAIT_BEFORE_READ is on), - qr|WSREP: JOIN message from member .* in non-primary configuration. Ignored.|, - qr|Query apply failed:*|, - qr(WSREP: Ignoring error*), + qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0\. WSREP_SYNC_WAIT_BEFORE_READ is on), + qr|WSREP: JOIN message from member .* in non-primary configuration\. Ignored\.|, + qr|WSREP: .*Query apply failed:.*|, + qr(WSREP: Ignoring error.*), qr(WSREP: Failed to remove page file .*), qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to .*), - qr|WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\). Will retry in new primary component.|, - qr|WSREP: Send action \{.* STATE_REQUEST} returned -107 \(Transport endpoint is not connected\)|, + qr|WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\)\. Will retry in new primary component\.|, + qr|WSREP: Send action \{.* STATE_REQUEST\} returned -107 \(Transport endpoint is not connected\)|, qr|WSREP: Trying to continue unpaused monitor|, qr|WSREP: Wait for gtid returned error 3 while waiting for prior transactions to commit before setting position|, qr|WSREP: Failed to report last committed|, diff --git a/mysql-test/suite/galera/t/MW-416.test b/mysql-test/suite/galera/t/MW-416.test index 9d876233eb4..178c7760da7 100644 --- a/mysql-test/suite/galera/t/MW-416.test +++ b/mysql-test/suite/galera/t/MW-416.test @@ -17,87 +17,87 @@ ALTER DATABASE db CHARACTER SET = utf8; ALTER EVENT ev1 RENAME TO ev2; --error 1370 ALTER FUNCTION fun1 COMMENT 'foo'; -#--error 1044,1142,1227,1370 +#--error 1044,1227 #ALTER INSTANCE ROTATE INNODB MASTER KEY; ---error 1044,1142,1227,1370 +--error 1044,1227 ALTER LOGFILE GROUP lfg ADD UNDOFILE 'file' ENGINE=InnoDB; ---error 1044,1142,1227,1370 +--error 1044,1227,1370 ALTER PROCEDURE proc1 COMMENT 'foo'; ---error 1044,1142,1227,1370 +--error 1044,1227 ALTER SERVER srv OPTIONS (USER 'sally'); ---error 1044,1142,1227,1370 +--error 1044,1142,1227 ALTER TABLE tbl DROP COLUMN col; ---error 1044,1142,1227,1370 +--error 1044,1227 ALTER TABLESPACE tblspc DROP DATAFILE 'file' ENGINE=innodb; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 ALTER VIEW vw AS SELECT 1; ---error 1044,1142,1227,1370 +--error 1044,1227 CREATE DATABASE db; ---error 1044,1142,1227,1370 -CREATE EVENT ev1 ON SCHEDULE AT CURRENT_TIMESTAMP DO SELECT 1; ---error 1044,1142,1227,1370 +--error 1044,1227 +CREATE EVENT ev1 ON SCHEDULE AT CURRENT_TIMESTAMP DO SELECT 1; +--error 1044,1227,1370 CREATE FUNCTION fun1() RETURNS int RETURN(1); ---error 1044,1142,1227,1370 +--error 1044,1227,1370 CREATE FUNCTION fun1 RETURNS STRING SONAME 'funlib.so'; ---error 1044,1142,1227,1370 -CREATE PROCEDURE proc1() BEGIN END; ---error 1044,1142,1227,1370 +--error 1044,1227,1370 +CREATE PROCEDURE proc1() BEGIN END; +--error 1044,1142,1227 CREATE INDEX idx ON tbl(id); ---error 1044,1142,1227,1370 +--error 1044,1142,1227 CREATE LOGFILE GROUP lfg ADD UNDOFILE 'undofile' ENGINE innodb; ---error 1044,1142,1227,1370 +--error 1044,1227 CREATE SERVER srv FOREIGN DATA WRAPPER 'fdw' OPTIONS (USER 'user'); ---error 1044,1142,1227,1370 +--error 1044,1142,1227 CREATE TABLE t (i int); ---error 1044,1142,1227,1370 +--error 1044,1227 CREATE TABLESPACE tblspc ADD DATAFILE 'file' ENGINE=innodb; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 CREATE TRIGGER trg BEFORE UPDATE ON t FOR EACH ROW BEGIN END; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 CREATE VIEW vw AS SELECT 1; ---error 1044,1142,1227,1370 +--error 1044,1227 DROP DATABASE db; ---error 1044,1142,1227,1370 +--error 1044,1227 DROP EVENT ev; ---error 1044,1142,1227,1370 +--error 1044,1227,1370 DROP FUNCTION fun1; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 DROP INDEX idx ON t0; ---error 1044,1142,1227,1370,1064 +--error 1044,1227,1064 DROP LOGFILE GROUP lfg; ---error 1044,1142,1227,1370 +--error 1044,1227,1370 DROP PROCEDURE proc1; ---error 1044,1142,1227,1370 +--error 1044,1227 DROP SERVEr srv; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 DROP TABLE t0; ---error 1044,1142,1227,1370,1064 +--error 1044,1227,1064 DROP TABLESPACE tblspc; ---error 1044,1142,1227,1360,1370 +--error 1044,1227,1360 DROP TRIGGER trg; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 DROP VIEW vw; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 RENAME TABLE t0 TO t1; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 TRUNCATE TABLE t0; # DCL # account management ---error 1044,1142,1227,1370,1064 +--error 1044,1227,1064 ALTER USER myuser PASSWORD EXPIRE; ---error 1044,1142,1227,1370 +--error 1044,1227 CREATE USER myuser IDENTIFIED BY 'pass'; ---error 1044,1142,1227,1370 +--error 1044,1227 DROP USER myuser; ---error 1044,1045,1142,1227,1370 +--error 1044,1045,1227 GRANT ALL ON *.* TO 'myuser'; ---error 1044,1142,1227,1370 +--error 1044,1227 RENAME USER myuser TO mariauser; --error 1044,1142,1227,1370 REVOKE SELECT ON test FROM myuser; @@ -107,23 +107,25 @@ REVOKE ALL, GRANT OPTION FROM myuser; REVOKE PROXY ON myuser FROM myuser; # table maintenance ---error 1044,1142,1227,1370 +--error 1044,1142,1227 ANALYZE TABLE db.tbl; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 CHECK TABLE db.tbl; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 CHECKSUM TABLE db.tbl; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 OPTIMIZE TABLE db.tbl; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 REPAIR TABLE db.tbl; # plugin and user defined functions ---error 1044,1142,1227,1370 +--error 1044,1142,1227 INSTALL PLUGIN plg SONAME 'plg.so'; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 UNINSTALL PLUGIN plg; --connection node_1 DROP USER 'userMW416'@'localhost'; SHOW DATABASES; + +--disconnect userMW416 diff --git a/mysql-test/suite/galera_3nodes/r/galera-features#115.result b/mysql-test/suite/galera_3nodes/r/galera-features#115.result new file mode 100644 index 00000000000..db965599d80 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/galera-features#115.result @@ -0,0 +1,41 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +connection node_2; +SET GLOBAL wsrep_on=OFF; +DROP SCHEMA test; +connection node_3; +SET GLOBAL wsrep_on=OFF; +CREATE TABLE t1 (f1 INTEGER); +connection node_1; +CREATE TABLE t1 (f1 INTEGER); +connection node_1; +SET SESSION wsrep_sync_wait=0; +connection node_2; +SET SESSION wsrep_sync_wait=0; +connection node_3; +SET SESSION wsrep_sync_wait=0; +connection node_1; +SET GLOBAL wsrep_provider_options='pc.bootstrap=YES'; +connection node_2; +disconnect node_2; +connect node_2, 127.0.0.1, root, , mysql, $NODE_MYPORT_2; +# restart +connection node_3; +# restart +connection node_1; +DROP TABLE test.t1; +connection node_2; +CALL mtr.add_suppression("Inconsistent by consensus\\."); +CALL mtr.add_suppression("Error_code: 1049"); +CALL mtr.add_suppression("WSREP: Failed to apply trx: source: "); +CALL mtr.add_suppression("WSREP: Failed to apply app buffer"); +CALL mtr.add_suppression("WSREP: Node consistency compromized, leaving cluster\\.\\.\\."); +connection node_3; +CALL mtr.add_suppression("Inconsistent by consensus\\."); +CALL mtr.add_suppression("Error_code: 1050"); +CALL mtr.add_suppression("WSREP: Failed to apply trx: source: "); +CALL mtr.add_suppression("WSREP: Failed to apply app buffer"); +CALL mtr.add_suppression("WSREP: Node consistency compromized, leaving cluster\\.\\.\\."); diff --git a/mysql-test/suite/galera_3nodes/r/galera_2_cluster.result b/mysql-test/suite/galera_3nodes/r/galera_2_cluster.result index bdd18ee2534..0a2be393d27 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_2_cluster.result +++ b/mysql-test/suite/galera_3nodes/r/galera_2_cluster.result @@ -3,7 +3,6 @@ connection node_1; connect node_5, 127.0.0.1, root, , test, $NODE_MYPORT_5; connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4; connection node_4; -CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_1, master_use_gtid=current_pos;; START SLAVE; include/wait_for_slave_to_start.inc connection node_1; diff --git a/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result b/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result index 1cb14cd3eff..f4929a22a06 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result +++ b/mysql-test/suite/galera_3nodes/r/galera_gtid_2_cluster.result @@ -35,7 +35,7 @@ SHOW STATUS LIKE 'wsrep_cluster_size'; Variable_name Value wsrep_cluster_size 3 connection node_1; -change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_4, master_use_gtid=current_pos, ignore_server_ids=(12,13);; +--- ignore_server_ids=(12,13) start slave; include/wait_for_slave_to_start.inc select @@gtid_binlog_state; @@ -45,7 +45,7 @@ select @@gtid_slave_pos; @@gtid_slave_pos connection node_4; -change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_1, master_use_gtid=current_pos, ignore_server_ids=(22,23);; +--- ignore_server_ids=(22,23) start slave; include/wait_for_slave_to_start.inc select @@gtid_binlog_state; @@ -258,7 +258,7 @@ set global wsrep_on=OFF; reset master; set global wsrep_on=ON; connection node_1; -change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_6, master_use_gtid=current_pos, ignore_server_ids=(12,13);; +--- ignore_server_ids=(12,13) start slave; include/wait_for_slave_to_start.inc select @@gtid_binlog_state; @@ -268,7 +268,7 @@ select @@gtid_slave_pos; @@gtid_slave_pos connection node_4; -change master to master_host='127.0.0.1', master_user='root', master_port=NODE_MYPORT_3, master_use_gtid=current_pos, ignore_server_ids=(22,23);; +--- ignore_server_ids=(22,23) start slave; include/wait_for_slave_to_start.inc select @@gtid_binlog_state; diff --git a/mysql-test/suite/galera_3nodes/suite.pm b/mysql-test/suite/galera_3nodes/suite.pm index 49b93248a58..ff1ba0a566f 100644 --- a/mysql-test/suite/galera_3nodes/suite.pm +++ b/mysql-test/suite/galera_3nodes/suite.pm @@ -9,20 +9,20 @@ return wsrep_not_ok() if wsrep_not_ok(); push @::global_suppressions, ( - qr(WSREP: wsrep_sst_receive_address is set to '127.0.0.1), + qr(WSREP: wsrep_sst_receive_address is set to '127\.0\.0\.1), qr(WSREP: Could not open saved state file for reading: .*), qr(WSREP: Could not open state file for reading: .*), - qr(WSREP: Gap in state sequence. Need state transfer.), + qr(WSREP: Gap in state sequence\. Need state transfer\.), qr(WSREP: Failed to prepare for incremental state transfer:), - qr(WSREP:.*down context.*), + qr(WSREP: .*down context.*), qr(WSREP: Failed to send state UUID:), qr(WSREP: last inactive check more than .* skipping check), - qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned.), + qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned\.), qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|, qr(WSREP: Quorum: No node with complete state), qr(WSREP: Initial position was provided by configuration or SST, avoiding override), qr|WSREP: discarding established \(time wait\) .*|, - qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside. Will use that one.), + qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside\. Will use that one\.), qr(WSREP: evs::proto.*), qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:.*|, qr(WSREP: no nodes coming from prim view, prim not possible), @@ -45,33 +45,35 @@ push @::global_suppressions, qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*), qr(WSREP: gcs connect failed: Connection timed out), qr|WSREP: wsrep::connect\(.*\) failed: 7|, - qr(WSREP: SYNC message from member .* in non-primary configuration. Ignored.), + qr(WSREP: SYNC message from member .* in non-primary configuration\. Ignored\.), qr(WSREP: Could not find peer:), qr(WSREP: TO isolation failed for: .*), qr|WSREP: gcs_caused\(\) returned .*|, - qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(SYNCED\). Message ignored.|, - qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(JOINED\). Message ignored.|, - qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled. Expect abort.|, + qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(SYNCED\). Message ignored\.|, + qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(JOINED\). Message ignored\.|, + qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled\. Expect abort\.|, qr(WSREP: Action message in non-primary configuration from member [0-9]*), qr(WSREP: Last Applied Action message in non-primary configuration from member [0-9]*), qr(WSREP: discarding established .*), qr|WSREP: .*core_handle_uuid_msg.*|, - qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0. WSREP_SYNC_WAIT_BEFORE_READ is on), - qr|WSREP: JOIN message from member .* in non-primary configuration. Ignored.|, - qr|Query apply failed:*|, - qr(WSREP: Ignoring error*), + qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0\. WSREP_SYNC_WAIT_BEFORE_READ is on), + qr|WSREP: JOIN message from member .* in non-primary configuration\. Ignored\.|, + qr|WSREP: .*Query apply failed:.*|, + qr(WSREP: Ignoring error.*), qr(WSREP: Failed to remove page file .*), qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to .*), - qr|WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\). Will retry in new primary component.|, + qr|WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\)\. Will retry in new primary component\.|, + qr|WSREP: Send action \{.* STATE_REQUEST\} returned -107 \(Transport endpoint is not connected\)|, qr|WSREP: Trying to continue unpaused monitor|, qr|WSREP: Wait for gtid returned error 3 while waiting for prior transactions to commit before setting position|, + qr|WSREP: Failed to report last committed|, ); sub which($) { return `sh -c "command -v $_[0]"` } sub skip_combinations { my %skip = (); - $skip{'include/have_mariabackup.inc'} = 'Need ss' + $skip{'include/have_mariabackup.inc'} = 'Need socket statistics utility' unless which("lsof") || which("sockstat") || which("ss"); %skip; } diff --git a/mysql-test/suite/galera_3nodes/t/galera-features#115.cnf b/mysql-test/suite/galera_3nodes/t/galera-features#115.cnf new file mode 100644 index 00000000000..e255e1d527e --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera-features#115.cnf @@ -0,0 +1,4 @@ +!include ../galera_3nodes.cnf + +[mysqld] +wsrep-ignore-apply-errors=0 diff --git a/mysql-test/suite/galera_3nodes/t/galera-features#115.test b/mysql-test/suite/galera_3nodes/t/galera-features#115.test new file mode 100644 index 00000000000..f045e7abe4b --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera-features#115.test @@ -0,0 +1,89 @@ +# +# This test tests that one successful node wins over two nodes that fail for +# different reasons +# +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source suite/galera/include/auto_increment_offset_save.inc + +# create inconsistency on node 2 +--connection node_2 +SET GLOBAL wsrep_on=OFF; +DROP SCHEMA test; + +# create inconsistency on node 3 +--connection node_3 +SET GLOBAL wsrep_on=OFF; +CREATE TABLE t1 (f1 INTEGER); + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER); + +# check that nodes 2 and 3 leave the cluster, and node_1 is Primary by itself + +--connection node_1 +SET SESSION wsrep_sync_wait=0; +--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 +SET SESSION wsrep_sync_wait=0; +--let $wait_condition = SELECT VARIABLE_VALUE = 'Disconnected' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc + +--connection node_3 +SET SESSION wsrep_sync_wait=0; +--let $wait_condition = SELECT VARIABLE_VALUE = 'Disconnected' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc + +--connection node_1 +# this is a workaround for "sending install message failed" BUG: +# https://github.com/codership/galera/issues/174 +# When it happens, node_1 becomes non-prim +SET GLOBAL wsrep_provider_options='pc.bootstrap=YES'; +--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc + +# restart nodes 2 and 3, since they failed + +--connection node_2 +# need to reinitialize connection due to a "Bad handshake" bug. +# we reconnect using the 'mysql' database as 'test' was dropped. +--disconnect node_2 +--connect node_2, 127.0.0.1, root, , mysql, $NODE_MYPORT_2 + --source include/restart_mysqld.inc + +--connection node_3 + --source include/restart_mysqld.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 3 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 + +DROP TABLE test.t1; + +--source suite/galera/include/auto_increment_offset_restore.inc + +--connection node_2 +CALL mtr.add_suppression("Inconsistent by consensus\\."); +CALL mtr.add_suppression("Error_code: 1049"); +CALL mtr.add_suppression("WSREP: Failed to apply trx: source: "); +CALL mtr.add_suppression("WSREP: Failed to apply app buffer"); +CALL mtr.add_suppression("WSREP: Node consistency compromized, leaving cluster\\.\\.\\."); + +--connection node_3 +CALL mtr.add_suppression("Inconsistent by consensus\\."); +CALL mtr.add_suppression("Error_code: 1050"); +CALL mtr.add_suppression("WSREP: Failed to apply trx: source: "); +CALL mtr.add_suppression("WSREP: Failed to apply app buffer"); +CALL mtr.add_suppression("WSREP: Node consistency compromized, leaving cluster\\.\\.\\."); diff --git a/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test b/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test index e59fcfb2100..86119bf7bcb 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test +++ b/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test @@ -15,8 +15,9 @@ --connection node_4 ---replace_result $NODE_MYPORT_1 NODE_MYPORT_1 +--disable_query_log --eval CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_1, master_use_gtid=current_pos; +--enable_query_log START SLAVE; --source include/wait_for_slave_to_start.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test index c8247f15aba..750f840c470 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test +++ b/mysql-test/suite/galera_3nodes/t/galera_gtid_2_cluster.test @@ -42,8 +42,10 @@ SHOW STATUS LIKE 'wsrep_cluster_size'; SHOW STATUS LIKE 'wsrep_cluster_size'; #--disable_parsing --connection node_1 ---replace_result $NODE_MYPORT_4 NODE_MYPORT_4 +--echo --- ignore_server_ids=(12,13) +--disable_query_log --eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_4, master_use_gtid=current_pos, ignore_server_ids=(12,13); +--enable_query_log start slave; --source include/wait_for_slave_to_start.inc select @@gtid_binlog_state; @@ -51,8 +53,10 @@ select @@gtid_slave_pos; #--query_vertical SHOW SLAVE STATUS; --connection node_4 ---replace_result $NODE_MYPORT_1 NODE_MYPORT_1 +--echo --- ignore_server_ids=(22,23) +--disable_query_log --eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_1, master_use_gtid=current_pos, ignore_server_ids=(22,23); +--enable_query_log start slave; --source include/wait_for_slave_to_start.inc select @@gtid_binlog_state; @@ -210,8 +214,10 @@ set global wsrep_on=ON; # Then we will kill node D and set up the replication between A and E # To see whether fail over works or not. --connection node_1 ---replace_result $NODE_MYPORT_6 NODE_MYPORT_6 +--echo --- ignore_server_ids=(12,13) +--disable_query_log --eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_6, master_use_gtid=current_pos, ignore_server_ids=(12,13); +--enable_query_log start slave; --source include/wait_for_slave_to_start.inc select @@gtid_binlog_state; @@ -219,8 +225,10 @@ select @@gtid_slave_pos; #--query_vertical SHOW SLAVE STATUS; --connection node_4 ---replace_result $NODE_MYPORT_3 NODE_MYPORT_3 +--echo --- ignore_server_ids=(22,23) +--disable_query_log --eval change master to master_host='127.0.0.1', master_user='root', master_port=$NODE_MYPORT_3, master_use_gtid=current_pos, ignore_server_ids=(22,23); +--enable_query_log start slave; --source include/wait_for_slave_to_start.inc select @@gtid_binlog_state; diff --git a/mysql-test/suite/galera_3nodes_sr/suite.pm b/mysql-test/suite/galera_3nodes_sr/suite.pm index becc764733a..d2b31a0fbc7 100644 --- a/mysql-test/suite/galera_3nodes_sr/suite.pm +++ b/mysql-test/suite/galera_3nodes_sr/suite.pm @@ -9,21 +9,21 @@ return wsrep_not_ok() if wsrep_not_ok(); push @::global_suppressions, ( - qr(WSREP: wsrep_sst_receive_address is set to '127.0.0.1), + qr(WSREP: wsrep_sst_receive_address is set to '127\.0\.0\.1), qr(WSREP: Could not open saved state file for reading: .*), qr(WSREP: Could not open state file for reading: .*), - qr(WSREP: Gap in state sequence. Need state transfer.), + qr(WSREP: Gap in state sequence. Need state transfer\.), qr(WSREP: Failed to prepare for incremental state transfer:), - qr(WSREP:.*down context.*), + qr(WSREP: .*down context.*), qr(WSREP: Failed to send state UUID:), qr(WSREP: last inactive check more than .* skipping check), qr(WSREP: SQL statement was ineffective), - qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned.), + qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned\.), qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|, qr(WSREP: Quorum: No node with complete state), qr(WSREP: Initial position was provided by configuration or SST, avoiding override), - qr|WSREP: discarding established \(time wait\) .*|, - qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside. Will use that one.), + qr|WSREP: discarding established \(time wait\).*|, + qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside\. Will use that one\.), qr(WSREP: evs::proto.*), qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:.*|, qr(WSREP: no nodes coming from prim view, prim not possible), @@ -31,16 +31,16 @@ push @::global_suppressions, qr(WSREP: user message in state LEAVING), qr(WSREP: .* sending install message failed: Transport endpoint is not connected), qr(WSREP: .* sending install message failed: Resource temporarily unavailable), - qr(WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\). Will retry in new primary component.), + qr(WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\)\. Will retry in new primary component\.), qr(WSREP: Could not find peer:), qr|WSREP: gcs_caused\(\) returned .*|, - qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(SYNCED\). Message ignored.|, - qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(JOINED\). Message ignored.|, + qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(SYNCED\)\. Message ignored\.|, + qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(JOINED\)\. Message ignored\.|, qr(WSREP: Action message in non-primary configuration from member [0-9]*), qr(WSREP: Last Applied Action message in non-primary configuration from member [0-9]*), qr|WSREP: .*core_handle_uuid_msg.*|, - qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0. WSREP_SYNC_WAIT_BEFORE_READ is on), - qr(WSREP: JOIN message from member .* in non-primary configuration. Ignored.), + qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0\. WSREP_SYNC_WAIT_BEFORE_READ is on), + qr(WSREP: JOIN message from member .* in non-primary configuration\. Ignored\.), ); bless { }; diff --git a/mysql-test/suite/galera_sr/suite.pm b/mysql-test/suite/galera_sr/suite.pm index a9665b5252c..1a0e9b28685 100644 --- a/mysql-test/suite/galera_sr/suite.pm +++ b/mysql-test/suite/galera_sr/suite.pm @@ -9,20 +9,20 @@ return wsrep_not_ok() if wsrep_not_ok(); push @::global_suppressions, ( - qr(WSREP: wsrep_sst_receive_address is set to '127.0.0.1), + qr(WSREP: wsrep_sst_receive_address is set to '127\.0\.0\.1), qr(WSREP: Could not open saved state file for reading: .*), qr(WSREP: Could not open state file for reading: .*), - qr(WSREP: Gap in state sequence. Need state transfer.), + qr(WSREP: Gap in state sequence\. Need state transfer\.), qr(WSREP: Failed to prepare for incremental state transfer:), - qr(WSREP:.*down context.*), + qr(WSREP: .*down context.*), qr(WSREP: Failed to send state UUID:), qr(WSREP: last inactive check more than .* skipping check), - qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned.), + qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned\.), qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|, qr(WSREP: Quorum: No node with complete state), qr(WSREP: Initial position was provided by configuration or SST, avoiding override), qr|WSREP: discarding established \(time wait\) .*|, - qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside. Will use that one.), + qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside\. Will use that one\.), qr(WSREP: evs::proto.*), qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:.*|, qr(WSREP: no nodes coming from prim view, prim not possible), @@ -45,26 +45,28 @@ push @::global_suppressions, qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*), qr(WSREP: gcs connect failed: Connection timed out), qr|WSREP: wsrep::connect\(.*\) failed: 7|, - qr(WSREP: SYNC message from member .* in non-primary configuration. Ignored.), + qr(WSREP: SYNC message from member .* in non-primary configuration\. Ignored\.), qr(WSREP: Could not find peer:), qr(WSREP: TO isolation failed for: .*), qr|WSREP: gcs_caused\(\) returned .*|, - qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(SYNCED\). Message ignored.|, - qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(JOINED\). Message ignored.|, - qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled. Expect abort.|, + qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(SYNCED\). Message ignored\.|, + qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(JOINED\). Message ignored\.|, + qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled\. Expect abort\.|, qr(WSREP: Action message in non-primary configuration from member [0-9]*), qr(WSREP: Last Applied Action message in non-primary configuration from member [0-9]*), qr(WSREP: discarding established .*), qr|WSREP: .*core_handle_uuid_msg.*|, - qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0. WSREP_SYNC_WAIT_BEFORE_READ is on), - qr|WSREP: JOIN message from member .* in non-primary configuration. Ignored.|, - qr|Query apply failed:*|, - qr(WSREP: Ignoring error*), + qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0\. WSREP_SYNC_WAIT_BEFORE_READ is on), + qr|WSREP: JOIN message from member .* in non-primary configuration\. Ignored\.|, + qr|WSREP: .*Query apply failed:.*|, + qr(WSREP: Ignoring error.*), qr(WSREP: Failed to remove page file .*), qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to .*), - qr|WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\). Will retry in new primary component.|, + qr|WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\)\. Will retry in new primary component\.|, + qr|WSREP: Send action \{.* STATE_REQUEST\} returned -107 \(Transport endpoint is not connected\)|, qr|WSREP: Trying to continue unpaused monitor|, qr|WSREP: Wait for gtid returned error 3 while waiting for prior transactions to commit before setting position|, + qr|WSREP: Failed to report last committed|, ); bless { }; From 7b040e53cc07bc7bd78d9c2029e1e714e19c2fec Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Thu, 6 Feb 2025 21:29:04 +0100 Subject: [PATCH 018/134] galera mtr tests: fixes for test failures, 'cosmetic' changes and unification between versions --- mysql-test/suite/galera/r/MDEV-20225.result | 2 +- mysql-test/suite/galera/r/MDEV-20793.result | 2 +- mysql-test/suite/galera/r/MDEV-25389.result | 1 + .../r/galera_applier_ftwrl_table_alter.result | 4 +- .../galera/r/galera_ddl_fk_conflict.result | 3 ++ .../r/galera_parallel_apply_lock_table.result | 7 ++- .../galera/r/galera_parallel_simple.result | 1 - .../galera/r/galera_var_slave_threads.result | 1 - .../suite/galera/r/wsrep_strict_ddl.result | 6 +-- mysql-test/suite/galera/suite.pm | 54 +++++++++---------- mysql-test/suite/galera/t/MDEV-10715.cnf | 4 +- mysql-test/suite/galera/t/MDEV-15443.cnf | 2 + mysql-test/suite/galera/t/MDEV-20225.test | 2 +- mysql-test/suite/galera/t/MDEV-20793.test | 2 +- mysql-test/suite/galera/t/MDEV-22227.test | 2 +- mysql-test/suite/galera/t/MDEV-22708.cnf | 2 +- mysql-test/suite/galera/t/MDEV-24143.test | 1 - mysql-test/suite/galera/t/MDEV-24327.cnf | 1 - mysql-test/suite/galera/t/MDEV-25389.test | 7 +++ mysql-test/suite/galera/t/MDEV-25731.test | 2 - mysql-test/suite/galera/t/MDEV-26597.test | 2 - mysql-test/suite/galera/t/MDEV-27123.opt | 1 - mysql-test/suite/galera/t/MDEV-29293.test | 1 - mysql-test/suite/galera/t/MDEV-29512.cnf | 2 - mysql-test/suite/galera/t/MDEV-6860.cnf | 5 +- mysql-test/suite/galera/t/MW-259.test | 1 - mysql-test/suite/galera/t/MW-313.cnf | 3 -- mysql-test/suite/galera/t/MW-360-master.opt | 1 - mysql-test/suite/galera/t/MW-369.inc | 2 - mysql-test/suite/galera/t/MW-86-wait8.cnf | 1 - mysql-test/suite/galera/t/create.test | 1 - .../suite/galera/t/galera_MDEV-29512.cnf | 2 - .../galera/t/galera_applier_ftwrl_table.test | 2 +- .../t/galera_applier_ftwrl_table_alter.cnf | 3 -- .../t/galera_applier_ftwrl_table_alter.test | 6 +-- .../suite/galera/t/galera_as_slave_ctas.test | 1 - .../suite/galera/t/galera_backup_stage.test | 6 +-- .../t/galera_bf_abort_at_after_statement.test | 1 - .../t/galera_bf_abort_flush_for_export.test | 4 +- .../galera/t/galera_bf_abort_lock_table.cnf | 4 -- .../galera/t/galera_bf_abort_lock_table.test | 5 +- .../suite/galera/t/galera_bf_abort_ps.cnf | 3 +- .../t/galera_bf_background_statistics.cnf | 2 - .../t/galera_bf_background_statistics.test | 1 - mysql-test/suite/galera/t/galera_bf_kill.test | 2 +- .../suite/galera/t/galera_bf_lock_wait.test | 1 - .../suite/galera/t/galera_binlog_checksum.cnf | 2 - .../t/galera_binlog_event_max_size_max.cnf | 3 -- .../t/galera_binlog_event_max_size_min.cnf | 3 -- .../t/galera_binlog_event_max_size_min.test | 1 - .../galera/t/galera_binlog_row_image.test | 4 -- .../suite/galera/t/galera_change_user.test | 1 - .../galera/t/galera_concurrent_ctas.test | 1 - .../suite/galera/t/galera_ddl_fk_conflict.cnf | 2 - .../galera/t/galera_ddl_fk_conflict.test | 1 - .../suite/galera/t/galera_ddl_multiline.test | 1 - .../galera/t/galera_encrypt_tmp_files.cnf | 2 +- .../galera/t/galera_forced_binlog_format.test | 1 - .../suite/galera/t/galera_gcs_fragment.cnf | 2 + .../galera/t/galera_gcs_max_packet_size.cnf | 2 + mysql-test/suite/galera/t/galera_gtid.cnf | 1 - .../suite/galera/t/galera_gtid_server_id.cnf | 1 - .../suite/galera/t/galera_gtid_slave.cnf | 3 ++ .../galera/t/galera_gtid_slave_sst_rsync.cnf | 4 +- .../galera/t/galera_gtid_trx_conflict.cnf | 2 + .../suite/galera/t/galera_insert_ignore.test | 1 - .../suite/galera/t/galera_insert_multi.test | 7 --- .../suite/galera/t/galera_ist_progress.cnf | 3 -- .../suite/galera/t/galera_ist_recv_bind.cnf | 1 - .../suite/galera/t/galera_kill_applier.cnf | 2 + .../suite/galera/t/galera_load_data.test | 1 - .../suite/galera/t/galera_mdev_13787.cnf | 2 - .../suite/galera/t/galera_mdev_13787.test | 1 + .../suite/galera/t/galera_mdev_15611.cnf | 1 + .../suite/galera/t/galera_mdl_race.test | 1 - .../suite/galera/t/galera_nonPK_and_PA.test | 1 + .../suite/galera/t/galera_nopk_unicode.test | 1 - .../t/galera_parallel_apply_lock_table.test | 11 ++-- .../t/galera_parallel_autoinc_largetrx.test | 1 - .../t/galera_parallel_autoinc_manytrx.test | 2 - .../galera/t/galera_parallel_simple.test | 6 ++- .../suite/galera/t/galera_pc_ignore_sb.cnf | 1 - .../suite/galera/t/galera_query_cache.cnf | 1 - .../galera/t/galera_query_cache_sync_wait.cnf | 1 - .../t/galera_repl_key_format_flat16.test | 1 - .../galera/t/galera_restart_nochanges.test | 1 - .../suite/galera/t/galera_restart_replica.cnf | 1 - .../galera/t/galera_savepoint_replay.test | 1 - mysql-test/suite/galera/t/galera_server.test | 1 - ...alera_set_position_after_cert_failure.test | 1 + .../suite/galera/t/galera_sp_bf_abort.inc | 1 - .../galera/t/galera_sql_log_bin_zero.test | 1 - .../suite/galera/t/galera_status_cluster.test | 2 - .../galera/t/galera_status_local_index.test | 1 - .../galera/t/galera_status_local_state.test | 4 -- .../suite/galera/t/galera_suspend_slave.test | 1 - .../galera/t/galera_sync_wait_upto-master.opt | 2 +- .../galera/t/galera_table_with_hyphen.inc | 1 - .../galera/t/galera_temporary_sequences.test | 1 - .../suite/galera/t/galera_threadpool.cnf | 2 - .../suite/galera/t/galera_toi_ftwrl.test | 1 - .../t/galera_transaction_read_only.test | 1 - mysql-test/suite/galera/t/galera_udf.cnf | 7 --- .../galera/t/galera_unicode_identifiers.test | 1 - .../suite/galera/t/galera_v1_row_events.cnf | 7 --- .../galera/t/galera_var_OSU_method2.test | 1 - .../t/galera_var_auto_inc_control_on.cnf | 6 --- .../galera/t/galera_var_slave_threads.test | 17 +++++- .../suite/galera/t/galera_wan_restart_sst.cnf | 1 - .../galera/t/galera_wsrep_log_conficts.cnf | 5 -- .../galera_wsrep_provider_options_syntax.test | 1 + mysql-test/suite/galera/t/mdev-31285.test | 2 - mysql-test/suite/galera/t/mysql-wsrep#198.cnf | 2 - .../suite/galera/t/mysql-wsrep#198.test | 3 +- mysql-test/suite/galera/t/mysql-wsrep#201.cnf | 2 - .../suite/galera/t/mysql-wsrep#247.test | 1 - mysql-test/suite/galera/t/mysql-wsrep#31.test | 2 - mysql-test/suite/galera/t/mysql-wsrep#33.cnf | 1 - .../suite/galera/t/mysql-wsrep#332.test | 1 - mysql-test/suite/galera/t/rename.test | 1 - mysql-test/suite/galera/t/view.test | 1 - .../r/galera_parallel_apply_3nodes.result | 2 +- mysql-test/suite/galera_3nodes/suite.pm | 54 +++++++++---------- .../galera_3nodes/t/galera-features#119.test | 1 - .../t/galera_certification_ccc.test | 1 - .../t/galera_evs_suspect_timeout.test | 1 + .../t/galera_parallel_apply_3nodes.test | 2 +- .../t/galera_wsrep_schema_init.test | 1 - .../t/inconsistency_shutdown.cnf | 3 +- .../galera_sr_kill_slave_before_apply.result | 2 +- mysql-test/suite/galera_3nodes_sr/suite.pm | 22 ++++---- .../suite/galera_3nodes_sr/t/GCF-606.test | 1 + ...a_sr_kill_slave_after_apply_rollback2.test | 1 + .../t/galera_sr_kill_slave_before_apply.test | 2 +- .../t/galera_sr_threeway_split.cnf | 1 - .../t/galera_vote_sr-master.opt | 1 - .../galera_sr/r/galera_sr_cc_master.result | 2 +- .../r/mysql-wsrep-features#148.result | 2 +- mysql-test/suite/galera_sr/suite.pm | 54 +++++++++---------- mysql-test/suite/galera_sr/t/MDEV-27615.test | 1 - .../galera_sr/t/galera_sr_cc_master.test | 2 +- .../galera_sr/t/galera_sr_gtid-master.opt | 2 +- .../galera_sr/t/galera_sr_mysqldump_sst.cnf | 1 - .../galera_sr/t/galera_sr_small_gcache.cnf | 3 +- .../galera_sr/t/mysql-wsrep-features#14.test | 1 - .../galera_sr/t/mysql-wsrep-features#148.test | 2 +- .../galera_sr/t/mysql-wsrep-features#22.test | 1 - .../galera_sr/t/mysql-wsrep-features#96.test | 4 -- mysql-test/suite/wsrep/r/plugin.result | 2 +- mysql-test/suite/wsrep/suite.pm | 6 +-- mysql-test/suite/wsrep/t/binlog_format.cnf | 1 - mysql-test/suite/wsrep/t/foreign_key.test | 1 - mysql-test/suite/wsrep/t/mdev_10186.test | 1 - mysql-test/suite/wsrep/t/mdev_7798.cnf | 1 - mysql-test/suite/wsrep/t/plugin.test | 2 +- mysql-test/suite/wsrep/t/wsrep-recover.cnf | 2 +- .../wsrep/t/wsrep_forced_binlog_format.test | 1 - mysql-test/suite/wsrep/t/wsrep_rpl.test | 1 - .../wsrep/t/wsrep_variables_sst_method.test | 1 - .../wsrep/t/wsrep_variables_wsrep_off.cnf | 1 - sql/wsrep_mysqld.cc | 9 ++-- 161 files changed, 215 insertions(+), 321 deletions(-) diff --git a/mysql-test/suite/galera/r/MDEV-20225.result b/mysql-test/suite/galera/r/MDEV-20225.result index 245051309d1..47c21249c8d 100644 --- a/mysql-test/suite/galera/r/MDEV-20225.result +++ b/mysql-test/suite/galera/r/MDEV-20225.result @@ -15,7 +15,7 @@ connection node_2a; SET GLOBAL debug_dbug = 'RESET'; SET DEBUG_SYNC = 'now SIGNAL signal.mdev_20225_continue'; SET DEBUG_SYNC = 'RESET'; -SET GLOBAL wsrep_slave_threads = 1; +SET GLOBAL wsrep_slave_threads = DEFAULT; connection node_2; SHOW TRIGGERS; Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation diff --git a/mysql-test/suite/galera/r/MDEV-20793.result b/mysql-test/suite/galera/r/MDEV-20793.result index feb068f258f..d37c0b79165 100644 --- a/mysql-test/suite/galera/r/MDEV-20793.result +++ b/mysql-test/suite/galera/r/MDEV-20793.result @@ -41,4 +41,4 @@ connection node_1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction SET debug_sync = "RESET"; DROP TABLE t1; -SET GLOBAL wsrep_slave_threads = 1; +SET GLOBAL wsrep_slave_threads = DEFAULT; diff --git a/mysql-test/suite/galera/r/MDEV-25389.result b/mysql-test/suite/galera/r/MDEV-25389.result index f369fe4dbae..fe3975fe163 100644 --- a/mysql-test/suite/galera/r/MDEV-25389.result +++ b/mysql-test/suite/galera/r/MDEV-25389.result @@ -15,3 +15,4 @@ SET GLOBAL wsrep_slave_threads=1; SELECT @@wsrep_slave_threads; @@wsrep_slave_threads 1 +connection node_2; diff --git a/mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result b/mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result index 451b2c80c2a..f0f67c28a28 100644 --- a/mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result +++ b/mysql-test/suite/galera/r/galera_applier_ftwrl_table_alter.result @@ -13,7 +13,7 @@ connection node_1; SELECT 1 FROM DUAL; 1 1 -SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock'; +SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); COUNT(*) = 1 1 UNLOCK TABLES; @@ -25,7 +25,7 @@ t1 CREATE TABLE `t1` ( `f2` int(11) DEFAULT NULL, PRIMARY KEY (`f1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci -SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock'; +SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); COUNT(*) = 0 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_ddl_fk_conflict.result b/mysql-test/suite/galera/r/galera_ddl_fk_conflict.result index 226aebde69e..cf0f1bf8e24 100644 --- a/mysql-test/suite/galera/r/galera_ddl_fk_conflict.result +++ b/mysql-test/suite/galera/r/galera_ddl_fk_conflict.result @@ -298,6 +298,7 @@ DROP TABLE p1, p2; ###################################################################### connection node_1; SET SESSION wsrep_sync_wait=0; +FLUSH STATUS; CREATE TABLE p1 (pk INTEGER PRIMARY KEY, f2 CHAR(30)); INSERT INTO p1 VALUES (1, 'INITIAL VALUE'); CREATE TABLE p2 (pk INTEGER PRIMARY KEY, f2 CHAR(30)); @@ -491,6 +492,7 @@ Note 1051 Unknown table 'test.tmp1,test.tmp2' ###################################################################### connection node_1; SET SESSION wsrep_sync_wait=0; +FLUSH STATUS; CREATE TABLE p1 (pk INTEGER PRIMARY KEY, f2 CHAR(30)); INSERT INTO p1 VALUES (1, 'INITIAL VALUE'); CREATE TABLE p2 (pk INTEGER PRIMARY KEY, f2 CHAR(30)); @@ -684,6 +686,7 @@ Note 1051 Unknown table 'test.tmp1,test.tmp2' ###################################################################### connection node_1; SET SESSION wsrep_sync_wait=0; +FLUSH STATUS; CREATE TABLE p1 (pk INTEGER PRIMARY KEY, f2 CHAR(30)); INSERT INTO p1 VALUES (1, 'INITIAL VALUE'); CREATE TABLE p2 (pk INTEGER PRIMARY KEY, f2 CHAR(30)); diff --git a/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result b/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result index a15b0c7df69..b1ba03a8391 100644 --- a/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result +++ b/mysql-test/suite/galera/r/galera_parallel_apply_lock_table.result @@ -10,10 +10,10 @@ INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (1); connection node_2a; SET SESSION wsrep_sync_wait=0; -SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE LIKE '%committing%' or STATE = 'Waiting for certification'); +SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE '%committing%' OR STATE LIKE 'Commit' OR STATE LIKE 'Waiting for certification'); EXPECT_1 1 -SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Waiting for table metadata lock%'; +SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); EXPECT_1 1 SELECT COUNT(*) AS EXPECT_0 FROM t1; @@ -32,9 +32,8 @@ EXPECT_1 SELECT COUNT(*) AS EXPECT_1 FROM t2; EXPECT_1 1 -SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE LIKE '%committed%' or STATE = 'Waiting for certification'); +SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE '%committed%' OR STATE LIKE 'Waiting for certification'); EXPECT_2 2 -SET GLOBAL wsrep_slave_threads = 1;; DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/suite/galera/r/galera_parallel_simple.result b/mysql-test/suite/galera/r/galera_parallel_simple.result index cac784cd16f..46b00539fb1 100644 --- a/mysql-test/suite/galera/r/galera_parallel_simple.result +++ b/mysql-test/suite/galera/r/galera_parallel_simple.result @@ -34,6 +34,5 @@ expect_20 SELECT COUNT(*) as expect_20 FROM t2; expect_20 20 -SET GLOBAL wsrep_slave_threads = 1;; DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/suite/galera/r/galera_var_slave_threads.result b/mysql-test/suite/galera/r/galera_var_slave_threads.result index 936f58b89a0..a835cbf527e 100644 --- a/mysql-test/suite/galera/r/galera_var_slave_threads.result +++ b/mysql-test/suite/galera/r/galera_var_slave_threads.result @@ -33,7 +33,6 @@ connection node_2; SELECT COUNT(*) FROM t2; COUNT(*) 70 -SET GLOBAL wsrep_slave_threads = 1; DROP TABLE t1; DROP TABLE t2; # diff --git a/mysql-test/suite/galera/r/wsrep_strict_ddl.result b/mysql-test/suite/galera/r/wsrep_strict_ddl.result index 7b166f00bc3..37332fb19a3 100644 --- a/mysql-test/suite/galera/r/wsrep_strict_ddl.result +++ b/mysql-test/suite/galera/r/wsrep_strict_ddl.result @@ -20,7 +20,7 @@ ERROR HY000: DDL-statement is forbidden as table storage engine does not support SHOW WARNINGS; Level Code Message Error 4165 DDL-statement is forbidden as table storage engine does not support Galera replication -Warning 1031 WSREP: wsrep_strict_dll enabled. Storage engine Aria not supported. +Warning 1031 WSREP: wsrep_strict_ddl enabled. Storage engine Aria not supported. connection node_2; SHOW CREATE TABLE t1; ERROR 42S02: Table 'test.t1' doesn't exist @@ -31,9 +31,9 @@ ERROR HY000: DDL-statement is forbidden as table storage engine does not support SHOW WARNINGS; Level Code Message Error 4165 DDL-statement is forbidden as table storage engine does not support Galera replication -Warning 1031 WSREP: wsrep_strict_dll enabled. Storage engine MyISAM not supported. +Warning 1031 WSREP: wsrep_strict_ddl enabled. Storage engine MyISAM not supported. Error 4165 DDL-statement is forbidden as table storage engine does not support Galera replication -Warning 1031 WSREP: wsrep_strict_dll enabled. Storage engine MyISAM not supported. +Warning 1031 WSREP: wsrep_strict_ddl enabled. Storage engine MyISAM not supported. SHOW CREATE TABLE t2; Table Create Table t2 CREATE TABLE `t2` ( diff --git a/mysql-test/suite/galera/suite.pm b/mysql-test/suite/galera/suite.pm index 825525765ca..404025fb175 100644 --- a/mysql-test/suite/galera/suite.pm +++ b/mysql-test/suite/galera/suite.pm @@ -11,58 +11,58 @@ return wsrep_not_ok() if wsrep_not_ok(); push @::global_suppressions, ( qr(WSREP: wsrep_sst_receive_address is set to '127\.0\.0\.1), - qr(WSREP: Could not open saved state file for reading: .*), - qr(WSREP: Could not open state file for reading: .*), + qr(WSREP: Could not open saved state file for reading: ), + qr(WSREP: Could not open state file for reading: ), qr(WSREP: Gap in state sequence\. Need state transfer\.), qr(WSREP: Failed to prepare for incremental state transfer:), qr(WSREP: .*down context.*), qr(WSREP: Failed to send state UUID:), qr(WSREP: last inactive check more than .* skipping check), - qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned\.), - qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|, + qr(WSREP: Releasing seqno [0-9]+ before [0-9]+ was assigned\.), + qr|WSREP: access file\(.*gvwstate.dat\) failed ?\(No such file or directory\)|, qr(WSREP: Quorum: No node with complete state), qr(WSREP: Initial position was provided by configuration or SST, avoiding override), - qr|WSREP: discarding established \(time wait\) .*|, + qr|WSREP: discarding established \(time wait\) |, qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside\. Will use that one\.), qr(WSREP: evs::proto.*), - qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:.*|, + qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:|, qr(WSREP: no nodes coming from prim view, prim not possible), qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable), qr(WSREP: user message in state LEAVING), qr(WSREP: .* sending install message failed: Transport endpoint is not connected), qr(WSREP: .* sending install message failed: Resource temporarily unavailable), - qr(WSREP: Maximum writeset size exceeded by .*), - qr(WSREP: transaction size exceeded.*), - qr(WSREP: RBR event .*), - qr(WSREP: Ignoring error for TO isolated action: .*), - qr(WSREP: transaction size limit .*), - qr(WSREP: rbr write fail, .*), - qr(WSREP: .*Backend not supported: foo.*), - qr(WSREP: .*Failed to initialize backend using .*), - qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*), + qr(WSREP: Maximum writeset size exceeded by ), + qr(WSREP: transaction size exceeded), + qr(WSREP: RBR event ), + qr(WSREP: Ignoring error for TO isolated action: ), + qr(WSREP: transaction size limit ), + qr(WSREP: rbr write fail, ), + qr(WSREP: .*Backend not supported: foo), + qr(WSREP: .*Failed to initialize backend using ), + qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at ), qr(WSREP: gcs connect failed: Socket type not supported), qr(WSREP: failed to open gcomm backend connection: 110: failed to reach primary view: 110 .*), - qr(WSREP: .*Failed to open backend connection: -110 .*), - qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*), + qr(WSREP: .*Failed to open backend connection: -110 ), + qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at ), qr(WSREP: gcs connect failed: Connection timed out), qr|WSREP: wsrep::connect\(.*\) failed: 7|, qr(WSREP: SYNC message from member .* in non-primary configuration\. Ignored\.), qr(WSREP: Could not find peer:), - qr(WSREP: TO isolation failed for: .*), - qr|WSREP: gcs_caused\(\) returned .*|, - qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(SYNCED\). Message ignored\.|, - qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(JOINED\). Message ignored\.|, + qr(WSREP: TO isolation failed for: ), + qr|WSREP: gcs_caused\(\) returned |, + qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(SYNCED\)\. Message ignored\.|, + qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(JOINED\)\. Message ignored\.|, qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled\. Expect abort\.|, qr(WSREP: Action message in non-primary configuration from member [0-9]*), qr(WSREP: Last Applied Action message in non-primary configuration from member [0-9]*), - qr(WSREP: discarding established .*), - qr|WSREP: .*core_handle_uuid_msg.*|, + qr(WSREP: discarding established ), + qr|WSREP: .*core_handle_uuid_msg|, qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0\. WSREP_SYNC_WAIT_BEFORE_READ is on), qr|WSREP: JOIN message from member .* in non-primary configuration\. Ignored\.|, - qr|WSREP: .*Query apply failed:.*|, - qr(WSREP: Ignoring error.*), - qr(WSREP: Failed to remove page file .*), - qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to .*), + qr|WSREP: .*Query apply failed:|, + qr(WSREP: Ignoring error), + qr(WSREP: Failed to remove page file ), + qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to ), qr|WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\)\. Will retry in new primary component\.|, qr|WSREP: Send action \{.* STATE_REQUEST\} returned -107 \(Transport endpoint is not connected\)|, qr|WSREP: Trying to continue unpaused monitor|, diff --git a/mysql-test/suite/galera/t/MDEV-10715.cnf b/mysql-test/suite/galera/t/MDEV-10715.cnf index 589514466ed..1422f977bf7 100644 --- a/mysql-test/suite/galera/t/MDEV-10715.cnf +++ b/mysql-test/suite/galera/t/MDEV-10715.cnf @@ -4,11 +4,13 @@ log-bin=mysqld-bin log-slave-updates binlog-format=ROW + [mysqld.1] gtid-domain-id=1 wsrep_gtid_mode=1 wsrep_gtid_domain_id=1 + [mysqld.2] gtid-domain-id=1 wsrep_gtid_mode=1 -wsrep_gtid_domain_id=1 \ No newline at end of file +wsrep_gtid_domain_id=1 diff --git a/mysql-test/suite/galera/t/MDEV-15443.cnf b/mysql-test/suite/galera/t/MDEV-15443.cnf index 88a08203d01..f8c6733de16 100644 --- a/mysql-test/suite/galera/t/MDEV-15443.cnf +++ b/mysql-test/suite/galera/t/MDEV-15443.cnf @@ -1,5 +1,7 @@ !include ../galera_2nodes.cnf + [mysqld.1] wsrep_auto_increment_control=OFF + [mysqld.2] wsrep_auto_increment_control=OFF diff --git a/mysql-test/suite/galera/t/MDEV-20225.test b/mysql-test/suite/galera/t/MDEV-20225.test index 60ab1c53e40..43c763e1d16 100644 --- a/mysql-test/suite/galera/t/MDEV-20225.test +++ b/mysql-test/suite/galera/t/MDEV-20225.test @@ -41,7 +41,7 @@ INSERT INTO t1 VALUES (NULL); SET GLOBAL debug_dbug = 'RESET'; SET DEBUG_SYNC = 'now SIGNAL signal.mdev_20225_continue'; SET DEBUG_SYNC = 'RESET'; -SET GLOBAL wsrep_slave_threads = 1; +SET GLOBAL wsrep_slave_threads = DEFAULT; --connection node_2 # Trigger should now be dropped on node_2. diff --git a/mysql-test/suite/galera/t/MDEV-20793.test b/mysql-test/suite/galera/t/MDEV-20793.test index 6835a73a2a4..67140d06e71 100644 --- a/mysql-test/suite/galera/t/MDEV-20793.test +++ b/mysql-test/suite/galera/t/MDEV-20793.test @@ -99,4 +99,4 @@ SET SESSION debug_sync = "now SIGNAL continue"; SET debug_sync = "RESET"; DROP TABLE t1; -SET GLOBAL wsrep_slave_threads = 1; +SET GLOBAL wsrep_slave_threads = DEFAULT; diff --git a/mysql-test/suite/galera/t/MDEV-22227.test b/mysql-test/suite/galera/t/MDEV-22227.test index 0ee75b979e2..e3c4565958b 100644 --- a/mysql-test/suite/galera/t/MDEV-22227.test +++ b/mysql-test/suite/galera/t/MDEV-22227.test @@ -13,7 +13,7 @@ SET lock_wait_timeout= 1; --connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1 --connection node_1b SET SESSION wsrep_sync_wait = 0; ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'Waiting for table level lock' +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for table level lock' --source include/wait_condition.inc --connection node_1 diff --git a/mysql-test/suite/galera/t/MDEV-22708.cnf b/mysql-test/suite/galera/t/MDEV-22708.cnf index f7ac4f43082..4c62448fe3d 100644 --- a/mysql-test/suite/galera/t/MDEV-22708.cnf +++ b/mysql-test/suite/galera/t/MDEV-22708.cnf @@ -1,4 +1,4 @@ !include ../galera_2nodes.cnf [mysqld] -log-bin \ No newline at end of file +log-bin diff --git a/mysql-test/suite/galera/t/MDEV-24143.test b/mysql-test/suite/galera/t/MDEV-24143.test index 3aecac8cb07..391c93a875c 100644 --- a/mysql-test/suite/galera/t/MDEV-24143.test +++ b/mysql-test/suite/galera/t/MDEV-24143.test @@ -21,4 +21,3 @@ CREATE TABLE t1 (pk INT PRIMARY KEY, b INT) ENGINE=SEQUENCE; ALTER TABLE t1 DROP COLUMN c2; SELECT get_lock ('test', 1.5); DROP TABLE t1; - diff --git a/mysql-test/suite/galera/t/MDEV-24327.cnf b/mysql-test/suite/galera/t/MDEV-24327.cnf index 390a9aab0f4..d3e98435699 100644 --- a/mysql-test/suite/galera/t/MDEV-24327.cnf +++ b/mysql-test/suite/galera/t/MDEV-24327.cnf @@ -3,4 +3,3 @@ [mysqld.1] log-bin=mariadb-bin log-slave-updates=OFF - diff --git a/mysql-test/suite/galera/t/MDEV-25389.test b/mysql-test/suite/galera/t/MDEV-25389.test index fc523371918..0bc7d8de9d5 100644 --- a/mysql-test/suite/galera/t/MDEV-25389.test +++ b/mysql-test/suite/galera/t/MDEV-25389.test @@ -7,6 +7,8 @@ --source ../galera/include/auto_increment_offset_save.inc --connection node_2 +--let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads` + call mtr.add_suppression("WSREP: Failed to create/initialize system thread"); SET GLOBAL debug_dbug='+d,wsrep_simulate_failed_connection_1'; --error ER_WRONG_ARGUMENTS @@ -21,4 +23,9 @@ SELECT @@wsrep_slave_threads; # issue is fixed. --source include/restart_mysqld.inc +--connection node_2 +--disable_query_log +--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; +--enable_query_log + --source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/MDEV-25731.test b/mysql-test/suite/galera/t/MDEV-25731.test index c26fad2fa6a..cf2a030d994 100644 --- a/mysql-test/suite/galera/t/MDEV-25731.test +++ b/mysql-test/suite/galera/t/MDEV-25731.test @@ -23,5 +23,3 @@ SELECT COUNT(*) AS EXPECT_12 FROM t1; DROP TABLE t1; SET GLOBAL wsrep_load_data_splitting=OFF; SET GLOBAL wsrep_replicate_myisam=OFF; - - diff --git a/mysql-test/suite/galera/t/MDEV-26597.test b/mysql-test/suite/galera/t/MDEV-26597.test index 465f1130443..7a57400c83d 100644 --- a/mysql-test/suite/galera/t/MDEV-26597.test +++ b/mysql-test/suite/galera/t/MDEV-26597.test @@ -28,5 +28,3 @@ SET SESSION wsrep_sync_wait = 0; --source ../../galera/include/auto_increment_offset_restore.inc --connection node_1 DROP TABLE t3; - - diff --git a/mysql-test/suite/galera/t/MDEV-27123.opt b/mysql-test/suite/galera/t/MDEV-27123.opt index 1c4accb816a..2a71a656039 100644 --- a/mysql-test/suite/galera/t/MDEV-27123.opt +++ b/mysql-test/suite/galera/t/MDEV-27123.opt @@ -1,2 +1 @@ --wsrep_auto_increment_control=OFF --auto_increment_increment=3 --auto_increment_offset=3 - diff --git a/mysql-test/suite/galera/t/MDEV-29293.test b/mysql-test/suite/galera/t/MDEV-29293.test index dacbf714c06..cf14a640035 100644 --- a/mysql-test/suite/galera/t/MDEV-29293.test +++ b/mysql-test/suite/galera/t/MDEV-29293.test @@ -38,4 +38,3 @@ set debug_sync= 'now SIGNAL continue'; --reap DROP TABLE t1; SET DEBUG_SYNC= 'RESET'; - diff --git a/mysql-test/suite/galera/t/MDEV-29512.cnf b/mysql-test/suite/galera/t/MDEV-29512.cnf index bf8e0c37984..136a8842a56 100644 --- a/mysql-test/suite/galera/t/MDEV-29512.cnf +++ b/mysql-test/suite/galera/t/MDEV-29512.cnf @@ -10,6 +10,4 @@ log_slave_updates max-binlog-size=4096 expire-logs-days=1 - [mysqld.2] - diff --git a/mysql-test/suite/galera/t/MDEV-6860.cnf b/mysql-test/suite/galera/t/MDEV-6860.cnf index d8defd343ad..71934249b25 100644 --- a/mysql-test/suite/galera/t/MDEV-6860.cnf +++ b/mysql-test/suite/galera/t/MDEV-6860.cnf @@ -1,7 +1,8 @@ !include ../galera_2nodes_as_slave.cnf +[mysqld.1] +wsrep-slave-threads=10 + [mysqld.2] slave-parallel-threads=2 slave-parallel-mode=optimistic -[mysqld.1] -wsrep-slave-threads=10 diff --git a/mysql-test/suite/galera/t/MW-259.test b/mysql-test/suite/galera/t/MW-259.test index 7298285f6ff..61e0f19e5bb 100644 --- a/mysql-test/suite/galera/t/MW-259.test +++ b/mysql-test/suite/galera/t/MW-259.test @@ -39,4 +39,3 @@ SET GLOBAL wsrep_desync=0; # Cleanup SET DEBUG_SYNC= 'RESET'; - diff --git a/mysql-test/suite/galera/t/MW-313.cnf b/mysql-test/suite/galera/t/MW-313.cnf index 184900c58fd..98e724fb2d0 100644 --- a/mysql-test/suite/galera/t/MW-313.cnf +++ b/mysql-test/suite/galera/t/MW-313.cnf @@ -7,6 +7,3 @@ log-slave-updates [mysqld.2] log-bin log-slave-updates - - - diff --git a/mysql-test/suite/galera/t/MW-360-master.opt b/mysql-test/suite/galera/t/MW-360-master.opt index e51c49c3808..35922307c93 100644 --- a/mysql-test/suite/galera/t/MW-360-master.opt +++ b/mysql-test/suite/galera/t/MW-360-master.opt @@ -1,2 +1 @@ --gtid-domain-id=1 --log-bin --log-slave-updates - diff --git a/mysql-test/suite/galera/t/MW-369.inc b/mysql-test/suite/galera/t/MW-369.inc index 3b0a32bdd9d..f2d59245d7d 100644 --- a/mysql-test/suite/galera/t/MW-369.inc +++ b/mysql-test/suite/galera/t/MW-369.inc @@ -80,5 +80,3 @@ SET SESSION DEBUG_SYNC = 'now SIGNAL signal.wsrep_apply_cb'; SET GLOBAL DEBUG_DBUG = ""; SET DEBUG_SYNC = 'RESET'; - - diff --git a/mysql-test/suite/galera/t/MW-86-wait8.cnf b/mysql-test/suite/galera/t/MW-86-wait8.cnf index 8f6a760def0..98e724fb2d0 100644 --- a/mysql-test/suite/galera/t/MW-86-wait8.cnf +++ b/mysql-test/suite/galera/t/MW-86-wait8.cnf @@ -7,4 +7,3 @@ log-slave-updates [mysqld.2] log-bin log-slave-updates - diff --git a/mysql-test/suite/galera/t/create.test b/mysql-test/suite/galera/t/create.test index 96a6640c21f..01b78d1ff41 100644 --- a/mysql-test/suite/galera/t/create.test +++ b/mysql-test/suite/galera/t/create.test @@ -86,4 +86,3 @@ DROP TABLE t1, t2; --source include/galera_end.inc --echo # End of tests - diff --git a/mysql-test/suite/galera/t/galera_MDEV-29512.cnf b/mysql-test/suite/galera/t/galera_MDEV-29512.cnf index bf8e0c37984..136a8842a56 100644 --- a/mysql-test/suite/galera/t/galera_MDEV-29512.cnf +++ b/mysql-test/suite/galera/t/galera_MDEV-29512.cnf @@ -10,6 +10,4 @@ log_slave_updates max-binlog-size=4096 expire-logs-days=1 - [mysqld.2] - diff --git a/mysql-test/suite/galera/t/galera_applier_ftwrl_table.test b/mysql-test/suite/galera/t/galera_applier_ftwrl_table.test index 97819384a75..4e17ddf2e4c 100644 --- a/mysql-test/suite/galera/t/galera_applier_ftwrl_table.test +++ b/mysql-test/suite/galera/t/galera_applier_ftwrl_table.test @@ -20,7 +20,7 @@ INSERT INTO t1 VALUES (2); --connection node_1a SET SESSION wsrep_sync_wait = 0; ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock' +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); --source include/wait_condition.inc SELECT COUNT(*) = 0 FROM t1; diff --git a/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.cnf b/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.cnf index 4d93a1b2509..3b7a713c30c 100644 --- a/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.cnf +++ b/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.cnf @@ -9,6 +9,3 @@ wait_timeout=5 lock_wait_timeout=5 innodb_lock_wait_timeout=5 wait_timeout=5 - - - diff --git a/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.test b/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.test index d62b6552973..9d9ec4bbee3 100644 --- a/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.test +++ b/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.test @@ -27,16 +27,16 @@ ALTER TABLE t1 ADD COLUMN f2 INTEGER; --connection node_1 SELECT 1 FROM DUAL; # Wait ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock'; +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); --source include/wait_condition.inc -SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock'; +SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); UNLOCK TABLES; SET SESSION wsrep_sync_wait = 15; SHOW CREATE TABLE t1; -SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock'; +SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_as_slave_ctas.test b/mysql-test/suite/galera/t/galera_as_slave_ctas.test index 32301a3d0d3..36d7f00ae87 100644 --- a/mysql-test/suite/galera/t/galera_as_slave_ctas.test +++ b/mysql-test/suite/galera/t/galera_as_slave_ctas.test @@ -73,4 +73,3 @@ RESET SLAVE ALL; --connection node_3 RESET MASTER; - diff --git a/mysql-test/suite/galera/t/galera_backup_stage.test b/mysql-test/suite/galera/t/galera_backup_stage.test index ef0706f9ab1..2756ebcf719 100644 --- a/mysql-test/suite/galera/t/galera_backup_stage.test +++ b/mysql-test/suite/galera/t/galera_backup_stage.test @@ -56,7 +56,7 @@ ALTER TABLE t1 ADD COLUMN (f4 int(10)); # reach commit stage. In the unlikely case the interleaving is different, the # result of the test should not change. --connection node_1c ---let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.processlist WHERE (State='Commit' OR State='Waiting for certification') AND ID=$insert_id +--let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.processlist WHERE (STATE LIKE '%committing%' OR STATE LIKE 'Commit' OR STATE LIKE 'Waiting for certification') AND ID=$insert_id --source include/wait_condition.inc --let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.metadata_lock_info WHERE TABLE_NAME='t1' AND THREAD_ID=$insert_id --source include/wait_condition.inc @@ -83,11 +83,11 @@ ALTER TABLE t1 ADD COLUMN (f4 int(10)); # wait for insert to get blocked --connection node_1c ---let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.processlist WHERE (State='Commit' OR State='Waiting for certification') AND ID=$insert_id +--let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.processlist WHERE (STATE LIKE '%committing%' OR STATE LIKE 'Commit' OR STATE LIKE 'Waiting for certification') AND ID=$insert_id --source include/wait_condition.inc --let $wait_condition = SELECT COUNT(*)=1 FROM information_schema.metadata_lock_info WHERE TABLE_NAME='t1' AND THREAD_ID=$insert_id --source include/wait_condition.inc ---let $wait_condition = SELECT COUNT(*)=2 FROM information_schema.processlist WHERE Info like 'INSERT INTO t1 (f1) values("node1%")' AND (State='Commit' or State='Waiting for certification') +--let $wait_condition = SELECT COUNT(*)=2 FROM information_schema.processlist WHERE Info like 'INSERT INTO t1 (f1) values("node1%")' AND (STATE LIKE '%committing%' OR STATE LIKE 'Commit' OR STATE LIKE 'Waiting for certification') --source include/wait_condition.inc # nothing after BLOCK_DDL is applied diff --git a/mysql-test/suite/galera/t/galera_bf_abort_at_after_statement.test b/mysql-test/suite/galera/t/galera_bf_abort_at_after_statement.test index 224db902569..5550c9a1c66 100644 --- a/mysql-test/suite/galera/t/galera_bf_abort_at_after_statement.test +++ b/mysql-test/suite/galera/t/galera_bf_abort_at_after_statement.test @@ -55,4 +55,3 @@ DROP TABLE t1; --disconnect node_2a --disconnect node_2b - diff --git a/mysql-test/suite/galera/t/galera_bf_abort_flush_for_export.test b/mysql-test/suite/galera/t/galera_bf_abort_flush_for_export.test index fde783e2cef..1227abb10f6 100644 --- a/mysql-test/suite/galera/t/galera_bf_abort_flush_for_export.test +++ b/mysql-test/suite/galera/t/galera_bf_abort_flush_for_export.test @@ -17,12 +17,12 @@ INSERT INTO t1 VALUES (2); --connection node_2 SET SESSION wsrep_sync_wait = 0; ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock' +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); --source include/wait_condition.inc UNLOCK TABLES; ---let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock' +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); --source include/wait_condition.inc COMMIT; diff --git a/mysql-test/suite/galera/t/galera_bf_abort_lock_table.cnf b/mysql-test/suite/galera/t/galera_bf_abort_lock_table.cnf index 033e6f8b99a..fa33b09d739 100644 --- a/mysql-test/suite/galera/t/galera_bf_abort_lock_table.cnf +++ b/mysql-test/suite/galera/t/galera_bf_abort_lock_table.cnf @@ -1,5 +1 @@ !include ../galera_2nodes.cnf - -[mysqld.1] -wsrep-debug=1 -loose-galera-bf-abort-lock-table=1 diff --git a/mysql-test/suite/galera/t/galera_bf_abort_lock_table.test b/mysql-test/suite/galera/t/galera_bf_abort_lock_table.test index 06009712c7b..652e89f8e57 100644 --- a/mysql-test/suite/galera/t/galera_bf_abort_lock_table.test +++ b/mysql-test/suite/galera/t/galera_bf_abort_lock_table.test @@ -1,6 +1,5 @@ --source include/galera_cluster.inc --source include/have_innodb.inc ---source include/force_restart.inc # # Test that a local LOCK TABLE will NOT be broken by an incoming remote transaction against that table @@ -18,13 +17,13 @@ INSERT INTO t1 VALUES (2); --connection node_2 SET SESSION wsrep_sync_wait = 0; ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock' +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); --let $wait_condition_on_error_output = SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST --source include/wait_condition_with_debug_and_kill.inc UNLOCK TABLES; ---let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE = 'Waiting for table metadata lock' +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); --let $wait_condition_on_error_output = SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST --source include/wait_condition_with_debug_and_kill.inc diff --git a/mysql-test/suite/galera/t/galera_bf_abort_ps.cnf b/mysql-test/suite/galera/t/galera_bf_abort_ps.cnf index 34c1a8cc3cf..ee365a18340 100644 --- a/mysql-test/suite/galera/t/galera_bf_abort_ps.cnf +++ b/mysql-test/suite/galera/t/galera_bf_abort_ps.cnf @@ -1,3 +1,4 @@ !include ../galera_2nodes.cnf + [mysqltest] -ps-protocol \ No newline at end of file +ps-protocol diff --git a/mysql-test/suite/galera/t/galera_bf_background_statistics.cnf b/mysql-test/suite/galera/t/galera_bf_background_statistics.cnf index 4101b4073ec..90f99fcdd21 100644 --- a/mysql-test/suite/galera/t/galera_bf_background_statistics.cnf +++ b/mysql-test/suite/galera/t/galera_bf_background_statistics.cnf @@ -5,5 +5,3 @@ innodb_stats_persistent=ON [mysqld.2] innodb_stats_persistent=ON - - diff --git a/mysql-test/suite/galera/t/galera_bf_background_statistics.test b/mysql-test/suite/galera/t/galera_bf_background_statistics.test index a9a98b1b567..0ffd4895f5b 100644 --- a/mysql-test/suite/galera/t/galera_bf_background_statistics.test +++ b/mysql-test/suite/galera/t/galera_bf_background_statistics.test @@ -46,4 +46,3 @@ ALTER TABLE t1 CHANGE f2 f2 INTEGER NOT NULL DEFAULT 1; --enable_query_log DROP TABLE t1; - diff --git a/mysql-test/suite/galera/t/galera_bf_kill.test b/mysql-test/suite/galera/t/galera_bf_kill.test index 1cb2e866cb4..6947733bb24 100644 --- a/mysql-test/suite/galera/t/galera_bf_kill.test +++ b/mysql-test/suite/galera/t/galera_bf_kill.test @@ -111,7 +111,7 @@ update t1 set a =5, b=2; --connection node_2b SET SESSION wsrep_sync_wait=0; ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'Waiting for table metadata lock'; +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'; --source include/wait_condition.inc --connection node_2a diff --git a/mysql-test/suite/galera/t/galera_bf_lock_wait.test b/mysql-test/suite/galera/t/galera_bf_lock_wait.test index 8ef2fee78ed..9ad3bbc36c6 100644 --- a/mysql-test/suite/galera/t/galera_bf_lock_wait.test +++ b/mysql-test/suite/galera/t/galera_bf_lock_wait.test @@ -95,4 +95,3 @@ drop procedure p1; --disconnect node_1_p2 --disconnect node_2_p1 --disconnect node_2_p2 - diff --git a/mysql-test/suite/galera/t/galera_binlog_checksum.cnf b/mysql-test/suite/galera/t/galera_binlog_checksum.cnf index bd61ee67406..590cecf36bc 100644 --- a/mysql-test/suite/galera/t/galera_binlog_checksum.cnf +++ b/mysql-test/suite/galera/t/galera_binlog_checksum.cnf @@ -9,5 +9,3 @@ slave-sql-verify-checksum=1 binlog-checksum=CRC32 master-verify-checksum=1 slave-sql-verify-checksum=1 - - diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.cnf b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.cnf index 9315086a3cc..5f0809ddf07 100644 --- a/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.cnf +++ b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.cnf @@ -4,6 +4,3 @@ binlog-row-event-max-size=4294967040 [mysqld.2] - - - diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.cnf b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.cnf index 798435d8e54..5899387f52d 100644 --- a/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.cnf +++ b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.cnf @@ -4,6 +4,3 @@ binlog-row-event-max-size=256 [mysqld.2] - - - diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.test b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.test index 00b55339770..43ea0932676 100644 --- a/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.test +++ b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.test @@ -12,4 +12,3 @@ INSERT INTO t1 VALUES (REPEAT('x', 1000)); SELECT COUNT(*) = 1 FROM t1 WHERE f1 = REPEAT('x', 1000); DROP TABLE t1; - diff --git a/mysql-test/suite/galera/t/galera_binlog_row_image.test b/mysql-test/suite/galera/t/galera_binlog_row_image.test index 70262ec44ca..5c544414b9e 100644 --- a/mysql-test/suite/galera/t/galera_binlog_row_image.test +++ b/mysql-test/suite/galera/t/galera_binlog_row_image.test @@ -94,7 +94,3 @@ SELECT COUNT(*) = 0 FROM t2; DROP TABLE t1; DROP TABLE t2; - - - - diff --git a/mysql-test/suite/galera/t/galera_change_user.test b/mysql-test/suite/galera/t/galera_change_user.test index 89efef1dbb0..5051b18eec6 100644 --- a/mysql-test/suite/galera/t/galera_change_user.test +++ b/mysql-test/suite/galera/t/galera_change_user.test @@ -26,4 +26,3 @@ reset_connection; --connection node_1 DROP TABLE t1; DROP USER user1; - diff --git a/mysql-test/suite/galera/t/galera_concurrent_ctas.test b/mysql-test/suite/galera/t/galera_concurrent_ctas.test index ed579f19a0d..199cd727df0 100644 --- a/mysql-test/suite/galera/t/galera_concurrent_ctas.test +++ b/mysql-test/suite/galera/t/galera_concurrent_ctas.test @@ -98,4 +98,3 @@ DROP TABLE t1; --source include/galera_end.inc --echo # End of test - diff --git a/mysql-test/suite/galera/t/galera_ddl_fk_conflict.cnf b/mysql-test/suite/galera/t/galera_ddl_fk_conflict.cnf index 2975070498e..106d79a503e 100644 --- a/mysql-test/suite/galera/t/galera_ddl_fk_conflict.cnf +++ b/mysql-test/suite/galera/t/galera_ddl_fk_conflict.cnf @@ -7,5 +7,3 @@ loose-galera-ddl-fk-conflict=1 [mysqld.2] wsrep-debug=1 loose-galera-ddl-fk-conflict=1 - - diff --git a/mysql-test/suite/galera/t/galera_ddl_fk_conflict.test b/mysql-test/suite/galera/t/galera_ddl_fk_conflict.test index a8fb6614e41..22da69dfc24 100644 --- a/mysql-test/suite/galera/t/galera_ddl_fk_conflict.test +++ b/mysql-test/suite/galera/t/galera_ddl_fk_conflict.test @@ -43,4 +43,3 @@ SET SESSION wsrep_sync_wait=0; --source galera_ddl_fk_conflict_with_tmp.inc # CHECK and ANALYZE are not affected - diff --git a/mysql-test/suite/galera/t/galera_ddl_multiline.test b/mysql-test/suite/galera/t/galera_ddl_multiline.test index c7155d066fa..dc69dfd186f 100644 --- a/mysql-test/suite/galera/t/galera_ddl_multiline.test +++ b/mysql-test/suite/galera/t/galera_ddl_multiline.test @@ -51,4 +51,3 @@ SHOW CREATE TABLE t6; --connection node_1 DROP TABLE t1, t2, t3, t4, t5, t6; - diff --git a/mysql-test/suite/galera/t/galera_encrypt_tmp_files.cnf b/mysql-test/suite/galera/t/galera_encrypt_tmp_files.cnf index 0f7f80b7d0b..a26c4b30b00 100644 --- a/mysql-test/suite/galera/t/galera_encrypt_tmp_files.cnf +++ b/mysql-test/suite/galera/t/galera_encrypt_tmp_files.cnf @@ -1,6 +1,6 @@ !include ../galera_2nodes.cnf -[mysqld] +[mysqld] encrypt-tmp-files = 1 plugin-load-add= @ENV.FILE_KEY_MANAGEMENT_SO file-key-management diff --git a/mysql-test/suite/galera/t/galera_forced_binlog_format.test b/mysql-test/suite/galera/t/galera_forced_binlog_format.test index 786837239ed..2866d6fee88 100644 --- a/mysql-test/suite/galera/t/galera_forced_binlog_format.test +++ b/mysql-test/suite/galera/t/galera_forced_binlog_format.test @@ -49,4 +49,3 @@ DROP DATABASE testdb_9401; #--source include/galera_end.inc --echo # End of tests - diff --git a/mysql-test/suite/galera/t/galera_gcs_fragment.cnf b/mysql-test/suite/galera/t/galera_gcs_fragment.cnf index aae3fee5904..5d7bbf7b053 100644 --- a/mysql-test/suite/galera/t/galera_gcs_fragment.cnf +++ b/mysql-test/suite/galera/t/galera_gcs_fragment.cnf @@ -1,5 +1,7 @@ !include ../galera_2nodes.cnf + [mysqld.1] wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcs.max_packet_size=64' + [mysqld.2] wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcs.max_packet_size=64' diff --git a/mysql-test/suite/galera/t/galera_gcs_max_packet_size.cnf b/mysql-test/suite/galera/t/galera_gcs_max_packet_size.cnf index 6bb11e5957a..7e7c99ecb63 100644 --- a/mysql-test/suite/galera/t/galera_gcs_max_packet_size.cnf +++ b/mysql-test/suite/galera/t/galera_gcs_max_packet_size.cnf @@ -1,5 +1,7 @@ !include ../galera_2nodes.cnf + [mysqld.1] wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcs.max_packet_size=64;gcache.size=10M' + [mysqld.2] wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcs.max_packet_size=64;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_gtid.cnf b/mysql-test/suite/galera/t/galera_gtid.cnf index 8f6a760def0..98e724fb2d0 100644 --- a/mysql-test/suite/galera/t/galera_gtid.cnf +++ b/mysql-test/suite/galera/t/galera_gtid.cnf @@ -7,4 +7,3 @@ log-slave-updates [mysqld.2] log-bin log-slave-updates - diff --git a/mysql-test/suite/galera/t/galera_gtid_server_id.cnf b/mysql-test/suite/galera/t/galera_gtid_server_id.cnf index bda7a00ab2e..76887d5c189 100644 --- a/mysql-test/suite/galera/t/galera_gtid_server_id.cnf +++ b/mysql-test/suite/galera/t/galera_gtid_server_id.cnf @@ -13,4 +13,3 @@ wsrep_gtid_mode=ON server-id=12 log_slave_updates log_bin - diff --git a/mysql-test/suite/galera/t/galera_gtid_slave.cnf b/mysql-test/suite/galera/t/galera_gtid_slave.cnf index 112c487851f..5d242f01707 100644 --- a/mysql-test/suite/galera/t/galera_gtid_slave.cnf +++ b/mysql-test/suite/galera/t/galera_gtid_slave.cnf @@ -4,13 +4,16 @@ log-bin=mysqld-bin log-slave-updates binlog-format=ROW + [mysqld.1] gtid-domain-id=1 wsrep_gtid_mode=1 wsrep_gtid_domain_id=1 + [mysqld.2] gtid-domain-id=1 wsrep_gtid_mode=1 wsrep_gtid_domain_id=1 + [mysqld.3] gtid-domain-id=2 diff --git a/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.cnf b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.cnf index efeb536de96..2b05acfde01 100644 --- a/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.cnf +++ b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.cnf @@ -5,14 +5,16 @@ log-bin=mysqld-bin log-slave-updates binlog-format=ROW wsrep_sst_method=rsync + [mysqld.1] gtid-domain-id=1 wsrep_gtid_mode=1 wsrep_gtid_domain_id=1 + [mysqld.2] gtid-domain-id=1 wsrep_gtid_mode=1 wsrep_gtid_domain_id=1 + [mysqld.3] gtid-domain-id=2 - diff --git a/mysql-test/suite/galera/t/galera_gtid_trx_conflict.cnf b/mysql-test/suite/galera/t/galera_gtid_trx_conflict.cnf index 5f129e7c168..1422f977bf7 100644 --- a/mysql-test/suite/galera/t/galera_gtid_trx_conflict.cnf +++ b/mysql-test/suite/galera/t/galera_gtid_trx_conflict.cnf @@ -4,10 +4,12 @@ log-bin=mysqld-bin log-slave-updates binlog-format=ROW + [mysqld.1] gtid-domain-id=1 wsrep_gtid_mode=1 wsrep_gtid_domain_id=1 + [mysqld.2] gtid-domain-id=1 wsrep_gtid_mode=1 diff --git a/mysql-test/suite/galera/t/galera_insert_ignore.test b/mysql-test/suite/galera/t/galera_insert_ignore.test index 027f70e96d9..4d500ab7b4e 100644 --- a/mysql-test/suite/galera/t/galera_insert_ignore.test +++ b/mysql-test/suite/galera/t/galera_insert_ignore.test @@ -57,4 +57,3 @@ DROP TABLE t1; DROP TABLE t2; DROP TABLE t3; --eval SET GLOBAL wsrep_sync_wait = $wsrep_sync_wait_orig - diff --git a/mysql-test/suite/galera/t/galera_insert_multi.test b/mysql-test/suite/galera/t/galera_insert_multi.test index d62283aff69..35205921283 100644 --- a/mysql-test/suite/galera/t/galera_insert_multi.test +++ b/mysql-test/suite/galera/t/galera_insert_multi.test @@ -113,10 +113,3 @@ SELECT COUNT(*) = 2 FROM t1; SELECT COUNT(*) = 2 FROM t1; DROP TABLE t1; - - - - - - - diff --git a/mysql-test/suite/galera/t/galera_ist_progress.cnf b/mysql-test/suite/galera/t/galera_ist_progress.cnf index b37e7f38ce3..10958aad9a8 100644 --- a/mysql-test/suite/galera/t/galera_ist_progress.cnf +++ b/mysql-test/suite/galera/t/galera_ist_progress.cnf @@ -2,6 +2,3 @@ [mysqld.1] wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' - - - diff --git a/mysql-test/suite/galera/t/galera_ist_recv_bind.cnf b/mysql-test/suite/galera/t/galera_ist_recv_bind.cnf index 2628f05eaef..035fb0769b7 100644 --- a/mysql-test/suite/galera/t/galera_ist_recv_bind.cnf +++ b/mysql-test/suite/galera/t/galera_ist_recv_bind.cnf @@ -5,4 +5,3 @@ wsrep_provider_options='base_port=@mysqld.1.#galera_port;ist.recv_bind=127.0.0.1 [mysqld.2] wsrep_provider_options='base_port=@mysqld.2.#galera_port;ist.recv_bind=127.0.0.1' - diff --git a/mysql-test/suite/galera/t/galera_kill_applier.cnf b/mysql-test/suite/galera/t/galera_kill_applier.cnf index 62cf1854032..18a80b22fb6 100644 --- a/mysql-test/suite/galera/t/galera_kill_applier.cnf +++ b/mysql-test/suite/galera/t/galera_kill_applier.cnf @@ -1,7 +1,9 @@ !include ../galera_2nodes.cnf [mysqld.1] +wsrep_slave_threads=1 wsrep-debug=1 [mysqld.2] +wsrep_slave_threads=1 wsrep-debug=1 diff --git a/mysql-test/suite/galera/t/galera_load_data.test b/mysql-test/suite/galera/t/galera_load_data.test index 252580f9426..24cd55c4ae0 100644 --- a/mysql-test/suite/galera/t/galera_load_data.test +++ b/mysql-test/suite/galera/t/galera_load_data.test @@ -397,4 +397,3 @@ SELECT data_length from information_schema.tables WHERE TABLE_NAME = 'cardtest_t --connection node_1 use test; drop database cardtest02; - diff --git a/mysql-test/suite/galera/t/galera_mdev_13787.cnf b/mysql-test/suite/galera/t/galera_mdev_13787.cnf index ada78e1db2a..5f954d5ccba 100644 --- a/mysql-test/suite/galera/t/galera_mdev_13787.cnf +++ b/mysql-test/suite/galera/t/galera_mdev_13787.cnf @@ -5,5 +5,3 @@ innodb-stats-persistent=1 [mysqld.2] innodb-stats-persistent=1 - - diff --git a/mysql-test/suite/galera/t/galera_mdev_13787.test b/mysql-test/suite/galera/t/galera_mdev_13787.test index 940cffb8b65..458d7f1d5d4 100644 --- a/mysql-test/suite/galera/t/galera_mdev_13787.test +++ b/mysql-test/suite/galera/t/galera_mdev_13787.test @@ -1,5 +1,6 @@ --source include/galera_cluster.inc --source include/have_innodb.inc + --connection node_1 create table t(a int); insert into t select 1; diff --git a/mysql-test/suite/galera/t/galera_mdev_15611.cnf b/mysql-test/suite/galera/t/galera_mdev_15611.cnf index b6f601c56b1..1d9f793beff 100644 --- a/mysql-test/suite/galera/t/galera_mdev_15611.cnf +++ b/mysql-test/suite/galera/t/galera_mdev_15611.cnf @@ -1,4 +1,5 @@ !include ../galera_2nodes.cnf + [mysqld.1] [mysqld.2] diff --git a/mysql-test/suite/galera/t/galera_mdl_race.test b/mysql-test/suite/galera/t/galera_mdl_race.test index 3341a3792f1..9d6babea0b3 100644 --- a/mysql-test/suite/galera/t/galera_mdl_race.test +++ b/mysql-test/suite/galera/t/galera_mdl_race.test @@ -91,4 +91,3 @@ SET DEBUG_SYNC = "RESET"; --disconnect node_1a --disconnect node_1b --disconnect node_1c - diff --git a/mysql-test/suite/galera/t/galera_nonPK_and_PA.test b/mysql-test/suite/galera/t/galera_nonPK_and_PA.test index 8a5173f576b..dbd516e9b31 100644 --- a/mysql-test/suite/galera/t/galera_nonPK_and_PA.test +++ b/mysql-test/suite/galera/t/galera_nonPK_and_PA.test @@ -164,5 +164,6 @@ SET GLOBAL wsrep_slave_threads = DEFAULT; DROP TABLE t1; DROP TABLE t2; + --connection node_2 SET GLOBAL wsrep_slave_threads = DEFAULT; diff --git a/mysql-test/suite/galera/t/galera_nopk_unicode.test b/mysql-test/suite/galera/t/galera_nopk_unicode.test index e036e14ebe0..8e98f1e5e47 100644 --- a/mysql-test/suite/galera/t/galera_nopk_unicode.test +++ b/mysql-test/suite/galera/t/galera_nopk_unicode.test @@ -39,5 +39,4 @@ COMMIT; SELECT f1 = 'текст2' FROM t1; SELECT f1 = 'текст2' FROM t1 WHERE f1 = 'текст2'; - DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test b/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test index 2e9f05cb4af..52226850532 100644 --- a/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test +++ b/mysql-test/suite/galera/t/galera_parallel_apply_lock_table.test @@ -29,11 +29,13 @@ INSERT INTO t2 VALUES (1); --let $galera_connection_name = node_2a --let $galera_server_number = 2 --source include/galera_connect.inc + --connection node_2a --sleep 1 SET SESSION wsrep_sync_wait=0; -SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE LIKE '%committing%' or STATE = 'Waiting for certification'); -SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Waiting for table metadata lock%'; +SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE '%committing%' OR STATE LIKE 'Commit' OR STATE LIKE 'Waiting for certification'); +SELECT COUNT(*) AS EXPECT_1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); + SELECT COUNT(*) AS EXPECT_0 FROM t1; SELECT COUNT(*) AS EXPECT_0 FROM t2; @@ -44,8 +46,11 @@ UNLOCK TABLES; --eval SET SESSION wsrep_sync_wait = $wsrep_sync_wait_orig; SELECT COUNT(*) AS EXPECT_1 FROM t1; SELECT COUNT(*) AS EXPECT_1 FROM t2; -SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE LIKE '%committed%' or STATE = 'Waiting for certification'); +SELECT COUNT(*) AS EXPECT_2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE '%committed%' OR STATE LIKE 'Waiting for certification'); +--disable_query_log --eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; +--enable_query_log + DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test b/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test index df0200fab55..f7d1c2c1e62 100644 --- a/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test +++ b/mysql-test/suite/galera/t/galera_parallel_autoinc_largetrx.test @@ -67,4 +67,3 @@ SELECT COUNT(DISTINCT f1) AS EXPECT_30000 FROM t1; --connection default DROP TABLE t1; DROP TABLE ten; - diff --git a/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test b/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test index 587fbe10fe4..a3e2f249e2f 100644 --- a/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test +++ b/mysql-test/suite/galera/t/galera_parallel_autoinc_manytrx.test @@ -91,5 +91,3 @@ SELECT COUNT(DISTINCT f1) FROM t1; DROP TABLE t1; DROP TABLE ten; DROP PROCEDURE p1; - - diff --git a/mysql-test/suite/galera/t/galera_parallel_simple.test b/mysql-test/suite/galera/t/galera_parallel_simple.test index a305473dbbb..074af301671 100644 --- a/mysql-test/suite/galera/t/galera_parallel_simple.test +++ b/mysql-test/suite/galera/t/galera_parallel_simple.test @@ -48,10 +48,10 @@ INSERT INTO t2 select * from t2; --connection node_2 SET SESSION wsrep_sync_wait = 0; ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for table metadata lock%'; +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); --source include/wait_condition.inc ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE (STATE LIKE '%committing%' or STATE = 'Waiting for certification'); +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE '%committing%' OR STATE LIKE 'Commit' OR STATE LIKE 'Waiting for certification'); --source include/wait_condition.inc UNLOCK TABLES; @@ -61,7 +61,9 @@ SET SESSION wsrep_sync_wait = 15; SELECT COUNT(*) as expect_20 FROM t1; SELECT COUNT(*) as expect_20 FROM t2; +--disable_query_log --eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; +--enable_query_log DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/suite/galera/t/galera_pc_ignore_sb.cnf b/mysql-test/suite/galera/t/galera_pc_ignore_sb.cnf index ae48aa3ae0f..8734323a2d6 100644 --- a/mysql-test/suite/galera/t/galera_pc_ignore_sb.cnf +++ b/mysql-test/suite/galera/t/galera_pc_ignore_sb.cnf @@ -8,4 +8,3 @@ wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore [mysqld.2] wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' - diff --git a/mysql-test/suite/galera/t/galera_query_cache.cnf b/mysql-test/suite/galera/t/galera_query_cache.cnf index 80f40b0997e..5f37e357a52 100644 --- a/mysql-test/suite/galera/t/galera_query_cache.cnf +++ b/mysql-test/suite/galera/t/galera_query_cache.cnf @@ -7,4 +7,3 @@ query_cache_size=1355776 [mysqld.2] query_cache_type=1 query_cache_size=1355776 - diff --git a/mysql-test/suite/galera/t/galera_query_cache_sync_wait.cnf b/mysql-test/suite/galera/t/galera_query_cache_sync_wait.cnf index 80f40b0997e..5f37e357a52 100644 --- a/mysql-test/suite/galera/t/galera_query_cache_sync_wait.cnf +++ b/mysql-test/suite/galera/t/galera_query_cache_sync_wait.cnf @@ -7,4 +7,3 @@ query_cache_size=1355776 [mysqld.2] query_cache_type=1 query_cache_size=1355776 - diff --git a/mysql-test/suite/galera/t/galera_repl_key_format_flat16.test b/mysql-test/suite/galera/t/galera_repl_key_format_flat16.test index 8749c20faed..5d12ad1c1c4 100644 --- a/mysql-test/suite/galera/t/galera_repl_key_format_flat16.test +++ b/mysql-test/suite/galera/t/galera_repl_key_format_flat16.test @@ -25,7 +25,6 @@ UPDATE t2 SET f1 = REPEAT('b', 256); SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 234; SELECT COUNT(*) = 1 FROM t2 WHERE f1 = REPEAT('b', 256); - --disable_query_log --eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig'; --enable_query_log diff --git a/mysql-test/suite/galera/t/galera_restart_nochanges.test b/mysql-test/suite/galera/t/galera_restart_nochanges.test index 0a6a0c5ccbe..8ca80649d3f 100644 --- a/mysql-test/suite/galera/t/galera_restart_nochanges.test +++ b/mysql-test/suite/galera/t/galera_restart_nochanges.test @@ -37,4 +37,3 @@ DROP TABLE t1; --source include/auto_increment_offset_restore.inc --source include/galera_end.inc - diff --git a/mysql-test/suite/galera/t/galera_restart_replica.cnf b/mysql-test/suite/galera/t/galera_restart_replica.cnf index 6713e301527..cb2a7998ec6 100644 --- a/mysql-test/suite/galera/t/galera_restart_replica.cnf +++ b/mysql-test/suite/galera/t/galera_restart_replica.cnf @@ -17,4 +17,3 @@ wsrep_gtid_mode=1 wsrep_gtid_domain_id=16 gtid_domain_id=11 gtid_strict_mode=1 - diff --git a/mysql-test/suite/galera/t/galera_savepoint_replay.test b/mysql-test/suite/galera/t/galera_savepoint_replay.test index cff26f4a94f..d8b04847a2b 100644 --- a/mysql-test/suite/galera/t/galera_savepoint_replay.test +++ b/mysql-test/suite/galera/t/galera_savepoint_replay.test @@ -83,4 +83,3 @@ SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b'; SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c'; DROP TABLE t1; - diff --git a/mysql-test/suite/galera/t/galera_server.test b/mysql-test/suite/galera/t/galera_server.test index 30b39028b96..36687402d4e 100644 --- a/mysql-test/suite/galera/t/galera_server.test +++ b/mysql-test/suite/galera/t/galera_server.test @@ -25,4 +25,3 @@ SELECT COUNT(*)=0 FROM mysql.servers; --source include/galera_end.inc --echo # End of test - diff --git a/mysql-test/suite/galera/t/galera_set_position_after_cert_failure.test b/mysql-test/suite/galera/t/galera_set_position_after_cert_failure.test index 4dfddb0f32a..a7f26e28aca 100644 --- a/mysql-test/suite/galera/t/galera_set_position_after_cert_failure.test +++ b/mysql-test/suite/galera/t/galera_set_position_after_cert_failure.test @@ -95,4 +95,5 @@ if ($galera_wsrep_start_position != $expected_position) --connection node_1 DROP TABLE t1; SET GLOBAL wsrep_slave_threads = DEFAULT; + --source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/galera_sp_bf_abort.inc b/mysql-test/suite/galera/t/galera_sp_bf_abort.inc index 58345184e98..a3c8c16209d 100644 --- a/mysql-test/suite/galera/t/galera_sp_bf_abort.inc +++ b/mysql-test/suite/galera/t/galera_sp_bf_abort.inc @@ -35,4 +35,3 @@ --source include/galera_signal_sync_point.inc --let $galera_sync_point = after_replicate_sync --source include/galera_signal_sync_point.inc - diff --git a/mysql-test/suite/galera/t/galera_sql_log_bin_zero.test b/mysql-test/suite/galera/t/galera_sql_log_bin_zero.test index cd8d6ba6426..c8c46b25e1c 100644 --- a/mysql-test/suite/galera/t/galera_sql_log_bin_zero.test +++ b/mysql-test/suite/galera/t/galera_sql_log_bin_zero.test @@ -17,7 +17,6 @@ SET SESSION sql_log_bin = 1; INSERT INTO t1 VALUES (2); - --connection node_2 SELECT COUNT(*) = 2 FROM t1; SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1; diff --git a/mysql-test/suite/galera/t/galera_status_cluster.test b/mysql-test/suite/galera/t/galera_status_cluster.test index 3299613d584..0c2260321e9 100644 --- a/mysql-test/suite/galera/t/galera_status_cluster.test +++ b/mysql-test/suite/galera/t/galera_status_cluster.test @@ -14,5 +14,3 @@ SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VA SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; - - diff --git a/mysql-test/suite/galera/t/galera_status_local_index.test b/mysql-test/suite/galera/t/galera_status_local_index.test index b61b8ced863..3e15911537a 100644 --- a/mysql-test/suite/galera/t/galera_status_local_index.test +++ b/mysql-test/suite/galera/t/galera_status_local_index.test @@ -12,7 +12,6 @@ INSERT INTO wsrep_local_indexes VALUES ((SELECT variable_value FROM INFORMATION_ --connection node_2 INSERT INTO wsrep_local_indexes VALUES ((SELECT variable_value FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_local_index')); - --connection node_1 SELECT COUNT(*) = 2 FROM wsrep_local_indexes; SELECT COUNT(DISTINCT wsrep_local_index) = 2 FROM wsrep_local_indexes; diff --git a/mysql-test/suite/galera/t/galera_status_local_state.test b/mysql-test/suite/galera/t/galera_status_local_state.test index 09cdb25f80c..6401c32082f 100644 --- a/mysql-test/suite/galera/t/galera_status_local_state.test +++ b/mysql-test/suite/galera/t/galera_status_local_state.test @@ -22,7 +22,3 @@ SET GLOBAL wsrep_desync = 0; --source include/wait_condition.inc SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; - - - - diff --git a/mysql-test/suite/galera/t/galera_suspend_slave.test b/mysql-test/suite/galera/t/galera_suspend_slave.test index 0f95bcd4531..9a238e59f30 100644 --- a/mysql-test/suite/galera/t/galera_suspend_slave.test +++ b/mysql-test/suite/galera/t/galera_suspend_slave.test @@ -67,4 +67,3 @@ DROP TABLE t1; # Restore original auto_increment_offset values. --let $node_2=node_2a --source include/auto_increment_offset_restore.inc - diff --git a/mysql-test/suite/galera/t/galera_sync_wait_upto-master.opt b/mysql-test/suite/galera/t/galera_sync_wait_upto-master.opt index 0b35236062b..93b3d5bfdaf 100644 --- a/mysql-test/suite/galera/t/galera_sync_wait_upto-master.opt +++ b/mysql-test/suite/galera/t/galera_sync_wait_upto-master.opt @@ -1 +1 @@ ---wsrep-sync-wait=0 --wsrep-causal-reads=OFF \ No newline at end of file +--wsrep-sync-wait=0 --wsrep-causal-reads=OFF diff --git a/mysql-test/suite/galera/t/galera_table_with_hyphen.inc b/mysql-test/suite/galera/t/galera_table_with_hyphen.inc index ac79d864e82..f53a08cd401 100644 --- a/mysql-test/suite/galera/t/galera_table_with_hyphen.inc +++ b/mysql-test/suite/galera/t/galera_table_with_hyphen.inc @@ -45,4 +45,3 @@ SET GLOBAL wsrep_slave_threads=DEFAULT; --connection node_2 --eval drop table `$fk_child` --eval drop table `$fk_parent` - diff --git a/mysql-test/suite/galera/t/galera_temporary_sequences.test b/mysql-test/suite/galera/t/galera_temporary_sequences.test index c46c4243514..a85124950af 100644 --- a/mysql-test/suite/galera/t/galera_temporary_sequences.test +++ b/mysql-test/suite/galera/t/galera_temporary_sequences.test @@ -30,7 +30,6 @@ SELECT * FROM t; SHOW CREATE TABLE seq1; SHOW CREATE TABLE seq2; - --connection node_1 DROP TABLE t; DROP SEQUENCE seq1; diff --git a/mysql-test/suite/galera/t/galera_threadpool.cnf b/mysql-test/suite/galera/t/galera_threadpool.cnf index c1a1e6a81aa..0ef20a3abb9 100644 --- a/mysql-test/suite/galera/t/galera_threadpool.cnf +++ b/mysql-test/suite/galera/t/galera_threadpool.cnf @@ -13,5 +13,3 @@ log_bin=binlog log_slave_updates=ON wsrep_sst_method=rsync thread_handling = pool-of-threads - - diff --git a/mysql-test/suite/galera/t/galera_toi_ftwrl.test b/mysql-test/suite/galera/t/galera_toi_ftwrl.test index 4d0edefda8e..25a3de20847 100644 --- a/mysql-test/suite/galera/t/galera_toi_ftwrl.test +++ b/mysql-test/suite/galera/t/galera_toi_ftwrl.test @@ -19,4 +19,3 @@ UNLOCK TABLES; SHOW CREATE TABLE t1; DROP TABLE t1; - diff --git a/mysql-test/suite/galera/t/galera_transaction_read_only.test b/mysql-test/suite/galera/t/galera_transaction_read_only.test index 386d73fd3ca..65c65deda45 100644 --- a/mysql-test/suite/galera/t/galera_transaction_read_only.test +++ b/mysql-test/suite/galera/t/galera_transaction_read_only.test @@ -55,4 +55,3 @@ COMMIT; --enable_query_log DROP TABLE t1; - diff --git a/mysql-test/suite/galera/t/galera_udf.cnf b/mysql-test/suite/galera/t/galera_udf.cnf index 69d5acd65f3..16477960835 100644 --- a/mysql-test/suite/galera/t/galera_udf.cnf +++ b/mysql-test/suite/galera/t/galera_udf.cnf @@ -6,10 +6,3 @@ query_cache_type=1 [mysqld.2] query_cache_type=1 - - - - - - - diff --git a/mysql-test/suite/galera/t/galera_unicode_identifiers.test b/mysql-test/suite/galera/t/galera_unicode_identifiers.test index c0c95768650..79f6a72cfdc 100644 --- a/mysql-test/suite/galera/t/galera_unicode_identifiers.test +++ b/mysql-test/suite/galera/t/galera_unicode_identifiers.test @@ -75,4 +75,3 @@ DROP DATABASE `database with space`; DROP DATABASE `база`; DROP DATABASE `втора база`; --eval SET GLOBAL wsrep_sync_wait = $wsrep_sync_wait_orig - diff --git a/mysql-test/suite/galera/t/galera_v1_row_events.cnf b/mysql-test/suite/galera/t/galera_v1_row_events.cnf index b95e321ad4f..cfb3782832b 100644 --- a/mysql-test/suite/galera/t/galera_v1_row_events.cnf +++ b/mysql-test/suite/galera/t/galera_v1_row_events.cnf @@ -4,10 +4,3 @@ log-bin-use-v1-row-events=1 [mysqld.2] - - - - - - - diff --git a/mysql-test/suite/galera/t/galera_var_OSU_method2.test b/mysql-test/suite/galera/t/galera_var_OSU_method2.test index 099e2cc6612..5117f87b647 100644 --- a/mysql-test/suite/galera/t/galera_var_OSU_method2.test +++ b/mysql-test/suite/galera/t/galera_var_OSU_method2.test @@ -44,4 +44,3 @@ SET DEBUG_SYNC= 'RESET'; --connection node_1a SET DEBUG_SYNC= 'RESET'; - diff --git a/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.cnf b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.cnf index 523bae68763..25da46fc009 100644 --- a/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.cnf +++ b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.cnf @@ -5,9 +5,3 @@ wsrep-auto-increment-control=ON [mysqld.2] wsrep-auto-increment-control=ON - - - - - - diff --git a/mysql-test/suite/galera/t/galera_var_slave_threads.test b/mysql-test/suite/galera/t/galera_var_slave_threads.test index 66909baff07..1a3a038a971 100644 --- a/mysql-test/suite/galera/t/galera_var_slave_threads.test +++ b/mysql-test/suite/galera/t/galera_var_slave_threads.test @@ -15,11 +15,15 @@ --connection node_1 --let $wsrep_slave_threads_orig = `SELECT @@wsrep_slave_threads` + CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=InnoDB; CREATE TABLE t2 (f1 INT AUTO_INCREMENT PRIMARY KEY) Engine=InnoDB; --connection node_2 +--let $wsrep_slave_threads_orig_2 = `SELECT @@wsrep_slave_threads` + CALL mtr.add_suppression("WSREP: Refusing exit for the last slave thread\\."); + # Setting wsrep_slave_threads to zero triggers a warning SET GLOBAL wsrep_slave_threads = 0; SHOW WARNINGS; @@ -74,7 +78,9 @@ SELECT COUNT(*) FROM t2; --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count'; --source include/wait_condition.inc ---eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig +--disable_query_log +--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig_2; +--enable_query_log DROP TABLE t1; DROP TABLE t2; @@ -94,6 +100,11 @@ SET GLOBAL wsrep_slave_threads = 4; SET GLOBAL wsrep_slave_threads = 1; --connection node_1 + +--disable_query_log +--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; +--enable_query_log + INSERT INTO t1 VALUES (DEFAULT); INSERT INTO t1 VALUES (DEFAULT); INSERT INTO t1 VALUES (DEFAULT); @@ -106,6 +117,10 @@ DROP TABLE t1; --connection node_2 +--disable_query_log +--eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig_2; +--enable_query_log + # Wait until above DDL is replicated # # make sure that we are left with exactly one applier thread before we leaving the test diff --git a/mysql-test/suite/galera/t/galera_wan_restart_sst.cnf b/mysql-test/suite/galera/t/galera_wan_restart_sst.cnf index 202aa4ce1c8..f549aeedf30 100644 --- a/mysql-test/suite/galera/t/galera_wan_restart_sst.cnf +++ b/mysql-test/suite/galera/t/galera_wan_restart_sst.cnf @@ -14,4 +14,3 @@ wsrep_provider_options='base_port=@mysqld.3.#galera_port;gmcast.segment=2' [mysqld.4] wsrep_provider_options='base_port=@mysqld.4.#galera_port;gmcast.segment=2' - diff --git a/mysql-test/suite/galera/t/galera_wsrep_log_conficts.cnf b/mysql-test/suite/galera/t/galera_wsrep_log_conficts.cnf index 440c37bea81..db7e2bd973c 100644 --- a/mysql-test/suite/galera/t/galera_wsrep_log_conficts.cnf +++ b/mysql-test/suite/galera/t/galera_wsrep_log_conficts.cnf @@ -5,8 +5,3 @@ wsrep_log_conflicts=ON [mysqld.2] wsrep_log_conflicts=ON - - - - - diff --git a/mysql-test/suite/galera/t/galera_wsrep_provider_options_syntax.test b/mysql-test/suite/galera/t/galera_wsrep_provider_options_syntax.test index c70dede09a3..5cfcffce475 100644 --- a/mysql-test/suite/galera/t/galera_wsrep_provider_options_syntax.test +++ b/mysql-test/suite/galera/t/galera_wsrep_provider_options_syntax.test @@ -3,6 +3,7 @@ # --source include/galera_cluster.inc --source include/have_innodb.inc + --let LOGF=$MYSQLTEST_VARDIR/log/mysqld.1.err --disable_info call mtr.add_suppression("WSREP: Unknown parameter 'gmcasts\\.segment'"); diff --git a/mysql-test/suite/galera/t/mdev-31285.test b/mysql-test/suite/galera/t/mdev-31285.test index 5abef37cccd..3e5f5a48cf5 100644 --- a/mysql-test/suite/galera/t/mdev-31285.test +++ b/mysql-test/suite/galera/t/mdev-31285.test @@ -11,5 +11,3 @@ CREATE TABLE t ENGINE=InnoDB WITH SYSTEM VERSIONING AS SELECT 1 AS i; --connection node_2 --error ER_NO_SUCH_TABLE SHOW CREATE TABLE t; - - diff --git a/mysql-test/suite/galera/t/mysql-wsrep#198.cnf b/mysql-test/suite/galera/t/mysql-wsrep#198.cnf index bbeb0e31c31..4c62448fe3d 100644 --- a/mysql-test/suite/galera/t/mysql-wsrep#198.cnf +++ b/mysql-test/suite/galera/t/mysql-wsrep#198.cnf @@ -2,5 +2,3 @@ [mysqld] log-bin -wsrep-debug=1 -loose-mysql-wsrep198=1 diff --git a/mysql-test/suite/galera/t/mysql-wsrep#198.test b/mysql-test/suite/galera/t/mysql-wsrep#198.test index aba05ed8bf9..dceae6e17e9 100644 --- a/mysql-test/suite/galera/t/mysql-wsrep#198.test +++ b/mysql-test/suite/galera/t/mysql-wsrep#198.test @@ -1,6 +1,5 @@ --source include/galera_cluster.inc --source include/have_innodb.inc ---source include/force_restart.inc CREATE TABLE t1 (id INT PRIMARY KEY) ENGINE=InnoDB; CREATE TABLE t2 (id INT PRIMARY KEY) ENGINE=InnoDB; @@ -21,7 +20,7 @@ LOCK TABLE t2 WRITE; --connection node_2 SET SESSION wsrep_sync_wait = 0; ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'Waiting for table metadata lock' +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'; --let $wait_condition_on_error_output = SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST --source include/wait_condition_with_debug_and_kill.inc diff --git a/mysql-test/suite/galera/t/mysql-wsrep#201.cnf b/mysql-test/suite/galera/t/mysql-wsrep#201.cnf index 4a82e9fa037..bea5b606e3e 100644 --- a/mysql-test/suite/galera/t/mysql-wsrep#201.cnf +++ b/mysql-test/suite/galera/t/mysql-wsrep#201.cnf @@ -5,5 +5,3 @@ query_cache_type=1 [mysqld.2] query_cache_type=1 - - diff --git a/mysql-test/suite/galera/t/mysql-wsrep#247.test b/mysql-test/suite/galera/t/mysql-wsrep#247.test index 8bcd58607a1..2f348029407 100644 --- a/mysql-test/suite/galera/t/mysql-wsrep#247.test +++ b/mysql-test/suite/galera/t/mysql-wsrep#247.test @@ -20,4 +20,3 @@ SET GLOBAL wsrep_desync=0; --sleep 1 DROP TABLE t1; SHOW VARIABLES LIKE 'wsrep_desync'; - diff --git a/mysql-test/suite/galera/t/mysql-wsrep#31.test b/mysql-test/suite/galera/t/mysql-wsrep#31.test index c669d4834ba..1924bc4a11c 100644 --- a/mysql-test/suite/galera/t/mysql-wsrep#31.test +++ b/mysql-test/suite/galera/t/mysql-wsrep#31.test @@ -49,5 +49,3 @@ DROP DATABASE db; --source include/auto_increment_offset_restore.inc --source include/galera_end.inc - - diff --git a/mysql-test/suite/galera/t/mysql-wsrep#33.cnf b/mysql-test/suite/galera/t/mysql-wsrep#33.cnf index f1c3d802e4b..f1d42cd791f 100644 --- a/mysql-test/suite/galera/t/mysql-wsrep#33.cnf +++ b/mysql-test/suite/galera/t/mysql-wsrep#33.cnf @@ -5,4 +5,3 @@ wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' [mysqld.2] wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' - diff --git a/mysql-test/suite/galera/t/mysql-wsrep#332.test b/mysql-test/suite/galera/t/mysql-wsrep#332.test index 464156e832e..dcbbca89f25 100644 --- a/mysql-test/suite/galera/t/mysql-wsrep#332.test +++ b/mysql-test/suite/galera/t/mysql-wsrep#332.test @@ -216,4 +216,3 @@ SELECT * FROM c; DROP TABLE c; DROP TABLE p1; DROP TABLE p2; - diff --git a/mysql-test/suite/galera/t/rename.test b/mysql-test/suite/galera/t/rename.test index 326d64d3b8a..b56caa1531f 100644 --- a/mysql-test/suite/galera/t/rename.test +++ b/mysql-test/suite/galera/t/rename.test @@ -50,4 +50,3 @@ DROP USER foo@localhost; DROP TABLE t2; --echo # End of tests - diff --git a/mysql-test/suite/galera/t/view.test b/mysql-test/suite/galera/t/view.test index fa2cd8b2a67..a6f94941ba0 100644 --- a/mysql-test/suite/galera/t/view.test +++ b/mysql-test/suite/galera/t/view.test @@ -47,4 +47,3 @@ DROP VIEW v1, v2, v3, v4; DROP TABLE t1; --echo # End of tests - diff --git a/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result b/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result index 087f9e7e279..a38e14c40a2 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result +++ b/mysql-test/suite/galera_3nodes/r/galera_parallel_apply_3nodes.result @@ -26,7 +26,7 @@ connection node_3; SELECT f1 = 111 FROM t1; f1 = 111 1 -SELECT COUNT(*) IN (1, 2) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%committed%'; +SELECT COUNT(*) IN (1, 2) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE '%committed%' OR STATE LIKE 'Waiting for certification'); COUNT(*) IN (1, 2) 1 SET GLOBAL wsrep_slave_threads = DEFAULT; diff --git a/mysql-test/suite/galera_3nodes/suite.pm b/mysql-test/suite/galera_3nodes/suite.pm index ff1ba0a566f..9f45e22d459 100644 --- a/mysql-test/suite/galera_3nodes/suite.pm +++ b/mysql-test/suite/galera_3nodes/suite.pm @@ -10,58 +10,58 @@ return wsrep_not_ok() if wsrep_not_ok(); push @::global_suppressions, ( qr(WSREP: wsrep_sst_receive_address is set to '127\.0\.0\.1), - qr(WSREP: Could not open saved state file for reading: .*), - qr(WSREP: Could not open state file for reading: .*), + qr(WSREP: Could not open saved state file for reading: ), + qr(WSREP: Could not open state file for reading: ), qr(WSREP: Gap in state sequence\. Need state transfer\.), qr(WSREP: Failed to prepare for incremental state transfer:), qr(WSREP: .*down context.*), qr(WSREP: Failed to send state UUID:), qr(WSREP: last inactive check more than .* skipping check), - qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned\.), - qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|, + qr(WSREP: Releasing seqno [0-9]+ before [0-9]+ was assigned\.), + qr|WSREP: access file\(.*gvwstate.dat\) failed ?\(No such file or directory\)|, qr(WSREP: Quorum: No node with complete state), qr(WSREP: Initial position was provided by configuration or SST, avoiding override), - qr|WSREP: discarding established \(time wait\) .*|, + qr|WSREP: discarding established \(time wait\) |, qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside\. Will use that one\.), qr(WSREP: evs::proto.*), - qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:.*|, + qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:|, qr(WSREP: no nodes coming from prim view, prim not possible), qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable), qr(WSREP: user message in state LEAVING), qr(WSREP: .* sending install message failed: Transport endpoint is not connected), qr(WSREP: .* sending install message failed: Resource temporarily unavailable), - qr(WSREP: Maximum writeset size exceeded by .*), - qr(WSREP: transaction size exceeded.*), - qr(WSREP: RBR event .*), - qr(WSREP: Ignoring error for TO isolated action: .*), - qr(WSREP: transaction size limit .*), - qr(WSREP: rbr write fail, .*), - qr(WSREP: .*Backend not supported: foo.*), - qr(WSREP: .*Failed to initialize backend using .*), - qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*), + qr(WSREP: Maximum writeset size exceeded by ), + qr(WSREP: transaction size exceeded), + qr(WSREP: RBR event ), + qr(WSREP: Ignoring error for TO isolated action: ), + qr(WSREP: transaction size limit ), + qr(WSREP: rbr write fail, ), + qr(WSREP: .*Backend not supported: foo), + qr(WSREP: .*Failed to initialize backend using ), + qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at ), qr(WSREP: gcs connect failed: Socket type not supported), qr(WSREP: failed to open gcomm backend connection: 110: failed to reach primary view: 110 .*), - qr(WSREP: .*Failed to open backend connection: -110 .*), - qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*), + qr(WSREP: .*Failed to open backend connection: -110 ), + qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at ), qr(WSREP: gcs connect failed: Connection timed out), qr|WSREP: wsrep::connect\(.*\) failed: 7|, qr(WSREP: SYNC message from member .* in non-primary configuration\. Ignored\.), qr(WSREP: Could not find peer:), - qr(WSREP: TO isolation failed for: .*), - qr|WSREP: gcs_caused\(\) returned .*|, - qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(SYNCED\). Message ignored\.|, - qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(JOINED\). Message ignored\.|, + qr(WSREP: TO isolation failed for: ), + qr|WSREP: gcs_caused\(\) returned |, + qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(SYNCED\)\. Message ignored\.|, + qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(JOINED\)\. Message ignored\.|, qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled\. Expect abort\.|, qr(WSREP: Action message in non-primary configuration from member [0-9]*), qr(WSREP: Last Applied Action message in non-primary configuration from member [0-9]*), - qr(WSREP: discarding established .*), - qr|WSREP: .*core_handle_uuid_msg.*|, + qr(WSREP: discarding established ), + qr|WSREP: .*core_handle_uuid_msg|, qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0\. WSREP_SYNC_WAIT_BEFORE_READ is on), qr|WSREP: JOIN message from member .* in non-primary configuration\. Ignored\.|, - qr|WSREP: .*Query apply failed:.*|, - qr(WSREP: Ignoring error.*), - qr(WSREP: Failed to remove page file .*), - qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to .*), + qr|WSREP: .*Query apply failed:|, + qr(WSREP: Ignoring error), + qr(WSREP: Failed to remove page file ), + qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to ), qr|WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\)\. Will retry in new primary component\.|, qr|WSREP: Send action \{.* STATE_REQUEST\} returned -107 \(Transport endpoint is not connected\)|, qr|WSREP: Trying to continue unpaused monitor|, diff --git a/mysql-test/suite/galera_3nodes/t/galera-features#119.test b/mysql-test/suite/galera_3nodes/t/galera-features#119.test index 0effe780a22..a9f96ddce7c 100644 --- a/mysql-test/suite/galera_3nodes/t/galera-features#119.test +++ b/mysql-test/suite/galera_3nodes/t/galera-features#119.test @@ -66,6 +66,5 @@ CALL mtr.add_suppression("WSREP: Event 3 Write_rows_v1 apply failed: 121, seqno" CALL mtr.add_suppression("WSREP: Node consistency compromized, leaving cluster\\.\\.\\."); CALL mtr.add_suppression("WSREP: Failed to apply write set: "); - # Restore original auto_increment_offset values. --source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_certification_ccc.test b/mysql-test/suite/galera_3nodes/t/galera_certification_ccc.test index b4fe10bff0d..e5646d98427 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_certification_ccc.test +++ b/mysql-test/suite/galera_3nodes/t/galera_certification_ccc.test @@ -50,4 +50,3 @@ DROP TABLE t1; --source ../galera/include/auto_increment_offset_restore.inc --source include/galera_end.inc - diff --git a/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test b/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test index c52bebc7019..c36cce61f23 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test +++ b/mysql-test/suite/galera_3nodes/t/galera_evs_suspect_timeout.test @@ -87,5 +87,6 @@ SELECT COUNT(*) FROM t1; --source include/wait_condition.inc DROP TABLE t1; + # Restore original auto_increment_offset values. --source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test b/mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test index 84629c96c65..61708f7ec6c 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test +++ b/mysql-test/suite/galera_3nodes/t/galera_parallel_apply_3nodes.test @@ -65,7 +65,7 @@ SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue'; --connection node_3 SELECT f1 = 111 FROM t1; -SELECT COUNT(*) IN (1, 2) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND STATE LIKE '%committed%'; +SELECT COUNT(*) IN (1, 2) FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE '%committed%' OR STATE LIKE 'Waiting for certification'); SET GLOBAL wsrep_slave_threads = DEFAULT; diff --git a/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema_init.test b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema_init.test index 7d8089a8ceb..9b0b5599709 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema_init.test +++ b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema_init.test @@ -55,4 +55,3 @@ SELECT node_incoming_address LIKE '127.0.0.1:%' from mysql.wsrep_cluster_members SELECT cluster_uuid = (SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_state_uuid') FROM mysql.wsrep_cluster_members; --source ../galera/include/auto_increment_offset_restore.inc - diff --git a/mysql-test/suite/galera_3nodes/t/inconsistency_shutdown.cnf b/mysql-test/suite/galera_3nodes/t/inconsistency_shutdown.cnf index ae2cf8068f5..340fe700e2b 100644 --- a/mysql-test/suite/galera_3nodes/t/inconsistency_shutdown.cnf +++ b/mysql-test/suite/galera_3nodes/t/inconsistency_shutdown.cnf @@ -5,5 +5,4 @@ wsrep-slave-threads=8 wsrep-ignore-apply-errors=0 [ENV] -galera_cluster_size = 3 - +galera_cluster_size=3 diff --git a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_before_apply.result b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_before_apply.result index 08e3fc6c3e3..404e909e956 100644 --- a/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_before_apply.result +++ b/mysql-test/suite/galera_3nodes_sr/r/galera_sr_kill_slave_before_apply.result @@ -44,7 +44,7 @@ connection node_2; SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; EXPECT_0 0 -call mtr.add_suppression("WSREP: node uuid:.*"); +call mtr.add_suppression("WSREP: node uuid:"); connection node_1; DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/suite/galera_3nodes_sr/suite.pm b/mysql-test/suite/galera_3nodes_sr/suite.pm index d2b31a0fbc7..3cc7af0666c 100644 --- a/mysql-test/suite/galera_3nodes_sr/suite.pm +++ b/mysql-test/suite/galera_3nodes_sr/suite.pm @@ -10,37 +10,37 @@ return wsrep_not_ok() if wsrep_not_ok(); push @::global_suppressions, ( qr(WSREP: wsrep_sst_receive_address is set to '127\.0\.0\.1), - qr(WSREP: Could not open saved state file for reading: .*), - qr(WSREP: Could not open state file for reading: .*), - qr(WSREP: Gap in state sequence. Need state transfer\.), + qr(WSREP: Could not open saved state file for reading: ), + qr(WSREP: Could not open state file for reading: ), + qr(WSREP: Gap in state sequence\. Need state transfer\.), qr(WSREP: Failed to prepare for incremental state transfer:), qr(WSREP: .*down context.*), qr(WSREP: Failed to send state UUID:), qr(WSREP: last inactive check more than .* skipping check), qr(WSREP: SQL statement was ineffective), - qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned\.), - qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|, + qr(WSREP: Releasing seqno [0-9]+ before [0-9]+ was assigned\.), + qr|WSREP: access file\(.*gvwstate.dat\) failed ?\(No such file or directory\)|, qr(WSREP: Quorum: No node with complete state), qr(WSREP: Initial position was provided by configuration or SST, avoiding override), - qr|WSREP: discarding established \(time wait\).*|, + qr|WSREP: discarding established \(time wait\) |, qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside\. Will use that one\.), qr(WSREP: evs::proto.*), - qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:.*|, + qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:|, qr(WSREP: no nodes coming from prim view, prim not possible), qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable), qr(WSREP: user message in state LEAVING), qr(WSREP: .* sending install message failed: Transport endpoint is not connected), qr(WSREP: .* sending install message failed: Resource temporarily unavailable), - qr(WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\)\. Will retry in new primary component\.), qr(WSREP: Could not find peer:), - qr|WSREP: gcs_caused\(\) returned .*|, + qr|WSREP: gcs_caused\(\) returned |, qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(SYNCED\)\. Message ignored\.|, qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(JOINED\)\. Message ignored\.|, qr(WSREP: Action message in non-primary configuration from member [0-9]*), qr(WSREP: Last Applied Action message in non-primary configuration from member [0-9]*), - qr|WSREP: .*core_handle_uuid_msg.*|, + qr|WSREP: .*core_handle_uuid_msg|, qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0\. WSREP_SYNC_WAIT_BEFORE_READ is on), - qr(WSREP: JOIN message from member .* in non-primary configuration\. Ignored\.), + qr|WSREP: JOIN message from member .* in non-primary configuration\. Ignored\.|, + qr|WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\)\. Will retry in new primary component\.|, ); bless { }; diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-606.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-606.test index 879c007e601..2048580d735 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/GCF-606.test +++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-606.test @@ -85,4 +85,5 @@ DROP TABLE t1; --connection node_2 CALL mtr.add_suppression("WSREP: failed to send SR rollback for "); + --source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test index 6ca2011d221..4dba60ba79d 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test @@ -65,4 +65,5 @@ SELECT COUNT(*) FROM mysql.wsrep_streaming_log; --connection node_1 --disconnect node_1a DROP TABLE t1; + --source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test index 58d744e704d..b6355050836 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test @@ -88,7 +88,7 @@ SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; --connection node_2 SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; # As noted above sometimes node delivers the same view twice -call mtr.add_suppression("WSREP: node uuid:.*"); +call mtr.add_suppression("WSREP: node uuid:"); --connection node_1 DROP TABLE t1; diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.cnf b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.cnf index 910d945949a..557edbb09d9 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.cnf +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.cnf @@ -2,4 +2,3 @@ [mysqld.1] wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.weight=3' - diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr-master.opt b/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr-master.opt index 196498bb9fa..954aacb818b 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr-master.opt +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_vote_sr-master.opt @@ -1,2 +1 @@ --wsrep-ignore-apply-errors=0 - diff --git a/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result b/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result index 433cfa4e459..de8d2bd7e7c 100644 --- a/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result +++ b/mysql-test/suite/galera_sr/r/galera_sr_cc_master.result @@ -1,6 +1,6 @@ connection node_2; connection node_1; -CALL mtr.add_suppression("WSREP: discarding established.*"); +CALL mtr.add_suppression("WSREP: discarding established"); connection node_1; connection node_2; connection node_2; diff --git a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#148.result b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#148.result index 98bf13e9d2b..a97c004999d 100644 --- a/mysql-test/suite/galera_sr/r/mysql-wsrep-features#148.result +++ b/mysql-test/suite/galera_sr/r/mysql-wsrep-features#148.result @@ -25,7 +25,7 @@ COMMIT; connection node_1; Got one of the listed errors connection node_2; -SET GLOBAL wsrep_slave_threads = 1; +SET GLOBAL wsrep_slave_threads = DEFAULT; SET GLOBAL debug_dbug = ''; SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb'; SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb'; diff --git a/mysql-test/suite/galera_sr/suite.pm b/mysql-test/suite/galera_sr/suite.pm index 1a0e9b28685..f60ad1eefe3 100644 --- a/mysql-test/suite/galera_sr/suite.pm +++ b/mysql-test/suite/galera_sr/suite.pm @@ -10,58 +10,58 @@ return wsrep_not_ok() if wsrep_not_ok(); push @::global_suppressions, ( qr(WSREP: wsrep_sst_receive_address is set to '127\.0\.0\.1), - qr(WSREP: Could not open saved state file for reading: .*), - qr(WSREP: Could not open state file for reading: .*), + qr(WSREP: Could not open saved state file for reading: ), + qr(WSREP: Could not open state file for reading: ), qr(WSREP: Gap in state sequence\. Need state transfer\.), qr(WSREP: Failed to prepare for incremental state transfer:), qr(WSREP: .*down context.*), qr(WSREP: Failed to send state UUID:), qr(WSREP: last inactive check more than .* skipping check), - qr(WSREP: Releasing seqno [0-9]* before [0-9]* was assigned\.), - qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|, + qr(WSREP: Releasing seqno [0-9]+ before [0-9]+ was assigned\.), + qr|WSREP: access file\(.*gvwstate.dat\) failed ?\(No such file or directory\)|, qr(WSREP: Quorum: No node with complete state), qr(WSREP: Initial position was provided by configuration or SST, avoiding override), - qr|WSREP: discarding established \(time wait\) .*|, + qr|WSREP: discarding established \(time wait\) |, qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside\. Will use that one\.), qr(WSREP: evs::proto.*), - qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:.*|, + qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:|, qr(WSREP: no nodes coming from prim view, prim not possible), qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable), qr(WSREP: user message in state LEAVING), qr(WSREP: .* sending install message failed: Transport endpoint is not connected), qr(WSREP: .* sending install message failed: Resource temporarily unavailable), - qr(WSREP: Maximum writeset size exceeded by .*), - qr(WSREP: transaction size exceeded.*), - qr(WSREP: RBR event .*), - qr(WSREP: Ignoring error for TO isolated action: .*), - qr(WSREP: transaction size limit .*), - qr(WSREP: rbr write fail, .*), - qr(WSREP: .*Backend not supported: foo.*), - qr(WSREP: .*Failed to initialize backend using .*), - qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*), + qr(WSREP: Maximum writeset size exceeded by ), + qr(WSREP: transaction size exceeded), + qr(WSREP: RBR event ), + qr(WSREP: Ignoring error for TO isolated action: ), + qr(WSREP: transaction size limit ), + qr(WSREP: rbr write fail, ), + qr(WSREP: .*Backend not supported: foo), + qr(WSREP: .*Failed to initialize backend using ), + qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at ), qr(WSREP: gcs connect failed: Socket type not supported), qr(WSREP: failed to open gcomm backend connection: 110: failed to reach primary view: 110 .*), - qr(WSREP: .*Failed to open backend connection: -110 .*), - qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at .*), + qr(WSREP: .*Failed to open backend connection: -110 ), + qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at ), qr(WSREP: gcs connect failed: Connection timed out), qr|WSREP: wsrep::connect\(.*\) failed: 7|, qr(WSREP: SYNC message from member .* in non-primary configuration\. Ignored\.), qr(WSREP: Could not find peer:), - qr(WSREP: TO isolation failed for: .*), - qr|WSREP: gcs_caused\(\) returned .*|, - qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(SYNCED\). Message ignored\.|, - qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(JOINED\). Message ignored\.|, + qr(WSREP: TO isolation failed for: ), + qr|WSREP: gcs_caused\(\) returned |, + qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(SYNCED\)\. Message ignored\.|, + qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(JOINED\)\. Message ignored\.|, qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled\. Expect abort\.|, qr(WSREP: Action message in non-primary configuration from member [0-9]*), qr(WSREP: Last Applied Action message in non-primary configuration from member [0-9]*), - qr(WSREP: discarding established .*), - qr|WSREP: .*core_handle_uuid_msg.*|, + qr(WSREP: discarding established ), + qr|WSREP: .*core_handle_uuid_msg|, qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0\. WSREP_SYNC_WAIT_BEFORE_READ is on), qr|WSREP: JOIN message from member .* in non-primary configuration\. Ignored\.|, - qr|WSREP: .*Query apply failed:.*|, - qr(WSREP: Ignoring error.*), - qr(WSREP: Failed to remove page file .*), - qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to .*), + qr|WSREP: .*Query apply failed:|, + qr(WSREP: Ignoring error), + qr(WSREP: Failed to remove page file ), + qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to ), qr|WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\)\. Will retry in new primary component\.|, qr|WSREP: Send action \{.* STATE_REQUEST\} returned -107 \(Transport endpoint is not connected\)|, qr|WSREP: Trying to continue unpaused monitor|, diff --git a/mysql-test/suite/galera_sr/t/MDEV-27615.test b/mysql-test/suite/galera_sr/t/MDEV-27615.test index 8cc425aa7e1..50076f23b41 100644 --- a/mysql-test/suite/galera_sr/t/MDEV-27615.test +++ b/mysql-test/suite/galera_sr/t/MDEV-27615.test @@ -69,5 +69,4 @@ SET DEBUG_SYNC = 'RESET'; --disconnect node_2 --connect node_2, 127.0.0.1, root, , test, $NODE_MYPORT_2 - --source suite/galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test b/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test index 563f115ecf1..b0d5853ac69 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test +++ b/mysql-test/suite/galera_sr/t/galera_sr_cc_master.test @@ -7,7 +7,7 @@ # leave the cluster. # -CALL mtr.add_suppression("WSREP: discarding established.*"); +CALL mtr.add_suppression("WSREP: discarding established"); # Save original auto_increment_offset values. --let $node_1=node_1 diff --git a/mysql-test/suite/galera_sr/t/galera_sr_gtid-master.opt b/mysql-test/suite/galera_sr/t/galera_sr_gtid-master.opt index 6623c33c484..2c3adba1eee 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_gtid-master.opt +++ b/mysql-test/suite/galera_sr/t/galera_sr_gtid-master.opt @@ -1 +1 @@ - --log-bin --log-slave-updates --loose-galera-sr-gtid-unique +--log-bin --log-slave-updates --loose-galera-sr-gtid-unique diff --git a/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.cnf b/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.cnf index 574ae28b54a..a4edaf98802 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.cnf +++ b/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.cnf @@ -8,4 +8,3 @@ wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore [mysqld.2] wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' - diff --git a/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.cnf b/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.cnf index c8e17436e71..8f9e053487f 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.cnf +++ b/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.cnf @@ -1,6 +1,7 @@ !include ../galera_2nodes.cnf + [mysqld.1] wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=16K' + [mysqld.2] wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=16K' - diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#14.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#14.test index deeb890fa0b..2f1e0920f0c 100644 --- a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#14.test +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#14.test @@ -18,4 +18,3 @@ DROP TABLE t1; --connection node_2 --source include/galera_wait_ready.inc - diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#148.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#148.test index e0a443061df..7689fac802e 100644 --- a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#148.test +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#148.test @@ -47,7 +47,7 @@ COMMIT; --reap --connection node_2 -SET GLOBAL wsrep_slave_threads = 1; +SET GLOBAL wsrep_slave_threads = DEFAULT; SET GLOBAL debug_dbug = ''; SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb'; SET DEBUG_SYNC='now SIGNAL signal.wsrep_apply_cb'; diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#22.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#22.test index 544109dadee..302c11d8ff1 100644 --- a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#22.test +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#22.test @@ -40,7 +40,6 @@ COMMIT; --connection node_1 SELECT COUNT(*) = 6 FROM t1; - --connection node_2 SELECT COUNT(*) = 6 FROM t1; diff --git a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#96.test b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#96.test index c773b310183..59875862f70 100644 --- a/mysql-test/suite/galera_sr/t/mysql-wsrep-features#96.test +++ b/mysql-test/suite/galera_sr/t/mysql-wsrep-features#96.test @@ -39,7 +39,3 @@ SELECT COUNT(*) = 0 FROM t2; --connection node_1 DROP TABLE t1; DROP TABLE t2; - - - - diff --git a/mysql-test/suite/wsrep/r/plugin.result b/mysql-test/suite/wsrep/r/plugin.result index 4f52173cb25..2928acd07d2 100644 --- a/mysql-test/suite/wsrep/r/plugin.result +++ b/mysql-test/suite/wsrep/r/plugin.result @@ -1,3 +1,3 @@ -SELECT plugin_name,plugin_version,plugin_maturity FROM information_schema.plugins where plugin_name like 'wsrep' ORDER BY plugin_maturity,plugin_name; +SELECT plugin_name,plugin_version,plugin_maturity FROM information_schema.plugins WHERE plugin_name like 'wsrep' ORDER BY plugin_maturity,plugin_name; plugin_name plugin_version plugin_maturity wsrep 1.0 Stable diff --git a/mysql-test/suite/wsrep/suite.pm b/mysql-test/suite/wsrep/suite.pm index 2ee33d83275..040a48c7964 100644 --- a/mysql-test/suite/wsrep/suite.pm +++ b/mysql-test/suite/wsrep/suite.pm @@ -9,9 +9,9 @@ return wsrep_not_ok() if wsrep_not_ok(); push @::global_suppressions, ( - qr(WSREP: Could not open saved state file for reading: .*), - qr(WSREP: Could not open state file for reading: .*), - qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|, + qr(WSREP: Could not open saved state file for reading: ), + qr(WSREP: Could not open state file for reading: ), + qr|WSREP: access file\(.*gvwstate.dat\) failed ?\(No such file or directory\)|, ); bless { }; diff --git a/mysql-test/suite/wsrep/t/binlog_format.cnf b/mysql-test/suite/wsrep/t/binlog_format.cnf index 7ec24c14d80..500a197e422 100644 --- a/mysql-test/suite/wsrep/t/binlog_format.cnf +++ b/mysql-test/suite/wsrep/t/binlog_format.cnf @@ -5,4 +5,3 @@ wsrep-on=ON wsrep-provider=@ENV.WSREP_PROVIDER wsrep-cluster-address=gcomm:// innodb_autoinc_lock_mode=2 - diff --git a/mysql-test/suite/wsrep/t/foreign_key.test b/mysql-test/suite/wsrep/t/foreign_key.test index 71f6076a1d7..c14910c7f86 100644 --- a/mysql-test/suite/wsrep/t/foreign_key.test +++ b/mysql-test/suite/wsrep/t/foreign_key.test @@ -17,4 +17,3 @@ SELECT * FROM test.c; # Cleanup DROP TABLE c; DROP TABLE p; - diff --git a/mysql-test/suite/wsrep/t/mdev_10186.test b/mysql-test/suite/wsrep/t/mdev_10186.test index 0f0aa287086..157e7b5a7b6 100644 --- a/mysql-test/suite/wsrep/t/mdev_10186.test +++ b/mysql-test/suite/wsrep/t/mdev_10186.test @@ -9,4 +9,3 @@ SELECT @@wsrep_on; SET @@GLOBAL.wsrep_cluster_address='gcomm://'; - diff --git a/mysql-test/suite/wsrep/t/mdev_7798.cnf b/mysql-test/suite/wsrep/t/mdev_7798.cnf index 0bf01f81fc5..c2b7c4d415f 100644 --- a/mysql-test/suite/wsrep/t/mdev_7798.cnf +++ b/mysql-test/suite/wsrep/t/mdev_7798.cnf @@ -4,4 +4,3 @@ wsrep-on=ON wsrep-provider=@ENV.WSREP_PROVIDER wsrep-cluster-address=gcomm:// - diff --git a/mysql-test/suite/wsrep/t/plugin.test b/mysql-test/suite/wsrep/t/plugin.test index 73d605b0918..90750403405 100644 --- a/mysql-test/suite/wsrep/t/plugin.test +++ b/mysql-test/suite/wsrep/t/plugin.test @@ -5,4 +5,4 @@ # MDEV-7604: wsrep plugin lists its status as Unknown # -SELECT plugin_name,plugin_version,plugin_maturity FROM information_schema.plugins where plugin_name like 'wsrep' ORDER BY plugin_maturity,plugin_name; \ No newline at end of file +SELECT plugin_name,plugin_version,plugin_maturity FROM information_schema.plugins WHERE plugin_name like 'wsrep' ORDER BY plugin_maturity,plugin_name; diff --git a/mysql-test/suite/wsrep/t/wsrep-recover.cnf b/mysql-test/suite/wsrep/t/wsrep-recover.cnf index 19986cd97bc..489c4385dbd 100644 --- a/mysql-test/suite/wsrep/t/wsrep-recover.cnf +++ b/mysql-test/suite/wsrep/t/wsrep-recover.cnf @@ -6,4 +6,4 @@ binlog-format=ROW innodb-flush-log-at-trx-commit=1 wsrep-cluster-address=gcomm:// wsrep-provider=@ENV.WSREP_PROVIDER -innodb-autoinc-lock-mode=2 \ No newline at end of file +innodb-autoinc-lock-mode=2 diff --git a/mysql-test/suite/wsrep/t/wsrep_forced_binlog_format.test b/mysql-test/suite/wsrep/t/wsrep_forced_binlog_format.test index 37e9c6c718e..718fc975071 100644 --- a/mysql-test/suite/wsrep/t/wsrep_forced_binlog_format.test +++ b/mysql-test/suite/wsrep/t/wsrep_forced_binlog_format.test @@ -2,7 +2,6 @@ --source include/have_wsrep_provider.inc --source include/have_binlog_format_row.inc - --echo # --echo # wsrep_forced_binlog_format --echo # diff --git a/mysql-test/suite/wsrep/t/wsrep_rpl.test b/mysql-test/suite/wsrep/t/wsrep_rpl.test index 4f34aadc365..98a70d0dfb1 100644 --- a/mysql-test/suite/wsrep/t/wsrep_rpl.test +++ b/mysql-test/suite/wsrep/t/wsrep_rpl.test @@ -41,4 +41,3 @@ eval SET @@GLOBAL.wsrep_max_ws_rows = $wsrep_max_ws_rows_slave; --source include/rpl_end.inc --echo # End of test. - diff --git a/mysql-test/suite/wsrep/t/wsrep_variables_sst_method.test b/mysql-test/suite/wsrep/t/wsrep_variables_sst_method.test index b41718792a2..d63c3e5fafb 100644 --- a/mysql-test/suite/wsrep/t/wsrep_variables_sst_method.test +++ b/mysql-test/suite/wsrep/t/wsrep_variables_sst_method.test @@ -44,7 +44,6 @@ SET GLOBAL wsrep_sst_method='method;'; SELECT @@global.wsrep_sst_method; SHOW WARNINGS; - --disable_query_log SET @@global.wsrep_sst_method = @wsrep_sst_method_saved; --enable_query_log diff --git a/mysql-test/suite/wsrep/t/wsrep_variables_wsrep_off.cnf b/mysql-test/suite/wsrep/t/wsrep_variables_wsrep_off.cnf index 2e66b1ef23c..66a5dcc1f7c 100644 --- a/mysql-test/suite/wsrep/t/wsrep_variables_wsrep_off.cnf +++ b/mysql-test/suite/wsrep/t/wsrep_variables_wsrep_off.cnf @@ -9,4 +9,3 @@ wsrep-on=OFF #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port - diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 974ddfc1d4c..ebd2659ea6f 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -2089,14 +2089,15 @@ bool wsrep_should_replicate_ddl(THD* thd, const handlerton *hton) { if (!wsrep_strict_ddl) return true; - - if (!hton) - return true; DBUG_ASSERT(hton != nullptr); switch (hton->db_type) { + case DB_TYPE_UNKNOWN: + /* Special pseudo-handlertons (such as 10.6+ JSON tables). */ + return true; + break; case DB_TYPE_INNODB: return true; break; @@ -2123,7 +2124,7 @@ bool wsrep_should_replicate_ddl(THD* thd, const handlerton *hton) my_error(ER_GALERA_REPLICATION_NOT_SUPPORTED, MYF(0)); push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, ER_ILLEGAL_HA, - "WSREP: wsrep_strict_dll enabled. " + "WSREP: wsrep_strict_ddl enabled. " "Storage engine %s not supported.", ha_resolve_storage_engine_name(hton)); return false; From bb64a5103798bff6fb6d191880d558a6651a7945 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 10 Feb 2025 09:19:23 +0200 Subject: [PATCH 019/134] MDEV-35941 : galera_bf_abort_lock_table fails with wait for metadata lock Problem was missing case from wsrep_handle_mdl_conflict. Test case was trying to confirm that LOCK TABLE thread is not BF-aborted. However as case was missing it was BF-aborted. Test case passed because BF-aborting takes time and used wait condition might see expected thread status before it was BF-aborted. Test naturally failed if BF-aborting was done early enough. Fix is to add missing case for SQLCOM_LOCK_TABLES to wsrep_handle_mdl_conflict. Note that using LOCK TABLE is still not recomended on cluster because it could cause cluster hang. This is a 10.5 specific commit that will then be overridden by another one for 10.6+. Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera/disabled.def | 2 -- .../suite/galera/t/galera_bf_abort_lock_table.cnf | 1 - .../suite/galera/t/galera_bf_abort_lock_table.test | 4 ++-- sql/wsrep_mysqld.cc | 11 ++++++++--- 4 files changed, 10 insertions(+), 8 deletions(-) delete mode 100644 mysql-test/suite/galera/t/galera_bf_abort_lock_table.cnf diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 72caea32867..538d2d36759 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -13,7 +13,5 @@ galera_sequences : MDEV-35934/MDEV-33850 For Galera, create sequence with low cache got signal 6 error: [ERROR] WSREP: FSM: no such a transition REPLICATING -> COMMITTED galera_wan : MDEV-35940 Unallowed state transition: donor -> synced in galera_wan galera_vote_rejoin_ddl : MDEV-35940 Unallowed state transition: donor -> synced in galera_wan -galera_bf_abort_lock_table : MDEV-35941 galera_bf_abort_lock_table fails with wait for metadata lock -mysql-wsrep#198 : MDEV-35941 galera_bf_abort_lock_table fails with wait for metadata lock MW-329 : MDEV-35951 Complete freeze during MW-329 test galera_vote_rejoin_dml : MDEV-35964 Assertion `ist_seqno >= cc_seqno' failed in galera_vote_rejoin_dml diff --git a/mysql-test/suite/galera/t/galera_bf_abort_lock_table.cnf b/mysql-test/suite/galera/t/galera_bf_abort_lock_table.cnf deleted file mode 100644 index fa33b09d739..00000000000 --- a/mysql-test/suite/galera/t/galera_bf_abort_lock_table.cnf +++ /dev/null @@ -1 +0,0 @@ -!include ../galera_2nodes.cnf diff --git a/mysql-test/suite/galera/t/galera_bf_abort_lock_table.test b/mysql-test/suite/galera/t/galera_bf_abort_lock_table.test index 652e89f8e57..71c3a7198f2 100644 --- a/mysql-test/suite/galera/t/galera_bf_abort_lock_table.test +++ b/mysql-test/suite/galera/t/galera_bf_abort_lock_table.test @@ -19,13 +19,13 @@ INSERT INTO t1 VALUES (2); SET SESSION wsrep_sync_wait = 0; --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); --let $wait_condition_on_error_output = SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST ---source include/wait_condition_with_debug_and_kill.inc +--source include/wait_condition_with_debug.inc UNLOCK TABLES; --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE USER = 'system user' AND (STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'); --let $wait_condition_on_error_output = SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST ---source include/wait_condition_with_debug_and_kill.inc +--source include/wait_condition_with_debug.inc COMMIT; SELECT COUNT(*) = 1 FROM t1; diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index ebd2659ea6f..569bfa35f75 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -2781,11 +2781,9 @@ void wsrep_to_isolation_end(THD *thd) @param requestor_ctx The MDL context of the requestor @param ticket MDL ticket for the requested lock + @param key The key of the object (data) being protected - @retval TRUE Lock request can be granted - @retval FALSE Lock request cannot be granted */ - void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx, const MDL_ticket *ticket, const MDL_key *key) @@ -2861,6 +2859,13 @@ void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx, mysql_mutex_unlock(&granted_thd->LOCK_thd_data); mysql_mutex_unlock(&granted_thd->LOCK_thd_kill); } + else if (granted_thd->lex->sql_command == SQLCOM_LOCK_TABLES) + { + WSREP_DEBUG("BF thread waiting for LOCK TABLES"); + ticket->wsrep_report(wsrep_debug); + mysql_mutex_unlock(&granted_thd->LOCK_thd_data); + mysql_mutex_unlock(&granted_thd->LOCK_thd_kill); + } else if (request_thd->lex->sql_command == SQLCOM_DROP_TABLE) { WSREP_DEBUG("DROP caused BF abort, conf %s", From 573b584eba18176d4cc367e8558966c83af682f6 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 11 Feb 2025 03:51:42 +0100 Subject: [PATCH 020/134] galera mtr tests: unification of wsrep provider settings --- mysql-test/suite/galera/galera_2nodes.cnf | 4 ++-- mysql-test/suite/galera/galera_2nodes_as_master.cnf | 4 ++-- .../suite/galera/galera_2nodes_as_replica_2primary.cnf | 4 ++-- mysql-test/suite/galera/galera_2nodes_as_slave.cnf | 4 ++-- mysql-test/suite/galera/galera_3nodes_as_slave.cnf | 6 +++--- mysql-test/suite/galera/galera_4nodes.cnf | 8 ++++---- mysql-test/suite/galera/t/galera#414.cnf | 4 ++-- .../suite/galera/t/galera_autoinc_sst_mariabackup.cnf | 4 ++-- mysql-test/suite/galera/t/galera_defaults.cnf | 4 ++-- mysql-test/suite/galera/t/galera_gcache_recover.cnf | 4 ++-- .../suite/galera/t/galera_gcache_recover_full_gcache.cnf | 4 ++-- mysql-test/suite/galera/t/galera_gcs_fragment.cnf | 4 ++-- mysql-test/suite/galera/t/galera_gcs_max_packet_size.cnf | 4 ++-- mysql-test/suite/galera/t/galera_ist_MDEV-28423.cnf | 4 ++-- mysql-test/suite/galera/t/galera_ist_MDEV-28583.cnf | 4 ++-- mysql-test/suite/galera/t/galera_ist_mariabackup.cnf | 4 ++-- .../galera/t/galera_ist_mariabackup_innodb_flush_logs.cnf | 4 ++-- .../suite/galera/t/galera_ist_mariabackup_verify_ca.cnf | 4 ++-- mysql-test/suite/galera/t/galera_ist_mysqldump.cnf | 4 ++-- mysql-test/suite/galera/t/galera_ist_progress.cnf | 2 +- mysql-test/suite/galera/t/galera_ist_recv_bind.cnf | 4 ++-- mysql-test/suite/galera/t/galera_ist_restart_joiner.cnf | 2 +- mysql-test/suite/galera/t/galera_ist_rsync.cnf | 4 ++-- mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.cnf | 4 ++-- mysql-test/suite/galera/t/galera_log_bin_opt.cnf | 4 ++-- mysql-test/suite/galera/t/galera_pc_ignore_sb.cnf | 4 ++-- mysql-test/suite/galera/t/galera_ssl.cnf | 4 ++-- mysql-test/suite/galera/t/galera_ssl_cipher.cnf | 4 ++-- mysql-test/suite/galera/t/galera_ssl_compression.cnf | 4 ++-- mysql-test/suite/galera/t/galera_ssl_upgrade.cnf | 4 ++-- mysql-test/suite/galera/t/galera_sst_encrypted.cnf | 4 ++-- mysql-test/suite/galera/t/galera_sst_mariabackup.cnf | 4 ++-- .../suite/galera/t/galera_sst_mariabackup_data_dir.cnf | 4 ++-- .../galera/t/galera_sst_mariabackup_force_recovery.cnf | 4 ++-- .../suite/galera/t/galera_sst_mariabackup_logarchive.cnf | 4 ++-- .../suite/galera/t/galera_sst_mariabackup_lost_found.cnf | 4 ++-- .../galera/t/galera_sst_mariabackup_table_options.cnf | 4 ++-- mysql-test/suite/galera/t/galera_sst_mysqldump.cnf | 5 +++-- .../suite/galera/t/galera_sst_mysqldump_with_key.cnf | 4 ++-- mysql-test/suite/galera/t/galera_sst_rsync.cnf | 4 ++-- mysql-test/suite/galera/t/galera_sst_rsync2.cnf | 4 ++-- mysql-test/suite/galera/t/galera_sst_rsync_binlogname.cnf | 4 ++-- mysql-test/suite/galera/t/galera_sst_rsync_data_dir.cnf | 4 ++-- .../galera/t/galera_sst_rsync_encrypt_with_capath.cnf | 4 ++-- .../suite/galera/t/galera_sst_rsync_encrypt_with_key.cnf | 4 ++-- .../galera/t/galera_sst_rsync_encrypt_with_server.cnf | 4 ++-- .../suite/galera/t/galera_sst_rsync_logbasename.cnf | 4 ++-- mysql-test/suite/galera/t/galera_sst_rsync_recv_auto.cnf | 8 ++++---- mysql-test/suite/galera/t/galera_var_notify_ssl_ipv6.cnf | 4 ++-- mysql-test/suite/galera/t/galera_wan.cnf | 8 ++++---- mysql-test/suite/galera/t/galera_wan_restart_ist.cnf | 8 ++++---- mysql-test/suite/galera/t/galera_wan_restart_sst.cnf | 8 ++++---- mysql-test/suite/galera/t/mysql-wsrep#33.cnf | 4 ++-- mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf | 1 + mysql-test/suite/galera_3nodes/galera_3nodes.cnf | 6 +++--- mysql-test/suite/galera_3nodes/t/GAL-501.cnf | 6 +++--- mysql-test/suite/galera_3nodes/t/GCF-354.cnf | 6 +++--- .../suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf | 6 +++--- .../galera_3nodes/t/galera_ipv6_mariabackup_section.cnf | 6 +++--- .../suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf | 6 +++--- mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf | 6 +++--- .../suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf | 6 +++--- .../suite/galera_3nodes/t/galera_ist_gcache_rollover.cnf | 6 +++--- mysql-test/suite/galera_3nodes/t/galera_ssl_reload.cnf | 6 +++--- .../suite/galera_3nodes_sr/t/galera_sr_threeway_split.cnf | 2 +- .../suite/galera_sr/t/galera_sr_kill_all_norecovery.cnf | 3 ++- mysql-test/suite/galera_sr/t/galera_sr_kill_slave.cnf | 2 +- mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.cnf | 4 ++-- mysql-test/suite/galera_sr/t/galera_sr_small_gcache.cnf | 4 ++-- 69 files changed, 155 insertions(+), 152 deletions(-) diff --git a/mysql-test/suite/galera/galera_2nodes.cnf b/mysql-test/suite/galera/galera_2nodes.cnf index f1697c08149..f0996fa3a97 100644 --- a/mysql-test/suite/galera/galera_2nodes.cnf +++ b/mysql-test/suite/galera/galera_2nodes.cnf @@ -17,7 +17,7 @@ wsrep-on=1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address=gcomm:// -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' @@ -28,7 +28,7 @@ wsrep-on=1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' diff --git a/mysql-test/suite/galera/galera_2nodes_as_master.cnf b/mysql-test/suite/galera/galera_2nodes_as_master.cnf index 11d7401535a..43bd091c8ee 100644 --- a/mysql-test/suite/galera/galera_2nodes_as_master.cnf +++ b/mysql-test/suite/galera/galera_2nodes_as_master.cnf @@ -25,7 +25,7 @@ server-id=1 #sst_port=@OPT.port wsrep_provider=@ENV.WSREP_PROVIDER wsrep_cluster_address=gcomm:// -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' @@ -38,7 +38,7 @@ server-id=2 #sst_port=@OPT.port wsrep_provider=@ENV.WSREP_PROVIDER wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' diff --git a/mysql-test/suite/galera/galera_2nodes_as_replica_2primary.cnf b/mysql-test/suite/galera/galera_2nodes_as_replica_2primary.cnf index 714caf6ee67..570eeda0bc6 100644 --- a/mysql-test/suite/galera/galera_2nodes_as_replica_2primary.cnf +++ b/mysql-test/suite/galera/galera_2nodes_as_replica_2primary.cnf @@ -24,7 +24,7 @@ server-id=1 #sst_port=@OPT.port wsrep_provider=@ENV.WSREP_PROVIDER wsrep_cluster_address=gcomm:// -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' @@ -37,7 +37,7 @@ server-id=2 #sst_port=@OPT.port wsrep_provider=@ENV.WSREP_PROVIDER wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' diff --git a/mysql-test/suite/galera/galera_2nodes_as_slave.cnf b/mysql-test/suite/galera/galera_2nodes_as_slave.cnf index c6f6299ca92..c00e6c6a937 100644 --- a/mysql-test/suite/galera/galera_2nodes_as_slave.cnf +++ b/mysql-test/suite/galera/galera_2nodes_as_slave.cnf @@ -24,7 +24,7 @@ server-id=1 #sst_port=@OPT.port wsrep_provider=@ENV.WSREP_PROVIDER wsrep_cluster_address=gcomm:// -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' @@ -37,7 +37,7 @@ server-id=2 #sst_port=@OPT.port wsrep_provider=@ENV.WSREP_PROVIDER wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' diff --git a/mysql-test/suite/galera/galera_3nodes_as_slave.cnf b/mysql-test/suite/galera/galera_3nodes_as_slave.cnf index 228147c0248..6231da6c246 100644 --- a/mysql-test/suite/galera/galera_3nodes_as_slave.cnf +++ b/mysql-test/suite/galera/galera_3nodes_as_slave.cnf @@ -24,7 +24,7 @@ server-id=1 #sst_port=@OPT.port wsrep_provider=@ENV.WSREP_PROVIDER wsrep_cluster_address=gcomm:// -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' @@ -37,7 +37,7 @@ server-id=2 #sst_port=@OPT.port wsrep_provider=@ENV.WSREP_PROVIDER wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' @@ -50,7 +50,7 @@ server-id=3 #sst_port=@OPT.port wsrep-provider=@ENV.WSREP_PROVIDER wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.3.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' diff --git a/mysql-test/suite/galera/galera_4nodes.cnf b/mysql-test/suite/galera/galera_4nodes.cnf index 090b8953bff..3006882eda3 100644 --- a/mysql-test/suite/galera/galera_4nodes.cnf +++ b/mysql-test/suite/galera/galera_4nodes.cnf @@ -18,7 +18,7 @@ wsrep-on=1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address=gcomm:// -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' @@ -30,7 +30,7 @@ wsrep-on=1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' @@ -42,7 +42,7 @@ wsrep-on=1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.3.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' @@ -54,7 +54,7 @@ wsrep-on=1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.4.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port wsrep_sst_receive_address='127.0.0.1:@mysqld.4.#sst_port' diff --git a/mysql-test/suite/galera/t/galera#414.cnf b/mysql-test/suite/galera/t/galera#414.cnf index 03e7214b76f..c1538deca8f 100644 --- a/mysql-test/suite/galera/t/galera#414.cnf +++ b/mysql-test/suite/galera/t/galera#414.cnf @@ -1,7 +1,7 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcs.max_packet_size=2' +wsrep_provider_options='gcs.max_packet_size=2;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcs.max_packet_size=2' +wsrep_provider_options='gcs.max_packet_size=2;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.cnf b/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.cnf index cddb8e0e174..1fcfcc6bf9f 100644 --- a/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.cnf +++ b/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.cnf @@ -5,7 +5,7 @@ wsrep_sst_method=mariabackup wsrep_sst_auth="root:" [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_defaults.cnf b/mysql-test/suite/galera/t/galera_defaults.cnf index fb143baf30f..02d3d542224 100644 --- a/mysql-test/suite/galera/t/galera_defaults.cnf +++ b/mysql-test/suite/galera/t/galera_defaults.cnf @@ -1,7 +1,7 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.segment=1' +wsrep_provider_options='gmcast.segment=1;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gmcast.segment=1' +wsrep_provider_options='gmcast.segment=1;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_gcache_recover.cnf b/mysql-test/suite/galera/t/galera_gcache_recover.cnf index 34c757de77e..d1bea184e3e 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover.cnf +++ b/mysql-test/suite/galera/t/galera_gcache_recover.cnf @@ -1,7 +1,7 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.recover=yes;pc.ignore_sb=true' +wsrep_provider_options='gcache.recover=yes;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.recover=yes' +wsrep_provider_options='gcache.recover=yes;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S' diff --git a/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.cnf b/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.cnf index 0157d2f08b1..fee9d154817 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.cnf +++ b/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.cnf @@ -3,7 +3,7 @@ [mysqld.1] max_allowed_packet=10M innodb_log_file_size=220M -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.recover=yes;pc.ignore_sb=true;gcache.size=10M' +wsrep_provider_options='gcache.recover=yes;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.recover=yes;pc.ignore_sb=true;gcache.size=10M' +wsrep_provider_options='gcache.recover=yes;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_gcs_fragment.cnf b/mysql-test/suite/galera/t/galera_gcs_fragment.cnf index 5d7bbf7b053..b75fddaef6f 100644 --- a/mysql-test/suite/galera/t/galera_gcs_fragment.cnf +++ b/mysql-test/suite/galera/t/galera_gcs_fragment.cnf @@ -1,7 +1,7 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcs.max_packet_size=64' +wsrep_provider_options='gcs.max_packet_size=64;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcs.max_packet_size=64' +wsrep_provider_options='gcs.max_packet_size=64;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_gcs_max_packet_size.cnf b/mysql-test/suite/galera/t/galera_gcs_max_packet_size.cnf index 7e7c99ecb63..b75fddaef6f 100644 --- a/mysql-test/suite/galera/t/galera_gcs_max_packet_size.cnf +++ b/mysql-test/suite/galera/t/galera_gcs_max_packet_size.cnf @@ -1,7 +1,7 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcs.max_packet_size=64;gcache.size=10M' +wsrep_provider_options='gcs.max_packet_size=64;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcs.max_packet_size=64;gcache.size=10M' +wsrep_provider_options='gcs.max_packet_size=64;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_ist_MDEV-28423.cnf b/mysql-test/suite/galera/t/galera_ist_MDEV-28423.cnf index 691e52208b1..c32726ae833 100644 --- a/mysql-test/suite/galera/t/galera_ist_MDEV-28423.cnf +++ b/mysql-test/suite/galera/t/galera_ist_MDEV-28423.cnf @@ -35,10 +35,10 @@ log_slave_updates=ON log_bin=binlog [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_ist_MDEV-28583.cnf b/mysql-test/suite/galera/t/galera_ist_MDEV-28583.cnf index 3835cd02a41..667757a337c 100644 --- a/mysql-test/suite/galera/t/galera_ist_MDEV-28583.cnf +++ b/mysql-test/suite/galera/t/galera_ist_MDEV-28583.cnf @@ -35,10 +35,10 @@ log_slave_updates=ON log_bin=binlog [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_ist_mariabackup.cnf b/mysql-test/suite/galera/t/galera_ist_mariabackup.cnf index f03527dc808..fea434ab181 100644 --- a/mysql-test/suite/galera/t/galera_ist_mariabackup.cnf +++ b/mysql-test/suite/galera/t/galera_ist_mariabackup.cnf @@ -5,10 +5,10 @@ wsrep_sst_method=mariabackup wsrep_sst_auth=root: [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.cnf b/mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.cnf index e4f52aaad0a..e0651b03e67 100644 --- a/mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.cnf +++ b/mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.cnf @@ -7,10 +7,10 @@ wsrep_sst_auth=root: innodb_flush_log_at_trx_commit=0 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.cnf b/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.cnf index f2187b83486..66f9c3217e8 100644 --- a/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.cnf +++ b/mysql-test/suite/galera/t/galera_ist_mariabackup_verify_ca.cnf @@ -9,10 +9,10 @@ ssl-key=@ENV.MYSQL_TEST_DIR/std_data/server-key.pem ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [sst] ssl-mode=VERIFY_CA diff --git a/mysql-test/suite/galera/t/galera_ist_mysqldump.cnf b/mysql-test/suite/galera/t/galera_ist_mysqldump.cnf index 807829f047f..1007de9f779 100644 --- a/mysql-test/suite/galera/t/galera_ist_mysqldump.cnf +++ b/mysql-test/suite/galera/t/galera_ist_mysqldump.cnf @@ -4,7 +4,7 @@ # causes the first MTR connection to be forefully dropped by Galera, which in turn confuses MTR [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_ist_progress.cnf b/mysql-test/suite/galera/t/galera_ist_progress.cnf index 10958aad9a8..7a043bbe9f0 100644 --- a/mysql-test/suite/galera/t/galera_ist_progress.cnf +++ b/mysql-test/suite/galera/t/galera_ist_progress.cnf @@ -1,4 +1,4 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_ist_recv_bind.cnf b/mysql-test/suite/galera/t/galera_ist_recv_bind.cnf index 035fb0769b7..90502d3326e 100644 --- a/mysql-test/suite/galera/t/galera_ist_recv_bind.cnf +++ b/mysql-test/suite/galera/t/galera_ist_recv_bind.cnf @@ -1,7 +1,7 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;ist.recv_bind=127.0.0.1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;ist.recv_bind=127.0.0.1;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;ist.recv_bind=127.0.0.1' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;ist.recv_bind=127.0.0.1;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_ist_restart_joiner.cnf b/mysql-test/suite/galera/t/galera_ist_restart_joiner.cnf index 10958aad9a8..7a043bbe9f0 100644 --- a/mysql-test/suite/galera/t/galera_ist_restart_joiner.cnf +++ b/mysql-test/suite/galera/t/galera_ist_restart_joiner.cnf @@ -1,4 +1,4 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_ist_rsync.cnf b/mysql-test/suite/galera/t/galera_ist_rsync.cnf index 7a3da6dad02..33cea999503 100644 --- a/mysql-test/suite/galera/t/galera_ist_rsync.cnf +++ b/mysql-test/suite/galera/t/galera_ist_rsync.cnf @@ -4,9 +4,9 @@ wsrep_sst_method=rsync [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sync_wait=1 [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sync_wait=1 diff --git a/mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.cnf b/mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.cnf index 9125f6708fe..ddedc97717c 100644 --- a/mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.cnf +++ b/mysql-test/suite/galera/t/galera_ist_rsync_verify_ca.cnf @@ -8,10 +8,10 @@ ssl-key=@ENV.MYSQL_TEST_DIR/std_data/server-key.pem ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [sst] ssl-mode=VERIFY_CA diff --git a/mysql-test/suite/galera/t/galera_log_bin_opt.cnf b/mysql-test/suite/galera/t/galera_log_bin_opt.cnf index 3c14cde794c..b9da661bb42 100644 --- a/mysql-test/suite/galera/t/galera_log_bin_opt.cnf +++ b/mysql-test/suite/galera/t/galera_log_bin_opt.cnf @@ -5,10 +5,10 @@ wsrep_sst_method=mariabackup wsrep_sst_auth="root:" [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_pc_ignore_sb.cnf b/mysql-test/suite/galera/t/galera_pc_ignore_sb.cnf index 8734323a2d6..5ea513d111e 100644 --- a/mysql-test/suite/galera/t/galera_pc_ignore_sb.cnf +++ b/mysql-test/suite/galera/t/galera_pc_ignore_sb.cnf @@ -4,7 +4,7 @@ wsrep_debug=1 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' diff --git a/mysql-test/suite/galera/t/galera_ssl.cnf b/mysql-test/suite/galera/t/galera_ssl.cnf index de57c9ffbf0..904842c88b6 100644 --- a/mysql-test/suite/galera/t/galera_ssl.cnf +++ b/mysql-test/suite/galera/t/galera_ssl.cnf @@ -1,7 +1,7 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem' +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem' +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_ssl_cipher.cnf b/mysql-test/suite/galera/t/galera_ssl_cipher.cnf index dff9c96afbb..776c321d800 100644 --- a/mysql-test/suite/galera/t/galera_ssl_cipher.cnf +++ b/mysql-test/suite/galera/t/galera_ssl_cipher.cnf @@ -5,7 +5,7 @@ loose-galera-ssl-cipher=1 wsrep-debug=1 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;cert.log_conflicts=YES' +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;cert.log_conflicts=YES;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;cert.log_conflicts=YES' +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;cert.log_conflicts=YES;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_ssl_compression.cnf b/mysql-test/suite/galera/t/galera_ssl_compression.cnf index 4dffe99bd5a..2994c552338 100644 --- a/mysql-test/suite/galera/t/galera_ssl_compression.cnf +++ b/mysql-test/suite/galera/t/galera_ssl_compression.cnf @@ -1,7 +1,7 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem;socket.ssl_compression=YES' +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem;socket.ssl_compression=YES;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem;socket.ssl_compression=YES' +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/cakey.pem;socket.ssl_compression=YES;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf b/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf index 7c495102564..ee8c6e590f4 100644 --- a/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf +++ b/mysql-test/suite/galera/t/galera_ssl_upgrade.cnf @@ -5,7 +5,7 @@ loose-galera-ssl-upgrade=1 wsrep-debug=1 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem' +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem' +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_sst_encrypted.cnf b/mysql-test/suite/galera/t/galera_sst_encrypted.cnf index e10c3e9f215..b796f9f92cf 100644 --- a/mysql-test/suite/galera/t/galera_sst_encrypted.cnf +++ b/mysql-test/suite/galera/t/galera_sst_encrypted.cnf @@ -11,7 +11,7 @@ innodb_file_per_table=1 wsrep_sst_method=rsync [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf index 857a4101406..06a49ff85d0 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf @@ -6,10 +6,10 @@ 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' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_data_dir.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_data_dir.cnf index b1caf700a12..20581ee765e 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup_data_dir.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_data_dir.cnf @@ -6,11 +6,11 @@ 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' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] innodb_data_home_dir=@ENV.MYSQL_TMP_DIR/data_dir_test -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_force_recovery.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_force_recovery.cnf index 857a4101406..1e6bbcce82f 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup_force_recovery.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_force_recovery.cnf @@ -6,10 +6,10 @@ 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' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_logarchive.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_logarchive.cnf index 04043ac2b74..8e68fc0554a 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup_logarchive.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_logarchive.cnf @@ -6,10 +6,10 @@ 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' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.cnf index a09efd2e011..56ab462df7d 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_lost_found.cnf @@ -5,10 +5,10 @@ wsrep_sst_method=mariabackup wsrep_sst_auth="root:" [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf index 4c57017299f..5c468a664f1 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf @@ -8,10 +8,10 @@ innodb-file-format='Barracuda' innodb-file-per-table=ON [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_sst_mysqldump.cnf b/mysql-test/suite/galera/t/galera_sst_mysqldump.cnf index af4fedf12ce..1007de9f779 100644 --- a/mysql-test/suite/galera/t/galera_sst_mysqldump.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mysqldump.cnf @@ -4,6 +4,7 @@ # causes the first MTR connection to be forefully dropped by Galera, which in turn confuses MTR [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' + [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.cnf b/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.cnf index da04a605291..2e4e0ffd31d 100644 --- a/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mysqldump_with_key.cnf @@ -9,10 +9,10 @@ wsrep-sync_wait=15 loose-galera_sst_mysqldump_with_key=1 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [client] ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem diff --git a/mysql-test/suite/galera/t/galera_sst_rsync.cnf b/mysql-test/suite/galera/t/galera_sst_rsync.cnf index 29d3a1e6219..197c2a1a11e 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync.cnf +++ b/mysql-test/suite/galera/t/galera_sst_rsync.cnf @@ -4,7 +4,7 @@ wsrep_sst_method=rsync [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_sst_rsync2.cnf b/mysql-test/suite/galera/t/galera_sst_rsync2.cnf index a089baacf36..483d4b0f015 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync2.cnf +++ b/mysql-test/suite/galera/t/galera_sst_rsync2.cnf @@ -4,11 +4,11 @@ wsrep_sst_method=rsync [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' log_bin=@ENV.MYSQLTEST_VARDIR/mysqld.1/server1_binlog log_bin_index=@ENV.MYSQLTEST_VARDIR/tmp/server1_binlog_index.index [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' log_bin=@ENV.MYSQLTEST_VARDIR/mysqld.2/server2_binlog log_bin_index=@ENV.MYSQLTEST_VARDIR/tmp/server2_binlog_index.index diff --git a/mysql-test/suite/galera/t/galera_sst_rsync_binlogname.cnf b/mysql-test/suite/galera/t/galera_sst_rsync_binlogname.cnf index b1e4278dceb..dcd77967c80 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync_binlogname.cnf +++ b/mysql-test/suite/galera/t/galera_sst_rsync_binlogname.cnf @@ -4,9 +4,9 @@ wsrep_sst_method=rsync [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' log_bin=server1_binlog [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' log_bin=server2_binlog diff --git a/mysql-test/suite/galera/t/galera_sst_rsync_data_dir.cnf b/mysql-test/suite/galera/t/galera_sst_rsync_data_dir.cnf index 4cc3442bd87..b873ac0d6a1 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync_data_dir.cnf +++ b/mysql-test/suite/galera/t/galera_sst_rsync_data_dir.cnf @@ -4,11 +4,11 @@ wsrep_sst_method=rsync [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' innodb_data_home_dir=@ENV.MYSQL_TMP_DIR/rsync_test_2 -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' [sst] backup_threads=2 diff --git a/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_capath.cnf b/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_capath.cnf index 3ab762df013..d93f5a1a663 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_capath.cnf +++ b/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_capath.cnf @@ -14,7 +14,7 @@ ssl-ca= ssl-mode=VERIFY_CA [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_key.cnf b/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_key.cnf index 948b52d4bf7..354376baec8 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_key.cnf +++ b/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_key.cnf @@ -8,7 +8,7 @@ tkey=@ENV.MYSQL_TEST_DIR/std_data/server-key.pem tcert=@ENV.MYSQL_TEST_DIR/std_data/server-cert.pem [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_server.cnf b/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_server.cnf index 8ed9348e789..6ad746ebff0 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_server.cnf +++ b/mysql-test/suite/galera/t/galera_sst_rsync_encrypt_with_server.cnf @@ -10,7 +10,7 @@ ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem ssl-mode=VERIFY_CA [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_sst_rsync_logbasename.cnf b/mysql-test/suite/galera/t/galera_sst_rsync_logbasename.cnf index 3913ab6660f..4c9745cba66 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync_logbasename.cnf +++ b/mysql-test/suite/galera/t/galera_sst_rsync_logbasename.cnf @@ -4,11 +4,11 @@ wsrep_sst_method=rsync [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' log_basename=server1 log_bin [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' log_basename=server2 log_bin diff --git a/mysql-test/suite/galera/t/galera_sst_rsync_recv_auto.cnf b/mysql-test/suite/galera/t/galera_sst_rsync_recv_auto.cnf index c2888926a57..c1011763faf 100644 --- a/mysql-test/suite/galera/t/galera_sst_rsync_recv_auto.cnf +++ b/mysql-test/suite/galera/t/galera_sst_rsync_recv_auto.cnf @@ -5,14 +5,14 @@ wsrep_sst_method=rsync bind-address=:: [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_incoming_address='[::1]:@mysqld.1.port' wsrep_node_address=::1 wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' [mysqld.2] -wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port;gcache.size=1;pc.ignore_sb=true' -wsrep_node_address=::1 +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_incoming_address='[::1]:@mysqld.2.port' +wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' +wsrep_node_address=::1 wsrep_sst_receive_address=AUTO diff --git a/mysql-test/suite/galera/t/galera_var_notify_ssl_ipv6.cnf b/mysql-test/suite/galera/t/galera_var_notify_ssl_ipv6.cnf index 9b88a09d814..a8c2826ad0d 100644 --- a/mysql-test/suite/galera/t/galera_var_notify_ssl_ipv6.cnf +++ b/mysql-test/suite/galera/t/galera_var_notify_ssl_ipv6.cnf @@ -6,7 +6,7 @@ ssl-key=@ENV.MYSQL_TEST_DIR/std_data/server-key.pem ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem [mysqld.1] -wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port;repl.causal_read_timeout=PT90S;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_incoming_address='[::1]:@mysqld.1.port' wsrep_node_address=[::1]:@mysqld.1.#galera_port wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' @@ -14,7 +14,7 @@ bind-address=:: [mysqld.2] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port;repl.causal_read_timeout=PT90S;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_incoming_address='[::1]:@mysqld.2.port' wsrep_node_address=[::1]:@mysqld.2.#galera_port wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' diff --git a/mysql-test/suite/galera/t/galera_wan.cnf b/mysql-test/suite/galera/t/galera_wan.cnf index 5f86e1cb61e..c01468b5073 100644 --- a/mysql-test/suite/galera/t/galera_wan.cnf +++ b/mysql-test/suite/galera/t/galera_wan.cnf @@ -4,13 +4,13 @@ loose-galera-wan=1 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M;gmcast.segment=1' +wsrep_provider_options='gmcast.segment=1;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M;gmcast.segment=1' +wsrep_provider_options='gmcast.segment=1;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.3] -wsrep_provider_options='base_port=@mysqld.3.#galera_port;gcache.size=10M;gmcast.segment=2' +wsrep_provider_options='gmcast.segment=2;repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.4] -wsrep_provider_options='base_port=@mysqld.4.#galera_port;gcache.size=10M;gmcast.segment=3' +wsrep_provider_options='gmcast.segment=3;repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_wan_restart_ist.cnf b/mysql-test/suite/galera/t/galera_wan_restart_ist.cnf index 941ce694f0b..d101f5d5f53 100644 --- a/mysql-test/suite/galera/t/galera_wan_restart_ist.cnf +++ b/mysql-test/suite/galera/t/galera_wan_restart_ist.cnf @@ -4,13 +4,13 @@ loose-galera-wan-restart-ist=1 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.segment=1' +wsrep_provider_options='gmcast.segment=1;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gmcast.segment=1' +wsrep_provider_options='gmcast.segment=1;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.3] -wsrep_provider_options='base_port=@mysqld.3.#galera_port;gmcast.segment=2' +wsrep_provider_options='gmcast.segment=2;repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.4] -wsrep_provider_options='base_port=@mysqld.4.#galera_port;gmcast.segment=2' +wsrep_provider_options='gmcast.segment=2;repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/galera_wan_restart_sst.cnf b/mysql-test/suite/galera/t/galera_wan_restart_sst.cnf index f549aeedf30..e8f6804ffe6 100644 --- a/mysql-test/suite/galera/t/galera_wan_restart_sst.cnf +++ b/mysql-test/suite/galera/t/galera_wan_restart_sst.cnf @@ -4,13 +4,13 @@ loose-galera-wan-restart-sst=1 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.segment=1' +wsrep_provider_options='gmcast.segment=1;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gmcast.segment=1' +wsrep_provider_options='gmcast.segment=1;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.3] -wsrep_provider_options='base_port=@mysqld.3.#galera_port;gmcast.segment=2' +wsrep_provider_options='gmcast.segment=2;repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.4] -wsrep_provider_options='base_port=@mysqld.4.#galera_port;gmcast.segment=2' +wsrep_provider_options='gmcast.segment=2;repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera/t/mysql-wsrep#33.cnf b/mysql-test/suite/galera/t/mysql-wsrep#33.cnf index f1d42cd791f..7100721695f 100644 --- a/mysql-test/suite/galera/t/mysql-wsrep#33.cnf +++ b/mysql-test/suite/galera/t/mysql-wsrep#33.cnf @@ -1,7 +1,7 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf index 22e160c21b4..5cd16f029e0 100644 --- a/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf +++ b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf @@ -24,6 +24,7 @@ wsrep-on=1 #sst_port=@OPT.port wsrep_cluster_address=gcomm:// wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' + wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' diff --git a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf index 12ddc8621d1..b0229971c57 100644 --- a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf +++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf @@ -19,7 +19,7 @@ wsrep-on=1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address=gcomm:// -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.1.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' @@ -31,7 +31,7 @@ wsrep-on=1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.2.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' @@ -43,7 +43,7 @@ wsrep-on=1 #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_node_address='127.0.0.1:@mysqld.3.#galera_port' wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' diff --git a/mysql-test/suite/galera_3nodes/t/GAL-501.cnf b/mysql-test/suite/galera_3nodes/t/GAL-501.cnf index cd99c90bc16..7e521ee5c5b 100644 --- a/mysql-test/suite/galera_3nodes/t/GAL-501.cnf +++ b/mysql-test/suite/galera_3nodes/t/GAL-501.cnf @@ -6,7 +6,7 @@ wsrep_sst_method=rsync [mysqld.1] wsrep-cluster-address=gcomm:// wsrep_node_address=[::1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' wsrep_node_incoming_address='[::1]:@mysqld.1.port' bind-address=:: @@ -14,7 +14,7 @@ bind-address=:: [mysqld.2] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' wsrep_node_address=[::1] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' wsrep_node_incoming_address='[::1]:@mysqld.2.port' bind-address=:: @@ -22,7 +22,7 @@ bind-address=:: [mysqld.3] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' wsrep_node_address=[::1] -wsrep_provider_options='base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' wsrep_node_incoming_address='[::1]:@mysqld.3.port' bind-address=:: diff --git a/mysql-test/suite/galera_3nodes/t/GCF-354.cnf b/mysql-test/suite/galera_3nodes/t/GCF-354.cnf index e87e65ca58c..660266e2cce 100644 --- a/mysql-test/suite/galera_3nodes/t/GCF-354.cnf +++ b/mysql-test/suite/galera_3nodes/t/GCF-354.cnf @@ -7,10 +7,10 @@ loose-gcf-354=0 wsrep-debug=1 [mysqld.1] -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1G;pc.weight=4' +wsrep_provider_options='repl.causal_read_timeout=PT90S;pc.weight=4;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=256M' [mysqld.2] -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1G' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=256M' [mysqld.3] -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1G' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=256M' diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf index ed0e6204d3e..e7f79cfb40a 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.cnf @@ -6,7 +6,7 @@ wsrep_sst_auth="root:" [mysqld.1] wsrep-cluster-address=gcomm:// -wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.1.port' @@ -15,7 +15,7 @@ bind-address=:: [mysqld.2] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.2.port' @@ -25,7 +25,7 @@ bind-address=:: [mysqld.3] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.3.port' diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf index aaad88ebcbd..765c465794e 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup_section.cnf @@ -9,7 +9,7 @@ wsrep_sst_auth="root:" [mysqld.1] wsrep-cluster-address=gcomm:// -wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.1.port' @@ -18,7 +18,7 @@ bind-address=:: [mysqld.2] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.2.port' @@ -28,7 +28,7 @@ bind-address=:: [mysqld.3] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.3.port' diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf index 0a54fb8e4e1..e739704aa9d 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mysqldump.cnf @@ -5,7 +5,7 @@ wsrep_sst_method=rsync [mysqld.1] wsrep-cluster-address=gcomm:// -wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.1.port' @@ -13,7 +13,7 @@ bind-address=:: [mysqld.2] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.2.port' @@ -21,7 +21,7 @@ bind-address=:: [mysqld.3] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.3.port' diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf index 0a54fb8e4e1..e739704aa9d 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync.cnf @@ -5,7 +5,7 @@ wsrep_sst_method=rsync [mysqld.1] wsrep-cluster-address=gcomm:// -wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.1.port' @@ -13,7 +13,7 @@ bind-address=:: [mysqld.2] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.2.port' @@ -21,7 +21,7 @@ bind-address=:: [mysqld.3] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.3.port' diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf index 35196700044..8e62cad67f6 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_rsync_section.cnf @@ -10,7 +10,7 @@ wsrep_sst_method=rsync [mysqld.1] wsrep-cluster-address=gcomm:// -wsrep_provider_options='base_host=[::1];base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1]:@mysqld.1.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.1.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.1.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.1.port' @@ -18,7 +18,7 @@ bind-address=:: [mysqld.2] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_host=[::1];base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1]:@mysqld.2.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.2.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.2.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.2.port' @@ -26,7 +26,7 @@ bind-address=:: [mysqld.3] wsrep_cluster_address='gcomm://[::1]:@mysqld.1.#galera_port' -wsrep_provider_options='base_host=[::1];base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1]:@mysqld.3.#ist_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;gmcast.listen_addr=tcp://[::]:@mysqld.3.#galera_port;ist.recv_addr=[::1];evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' wsrep_sst_receive_address='[::1]:@mysqld.3.#sst_port' wsrep_node_address=::1 wsrep_node_incoming_address='[::1]:@mysqld.3.port' diff --git a/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.cnf b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.cnf index 29563657262..3b8375ceae7 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.cnf @@ -1,7 +1,7 @@ !include ../galera_3nodes.cnf [mysqld.1] -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.ignore_sb=true;gcache.size=1M' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1M' auto_increment_increment=1 auto_increment_offset=1 # this will force server restarts before this test @@ -9,14 +9,14 @@ loose-galera-ist-gcache-rollover=1 wsrep-debug=1 [mysqld.2] -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.ignore_sb=true;gcache.size=1M' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1M' auto_increment_increment=2 auto_increment_offset=2 loose-galera-ist-gcache-rollover=2 wsrep-debug=1 [mysqld.3] -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.ignore_sb=true;gcache.size=1M' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1M' auto_increment_increment=3 auto_increment_offset=3 loose-galera-ist-gcache-rollover=3 diff --git a/mysql-test/suite/galera_3nodes/t/galera_ssl_reload.cnf b/mysql-test/suite/galera_3nodes/t/galera_ssl_reload.cnf index d4c654e2bf8..58c3093d811 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ssl_reload.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_ssl_reload.cnf @@ -5,10 +5,10 @@ wsrep-debug=1 loose-galera-ssl-reload=1 [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/client-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/client-key.pem' +wsrep_provider_options='socket.ssl=yes;socket.ssl_ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/client-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/client-key.pem;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;socket.ssl=yes;socket.ssl_ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/client-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/client-key.pem' +wsrep_provider_options='socket.ssl=yes;socket.ssl_ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/client-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/client-key.pem;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.3] -wsrep_provider_options='base_port=@mysqld.3.#galera_port;socket.ssl=yes;socket.ssl_ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/client-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/client-key.pem' +wsrep_provider_options='socket.ssl=yes;socket.ssl_ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/client-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/client-key.pem;repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.cnf b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.cnf index 557edbb09d9..18bae4a74e9 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.cnf +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.cnf @@ -1,4 +1,4 @@ !include ../galera_3nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.weight=3' +wsrep_provider_options='pc.weight=3;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.cnf b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.cnf index 82c001e0131..c9b6ff8c3f7 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.cnf +++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.cnf @@ -1,7 +1,8 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.recovery=false' +wsrep_provider_options='pc.recovery=false;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' + auto_increment_offset=1 [mysqld.2] diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_slave.cnf b/mysql-test/suite/galera_sr/t/galera_sr_kill_slave.cnf index 290d8fe196e..d0509488d83 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_kill_slave.cnf +++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_slave.cnf @@ -1,4 +1,4 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.weight=2' +wsrep_provider_options='pc.weight=2;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.cnf b/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.cnf index a4edaf98802..1007de9f779 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.cnf +++ b/mysql-test/suite/galera_sr/t/galera_sr_mysqldump_sst.cnf @@ -4,7 +4,7 @@ # causes the first MTR connection to be forefully dropped by Galera, which in turn confuses MTR [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.cnf b/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.cnf index 8f9e053487f..c56efcbf2d4 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.cnf +++ b/mysql-test/suite/galera_sr/t/galera_sr_small_gcache.cnf @@ -1,7 +1,7 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=16K' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=16K' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=16K' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=16K' From 94ef07d61edd21d81eaa788c07a15e5508aacbe0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Tue, 24 Sep 2024 11:09:00 +0300 Subject: [PATCH 021/134] MDEV-32631 : galera_2_cluster: before_rollback(): Assertion `0' failed Test case changes only. Add wait_conditions to make sure nodes rejoin the cluster. Assertion itself should not be possible anymore as we do not allow sequences on Aria tables. Signed-off-by: Julius Goryavsky --- .../galera/r/galera_sequences,binlogoff.rdiff | 11 +++ .../suite/galera/r/galera_sequences.result | 13 ++++ .../suite/galera/t/galera_sequences.cnf | 4 - .../galera/t/galera_sequences.combinations | 5 ++ .../suite/galera/t/galera_sequences.test | 24 ++++++ mysql-test/suite/galera_3nodes/disabled.def | 2 - .../galera_3nodes/r/galera_2_cluster.result | 32 +++++++- .../galera_3nodes/t/galera_2_cluster.cnf | 9 +++ .../t/galera_2_cluster.combinations | 5 ++ .../galera_3nodes/t/galera_2_cluster.test | 74 +++++++++++++++---- 10 files changed, 155 insertions(+), 24 deletions(-) create mode 100644 mysql-test/suite/galera/r/galera_sequences,binlogoff.rdiff create mode 100644 mysql-test/suite/galera/t/galera_sequences.combinations create mode 100644 mysql-test/suite/galera_3nodes/t/galera_2_cluster.combinations diff --git a/mysql-test/suite/galera/r/galera_sequences,binlogoff.rdiff b/mysql-test/suite/galera/r/galera_sequences,binlogoff.rdiff new file mode 100644 index 00000000000..425d1175a09 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sequences,binlogoff.rdiff @@ -0,0 +1,11 @@ +--- r/galera_sequences.result ++++ r/galera_sequences,binlogoff.reject +@@ -313,7 +313,7 @@ + 7 4 + SELECT NEXTVAL(t); + NEXTVAL(t) +-42 ++2 + connection node_1; + DROP TABLE t1; + DROP SEQUENCE t; diff --git a/mysql-test/suite/galera/r/galera_sequences.result b/mysql-test/suite/galera/r/galera_sequences.result index 1f6b2bd6637..e78b89d4b09 100644 --- a/mysql-test/suite/galera/r/galera_sequences.result +++ b/mysql-test/suite/galera/r/galera_sequences.result @@ -279,6 +279,9 @@ NEXTVAL(t) connection node_1; DROP TABLE t1; DROP SEQUENCE t; +connection node_2; +SET SESSION wsrep_sync_wait=15; +connection node_1; CREATE SEQUENCE t INCREMENT BY 0 CACHE=20 ENGINE=INNODB; CREATE TABLE t1(a int not null primary key default nextval(t), b int) engine=innodb; BEGIN; @@ -324,4 +327,14 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp ALTER SEQUENCE IF EXISTS t MINVALUE=1; ERROR 42000: This version of MariaDB doesn't yet support 'CACHE without INCREMENT BY 0 in Galera cluster' DROP TABLE t; + +MDEV-32631: + +CREATE OR REPLACE TABLE t1(c INT ) ENGINE=ARIA; +SET SESSION WSREP_OSU_METHOD=RSU; +INSERT INTO t1 SELECT seq,concat(seq,1) FROM seq_1_to_100; +ERROR 42000: This version of MariaDB doesn't yet support 'RSU on this table engine' +SET SESSION WSREP_OSU_METHOD=TOI; +DROP TABLE t1; + End of 10.5 tests diff --git a/mysql-test/suite/galera/t/galera_sequences.cnf b/mysql-test/suite/galera/t/galera_sequences.cnf index 3a0543e3d34..8701e86db5f 100644 --- a/mysql-test/suite/galera/t/galera_sequences.cnf +++ b/mysql-test/suite/galera/t/galera_sequences.cnf @@ -1,13 +1,9 @@ !include ../galera_2nodes.cnf [mysqld.1] -log-bin -log-slave-updates auto-increment-increment=2 auto-increment-offset=1 [mysqld.2] -log-bin -log-slave-updates auto-increment-increment=2 auto-increment-offset=2 diff --git a/mysql-test/suite/galera/t/galera_sequences.combinations b/mysql-test/suite/galera/t/galera_sequences.combinations new file mode 100644 index 00000000000..cef98e75213 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sequences.combinations @@ -0,0 +1,5 @@ +[binlogon] +log-bin +log-slave-updates + +[binlogoff] diff --git a/mysql-test/suite/galera/t/galera_sequences.test b/mysql-test/suite/galera/t/galera_sequences.test index f99796264b6..db388de2551 100644 --- a/mysql-test/suite/galera/t/galera_sequences.test +++ b/mysql-test/suite/galera/t/galera_sequences.test @@ -1,6 +1,7 @@ --source include/galera_cluster.inc --source include/have_innodb.inc --source include/have_sequence.inc +--source include/have_aria.inc # # MDEV-19353 : Alter Sequence do not replicate to another nodes with in Galera Cluster @@ -317,6 +318,12 @@ SELECT NEXTVAL(t); DROP TABLE t1; DROP SEQUENCE t; +--connection node_2 +--let $wsrep_sync_wait_orig_2 = `SELECT @@wsrep_sync_wait` +SET SESSION wsrep_sync_wait=15; + +--connection node_1 + CREATE SEQUENCE t INCREMENT BY 0 CACHE=20 ENGINE=INNODB; CREATE TABLE t1(a int not null primary key default nextval(t), b int) engine=innodb; # @@ -339,6 +346,10 @@ SELECT NEXTVAL(t); SELECT * FROM t1; SELECT NEXTVAL(t); +--disable_query_log +--eval SET SESSION wsrep_sync_wait = $wsrep_sync_wait_orig_2 +--enable_query_log + --connection node_1 DROP TABLE t1; DROP SEQUENCE t; @@ -356,4 +367,17 @@ CREATE TABLE t1 (c VARCHAR) ENGINE=InnoDB; ALTER SEQUENCE IF EXISTS t MINVALUE=1; DROP TABLE t; + +--echo +--echo MDEV-32631: +--echo + +CREATE OR REPLACE TABLE t1(c INT ) ENGINE=ARIA; +SET SESSION WSREP_OSU_METHOD=RSU; +--error ER_NOT_SUPPORTED_YET +INSERT INTO t1 SELECT seq,concat(seq,1) FROM seq_1_to_100; +SET SESSION WSREP_OSU_METHOD=TOI; +DROP TABLE t1; + +--echo --echo End of 10.5 tests diff --git a/mysql-test/suite/galera_3nodes/disabled.def b/mysql-test/suite/galera_3nodes/disabled.def index 6fbfda9a07f..fcaf38a3d7b 100644 --- a/mysql-test/suite/galera_3nodes/disabled.def +++ b/mysql-test/suite/galera_3nodes/disabled.def @@ -9,5 +9,3 @@ # Do not use any TAB characters for whitespace. # ############################################################################## - -galera_2_cluster : MDEV-32631 galera_2_cluster: before_rollback(): Assertion `0' failed diff --git a/mysql-test/suite/galera_3nodes/r/galera_2_cluster.result b/mysql-test/suite/galera_3nodes/r/galera_2_cluster.result index 0a2be393d27..9a151c10b9b 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_2_cluster.result +++ b/mysql-test/suite/galera_3nodes/r/galera_2_cluster.result @@ -1,5 +1,6 @@ connection node_2; connection node_1; +connect node_6, 127.0.0.1, root, , test, $NODE_MYPORT_6; connect node_5, 127.0.0.1, root, , test, $NODE_MYPORT_5; connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4; connection node_4; @@ -20,7 +21,6 @@ include/sync_with_master_gtid.inc SELECT COUNT(*) = 1 FROM t1; COUNT(*) = 1 1 -connect node_6, 127.0.0.1, root, , test, $NODE_MYPORT_6; connection node_6; SELECT COUNT(*) = 1 FROM t1; COUNT(*) = 1 @@ -50,12 +50,22 @@ SELECT COUNT(*) = 3 FROM information_schema.columns WHERE table_name ='t1'; COUNT(*) = 3 1 connection node_2; +connection node_1; +connection node_3; +connection node_4; +connection node_5; +connection node_6; +connection node_2; OPTIMIZE TABLE t1; Table Op Msg_type Msg_text test.t1 optimize note Table does not support optimize, doing recreate + analyze instead test.t1 optimize status OK +Warnings: +Note 1592 Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT. Statement is unsafe because it uses a system variable that may have a different value on the slave connection node_1; +connection node_3; connection node_4; +connection node_5; connection node_6; connection node_1; DROP TABLE t1; @@ -74,19 +84,33 @@ connection node_2; SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; -CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); connection node_3; SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; -CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); connection node_5; SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; -CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); connection node_6; SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; +connection node_1; CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); +connection node_2; +CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); +connection node_3; +CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); +connection node_4; +CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); +connection node_5; +CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); +connection node_6; +CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); diff --git a/mysql-test/suite/galera_3nodes/t/galera_2_cluster.cnf b/mysql-test/suite/galera_3nodes/t/galera_2_cluster.cnf index 41c1c7c0519..297e0fad159 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_2_cluster.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_2_cluster.cnf @@ -1,25 +1,34 @@ !include ../galera_2x3nodes.cnf +[mysqld] +wsrep-debug=1 + [mysqld.1] wsrep_gtid_domain_id=1 server-id=11 +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT20S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S;pc.wait_prim_timeout=PT60S;gcache.size=128M;pc.weight=2' [mysqld.2] wsrep_gtid_domain_id=1 server-id=12 +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT20S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S;pc.wait_prim_timeout=PT60S;gcache.size=128M' [mysqld.3] wsrep_gtid_domain_id=1 server-id=13 +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT20S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S;pc.wait_prim_timeout=PT60S;gcache.size=128M' [mysqld.4] wsrep_gtid_domain_id=2 server-id=21 +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.4.#galera_port;evs.suspect_timeout=PT20S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S;pc.wait_prim_timeout=PT60S;gcache.size=128M' [mysqld.5] wsrep_gtid_domain_id=2 server-id=22 +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.5.#galera_port;evs.suspect_timeout=PT20S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S;pc.wait_prim_timeout=PT60S;gcache.size=128M' [mysqld.6] wsrep_gtid_domain_id=2 server-id=23 +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.6.#galera_port;evs.suspect_timeout=PT20S;evs.inactive_timeout=PT30S;evs.install_timeout=PT25S;pc.wait_prim_timeout=PT60S;gcache.size=128M' diff --git a/mysql-test/suite/galera_3nodes/t/galera_2_cluster.combinations b/mysql-test/suite/galera_3nodes/t/galera_2_cluster.combinations new file mode 100644 index 00000000000..cef98e75213 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_2_cluster.combinations @@ -0,0 +1,5 @@ +[binlogon] +log-bin +log-slave-updates + +[binlogoff] diff --git a/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test b/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test index 86119bf7bcb..a41a5096c7d 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test +++ b/mysql-test/suite/galera_3nodes/t/galera_2_cluster.test @@ -9,7 +9,9 @@ --source include/big_test.inc --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/force_restart.inc +--connect node_6, 127.0.0.1, root, , test, $NODE_MYPORT_6 --connect node_5, 127.0.0.1, root, , test, $NODE_MYPORT_5 --connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4 @@ -43,7 +45,6 @@ SELECT COUNT(*) = 1 FROM t1; SELECT COUNT(*) = 1 FROM t1; ---connect node_6, 127.0.0.1, root, , test, $NODE_MYPORT_6 --connection node_6 SELECT COUNT(*) = 1 FROM t1; @@ -82,23 +83,46 @@ SELECT COUNT(*) = 3 FROM information_schema.columns WHERE table_name ='t1'; # --connection node_2 - ---let $wsrep_last_committed_before = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` -OPTIMIZE TABLE t1; +--let $wsrep_last_committed_before_2 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` --connection node_1 +--let $wsrep_last_committed_before_1 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` ---let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--connection node_3 +--let $wsrep_last_committed_before_3 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` + +--connection node_4 +--let $wsrep_last_committed_before_4 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` + +--connection node_5 +--let $wsrep_last_committed_before_5 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` + +--connection node_6 +--let $wsrep_last_committed_before_6 = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'` + +--connection node_2 +OPTIMIZE TABLE t1; +--let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before_2 + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--source include/wait_condition.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before_1 + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--source include/wait_condition.inc + +--connection node_3 +--let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before_3 + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' --source include/wait_condition.inc --connection node_4 +--let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before_4 + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--source include/wait_condition.inc ---let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--connection node_5 +--let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before_5 + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' --source include/wait_condition.inc --connection node_6 - ---let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' +--let $wait_condition = SELECT VARIABLE_VALUE >= $wsrep_last_committed_before_6 + 1 FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed' --source include/wait_condition.inc # @@ -116,6 +140,7 @@ RESET SLAVE; SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc SET GLOBAL GTID_SLAVE_POS=""; --connection node_1 @@ -123,35 +148,56 @@ SET GLOBAL GTID_SLAVE_POS=""; SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc --connection node_2 SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; - -CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +--source include/wait_until_ready.inc --connection node_3 SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; - -CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +--source include/wait_until_ready.inc --connection node_5 SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; - -CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +--source include/wait_until_ready.inc --connection node_6 SET GLOBAL wsrep_on = OFF; RESET MASTER; SET GLOBAL wsrep_on = ON; +--source include/wait_until_ready.inc +connection node_1; CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); + +connection node_2; +CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); + +connection node_3; +CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); + +connection node_4; +CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); + +connection node_5; +CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); + +connection node_6; +CALL mtr.add_suppression("Ignoring server id .* for non bootstrap node"); +CALL mtr.add_suppression("Unsafe statement written to the binary log using statement format since "); From 5ebff6e15a0c2e1b8a8e41943540332c757a6d03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 18 Feb 2025 17:01:44 +0200 Subject: [PATCH 022/134] =?UTF-8?q?MDEV-36038=20ALTER=20TABLE=E2=80=A6SEQU?= =?UTF-8?q?ENCE=20does=20not=20work=20correctly=20with=20InnoDB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mysql_alter_table(): Consider ha_sequence::storage_ht() when determining if the storage engine changed. ha_sequence::check_if_supported_inplace_alter(): A new function, to ensure that ha_innobase::check_if_supported_inplace_alter() will be called on ALTER TABLE name_of_sequence SEQUENCE=0. ha_innobase::check_if_supported_inplace_alter(): For any change of the SEQUENCE attribute, always return HA_ALTER_INPLACE_NOT_SUPPORTED, forcing ALGORITHM=COPY. --- mysql-test/suite/sql_sequence/alter.opt | 1 + mysql-test/suite/sql_sequence/alter.result | 26 ++++++++++++++++++++++ mysql-test/suite/sql_sequence/alter.test | 19 ++++++++++++++++ sql/ha_sequence.cc | 6 +++++ sql/ha_sequence.h | 3 +++ sql/sql_table.cc | 3 ++- storage/innobase/handler/handler0alter.cc | 8 +++++++ 7 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/sql_sequence/alter.opt diff --git a/mysql-test/suite/sql_sequence/alter.opt b/mysql-test/suite/sql_sequence/alter.opt new file mode 100644 index 00000000000..c5eebd75ce5 --- /dev/null +++ b/mysql-test/suite/sql_sequence/alter.opt @@ -0,0 +1 @@ +--innodb-sys-tables diff --git a/mysql-test/suite/sql_sequence/alter.result b/mysql-test/suite/sql_sequence/alter.result index 0508660e82b..dc55040c135 100644 --- a/mysql-test/suite/sql_sequence/alter.result +++ b/mysql-test/suite/sql_sequence/alter.result @@ -166,6 +166,32 @@ next_not_cached_value minimum_value maximum_value start_value increment cache_si select next value for t1; next value for t1 11 +$check_innodb_flags; +is_sequence +12288 +alter table t1 sequence=0; +begin; +delete from t1; +rollback; +$check_innodb_flags; +is_sequence +0 +alter table t1 sequence=1; +$check_innodb_flags; +is_sequence +12288 +alter table t1 sequence=0, algorithm=copy; +$check_innodb_flags; +is_sequence +0 +alter table t1 sequence=1, algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: SEQUENCE. Try ALGORITHM=COPY +alter table t1 sequence=1, algorithm=copy; +$check_innodb_flags; +is_sequence +12288 +alter table t1 sequence=0, algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: SEQUENCE. Try ALGORITHM=COPY drop sequence t1; # # ALTER TABLE diff --git a/mysql-test/suite/sql_sequence/alter.test b/mysql-test/suite/sql_sequence/alter.test index fce2cb45838..34b83cb19d2 100644 --- a/mysql-test/suite/sql_sequence/alter.test +++ b/mysql-test/suite/sql_sequence/alter.test @@ -80,6 +80,25 @@ alter sequence t1 start=100; show create sequence t1; select * from t1; select next value for t1; +let $check_innodb_flags = +select flag & 12288 is_sequence from information_schema.innodb_sys_tables +where name='test/t1'; +evalp $check_innodb_flags; +alter table t1 sequence=0; +begin; +delete from t1; +rollback; +evalp $check_innodb_flags; +alter table t1 sequence=1; +evalp $check_innodb_flags; +alter table t1 sequence=0, algorithm=copy; +evalp $check_innodb_flags; +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +alter table t1 sequence=1, algorithm=inplace; +alter table t1 sequence=1, algorithm=copy; +evalp $check_innodb_flags; +--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON +alter table t1 sequence=0, algorithm=inplace; drop sequence t1; --echo # diff --git a/sql/ha_sequence.cc b/sql/ha_sequence.cc index 3803042bec5..1e0e253a618 100644 --- a/sql/ha_sequence.cc +++ b/sql/ha_sequence.cc @@ -353,6 +353,12 @@ bool ha_sequence::check_if_incompatible_data(HA_CREATE_INFO *create_info, return(COMPATIBLE_DATA_YES); } +enum_alter_inplace_result +ha_sequence::check_if_supported_inplace_alter(TABLE *altered_table, + Alter_inplace_info *ai) +{ + return file->check_if_supported_inplace_alter(altered_table, ai); +} int ha_sequence::external_lock(THD *thd, int lock_type) { diff --git a/sql/ha_sequence.h b/sql/ha_sequence.h index 24fcc6baa31..3ce71b1da05 100644 --- a/sql/ha_sequence.h +++ b/sql/ha_sequence.h @@ -94,6 +94,9 @@ public: /* For ALTER ONLINE TABLE */ bool check_if_incompatible_data(HA_CREATE_INFO *create_info, uint table_changes) override; + enum_alter_inplace_result + check_if_supported_inplace_alter(TABLE *altered_table, + Alter_inplace_info *ai) override; void write_lock() { write_locked= 1;} void unlock() { write_locked= 0; } bool is_locked() { return write_locked; } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 2b46fae9781..a080677a251 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -11534,7 +11534,8 @@ do_continue:; - Neither old or new engine uses files from another engine The above is mainly true for the sequence and the partition engine. */ - engine_changed= ((new_table->file->ht != table->file->ht) && + engine_changed= ((new_table->file->storage_ht() != + table->file->storage_ht()) && ((!(new_table->file->ha_table_flags() & HA_FILE_BASED) || !(table->file->ha_table_flags() & HA_FILE_BASED))) && !(table->file->ha_table_flags() & HA_REUSES_FILE_NAMES) && diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index e5824dcdb86..5afdcb3892e 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -2049,6 +2049,12 @@ ha_innobase::check_if_supported_inplace_alter( DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); } + if (ha_alter_info->create_info->used_fields + & HA_CREATE_USED_SEQUENCE) { + ha_alter_info->unsupported_reason = "SEQUENCE"; + DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); + } + update_thd(); if (!m_prebuilt->table->space) { @@ -6317,6 +6323,8 @@ prepare_inplace_alter_table_dict( DBUG_ASSERT(!ctx->add_index); DBUG_ASSERT(!ctx->add_key_numbers); DBUG_ASSERT(!ctx->num_to_add_index); + DBUG_ASSERT(!(ha_alter_info->create_info->used_fields + & HA_CREATE_USED_SEQUENCE)); user_table = ctx->new_table; From b167730499b359f247015447e985319814342bf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 2 Jan 2025 11:13:32 +0200 Subject: [PATCH 023/134] MDEV-34891 : SST failure occurs when gtid_strict_mode is enabled Problem was that initial GTID was set on wsrep_before_prepare out-of-order. In practice GTID was set to same as previous executed transaction GTID. In recovery valid GTID was found from prepared transaction and this transaction is committed leading to fact that same GTID was executed twice. This is fixed by setting invalid GTID at wsrep_before_prepare and later in wsrep_before_commit actual correct GTID is set and this setting is done while we are in commit monitor i.e. assigment is done in order of replication. In recovery if prepared transaction is found we check its GTID, if it is invalid transaction will be rolled back and if it is valid it will be committed. Initialize gtid seqno from recovered seqno when bootstrapping a new cluster. Added two test cases for both mariabackup and rsync SST methods to show that GTIDs remain consistent on cluster and that all expected rows are in the table. Added tests for wsrep GTID recovery with binlog on and off. Signed-off-by: Julius Goryavsky --- .../r/galera_sst_mariabackup_gtid,debug.rdiff | 210 +++++++ .../r/galera_sst_mariabackup_gtid.result | 534 ++++++++++++++++++ .../r/galera_sst_rsync_gtid,debug.rdiff | 210 +++++++ .../galera/r/galera_sst_rsync_gtid.result | 534 ++++++++++++++++++ mysql-test/suite/galera/suite.pm | 2 +- .../galera/t/galera_sst_mariabackup_gtid.cnf | 28 + .../galera/t/galera_sst_mariabackup_gtid.test | 29 + .../suite/galera/t/galera_sst_rsync_gtid.cnf | 23 + .../suite/galera/t/galera_sst_rsync_gtid.test | 29 + mysql-test/suite/galera_3nodes/suite.pm | 2 +- mysql-test/suite/galera_3nodes_sr/suite.pm | 2 +- mysql-test/suite/galera_sr/suite.pm | 2 +- .../r/wsrep-recover-gtid-nobinlog.result | 18 + .../suite/wsrep/r/wsrep-recover-gtid.result | 65 +++ .../wsrep/t/wsrep-recover-gtid-nobinlog.cnf | 10 + .../wsrep/t/wsrep-recover-gtid-nobinlog.test | 28 + .../suite/wsrep/t/wsrep-recover-gtid.cnf | 14 + .../suite/wsrep/t/wsrep-recover-gtid.test | 73 +++ sql/handler.cc | 1 + sql/wsrep_mysqld.cc | 3 +- sql/wsrep_trans_observer.h | 15 +- sql/wsrep_xid.cc | 43 +- sql/wsrep_xid.h | 4 +- 23 files changed, 1853 insertions(+), 26 deletions(-) create mode 100644 mysql-test/suite/galera/r/galera_sst_mariabackup_gtid,debug.rdiff create mode 100644 mysql-test/suite/galera/r/galera_sst_mariabackup_gtid.result create mode 100644 mysql-test/suite/galera/r/galera_sst_rsync_gtid,debug.rdiff create mode 100644 mysql-test/suite/galera/r/galera_sst_rsync_gtid.result create mode 100644 mysql-test/suite/galera/t/galera_sst_mariabackup_gtid.cnf create mode 100644 mysql-test/suite/galera/t/galera_sst_mariabackup_gtid.test create mode 100644 mysql-test/suite/galera/t/galera_sst_rsync_gtid.cnf create mode 100644 mysql-test/suite/galera/t/galera_sst_rsync_gtid.test create mode 100644 mysql-test/suite/wsrep/r/wsrep-recover-gtid-nobinlog.result create mode 100644 mysql-test/suite/wsrep/r/wsrep-recover-gtid.result create mode 100644 mysql-test/suite/wsrep/t/wsrep-recover-gtid-nobinlog.cnf create mode 100644 mysql-test/suite/wsrep/t/wsrep-recover-gtid-nobinlog.test create mode 100644 mysql-test/suite/wsrep/t/wsrep-recover-gtid.cnf create mode 100644 mysql-test/suite/wsrep/t/wsrep-recover-gtid.test diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_gtid,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mariabackup_gtid,debug.rdiff new file mode 100644 index 00000000000..12609bb571f --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_gtid,debug.rdiff @@ -0,0 +1,210 @@ +--- suite/galera/r/galera_sst_mariabackup_gtid.result 2025-01-02 15:34:28.251593452 +0200 ++++ suite/galera/r/galera_sst_mariabackup_gtid.reject 2025-01-02 16:01:18.058469177 +0200 +@@ -516,19 +516,203 @@ + 1 + DROP TABLE t1; + COMMIT; ++Performing State Transfer on a server that has been killed and restarted ++while a DDL was in progress on it ++connection node_1; ++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1,'node1_committed_before'); ++INSERT INTO t1 VALUES (2,'node1_committed_before'); ++INSERT INTO t1 VALUES (3,'node1_committed_before'); ++INSERT INTO t1 VALUES (4,'node1_committed_before'); ++INSERT INTO t1 VALUES (5,'node1_committed_before'); ++connection node_2; ++START TRANSACTION; ++INSERT INTO t1 VALUES (6,'node2_committed_before'); ++INSERT INTO t1 VALUES (7,'node2_committed_before'); ++INSERT INTO t1 VALUES (8,'node2_committed_before'); ++INSERT INTO t1 VALUES (9,'node2_committed_before'); ++INSERT INTO t1 VALUES (10,'node2_committed_before'); ++COMMIT; ++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; ++connection node_1; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++connection node_2; ++SET wsrep_sync_wait = 0; ++Killing server ... ++connection node_1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after'); ++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after'); ++connection node_2; ++Performing --wsrep-recover ... ++connection node_2; ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after'); ++COMMIT; ++connection node_1; ++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after'); ++COMMIT; ++connection node_1a_galera_st_kill_slave_ddl; ++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after'); ++ROLLBACK; ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++connection node_1; ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET GLOBAL debug_dbug = $debug_orig; + connection node_1; + # Node_1 + SHOW global variables like 'gtid%pos'; + Variable_name Value +-gtid_binlog_pos 100-10-24 +-gtid_current_pos 100-10-24 ++gtid_binlog_pos 100-10-33 ++gtid_current_pos 100-10-33 + gtid_slave_pos + connection node_2; + # Node_2 + SHOW global variables like 'gtid%pos'; + Variable_name Value +-gtid_binlog_pos 100-10-24 +-gtid_current_pos 100-10-24 ++gtid_binlog_pos 100-10-33 ++gtid_current_pos 100-10-33 + gtid_slave_pos + disconnect node_2; + disconnect node_1; diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_gtid.result b/mysql-test/suite/galera/r/galera_sst_mariabackup_gtid.result new file mode 100644 index 00000000000..fa2397b722e --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_gtid.result @@ -0,0 +1,534 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +Performing State Transfer on a server that has been shut down cleanly and restarted +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Shutting down server ... +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Starting server ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_shutdown_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +Performing State Transfer on a server that starts from a clean var directory +This is accomplished by shutting down node #2 and removing its var directory before restarting it +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Shutting down server ... +connection node_1; +Cleaning var directory ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Starting server ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_clean_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +Performing State Transfer on a server that has been killed and restarted +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Killing server ... +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Performing --wsrep-recover ... +Starting server ... +Using --wsrep-start-position when starting mysqld ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_kill_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +connection node_1; +# Node_1 +SHOW global variables like 'gtid%pos'; +Variable_name Value +gtid_binlog_pos 100-10-24 +gtid_current_pos 100-10-24 +gtid_slave_pos +connection node_2; +# Node_2 +SHOW global variables like 'gtid%pos'; +Variable_name Value +gtid_binlog_pos 100-10-24 +gtid_current_pos 100-10-24 +gtid_slave_pos +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_gtid,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_rsync_gtid,debug.rdiff new file mode 100644 index 00000000000..0e3e85ef213 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sst_rsync_gtid,debug.rdiff @@ -0,0 +1,210 @@ +--- suite/galera/r/galera_sst_rsync_gtid.result 2025-01-02 15:35:15.162175835 +0200 ++++ suite/galera/r/galera_sst_rsync_gtid.reject 2025-01-02 16:02:08.588902711 +0200 +@@ -516,19 +516,203 @@ + 1 + DROP TABLE t1; + COMMIT; ++Performing State Transfer on a server that has been killed and restarted ++while a DDL was in progress on it ++connection node_1; ++CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 VALUES (1,'node1_committed_before'); ++INSERT INTO t1 VALUES (2,'node1_committed_before'); ++INSERT INTO t1 VALUES (3,'node1_committed_before'); ++INSERT INTO t1 VALUES (4,'node1_committed_before'); ++INSERT INTO t1 VALUES (5,'node1_committed_before'); ++connection node_2; ++START TRANSACTION; ++INSERT INTO t1 VALUES (6,'node2_committed_before'); ++INSERT INTO t1 VALUES (7,'node2_committed_before'); ++INSERT INTO t1 VALUES (8,'node2_committed_before'); ++INSERT INTO t1 VALUES (9,'node2_committed_before'); ++INSERT INTO t1 VALUES (10,'node2_committed_before'); ++COMMIT; ++SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; ++connection node_1; ++ALTER TABLE t1 ADD COLUMN f2 INTEGER; ++connection node_2; ++SET wsrep_sync_wait = 0; ++Killing server ... ++connection node_1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (11,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (12,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (13,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (14,'node1_committed_during'); ++INSERT INTO t1 (id,f1) VALUES (15,'node1_committed_during'); ++COMMIT; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (16,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (17,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (18,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (19,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (20,'node1_to_be_committed_after'); ++connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (21,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (22,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (23,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (24,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (25,'node1_to_be_rollbacked_after'); ++connection node_2; ++Performing --wsrep-recover ... ++connection node_2; ++Starting server ... ++Using --wsrep-start-position when starting mysqld ... ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (26,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (27,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (28,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (29,'node2_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (30,'node2_committed_after'); ++COMMIT; ++connection node_1; ++INSERT INTO t1 (id,f1) VALUES (31,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (32,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (33,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (34,'node1_to_be_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (35,'node1_to_be_committed_after'); ++COMMIT; ++SET AUTOCOMMIT=OFF; ++START TRANSACTION; ++INSERT INTO t1 (id,f1) VALUES (36,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (37,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (38,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (39,'node1_committed_after'); ++INSERT INTO t1 (id,f1) VALUES (40,'node1_committed_after'); ++COMMIT; ++connection node_1a_galera_st_kill_slave_ddl; ++INSERT INTO t1 (id,f1) VALUES (41,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (42,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (43,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (44,'node1_to_be_rollbacked_after'); ++INSERT INTO t1 (id,f1) VALUES (45,'node1_to_be_rollbacked_after'); ++ROLLBACK; ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++COMMIT; ++connection node_1; ++SET AUTOCOMMIT=ON; ++SET SESSION wsrep_sync_wait=15; ++SELECT COUNT(*) AS EXPECT_3 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; ++EXPECT_3 ++3 ++SELECT COUNT(*) AS EXPECT_35 FROM t1; ++EXPECT_35 ++35 ++SELECT * FROM t1; ++id f1 f2 ++1 node1_committed_before NULL ++2 node1_committed_before NULL ++3 node1_committed_before NULL ++4 node1_committed_before NULL ++5 node1_committed_before NULL ++6 node2_committed_before NULL ++7 node2_committed_before NULL ++8 node2_committed_before NULL ++9 node2_committed_before NULL ++10 node2_committed_before NULL ++11 node1_committed_during NULL ++12 node1_committed_during NULL ++13 node1_committed_during NULL ++14 node1_committed_during NULL ++15 node1_committed_during NULL ++16 node1_to_be_committed_after NULL ++17 node1_to_be_committed_after NULL ++18 node1_to_be_committed_after NULL ++19 node1_to_be_committed_after NULL ++20 node1_to_be_committed_after NULL ++26 node2_committed_after NULL ++27 node2_committed_after NULL ++28 node2_committed_after NULL ++29 node2_committed_after NULL ++30 node2_committed_after NULL ++31 node1_to_be_committed_after NULL ++32 node1_to_be_committed_after NULL ++33 node1_to_be_committed_after NULL ++34 node1_to_be_committed_after NULL ++35 node1_to_be_committed_after NULL ++36 node1_committed_after NULL ++37 node1_committed_after NULL ++38 node1_committed_after NULL ++39 node1_committed_after NULL ++40 node1_committed_after NULL ++SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; ++COUNT(*) = 0 ++1 ++DROP TABLE t1; ++COMMIT; ++SET GLOBAL debug_dbug = $debug_orig; + connection node_1; + # Node_1 + SHOW global variables like 'gtid%pos'; + Variable_name Value +-gtid_binlog_pos 100-10-24 +-gtid_current_pos 100-10-24 ++gtid_binlog_pos 100-10-33 ++gtid_current_pos 100-10-33 + gtid_slave_pos + connection node_2; + # Node_2 + SHOW global variables like 'gtid%pos'; + Variable_name Value +-gtid_binlog_pos 100-10-24 +-gtid_current_pos 100-10-24 ++gtid_binlog_pos 100-10-33 ++gtid_current_pos 100-10-33 + gtid_slave_pos + disconnect node_2; + disconnect node_1; diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_gtid.result b/mysql-test/suite/galera/r/galera_sst_rsync_gtid.result new file mode 100644 index 00000000000..fa2397b722e --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sst_rsync_gtid.result @@ -0,0 +1,534 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +Performing State Transfer on a server that has been shut down cleanly and restarted +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Shutting down server ... +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_shutdown_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Starting server ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_shutdown_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_15 FROM t1; +EXPECT_15 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +Performing State Transfer on a server that starts from a clean var directory +This is accomplished by shutting down node #2 and removing its var directory before restarting it +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Shutting down server ... +connection node_1; +Cleaning var directory ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_clean_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Starting server ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_clean_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (44,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * from t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +Performing State Transfer on a server that has been killed and restarted +connection node_1; +CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (1,'node1_committed_before'); +INSERT INTO t1 VALUES (2,'node1_committed_before'); +INSERT INTO t1 VALUES (3,'node1_committed_before'); +INSERT INTO t1 VALUES (4,'node1_committed_before'); +INSERT INTO t1 VALUES (5,'node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (6,'node2_committed_before'); +INSERT INTO t1 VALUES (7,'node2_committed_before'); +INSERT INTO t1 VALUES (8,'node2_committed_before'); +INSERT INTO t1 VALUES (9,'node2_committed_before'); +INSERT INTO t1 VALUES (10,'node2_committed_before'); +COMMIT; +Killing server ... +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (11,'node1_committed_during'); +INSERT INTO t1 VALUES (12,'node1_committed_during'); +INSERT INTO t1 VALUES (13,'node1_committed_during'); +INSERT INTO t1 VALUES (14,'node1_committed_during'); +INSERT INTO t1 VALUES (15,'node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES (16,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (17,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (18,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (19,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (20,'node1_to_be_committed_after'); +connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (21,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (22,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (23,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (24,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (25,'node1_to_be_rollbacked_after'); +connection node_2; +Performing --wsrep-recover ... +Starting server ... +Using --wsrep-start-position when starting mysqld ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (26,'node2_committed_after'); +INSERT INTO t1 VALUES (27,'node2_committed_after'); +INSERT INTO t1 VALUES (28,'node2_committed_after'); +INSERT INTO t1 VALUES (29,'node2_committed_after'); +INSERT INTO t1 VALUES (30,'node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES (31,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (32,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (33,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (34,'node1_to_be_committed_after'); +INSERT INTO t1 VALUES (35,'node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES (36,'node1_committed_after'); +INSERT INTO t1 VALUES (37,'node1_committed_after'); +INSERT INTO t1 VALUES (38,'node1_committed_after'); +INSERT INTO t1 VALUES (39,'node1_committed_after'); +INSERT INTO t1 VALUES (40,'node1_committed_after'); +COMMIT; +connection node_1a_galera_st_kill_slave; +INSERT INTO t1 VALUES (41,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (42,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (43,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (45,'node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES (46,'node1_to_be_rollbacked_after'); +ROLLBACK; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +connection node_1; +SET AUTOCOMMIT=ON; +SET SESSION wsrep_sync_wait=15; +SELECT COUNT(*) AS EXPECT_35 FROM t1; +EXPECT_35 +35 +SELECT * FROM t1; +id f1 +1 node1_committed_before +2 node1_committed_before +3 node1_committed_before +4 node1_committed_before +5 node1_committed_before +6 node2_committed_before +7 node2_committed_before +8 node2_committed_before +9 node2_committed_before +10 node2_committed_before +11 node1_committed_during +12 node1_committed_during +13 node1_committed_during +14 node1_committed_during +15 node1_committed_during +16 node1_to_be_committed_after +17 node1_to_be_committed_after +18 node1_to_be_committed_after +19 node1_to_be_committed_after +20 node1_to_be_committed_after +26 node2_committed_after +27 node2_committed_after +28 node2_committed_after +29 node2_committed_after +30 node2_committed_after +31 node1_to_be_committed_after +32 node1_to_be_committed_after +33 node1_to_be_committed_after +34 node1_to_be_committed_after +35 node1_to_be_committed_after +36 node1_committed_after +37 node1_committed_after +38 node1_committed_after +39 node1_committed_after +40 node1_committed_after +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +connection node_1; +# Node_1 +SHOW global variables like 'gtid%pos'; +Variable_name Value +gtid_binlog_pos 100-10-24 +gtid_current_pos 100-10-24 +gtid_slave_pos +connection node_2; +# Node_2 +SHOW global variables like 'gtid%pos'; +Variable_name Value +gtid_binlog_pos 100-10-24 +gtid_current_pos 100-10-24 +gtid_slave_pos +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera/suite.pm b/mysql-test/suite/galera/suite.pm index 404025fb175..8f2a0cf5385 100644 --- a/mysql-test/suite/galera/suite.pm +++ b/mysql-test/suite/galera/suite.pm @@ -29,7 +29,7 @@ push @::global_suppressions, qr(WSREP: no nodes coming from prim view, prim not possible), qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable), qr(WSREP: user message in state LEAVING), - qr(WSREP: .* sending install message failed: Transport endpoint is not connected), + qr(WSREP: .* sending install message failed: (Transport endpoint|Socket) is not connected), qr(WSREP: .* sending install message failed: Resource temporarily unavailable), qr(WSREP: Maximum writeset size exceeded by ), qr(WSREP: transaction size exceeded), diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_gtid.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_gtid.cnf new file mode 100644 index 00000000000..053c2175946 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_gtid.cnf @@ -0,0 +1,28 @@ +!include ../galera_2nodes.cnf + +[mysqld] +wsrep_sst_method=mariabackup +wsrep_sst_auth="root:" +gtid_strict_mode=ON +wsrep-gtid_mode=ON +log-bin +log-slave_updates +loose-galera-sst-mariabackup-gtid=1 + +[mysqld.1] +wsrep_provider_options='pc.weight=2;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +gtid_domain_id=10 +wsrep_gtid_domain_id=100 +wsrep_slave_threads=4 +server-id=10 + +[mysqld.2] +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +gtid_domain_id=10 +wsrep_gtid_domain_id=100 +wsrep_slave_threads=4 +server-id=10 + +[sst] +transferfmt=@ENV.MTR_GALERA_TFMT +streamfmt=mbstream diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_gtid.test b/mysql-test/suite/galera/t/galera_sst_mariabackup_gtid.test new file mode 100644 index 00000000000..66cd0c92307 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_gtid.test @@ -0,0 +1,29 @@ +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_mariabackup.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 + +--source suite/galera/include/galera_st_shutdown_slave.inc +--source suite/galera/include/galera_st_clean_slave.inc + +--source suite/galera/include/galera_st_kill_slave.inc +--source suite/galera/include/galera_st_kill_slave_ddl.inc + +# Restore original auto_increment_offset values. +--source include/auto_increment_offset_restore.inc + +--connection node_1 +--echo # Node_1 +SHOW global variables like 'gtid%pos'; + +--connection node_2 +--echo # Node_2 +SHOW global variables like 'gtid%pos'; + +--source include/galera_end.inc diff --git a/mysql-test/suite/galera/t/galera_sst_rsync_gtid.cnf b/mysql-test/suite/galera/t/galera_sst_rsync_gtid.cnf new file mode 100644 index 00000000000..af5d2225bba --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_rsync_gtid.cnf @@ -0,0 +1,23 @@ +!include ../galera_2nodes.cnf + +[mysqld] +wsrep_sst_method=rsync +gtid_strict_mode=ON +wsrep-gtid_mode=ON +log-bin +log-slave_updates +loose-galera-sst-rsync-gtid=1 + +[mysqld.1] +wsrep_provider_options='pc.weight=2;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +gtid_domain_id=10 +wsrep_gtid_domain_id=100 +wsrep_slave_threads=4 +server-id=10 + +[mysqld.2] +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +gtid_domain_id=10 +wsrep_gtid_domain_id=100 +wsrep_slave_threads=4 +server-id=10 diff --git a/mysql-test/suite/galera/t/galera_sst_rsync_gtid.test b/mysql-test/suite/galera/t/galera_sst_rsync_gtid.test new file mode 100644 index 00000000000..66cd0c92307 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_rsync_gtid.test @@ -0,0 +1,29 @@ +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_mariabackup.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 + +--source suite/galera/include/galera_st_shutdown_slave.inc +--source suite/galera/include/galera_st_clean_slave.inc + +--source suite/galera/include/galera_st_kill_slave.inc +--source suite/galera/include/galera_st_kill_slave_ddl.inc + +# Restore original auto_increment_offset values. +--source include/auto_increment_offset_restore.inc + +--connection node_1 +--echo # Node_1 +SHOW global variables like 'gtid%pos'; + +--connection node_2 +--echo # Node_2 +SHOW global variables like 'gtid%pos'; + +--source include/galera_end.inc diff --git a/mysql-test/suite/galera_3nodes/suite.pm b/mysql-test/suite/galera_3nodes/suite.pm index 9f45e22d459..c1cc1ef4076 100644 --- a/mysql-test/suite/galera_3nodes/suite.pm +++ b/mysql-test/suite/galera_3nodes/suite.pm @@ -28,7 +28,7 @@ push @::global_suppressions, qr(WSREP: no nodes coming from prim view, prim not possible), qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable), qr(WSREP: user message in state LEAVING), - qr(WSREP: .* sending install message failed: Transport endpoint is not connected), + qr(WSREP: .* sending install message failed: (Transport endpoint|Socket) is not connected), qr(WSREP: .* sending install message failed: Resource temporarily unavailable), qr(WSREP: Maximum writeset size exceeded by ), qr(WSREP: transaction size exceeded), diff --git a/mysql-test/suite/galera_3nodes_sr/suite.pm b/mysql-test/suite/galera_3nodes_sr/suite.pm index 3cc7af0666c..54489387ec5 100644 --- a/mysql-test/suite/galera_3nodes_sr/suite.pm +++ b/mysql-test/suite/galera_3nodes_sr/suite.pm @@ -29,7 +29,7 @@ push @::global_suppressions, qr(WSREP: no nodes coming from prim view, prim not possible), qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable), qr(WSREP: user message in state LEAVING), - qr(WSREP: .* sending install message failed: Transport endpoint is not connected), + qr(WSREP: .* sending install message failed: (Transport endpoint|Socket) is not connected), qr(WSREP: .* sending install message failed: Resource temporarily unavailable), qr(WSREP: Could not find peer:), qr|WSREP: gcs_caused\(\) returned |, diff --git a/mysql-test/suite/galera_sr/suite.pm b/mysql-test/suite/galera_sr/suite.pm index f60ad1eefe3..a0e386a52b7 100644 --- a/mysql-test/suite/galera_sr/suite.pm +++ b/mysql-test/suite/galera_sr/suite.pm @@ -28,7 +28,7 @@ push @::global_suppressions, qr(WSREP: no nodes coming from prim view, prim not possible), qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable), qr(WSREP: user message in state LEAVING), - qr(WSREP: .* sending install message failed: Transport endpoint is not connected), + qr(WSREP: .* sending install message failed: (Transport endpoint|Socket) is not connected), qr(WSREP: .* sending install message failed: Resource temporarily unavailable), qr(WSREP: Maximum writeset size exceeded by ), qr(WSREP: transaction size exceeded), diff --git a/mysql-test/suite/wsrep/r/wsrep-recover-gtid-nobinlog.result b/mysql-test/suite/wsrep/r/wsrep-recover-gtid-nobinlog.result new file mode 100644 index 00000000000..2429434ae53 --- /dev/null +++ b/mysql-test/suite/wsrep/r/wsrep-recover-gtid-nobinlog.result @@ -0,0 +1,18 @@ +CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; +# Case 1: Server goes through graceful shutdown and is restarted +connection default; +INSERT INTO t1 VALUES (1); +Expect 100-10-2 +SELECT WSREP_LAST_SEEN_GTID(); +WSREP_LAST_SEEN_GTID() +100-10-2 +Performing --wsrep-recover ... +Using --wsrep-start-position when starting mysqld ... +Expect 100-10-2 +SELECT WSREP_LAST_SEEN_GTID(); +WSREP_LAST_SEEN_GTID() +100-10-2 +SELECT * FROM t1; +f1 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/wsrep/r/wsrep-recover-gtid.result b/mysql-test/suite/wsrep/r/wsrep-recover-gtid.result new file mode 100644 index 00000000000..682cecca8bb --- /dev/null +++ b/mysql-test/suite/wsrep/r/wsrep-recover-gtid.result @@ -0,0 +1,65 @@ +CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; +# Case 1: Server goes through graceful shutdown and is restarted +connection default; +INSERT INTO t1 VALUES (1); +Performing --wsrep-recover ... +Using --wsrep-start-position when starting mysqld ... +Expect 100-10-2 +SELECT WSREP_LAST_SEEN_GTID(); +WSREP_LAST_SEEN_GTID() +100-10-2 +SELECT @@GLOBAL.gtid_binlog_pos; +@@GLOBAL.gtid_binlog_pos +100-10-2 +SELECT * FROM t1; +f1 +1 +# Case 2: Server is killed after the transaction gets prepared +# but before it is written into binlog. As there is not GTID assigned, +# the transaction must be rolled back during recovery. +connect con, localhost, root; +SET DEBUG_SYNC = "ha_commit_trans_after_prepare SIGNAL reached WAIT_FOR continue"; +INSERT INTO t1 VALUES (2); +connection default; +SET DEBUG_SYNC = "now WAIT_FOR reached"; +# Kill the server +Performing --wsrep-recover ... +Using --wsrep-start-position when starting mysqld ... +Expect 100-10-2 +SELECT WSREP_LAST_SEEN_GTID(); +WSREP_LAST_SEEN_GTID() +100-10-2 +SELECT @@GLOBAL.gtid_binlog_pos; +@@GLOBAL.gtid_binlog_pos +100-10-2 +Expect 1 +SELECT * FROM t1; +f1 +1 +disconnect con; +# Case 3: Server is killed after the transaction gets written into binlog +# but before it is committed in storage engine. In this case the +# transaction must be committed during recovery as it had a valid +# GTID assigned. +connect con, localhost, root; +SET DEBUG_SYNC = "commit_before_get_LOCK_commit_ordered SIGNAL reached WAIT_FOR continue"; +INSERT INTO t1 VALUES (3); +connection default; +SET DEBUG_SYNC = "now WAIT_FOR reached"; +# Kill the server +Performing --wsrep-recover ... +Using --wsrep-start-position when starting mysqld ... +Expect 100-10-3 +SELECT WSREP_LAST_SEEN_GTID(); +WSREP_LAST_SEEN_GTID() +100-10-3 +SELECT @@GLOBAL.gtid_binlog_pos; +@@GLOBAL.gtid_binlog_pos +100-10-3 +Expect 1 3 +SELECT * FROM t1; +f1 +1 +3 +disconnect con; +DROP TABLE t1; diff --git a/mysql-test/suite/wsrep/t/wsrep-recover-gtid-nobinlog.cnf b/mysql-test/suite/wsrep/t/wsrep-recover-gtid-nobinlog.cnf new file mode 100644 index 00000000000..a6b93d651bd --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep-recover-gtid-nobinlog.cnf @@ -0,0 +1,10 @@ +!include ../my.cnf + +[mysqld.1] +wsrep-on=ON +wsrep-provider=@ENV.WSREP_PROVIDER +wsrep-cluster-address=gcomm:// +binlog-format=ROW +wsrep-gtid-domain-id=100 +server-id=10 +innodb-autoinc-lock-mode=2 diff --git a/mysql-test/suite/wsrep/t/wsrep-recover-gtid-nobinlog.test b/mysql-test/suite/wsrep/t/wsrep-recover-gtid-nobinlog.test new file mode 100644 index 00000000000..06685ebdd17 --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep-recover-gtid-nobinlog.test @@ -0,0 +1,28 @@ +# Test wsrep GTID recovery with binlog off. The test restarts the server +# and verifies that the GTID returned by SELECT WSREP_LAST_SEEN_GTID() +# gets initialized properly during server restart. +# +--source include/have_wsrep.inc +--source include/have_wsrep_provider.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc + +CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; + +--echo # Case 1: Server goes through graceful shutdown and is restarted +--connection default +INSERT INTO t1 VALUES (1); + +--echo Expect 100-10-2 +SELECT WSREP_LAST_SEEN_GTID(); + +--source include/shutdown_mysqld.inc +--let $galera_wsrep_recover_server_id = 1 +--source suite/galera/include/galera_wsrep_recover.inc +--source suite/galera/include/start_mysqld.inc + +--echo Expect 100-10-2 +SELECT WSREP_LAST_SEEN_GTID(); +SELECT * FROM t1; + +DROP TABLE t1; diff --git a/mysql-test/suite/wsrep/t/wsrep-recover-gtid.cnf b/mysql-test/suite/wsrep/t/wsrep-recover-gtid.cnf new file mode 100644 index 00000000000..7080157b2b4 --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep-recover-gtid.cnf @@ -0,0 +1,14 @@ +!include ../my.cnf + +[mysqld.1] +wsrep-on=ON +wsrep-provider=@ENV.WSREP_PROVIDER +wsrep-cluster-address=gcomm:// +binlog-format=ROW +log-bin +log-slave-updates +gtid-domain-id=10 +gtid-strict-mode=ON +wsrep-gtid-mode=ON +wsrep-gtid-domain-id=100 +server-id=10 diff --git a/mysql-test/suite/wsrep/t/wsrep-recover-gtid.test b/mysql-test/suite/wsrep/t/wsrep-recover-gtid.test new file mode 100644 index 00000000000..2113bafb6de --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep-recover-gtid.test @@ -0,0 +1,73 @@ +# Test wsrep recovery with gtid_mode=ON. The test crashes the server +# in different commit stages and verifies that the GTID returned by +# SELECT WSREP_LAST_SEEN_GTID() and @@GLOBAL.gtid_binlog_pos get +# initialized properly during server restart. +# +--source include/have_wsrep.inc +--source include/have_wsrep_provider.inc +--source include/have_innodb.inc +--source include/have_log_bin.inc +--source include/have_debug_sync.inc + +CREATE TABLE t1 (f1 INT PRIMARY KEY) ENGINE=InnoDB; + +--echo # Case 1: Server goes through graceful shutdown and is restarted +--connection default +INSERT INTO t1 VALUES (1); +--source include/shutdown_mysqld.inc +--let $galera_wsrep_recover_server_id = 1 +--source suite/galera/include/galera_wsrep_recover.inc +--source suite/galera/include/start_mysqld.inc + +--echo Expect 100-10-2 +SELECT WSREP_LAST_SEEN_GTID(); +SELECT @@GLOBAL.gtid_binlog_pos; +SELECT * FROM t1; + +--echo # Case 2: Server is killed after the transaction gets prepared +--echo # but before it is written into binlog. As there is not GTID assigned, +--echo # the transaction must be rolled back during recovery. +--connect con, localhost, root +SET DEBUG_SYNC = "ha_commit_trans_after_prepare SIGNAL reached WAIT_FOR continue"; +--send INSERT INTO t1 VALUES (2) + +--connection default +SET DEBUG_SYNC = "now WAIT_FOR reached"; +--source include/kill_mysqld.inc +--let $galera_wsrep_recover_server_id = 1 +--source suite/galera/include/galera_wsrep_recover.inc +--source suite/galera/include/start_mysqld.inc +--source include/wait_wsrep_ready.inc + +--echo Expect 100-10-2 +SELECT WSREP_LAST_SEEN_GTID(); +SELECT @@GLOBAL.gtid_binlog_pos; +--echo Expect 1 +SELECT * FROM t1; +--disconnect con + +--echo # Case 3: Server is killed after the transaction gets written into binlog +--echo # but before it is committed in storage engine. In this case the +--echo # transaction must be committed during recovery as it had a valid +--echo # GTID assigned. + +--connect con, localhost, root +SET DEBUG_SYNC = "commit_before_get_LOCK_commit_ordered SIGNAL reached WAIT_FOR continue"; +--send INSERT INTO t1 VALUES (3) + +--connection default +SET DEBUG_SYNC = "now WAIT_FOR reached"; +--source include/kill_mysqld.inc +--let $galera_wsrep_recover_server_id = 1 +--source suite/galera/include/galera_wsrep_recover.inc +--source suite/galera/include/start_mysqld.inc +--source include/wait_wsrep_ready.inc +--echo Expect 100-10-3 +SELECT WSREP_LAST_SEEN_GTID(); +SELECT @@GLOBAL.gtid_binlog_pos; +--echo Expect 1 3 +SELECT * FROM t1; + +--disconnect con + +DROP TABLE t1; diff --git a/sql/handler.cc b/sql/handler.cc index 22bc363e88c..2be0740fdd8 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2454,6 +2454,7 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin, // recovery mode if (IF_WSREP((wsrep_emulate_bin_log && wsrep_is_wsrep_xid(info->list + i) && + !wsrep_is_xid_gtid_undefined(info->list + i) && x <= wsrep_limit), false) || (info->commit_list ? my_hash_search(info->commit_list, (uchar *)&x, sizeof(x)) != 0 : diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 569bfa35f75..f0fc9c37dae 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -819,7 +819,8 @@ void wsrep_init_globals() wsrep_server_gtid_t new_gtid; new_gtid.domain_id= wsrep_gtid_domain_id; new_gtid.server_id= global_system_variables.server_id; - new_gtid.seqno= 0; + /* Use seqno which was recovered in wsrep_init_gtid() */ + new_gtid.seqno= wsrep_gtid_server.seqno(); /* Try to search for domain_id and server_id combination in binlog if found continue from last seqno */ wsrep_get_binlog_gtid_seqno(new_gtid); wsrep_gtid_server.gtid(new_gtid); diff --git a/sql/wsrep_trans_observer.h b/sql/wsrep_trans_observer.h index 028882d428b..7e5fcf3930e 100644 --- a/sql/wsrep_trans_observer.h +++ b/sql/wsrep_trans_observer.h @@ -1,4 +1,4 @@ -/* Copyright 2016-2023 Codership Oy +/* Copyright 2016-2025 Codership Oy 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 @@ -265,12 +265,17 @@ static inline int wsrep_before_prepare(THD* thd, bool all) { DBUG_RETURN(ret); } + if ((ret= thd->wsrep_cs().before_prepare()) == 0) { DBUG_ASSERT(!thd->wsrep_trx().ws_meta().gtid().is_undefined()); + /* Here we init xid with UUID and wsrep seqno. GTID is + set to undefined because commit order is decided later + in wsrep_before_commit(). wsrep_before_prepare() is + executed out of order. */ wsrep_xid_init(&thd->wsrep_xid, thd->wsrep_trx().ws_meta().gtid(), - wsrep_gtid_server.gtid()); + wsrep_gtid_server.undefined()); } mysql_mutex_lock(&thd->LOCK_thd_kill); @@ -470,12 +475,6 @@ static inline int wsrep_after_statement(THD* thd) { DBUG_ENTER("wsrep_after_statement"); - WSREP_DEBUG("wsrep_after_statement for %lu client_state %s " - " client_mode %s trans_state %s", - thd_get_thread_id(thd), - wsrep::to_c_string(thd->wsrep_cs().state()), - wsrep::to_c_string(thd->wsrep_cs().mode()), - wsrep::to_c_string(thd->wsrep_cs().transaction().state())); int ret= ((thd->wsrep_cs().state() != wsrep::client_state::s_none && thd->wsrep_cs().mode() == Wsrep_client_state::m_local) && !thd->internal_transaction() ? diff --git a/sql/wsrep_xid.cc b/sql/wsrep_xid.cc index 34eafe9c46c..12647907881 100644 --- a/sql/wsrep_xid.cc +++ b/sql/wsrep_xid.cc @@ -1,4 +1,4 @@ -/* Copyright 2015 Codership Oy +/* Copyright 2015-2025 Codership Oy 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 @@ -24,6 +24,8 @@ #include #include /* std::sort() */ +#include /* std::string */ +#include /* std::stringstream */ /* * WSREPXid */ @@ -119,11 +121,7 @@ static my_bool set_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg) if (hton->set_checkpoint) { - const unsigned char* uuid= wsrep_xid_uuid(xid); - char uuid_str[40]= {0, }; - wsrep_uuid_print((const wsrep_uuid_t*)uuid, uuid_str, sizeof(uuid_str)); - WSREP_DEBUG("Set WSREPXid for InnoDB: %s:%lld", - uuid_str, (long long)wsrep_xid_seqno(xid)); + WSREP_DEBUG("Set WSREPXid for InnoDB: %s", wsrep_xid_print(xid).c_str()); hton->set_checkpoint(hton, xid); } return FALSE; @@ -150,12 +148,7 @@ static my_bool get_SE_checkpoint(THD* unused, plugin_ref plugin, void* arg) if (hton->get_checkpoint) { hton->get_checkpoint(hton, xid); - wsrep_uuid_t uuid; - memcpy(&uuid, wsrep_xid_uuid(xid), sizeof(uuid)); - char uuid_str[40]= {0, }; - wsrep_uuid_print(&uuid, uuid_str, sizeof(uuid_str)); - WSREP_DEBUG("Read WSREPXid from InnoDB: %s:%lld", - uuid_str, (long long)wsrep_xid_seqno(xid)); + WSREP_DEBUG("Read WSREPXid from InnoDB: %s", wsrep_xid_print(xid).c_str()); } return FALSE; } @@ -252,3 +245,29 @@ void wsrep_sort_xid_array(XID *array, int len) { std::sort(array, array + len, Wsrep_xid_cmp()); } + +std::string wsrep_xid_print(const XID *xid) +{ + std::stringstream ss; + const unsigned char* uuid= wsrep_xid_uuid(xid); + char uuid_str[40]= {0, }; + wsrep_uuid_print((const wsrep_uuid_t*)uuid, uuid_str, sizeof(uuid_str)); + wsrep_server_gtid_t gtid= {0,0,0}; + memcpy(>id, &xid->data[WSREP_XID_RPL_GTID_OFFSET], sizeof(wsrep_server_gtid_t)); + ss << uuid_str << ":" << wsrep_xid_seqno(xid) << " " << gtid.domain_id << "-" + << gtid.server_id << "-" << gtid.seqno; + return ss.str(); +} + +bool wsrep_is_xid_gtid_undefined(const XID *xid) +{ + wsrep_server_gtid_t gtid= {0,0,0}; + + if (wsrep_is_wsrep_xid(xid) && + xid->data[WSREP_XID_VERSION_OFFSET] == WSREP_XID_VERSION_3) + { + memcpy(>id, &xid->data[WSREP_XID_RPL_GTID_OFFSET], sizeof(wsrep_server_gtid_t)); + } + + return (gtid.seqno == 0 && gtid.server_id == 0 && gtid.domain_id == 0); +} diff --git a/sql/wsrep_xid.h b/sql/wsrep_xid.h index 45ba6ffee6b..6eb812c81ce 100644 --- a/sql/wsrep_xid.h +++ b/sql/wsrep_xid.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 Codership Oy +/* Copyright (C) 2015-2025 Codership Oy 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 @@ -34,6 +34,8 @@ bool wsrep_set_SE_checkpoint(const wsrep::gtid& gtid, const wsrep_server_gtid_t& //void wsrep_set_SE_checkpoint(XID&); /* uncomment if needed */ void wsrep_sort_xid_array(XID *array, int len); +std::string wsrep_xid_print(const XID *xid); +bool wsrep_is_xid_gtid_undefined(const XID *xid); #endif /* WITH_WSREP */ #endif /* WSREP_UTILS_H */ From f3687ccaafe3f4216e832c429c6494d0e76b54ac Mon Sep 17 00:00:00 2001 From: Aryan Arora Date: Fri, 21 Feb 2025 09:31:21 +0530 Subject: [PATCH 024/134] MDEV-27126 my_getopt compares option names case sensitively my_getopt compares option names case-sensitively, causing "Unknown option" errors when users type mixed-case options like wsrep_slave_UK_checks in lowercase wsrep_slave_fk_checks. Made the comparison in the getopt_compare_strings() case-insensitive. --- mysql-test/main/my_getopt_case_insensitive.opt | 1 + mysql-test/main/my_getopt_case_insensitive.result | 8 ++++++++ mysql-test/main/my_getopt_case_insensitive.test | 8 ++++++++ .../suite/wsrep/r/wsrep_mixed_case_cmd_arg.result | 8 ++++++++ mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.cnf | 7 +++++++ mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.opt | 1 + .../suite/wsrep/t/wsrep_mixed_case_cmd_arg.test | 11 +++++++++++ mysys/my_getopt.c | 3 ++- 8 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 mysql-test/main/my_getopt_case_insensitive.opt create mode 100644 mysql-test/main/my_getopt_case_insensitive.result create mode 100644 mysql-test/main/my_getopt_case_insensitive.test create mode 100644 mysql-test/suite/wsrep/r/wsrep_mixed_case_cmd_arg.result create mode 100644 mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.cnf create mode 100644 mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.opt create mode 100644 mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.test diff --git a/mysql-test/main/my_getopt_case_insensitive.opt b/mysql-test/main/my_getopt_case_insensitive.opt new file mode 100644 index 00000000000..cadcd15e765 --- /dev/null +++ b/mysql-test/main/my_getopt_case_insensitive.opt @@ -0,0 +1 @@ +--slOw_QuEry_loG=OFF diff --git a/mysql-test/main/my_getopt_case_insensitive.result b/mysql-test/main/my_getopt_case_insensitive.result new file mode 100644 index 00000000000..0ab93079fbf --- /dev/null +++ b/mysql-test/main/my_getopt_case_insensitive.result @@ -0,0 +1,8 @@ +# +# MDEV-27126: my_getopt compares option names case sensitively +# +# Check if the variable is set correctly from options +SELECT @@GLOBAL.slow_query_log; +@@GLOBAL.slow_query_log +0 +# End of test. diff --git a/mysql-test/main/my_getopt_case_insensitive.test b/mysql-test/main/my_getopt_case_insensitive.test new file mode 100644 index 00000000000..5b301375034 --- /dev/null +++ b/mysql-test/main/my_getopt_case_insensitive.test @@ -0,0 +1,8 @@ +--echo # +--echo # MDEV-27126: my_getopt compares option names case sensitively +--echo # + +--echo # Check if the variable is set correctly from options +SELECT @@GLOBAL.slow_query_log; + +--echo # End of test. diff --git a/mysql-test/suite/wsrep/r/wsrep_mixed_case_cmd_arg.result b/mysql-test/suite/wsrep/r/wsrep_mixed_case_cmd_arg.result new file mode 100644 index 00000000000..6eb68ca13a5 --- /dev/null +++ b/mysql-test/suite/wsrep/r/wsrep_mixed_case_cmd_arg.result @@ -0,0 +1,8 @@ +# +# MDEV-27126: my_getopt compares option names case sensitively +# +# Check if the variable is set correctly from options +SELECT @@GLOBAL.wsrep_slave_uk_checks; +@@GLOBAL.wsrep_slave_uk_checks +1 +# End of test. diff --git a/mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.cnf b/mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.cnf new file mode 100644 index 00000000000..0bf01f81fc5 --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.cnf @@ -0,0 +1,7 @@ +!include ../my.cnf + +[mysqld.1] +wsrep-on=ON +wsrep-provider=@ENV.WSREP_PROVIDER +wsrep-cluster-address=gcomm:// + diff --git a/mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.opt b/mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.opt new file mode 100644 index 00000000000..d13f9f874c9 --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.opt @@ -0,0 +1 @@ +--wsrep-slave-uk-checks=1 diff --git a/mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.test b/mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.test new file mode 100644 index 00000000000..acfe8fd6c45 --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.test @@ -0,0 +1,11 @@ +--source include/have_innodb.inc +--source include/have_wsrep_provider.inc +--source include/have_binlog_format_row.inc +--echo # +--echo # MDEV-27126: my_getopt compares option names case sensitively +--echo # + +--echo # Check if the variable is set correctly from options +SELECT @@GLOBAL.wsrep_slave_uk_checks; + +--echo # End of test. diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 40cc17d0c22..ada7f883b01 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -962,7 +963,7 @@ my_bool getopt_compare_strings(register const char *s, register const char *t, for (;s != end ; s++, t++) { - if ((*s != '-' ? *s : '_') != (*t != '-' ? *t : '_')) + if ((*s != '-' ? tolower(*s) : '_') != (*t != '-' ? tolower(*t) : '_')) DBUG_RETURN(1); } DBUG_RETURN(0); From 0fa141ebb4639c5c6c4b5d990f448a932fd095a8 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 24 Feb 2025 12:10:32 +1100 Subject: [PATCH 025/134] MDEV-36138 Server null-pointer crash at startup when tmptables left in --tmpdir Fix a regression introduced in MDEV-35840 78157c4765f2c086fabe183d51d7734ecffdbdd8 Also tested compiling with -O3 that the -Warray-bounds fixed in MDEV-35840 does not resurface --- mysql-test/main/temp_table_frm.result | 6 ++++++ mysql-test/main/temp_table_frm.test | 13 ++++++++++++- sql/sql_base.cc | 6 ++++-- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/mysql-test/main/temp_table_frm.result b/mysql-test/main/temp_table_frm.result index a9c59ff5969..e54d91bf940 100644 --- a/mysql-test/main/temp_table_frm.result +++ b/mysql-test/main/temp_table_frm.result @@ -25,3 +25,9 @@ OPENED_VIEWS 0 set @@use_stat_tables= @save_use_stat_tables; set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; drop table t1; +# +# MDEV-36138 Server null-pointer crash at startup when tmptables left in --tmpdir +# +create table t1 (c int); +drop table t1; +# restart diff --git a/mysql-test/main/temp_table_frm.test b/mysql-test/main/temp_table_frm.test index 47d2fc40d20..1f36238f418 100644 --- a/mysql-test/main/temp_table_frm.test +++ b/mysql-test/main/temp_table_frm.test @@ -24,4 +24,15 @@ select variable_name, session_status.variable_value - t1.variable_value from information_schema.session_status join t1 using (variable_name); set @@use_stat_tables= @save_use_stat_tables; set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; -drop table t1; \ No newline at end of file +drop table t1; + +--echo # +--echo # MDEV-36138 Server null-pointer crash at startup when tmptables left in --tmpdir +--echo # + +create table t1 (c int); +let $MYSQLD_TMPDIR=`SELECT @@tmpdir`; +let $MYSQLD_DATADIR=`SELECT @@datadir`; +--copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_TMPDIR/#sqlt1.frm +drop table t1; +--source include/restart_mysqld.inc diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 95b650c33d3..09dac838c3f 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -8986,9 +8986,11 @@ my_bool mysql_rm_tmp_tables(void) memcpy(path_copy, path, path_len - ext_len); path_copy[path_len - ext_len]= 0; init_tmp_table_share(thd, &share, "", 0, "", path_copy); - handlerton *ht= share.db_type(); if (!open_table_def(thd, &share)) - ht->drop_table(share.db_type(), path_copy); + { + handlerton *ht= share.db_type(); + ht->drop_table(ht, path_copy); + } free_table_share(&share); } /* From fcfb89a8979862ff06552a5e6cd8329f3d5fed6a Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 24 Feb 2025 13:23:47 +1100 Subject: [PATCH 026/134] MDEV-35874 Spider: add missing skips when fetching results In MDEV-26345 77ed235d50bd9b1480f26d18ea0b70ca7480af23 a bitmap is introduced to skip spider GBH SELECTed constant fields when storing the results from the data node. Unfortunately this bitmap was not used in all applicable calls. This patch fixes it. The test covers most of the calls, with the exception of spider_db_store_result_for_reuse_cursor(), which is not covered in existing tests, because it is only called when limit_mode()==1, which is not the case for any spider backend wrapper. --- .../spider/bugfix/r/mdev_35874.result | 50 ++++++++++++++++++ .../spider/bugfix/t/mdev_35874.test | 52 +++++++++++++++++++ storage/spider/spd_db_conn.cc | 25 +++++---- 3 files changed, 114 insertions(+), 13 deletions(-) create mode 100644 storage/spider/mysql-test/spider/bugfix/r/mdev_35874.result create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_35874.test diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_35874.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_35874.result new file mode 100644 index 00000000000..9425babbb22 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_35874.result @@ -0,0 +1,50 @@ +# +# MDEV-35874 Unexpected error 1264 'Out of Range Value for Column' when inserting into ... select ... from a spider table +# +for master_1 +for child2 +for child3 +set spider_same_server_link= 1; +CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +CREATE TABLE t1 (c6 decimal(6,0)) ENGINE=InnoDB; +CREATE TABLE t1_s (c6 decimal(6,0)) +ENGINE=SPIDER COMMENT='wrapper "mariadb", srv "srv", table "t1"' ; +CREATE TABLE t2 (c8 decimal(8,0), c6 decimal(6,0)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (123456), (654321); +/* 1 */ SELECT 12345678, c6 FROM t1_s GROUP BY c6; +12345678 c6 +12345678 123456 +12345678 654321 +/* 2 */ INSERT INTO t2 (c8, c6) SELECT 12345678, c6 FROM t1_s GROUP BY c6; +set spider_quick_mode= 2; +/* 3 */ SELECT 12345678, c6 FROM t1_s GROUP BY c6; +12345678 c6 +12345678 123456 +12345678 654321 +/* 4 */ INSERT INTO t2 (c8, c6) SELECT 12345678, c6 FROM t1_s GROUP BY c6; +set spider_quick_mode= 3; +set spider_quick_page_size= 1; +INSERT INTO t1 VALUES (777777); +/* 5 */ SELECT 12345678, c6 FROM t1_s GROUP BY c6; +12345678 c6 +12345678 123456 +12345678 654321 +12345678 777777 +/* 6 */ INSERT INTO t2 (c8, c6) SELECT 12345678, c6 FROM t1_s GROUP BY c6; +set spider_quick_mode= 0; +set spider_quick_page_size= 1024; +CREATE OR REPLACE TABLE t1_s (c6 decimal(6,0) key) +ENGINE=SPIDER COMMENT='wrapper "mariadb", srv "srv", table "t1"' ; +/* 7 */ SELECT MAX(c6), SUM(c6) FROM t1_s; +MAX(c6) SUM(c6) +777777 1555554 +set spider_select_column_mode= 0; +/* 8 */ SELECT MAX(c6), SUM(c6) FROM t1_s; +MAX(c6) SUM(c6) +777777 1555554 +drop table t2, t1_s, t1; +drop server srv; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_35874.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_35874.test new file mode 100644 index 00000000000..beeec416a8d --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_35874.test @@ -0,0 +1,52 @@ +--echo # +--echo # MDEV-35874 Unexpected error 1264 'Out of Range Value for Column' when inserting into ... select ... from a spider table +--echo # + +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log +--source include/have_innodb.inc +set spider_same_server_link= 1; +evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); + +CREATE TABLE t1 (c6 decimal(6,0)) ENGINE=InnoDB; + +CREATE TABLE t1_s (c6 decimal(6,0)) +ENGINE=SPIDER COMMENT='wrapper "mariadb", srv "srv", table "t1"' ; + +CREATE TABLE t2 (c8 decimal(8,0), c6 decimal(6,0)) ENGINE=InnoDB; + +INSERT INTO t1 VALUES (123456), (654321); + +/* 1 */ SELECT 12345678, c6 FROM t1_s GROUP BY c6; +/* 2 */ INSERT INTO t2 (c8, c6) SELECT 12345678, c6 FROM t1_s GROUP BY c6; + +set spider_quick_mode= 2; +/* 3 */ SELECT 12345678, c6 FROM t1_s GROUP BY c6; +/* 4 */ INSERT INTO t2 (c8, c6) SELECT 12345678, c6 FROM t1_s GROUP BY c6; + +set spider_quick_mode= 3; +set spider_quick_page_size= 1; +INSERT INTO t1 VALUES (777777); +/* 5 */ SELECT 12345678, c6 FROM t1_s GROUP BY c6; +/* 6 */ INSERT INTO t2 (c8, c6) SELECT 12345678, c6 FROM t1_s GROUP BY c6; + +set spider_quick_mode= 0; +set spider_quick_page_size= 1024; +CREATE OR REPLACE TABLE t1_s (c6 decimal(6,0) key) +ENGINE=SPIDER COMMENT='wrapper "mariadb", srv "srv", table "t1"' ; +/* 7 */ SELECT MAX(c6), SUM(c6) FROM t1_s; + +set spider_select_column_mode= 0; +/* 8 */ SELECT MAX(c6), SUM(c6) FROM t1_s; + +drop table t2, t1_s, t1; +drop server srv; +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log diff --git a/storage/spider/spd_db_conn.cc b/storage/spider/spd_db_conn.cc index 1c1aa308e82..d33115ca1a0 100644 --- a/storage/spider/spd_db_conn.cc +++ b/storage/spider/spd_db_conn.cc @@ -2872,7 +2872,7 @@ int spider_db_fetch_table( if (result_list->quick_mode == 0) { SPIDER_DB_RESULT *result = current->result; - if (!(row = result->fetch_row())) + if (!(row = result->fetch_row(result_list->skips))) { table->status = STATUS_NOT_FOUND; DBUG_RETURN(HA_ERR_END_OF_FILE); @@ -2992,7 +2992,7 @@ int spider_db_fetch_key( if (result_list->quick_mode == 0) { SPIDER_DB_RESULT *result = current->result; - if (!(row = result->fetch_row())) + if (!(row = result->fetch_row(result_list->skips))) { table->status = STATUS_NOT_FOUND; DBUG_RETURN(HA_ERR_END_OF_FILE); @@ -3099,7 +3099,7 @@ int spider_db_fetch_minimum_columns( if (result_list->quick_mode == 0) { SPIDER_DB_RESULT *result = current->result; - if (!(row = result->fetch_row())) + if (!(row = result->fetch_row(result_list->skips))) { table->status = STATUS_NOT_FOUND; DBUG_RETURN(HA_ERR_END_OF_FILE); @@ -3874,7 +3874,7 @@ int spider_db_store_result( } position++; roop_count++; - row = current->result->fetch_row(); + row = current->result->fetch_row(result_list->skips); } } else { do { @@ -3896,7 +3896,7 @@ int spider_db_store_result( } } while ( page_size > roop_count && - (row = current->result->fetch_row()) + (row = current->result->fetch_row(result_list->skips)) ); } if ( @@ -3940,7 +3940,7 @@ int spider_db_store_result( roop_count++; } while ( result_list->limit_num > roop_count && - (row = current->result->fetch_row()) + (row = current->result->fetch_row(result_list->skips)) ); tmp_tbl->file->ha_end_bulk_insert(); page_size = result_list->limit_num; @@ -4171,7 +4171,7 @@ int spider_db_store_result_for_reuse_cursor( } current->dbton_id = current->result->dbton_id; SPIDER_DB_ROW *row; - if (!(row = current->result->fetch_row())) + if (!(row = current->result->fetch_row(result_list->skips))) { error_num = current->result->get_errno(); DBUG_PRINT("info",("spider set finish_flg point 3")); @@ -4249,7 +4249,7 @@ int spider_db_store_result_for_reuse_cursor( } position++; roop_count++; - row = current->result->fetch_row(); + row = current->result->fetch_row(result_list->skips); } } else { do { @@ -4271,7 +4271,7 @@ int spider_db_store_result_for_reuse_cursor( } } while ( page_size > roop_count && - (row = current->result->fetch_row()) + (row = current->result->fetch_row(result_list->skips)) ); } if ( @@ -4315,7 +4315,7 @@ int spider_db_store_result_for_reuse_cursor( roop_count++; } while ( result_list->limit_num > roop_count && - (row = current->result->fetch_row()) + (row = current->result->fetch_row(result_list->skips)) ); tmp_tbl->file->ha_end_bulk_insert(); page_size = result_list->limit_num; @@ -4887,9 +4887,8 @@ int spider_db_seek_next( #ifndef WITHOUT_SPIDER_BG_SEARCH } #endif - DBUG_RETURN(spider_db_fetch(buf, spider, table)); - } else - DBUG_RETURN(spider_db_fetch(buf, spider, table)); + } + DBUG_RETURN(spider_db_fetch(buf, spider, table)); } int spider_db_seek_last( From 71244c30a11299e6249b7ea108be98ce6d52d88c Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 13 Jan 2025 14:07:22 +1100 Subject: [PATCH 027/134] MDEV-35807 Removed an unused function spider_cmp_trx_alter_table --- storage/spider/spd_trx.cc | 199 -------------------------------------- storage/spider/spd_trx.h | 5 - 2 files changed, 204 deletions(-) diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index c52c781af8a..c72b201fc81 100644 --- a/storage/spider/spd_trx.cc +++ b/storage/spider/spd_trx.cc @@ -820,205 +820,6 @@ error_alloc_alter_table: DBUG_RETURN(error_num); } -bool spider_cmp_trx_alter_table( - SPIDER_ALTER_TABLE *cmp1, - SPIDER_ALTER_TABLE *cmp2 -) { - int roop_count; - DBUG_ENTER("spider_cmp_trx_alter_table"); - if ( - cmp1->tmp_priority != cmp2->tmp_priority || - cmp1->link_count != cmp2->link_count || - cmp1->all_link_count != cmp2->all_link_count - ) - DBUG_RETURN(TRUE); - - for (roop_count = 0; roop_count < (int) cmp1->all_link_count; roop_count++) - { - if ( - ( - cmp1->tmp_server_names[roop_count] != - cmp2->tmp_server_names[roop_count] && - ( - !cmp1->tmp_server_names[roop_count] || - !cmp2->tmp_server_names[roop_count] || - strcmp(cmp1->tmp_server_names[roop_count], - cmp2->tmp_server_names[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_table_names[roop_count] != - cmp2->tmp_tgt_table_names[roop_count] && - ( - !cmp1->tmp_tgt_table_names[roop_count] || - !cmp2->tmp_tgt_table_names[roop_count] || - strcmp(cmp1->tmp_tgt_table_names[roop_count], - cmp2->tmp_tgt_table_names[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_dbs[roop_count] != - cmp2->tmp_tgt_dbs[roop_count] && - ( - !cmp1->tmp_tgt_dbs[roop_count] || - !cmp2->tmp_tgt_dbs[roop_count] || - strcmp(cmp1->tmp_tgt_dbs[roop_count], - cmp2->tmp_tgt_dbs[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_hosts[roop_count] != - cmp2->tmp_tgt_hosts[roop_count] && - ( - !cmp1->tmp_tgt_hosts[roop_count] || - !cmp2->tmp_tgt_hosts[roop_count] || - strcmp(cmp1->tmp_tgt_hosts[roop_count], - cmp2->tmp_tgt_hosts[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_usernames[roop_count] != - cmp2->tmp_tgt_usernames[roop_count] && - ( - !cmp1->tmp_tgt_usernames[roop_count] || - !cmp2->tmp_tgt_usernames[roop_count] || - strcmp(cmp1->tmp_tgt_usernames[roop_count], - cmp2->tmp_tgt_usernames[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_passwords[roop_count] != - cmp2->tmp_tgt_passwords[roop_count] && - ( - !cmp1->tmp_tgt_passwords[roop_count] || - !cmp2->tmp_tgt_passwords[roop_count] || - strcmp(cmp1->tmp_tgt_passwords[roop_count], - cmp2->tmp_tgt_passwords[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_sockets[roop_count] != - cmp2->tmp_tgt_sockets[roop_count] && - ( - !cmp1->tmp_tgt_sockets[roop_count] || - !cmp2->tmp_tgt_sockets[roop_count] || - strcmp(cmp1->tmp_tgt_sockets[roop_count], - cmp2->tmp_tgt_sockets[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_wrappers[roop_count] != - cmp2->tmp_tgt_wrappers[roop_count] && - ( - !cmp1->tmp_tgt_wrappers[roop_count] || - !cmp2->tmp_tgt_wrappers[roop_count] || - strcmp(cmp1->tmp_tgt_wrappers[roop_count], - cmp2->tmp_tgt_wrappers[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_ssl_cas[roop_count] != - cmp2->tmp_tgt_ssl_cas[roop_count] && - ( - !cmp1->tmp_tgt_ssl_cas[roop_count] || - !cmp2->tmp_tgt_ssl_cas[roop_count] || - strcmp(cmp1->tmp_tgt_ssl_cas[roop_count], - cmp2->tmp_tgt_ssl_cas[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_ssl_capaths[roop_count] != - cmp2->tmp_tgt_ssl_capaths[roop_count] && - ( - !cmp1->tmp_tgt_ssl_capaths[roop_count] || - !cmp2->tmp_tgt_ssl_capaths[roop_count] || - strcmp(cmp1->tmp_tgt_ssl_capaths[roop_count], - cmp2->tmp_tgt_ssl_capaths[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_ssl_certs[roop_count] != - cmp2->tmp_tgt_ssl_certs[roop_count] && - ( - !cmp1->tmp_tgt_ssl_certs[roop_count] || - !cmp2->tmp_tgt_ssl_certs[roop_count] || - strcmp(cmp1->tmp_tgt_ssl_certs[roop_count], - cmp2->tmp_tgt_ssl_certs[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_ssl_ciphers[roop_count] != - cmp2->tmp_tgt_ssl_ciphers[roop_count] && - ( - !cmp1->tmp_tgt_ssl_ciphers[roop_count] || - !cmp2->tmp_tgt_ssl_ciphers[roop_count] || - strcmp(cmp1->tmp_tgt_ssl_ciphers[roop_count], - cmp2->tmp_tgt_ssl_ciphers[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_ssl_keys[roop_count] != - cmp2->tmp_tgt_ssl_keys[roop_count] && - ( - !cmp1->tmp_tgt_ssl_keys[roop_count] || - !cmp2->tmp_tgt_ssl_keys[roop_count] || - strcmp(cmp1->tmp_tgt_ssl_keys[roop_count], - cmp2->tmp_tgt_ssl_keys[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_default_files[roop_count] != - cmp2->tmp_tgt_default_files[roop_count] && - ( - !cmp1->tmp_tgt_default_files[roop_count] || - !cmp2->tmp_tgt_default_files[roop_count] || - strcmp(cmp1->tmp_tgt_default_files[roop_count], - cmp2->tmp_tgt_default_files[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_default_groups[roop_count] != - cmp2->tmp_tgt_default_groups[roop_count] && - ( - !cmp1->tmp_tgt_default_groups[roop_count] || - !cmp2->tmp_tgt_default_groups[roop_count] || - strcmp(cmp1->tmp_tgt_default_groups[roop_count], - cmp2->tmp_tgt_default_groups[roop_count]) - ) - ) || - ( - cmp1->tmp_tgt_dsns[roop_count] != - cmp2->tmp_tgt_dsns[roop_count] && - ( - !cmp1->tmp_tgt_dsns[roop_count] || - !cmp2->tmp_tgt_dsns[roop_count] || - strcmp(cmp1->tmp_tgt_dsns[roop_count], - cmp2->tmp_tgt_dsns[roop_count]) - ) - ) || - ( - cmp1->tmp_static_link_ids[roop_count] != - cmp2->tmp_static_link_ids[roop_count] && - ( - !cmp1->tmp_static_link_ids[roop_count] || - !cmp2->tmp_static_link_ids[roop_count] || - strcmp(cmp1->tmp_static_link_ids[roop_count], - cmp2->tmp_static_link_ids[roop_count]) - ) - ) || - cmp1->tmp_tgt_ports[roop_count] != cmp2->tmp_tgt_ports[roop_count] || - cmp1->tmp_tgt_ssl_vscs[roop_count] != - cmp2->tmp_tgt_ssl_vscs[roop_count] || - cmp1->tmp_monitoring_binlog_pos_at_failing[roop_count] != - cmp2->tmp_monitoring_binlog_pos_at_failing[roop_count] || - cmp1->tmp_link_statuses[roop_count] != - cmp2->tmp_link_statuses[roop_count] - ) - DBUG_RETURN(TRUE); - } - DBUG_RETURN(FALSE); -} - int spider_free_trx_alloc( SPIDER_TRX *trx ) { diff --git a/storage/spider/spd_trx.h b/storage/spider/spd_trx.h index 93b03fcec21..9185661fe1f 100644 --- a/storage/spider/spd_trx.h +++ b/storage/spider/spd_trx.h @@ -67,11 +67,6 @@ int spider_create_trx_alter_table( bool now_create ); -bool spider_cmp_trx_alter_table( - SPIDER_ALTER_TABLE *cmp1, - SPIDER_ALTER_TABLE *cmp2 -); - SPIDER_TRX *spider_get_trx( THD *thd, bool regist_allocated_thds, From 92d5882ffd51c89520889aff1fed7ce5f02d1a35 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 13 Jan 2025 14:09:42 +1100 Subject: [PATCH 028/134] MDEV-35807 Case-insensitive wrappers in spider Continued on the work in MDEV-32157 18990f007366863e2066c2905993358ceb941ce3 --- .../spider/bugfix/r/mdev_35807.result | 16 ++++++++++++++ .../spider/bugfix/t/mdev_35807.test | 21 +++++++++++++++++++ storage/spider/spd_direct_sql.cc | 4 ++-- storage/spider/spd_table.cc | 4 ++-- 4 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 storage/spider/mysql-test/spider/bugfix/r/mdev_35807.result create mode 100644 storage/spider/mysql-test/spider/bugfix/t/mdev_35807.test diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_35807.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_35807.result new file mode 100644 index 00000000000..e02629ca9ec --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_35807.result @@ -0,0 +1,16 @@ +# +# MDEV-35807 Spider wrapper name is case sensitive +# +for master_1 +for child2 +for child3 +set spider_same_server_link= 1; +CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +SELECT spider_direct_sql ('SELECT 1','','SRV "srv"'); +spider_direct_sql ('SELECT 1','','SRV "srv"') +1 +drop server srv; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_35807.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_35807.test new file mode 100644 index 00000000000..cab648124cc --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_35807.test @@ -0,0 +1,21 @@ +--echo # +--echo # MDEV-35807 Spider wrapper name is case sensitive +--echo # + +--disable_query_log +--disable_result_log +--source ../../t/test_init.inc +--enable_result_log +--enable_query_log + +set spider_same_server_link= 1; +evalp CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +SELECT spider_direct_sql ('SELECT 1','','SRV "srv"'); +drop server srv; + +--disable_query_log +--disable_result_log +--source ../../t/test_deinit.inc +--enable_result_log +--enable_query_log diff --git a/storage/spider/spd_direct_sql.cc b/storage/spider/spd_direct_sql.cc index f0661bdd4c0..fb9aa4f5be9 100644 --- a/storage/spider/spd_direct_sql.cc +++ b/storage/spider/spd_direct_sql.cc @@ -194,7 +194,7 @@ int spider_udf_direct_sql_create_conn_key( spider_dbton[roop_count2].wrapper : "NULL")); if ( spider_dbton[roop_count2].wrapper && - !strcmp(direct_sql->tgt_wrapper, spider_dbton[roop_count2].wrapper) + !strcasecmp(direct_sql->tgt_wrapper, spider_dbton[roop_count2].wrapper) ) { if (spider_dbton[roop_count2].db_access_type == SPIDER_DB_ACCESS_TYPE_SQL) @@ -983,7 +983,7 @@ int spider_udf_set_direct_sql_param_default( spider_dbton[roop_count].wrapper : "NULL")); if ( spider_dbton[roop_count].wrapper && - !strcmp(direct_sql->tgt_wrapper, + !strcasecmp(direct_sql->tgt_wrapper, spider_dbton[roop_count].wrapper) ) { if (spider_dbton[roop_count].db_access_type == diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 347a3074325..cdbcd39ec5b 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -3421,7 +3421,7 @@ int spider_set_connect_info_default( spider_dbton[roop_count2].wrapper : "NULL")); if ( spider_dbton[roop_count2].wrapper && - !strcmp(share->tgt_wrappers[roop_count], + !strcasecmp(share->tgt_wrappers[roop_count], spider_dbton[roop_count2].wrapper) ) { if (spider_dbton[roop_count2].db_access_type == @@ -3697,7 +3697,7 @@ int spider_set_connect_info_default_db_table( spider_dbton[roop_count2].wrapper : "NULL")); if ( spider_dbton[roop_count2].wrapper && - !strcmp(share->tgt_wrappers[roop_count], + !strcasecmp(share->tgt_wrappers[roop_count], spider_dbton[roop_count2].wrapper) ) { if (spider_dbton[roop_count2].db_access_type == From 04d731b6cc93b3957a3dc6ccdd5b57db29828a82 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Wed, 19 Feb 2025 03:53:49 +0100 Subject: [PATCH 029/134] galera mtr tests: synchronization between versions Added fixes to galera tests for issues found during merging changes from 10.5 to 10.6. --- .../galera/r/galera_as_slave_nonprim.result | 2 +- .../r/galera_sst_mariabackup_gtid,debug.rdiff | 4 ++-- .../galera/r/galera_sst_rsync_gtid,debug.rdiff | 4 ++-- mysql-test/suite/galera/suite.pm | 16 ++++++++-------- .../suite/galera/t/galera_as_slave_nonprim.test | 2 +- .../galera_3nodes/r/galera_join_with_cc_A.result | 6 +++--- .../galera_3nodes/r/galera_join_with_cc_B.result | 6 +++--- .../galera_3nodes/r/galera_join_with_cc_C.result | 8 ++++---- .../galera_3nodes/r/galera_pc_weight.result | 10 +++++----- mysql-test/suite/galera_3nodes/suite.pm | 16 ++++++++-------- .../galera_3nodes/t/galera_join_with_cc_A.test | 6 +++--- .../galera_3nodes/t/galera_join_with_cc_B.test | 6 +++--- .../galera_3nodes/t/galera_join_with_cc_C.test | 8 ++++---- .../suite/galera_3nodes/t/galera_pc_weight.test | 10 +++++----- mysql-test/suite/galera_3nodes_sr/suite.pm | 11 ++++++----- mysql-test/suite/galera_sr/suite.pm | 16 ++++++++-------- .../suite/wsrep/t/wsrep_mixed_case_cmd_arg.cnf | 1 - 17 files changed, 66 insertions(+), 66 deletions(-) diff --git a/mysql-test/suite/galera/r/galera_as_slave_nonprim.result b/mysql-test/suite/galera/r/galera_as_slave_nonprim.result index fefc988d9d4..969e844577e 100644 --- a/mysql-test/suite/galera/r/galera_as_slave_nonprim.result +++ b/mysql-test/suite/galera/r/galera_as_slave_nonprim.result @@ -27,7 +27,7 @@ STOP SLAVE; RESET SLAVE ALL; CALL mtr.add_suppression("Slave SQL: Error 'Unknown command' on query"); CALL mtr.add_suppression("Slave: Unknown command Error_code: 1047"); -CALL mtr.add_suppression("Transport endpoint is not connected"); +CALL mtr.add_suppression("(Transport endpoint|Socket) is not connected"); CALL mtr.add_suppression("Slave SQL: Error in Xid_log_event: Commit could not be completed, 'Deadlock found when trying to get lock; try restarting transaction', Error_code: 1213"); CALL mtr.add_suppression("Slave SQL: Node has dropped from cluster, Error_code: 1047"); connection node_4; diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_gtid,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_mariabackup_gtid,debug.rdiff index 12609bb571f..4e1470839e9 100644 --- a/mysql-test/suite/galera/r/galera_sst_mariabackup_gtid,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_gtid,debug.rdiff @@ -1,5 +1,5 @@ ---- suite/galera/r/galera_sst_mariabackup_gtid.result 2025-01-02 15:34:28.251593452 +0200 -+++ suite/galera/r/galera_sst_mariabackup_gtid.reject 2025-01-02 16:01:18.058469177 +0200 +--- r/galera_sst_mariabackup_gtid.result ++++ r/galera_sst_mariabackup_gtid,debug.reject @@ -516,19 +516,203 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_sst_rsync_gtid,debug.rdiff b/mysql-test/suite/galera/r/galera_sst_rsync_gtid,debug.rdiff index 0e3e85ef213..c83ead475e2 100644 --- a/mysql-test/suite/galera/r/galera_sst_rsync_gtid,debug.rdiff +++ b/mysql-test/suite/galera/r/galera_sst_rsync_gtid,debug.rdiff @@ -1,5 +1,5 @@ ---- suite/galera/r/galera_sst_rsync_gtid.result 2025-01-02 15:35:15.162175835 +0200 -+++ suite/galera/r/galera_sst_rsync_gtid.reject 2025-01-02 16:02:08.588902711 +0200 +--- r/galera_sst_rsync_gtid.result ++++ r/galera_sst_rsync_gtid,debug.reject @@ -516,19 +516,203 @@ 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/suite.pm b/mysql-test/suite/galera/suite.pm index 8f2a0cf5385..55cdde373c5 100644 --- a/mysql-test/suite/galera/suite.pm +++ b/mysql-test/suite/galera/suite.pm @@ -17,7 +17,7 @@ push @::global_suppressions, qr(WSREP: Failed to prepare for incremental state transfer:), qr(WSREP: .*down context.*), qr(WSREP: Failed to send state UUID:), - qr(WSREP: last inactive check more than .* skipping check), + qr(WSREP: last inactive check more than .+ skipping check), qr(WSREP: Releasing seqno [0-9]+ before [0-9]+ was assigned\.), qr|WSREP: access file\(.*gvwstate.dat\) failed ?\(No such file or directory\)|, qr(WSREP: Quorum: No node with complete state), @@ -27,7 +27,7 @@ push @::global_suppressions, qr(WSREP: evs::proto.*), qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:|, qr(WSREP: no nodes coming from prim view, prim not possible), - qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable), + qr(WSREP: Member .+ ?requested state transfer from .+ but it is impossible to select State Transfer donor: Resource temporarily unavailable), qr(WSREP: user message in state LEAVING), qr(WSREP: .* sending install message failed: (Transport endpoint|Socket) is not connected), qr(WSREP: .* sending install message failed: Resource temporarily unavailable), @@ -46,25 +46,25 @@ push @::global_suppressions, qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at ), qr(WSREP: gcs connect failed: Connection timed out), qr|WSREP: wsrep::connect\(.*\) failed: 7|, - qr(WSREP: SYNC message from member .* in non-primary configuration\. Ignored\.), + qr(WSREP: SYNC message from member .+ ?in non-primary configuration\. Ignored\.), qr(WSREP: Could not find peer:), qr(WSREP: TO isolation failed for: ), qr|WSREP: gcs_caused\(\) returned |, - qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(SYNCED\)\. Message ignored\.|, - qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(JOINED\)\. Message ignored\.|, + qr|WSREP: Protocol violation\. JOIN message sender .+ ?is not in state transfer \(SYNCED\)\. Message ignored\.|, + qr|WSREP: Protocol violation\. JOIN message sender .+ ?is not in state transfer \(JOINED\)\. Message ignored\.|, qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled\. Expect abort\.|, qr(WSREP: Action message in non-primary configuration from member [0-9]*), qr(WSREP: Last Applied Action message in non-primary configuration from member [0-9]*), qr(WSREP: discarding established ), qr|WSREP: .*core_handle_uuid_msg|, qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0\. WSREP_SYNC_WAIT_BEFORE_READ is on), - qr|WSREP: JOIN message from member .* in non-primary configuration\. Ignored\.|, + qr|WSREP: JOIN message from member .+ ?in non-primary configuration\. Ignored\.|, qr|WSREP: .*Query apply failed:|, qr(WSREP: Ignoring error), qr(WSREP: Failed to remove page file ), qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to ), - qr|WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\)\. Will retry in new primary component\.|, - qr|WSREP: Send action \{.* STATE_REQUEST\} returned -107 \(Transport endpoint is not connected\)|, + qr+WSREP: Sending JOIN failed: -107 \((Transport endpoint|Socket) is not connected\)\. Will retry in new primary component\.+, + qr+WSREP: Send action \{.* STATE_REQUEST\} returned -107 \((Transport endpoint|Socket) is not connected\)+, qr|WSREP: Trying to continue unpaused monitor|, qr|WSREP: Wait for gtid returned error 3 while waiting for prior transactions to commit before setting position|, qr|WSREP: Failed to report last committed|, diff --git a/mysql-test/suite/galera/t/galera_as_slave_nonprim.test b/mysql-test/suite/galera/t/galera_as_slave_nonprim.test index 600d64e5a81..42414761e62 100644 --- a/mysql-test/suite/galera/t/galera_as_slave_nonprim.test +++ b/mysql-test/suite/galera/t/galera_as_slave_nonprim.test @@ -84,7 +84,7 @@ RESET SLAVE ALL; CALL mtr.add_suppression("Slave SQL: Error 'Unknown command' on query"); CALL mtr.add_suppression("Slave: Unknown command Error_code: 1047"); -CALL mtr.add_suppression("Transport endpoint is not connected"); +CALL mtr.add_suppression("(Transport endpoint|Socket) is not connected"); CALL mtr.add_suppression("Slave SQL: Error in Xid_log_event: Commit could not be completed, 'Deadlock found when trying to get lock; try restarting transaction', Error_code: 1213"); CALL mtr.add_suppression("Slave SQL: Node has dropped from cluster, Error_code: 1047"); diff --git a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_A.result b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_A.result index fdea4154626..52f5db8daed 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_A.result +++ b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_A.result @@ -77,8 +77,8 @@ SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration'; SET GLOBAL wsrep_provider_options = 'dbug='; connection node_1; DROP TABLE t1; -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); connection node_2; -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); connection node_3; -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); diff --git a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_B.result b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_B.result index 7811059db42..a63e7933e9c 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_B.result +++ b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_B.result @@ -87,11 +87,11 @@ SET GLOBAL wsrep_provider_options = 'signal=process_primary_configuration'; SET GLOBAL wsrep_provider_options = 'dbug='; connection node_1; DROP TABLE t1; -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); connection node_2; -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); connection node_3; -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); disconnect node_1a; disconnect node_3; disconnect node_2; diff --git a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_C.result b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_C.result index ea185bf676a..d80d90cd726 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_C.result +++ b/mysql-test/suite/galera_3nodes/r/galera_join_with_cc_C.result @@ -94,9 +94,9 @@ SET GLOBAL wsrep_provider_options = 'dbug='; SET GLOBAL wsrep_provider_options = 'signal=after_shift_to_joining'; connection node_1; DROP TABLE t1; -call mtr.add_suppression("WSREP: Send action {(.*), STATE_REQUEST} returned -107 \\(Transport endpoint is not connected\\)"); -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Send action {.* STATE_REQUEST} returned -107 \\((Transport endpoint|Socket) is not connected\\)"); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); connection node_2; -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); connection node_3; -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); diff --git a/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result b/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result index 6d8c7a51b1f..9351d528b87 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result +++ b/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result @@ -157,10 +157,10 @@ SET GLOBAL wsrep_provider_options = 'pc.weight=1'; CALL mtr.add_suppression('WSREP: gcs_caused\\(\\) returned -1'); connection node_2; CALL mtr.add_suppression('SYNC message from member'); -CALL mtr.add_suppression('user message in state LEAVING'); -CALL mtr.add_suppression('sending install message failed: (Transport endpoint is not connected|Socket is not connected)'); -CALL mtr.add_suppression('overriding reported weight for'); +CALL mtr.add_suppression('WSREP: user message in state LEAVING'); +CALL mtr.add_suppression('sending install message failed: (Transport endpoint|Socket) is not connected'); +CALL mtr.add_suppression('overriding reported weight for '); connection node_3; CALL mtr.add_suppression('WSREP: user message in state LEAVING'); -CALL mtr.add_suppression('sending install message failed: (Transport endpoint is not connected|Socket is not connected)'); -CALL mtr.add_suppression('overriding reported weight for'); +CALL mtr.add_suppression('sending install message failed: (Transport endpoint|Socket) is not connected'); +CALL mtr.add_suppression('overriding reported weight for '); diff --git a/mysql-test/suite/galera_3nodes/suite.pm b/mysql-test/suite/galera_3nodes/suite.pm index c1cc1ef4076..34b5afd0cdc 100644 --- a/mysql-test/suite/galera_3nodes/suite.pm +++ b/mysql-test/suite/galera_3nodes/suite.pm @@ -16,7 +16,7 @@ push @::global_suppressions, qr(WSREP: Failed to prepare for incremental state transfer:), qr(WSREP: .*down context.*), qr(WSREP: Failed to send state UUID:), - qr(WSREP: last inactive check more than .* skipping check), + qr(WSREP: last inactive check more than .+ skipping check), qr(WSREP: Releasing seqno [0-9]+ before [0-9]+ was assigned\.), qr|WSREP: access file\(.*gvwstate.dat\) failed ?\(No such file or directory\)|, qr(WSREP: Quorum: No node with complete state), @@ -26,7 +26,7 @@ push @::global_suppressions, qr(WSREP: evs::proto.*), qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:|, qr(WSREP: no nodes coming from prim view, prim not possible), - qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable), + qr(WSREP: Member .+ ?requested state transfer from .+ but it is impossible to select State Transfer donor: Resource temporarily unavailable), qr(WSREP: user message in state LEAVING), qr(WSREP: .* sending install message failed: (Transport endpoint|Socket) is not connected), qr(WSREP: .* sending install message failed: Resource temporarily unavailable), @@ -45,25 +45,25 @@ push @::global_suppressions, qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at ), qr(WSREP: gcs connect failed: Connection timed out), qr|WSREP: wsrep::connect\(.*\) failed: 7|, - qr(WSREP: SYNC message from member .* in non-primary configuration\. Ignored\.), + qr(WSREP: SYNC message from member .+ ?in non-primary configuration\. Ignored\.), qr(WSREP: Could not find peer:), qr(WSREP: TO isolation failed for: ), qr|WSREP: gcs_caused\(\) returned |, - qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(SYNCED\)\. Message ignored\.|, - qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(JOINED\)\. Message ignored\.|, + qr|WSREP: Protocol violation\. JOIN message sender .+ ?is not in state transfer \(SYNCED\)\. Message ignored\.|, + qr|WSREP: Protocol violation\. JOIN message sender .+ ?is not in state transfer \(JOINED\)\. Message ignored\.|, qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled\. Expect abort\.|, qr(WSREP: Action message in non-primary configuration from member [0-9]*), qr(WSREP: Last Applied Action message in non-primary configuration from member [0-9]*), qr(WSREP: discarding established ), qr|WSREP: .*core_handle_uuid_msg|, qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0\. WSREP_SYNC_WAIT_BEFORE_READ is on), - qr|WSREP: JOIN message from member .* in non-primary configuration\. Ignored\.|, + qr|WSREP: JOIN message from member .+ ?in non-primary configuration\. Ignored\.|, qr|WSREP: .*Query apply failed:|, qr(WSREP: Ignoring error), qr(WSREP: Failed to remove page file ), qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to ), - qr|WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\)\. Will retry in new primary component\.|, - qr|WSREP: Send action \{.* STATE_REQUEST\} returned -107 \(Transport endpoint is not connected\)|, + qr+WSREP: Sending JOIN failed: -107 \((Transport endpoint|Socket) is not connected\)\. Will retry in new primary component\.+, + qr+WSREP: Send action \{.* STATE_REQUEST\} returned -107 \((Transport endpoint|Socket) is not connected\)+, qr|WSREP: Trying to continue unpaused monitor|, qr|WSREP: Wait for gtid returned error 3 while waiting for prior transactions to commit before setting position|, qr|WSREP: Failed to report last committed|, diff --git a/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_A.test b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_A.test index bb25b1dd9d1..b30446b84bb 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_A.test +++ b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_A.test @@ -259,12 +259,12 @@ INSERT INTO t1 VALUES (9, 2); DROP TABLE t1; -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); --connection node_2 -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); --connection node_3 -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); --source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_B.test b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_B.test index b5983c384ed..b80a1dd89fb 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_B.test +++ b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_B.test @@ -270,13 +270,13 @@ SELECT * FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debu DROP TABLE t1; -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); --connection node_2 -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); --connection node_3 -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); --disconnect node_1a diff --git a/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_C.test b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_C.test index d914482a100..6afd7b94d0f 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_C.test +++ b/mysql-test/suite/galera_3nodes/t/galera_join_with_cc_C.test @@ -295,13 +295,13 @@ INSERT INTO t1 VALUES (9, 2); DROP TABLE t1; -call mtr.add_suppression("WSREP: Send action {(.*), STATE_REQUEST} returned -107 \\(Transport endpoint is not connected\\)"); -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Send action {.* STATE_REQUEST} returned -107 \\((Transport endpoint|Socket) is not connected\\)"); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); --connection node_2 -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); --connection node_3 -call mtr.add_suppression("WSREP: Rejecting JOIN message from (.*): new State Transfer required\\."); +call mtr.add_suppression("WSREP: Rejecting JOIN message from .+: new State Transfer required\\."); --source ../galera/include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test index 8a1c93a769f..037a732923f 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test +++ b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test @@ -132,11 +132,11 @@ CALL mtr.add_suppression('WSREP: gcs_caused\\(\\) returned -1'); --connection node_2 CALL mtr.add_suppression('SYNC message from member'); -CALL mtr.add_suppression('user message in state LEAVING'); -CALL mtr.add_suppression('sending install message failed: (Transport endpoint is not connected|Socket is not connected)'); -CALL mtr.add_suppression('overriding reported weight for'); +CALL mtr.add_suppression('WSREP: user message in state LEAVING'); +CALL mtr.add_suppression('sending install message failed: (Transport endpoint|Socket) is not connected'); +CALL mtr.add_suppression('overriding reported weight for '); --connection node_3 CALL mtr.add_suppression('WSREP: user message in state LEAVING'); -CALL mtr.add_suppression('sending install message failed: (Transport endpoint is not connected|Socket is not connected)'); -CALL mtr.add_suppression('overriding reported weight for'); +CALL mtr.add_suppression('sending install message failed: (Transport endpoint|Socket) is not connected'); +CALL mtr.add_suppression('overriding reported weight for '); diff --git a/mysql-test/suite/galera_3nodes_sr/suite.pm b/mysql-test/suite/galera_3nodes_sr/suite.pm index 54489387ec5..c7f4472e242 100644 --- a/mysql-test/suite/galera_3nodes_sr/suite.pm +++ b/mysql-test/suite/galera_3nodes_sr/suite.pm @@ -27,20 +27,21 @@ push @::global_suppressions, qr(WSREP: evs::proto.*), qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:|, qr(WSREP: no nodes coming from prim view, prim not possible), - qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable), + qr(WSREP: Member .+ ?requested state transfer from .+ but it is impossible to select State Transfer donor: Resource temporarily unavailable), qr(WSREP: user message in state LEAVING), qr(WSREP: .* sending install message failed: (Transport endpoint|Socket) is not connected), qr(WSREP: .* sending install message failed: Resource temporarily unavailable), qr(WSREP: Could not find peer:), qr|WSREP: gcs_caused\(\) returned |, - qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(SYNCED\)\. Message ignored\.|, - qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(JOINED\)\. Message ignored\.|, + qr|WSREP: Protocol violation\. JOIN message sender .+ ?is not in state transfer \(SYNCED\)\. Message ignored\.|, + qr|WSREP: Protocol violation\. JOIN message sender .+ ?is not in state transfer \(JOINED\)\. Message ignored\.|, qr(WSREP: Action message in non-primary configuration from member [0-9]*), qr(WSREP: Last Applied Action message in non-primary configuration from member [0-9]*), qr|WSREP: .*core_handle_uuid_msg|, qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0\. WSREP_SYNC_WAIT_BEFORE_READ is on), - qr|WSREP: JOIN message from member .* in non-primary configuration\. Ignored\.|, - qr|WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\)\. Will retry in new primary component\.|, + qr|WSREP: JOIN message from member .+ ?in non-primary configuration\. Ignored\.|, + qr+WSREP: Sending JOIN failed: -107 \((Transport endpoint|Socket) is not connected\)\. Will retry in new primary component\.+, + qr+WSREP: Send action \{.* STATE_REQUEST\} returned -107 \((Transport endpoint|Socket) is not connected\)+, ); bless { }; diff --git a/mysql-test/suite/galera_sr/suite.pm b/mysql-test/suite/galera_sr/suite.pm index a0e386a52b7..0aea25145da 100644 --- a/mysql-test/suite/galera_sr/suite.pm +++ b/mysql-test/suite/galera_sr/suite.pm @@ -16,7 +16,7 @@ push @::global_suppressions, qr(WSREP: Failed to prepare for incremental state transfer:), qr(WSREP: .*down context.*), qr(WSREP: Failed to send state UUID:), - qr(WSREP: last inactive check more than .* skipping check), + qr(WSREP: last inactive check more than .+ skipping check), qr(WSREP: Releasing seqno [0-9]+ before [0-9]+ was assigned\.), qr|WSREP: access file\(.*gvwstate.dat\) failed ?\(No such file or directory\)|, qr(WSREP: Quorum: No node with complete state), @@ -26,7 +26,7 @@ push @::global_suppressions, qr(WSREP: evs::proto.*), qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:|, qr(WSREP: no nodes coming from prim view, prim not possible), - qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable), + qr(WSREP: Member .+ ?requested state transfer from .+ but it is impossible to select State Transfer donor: Resource temporarily unavailable), qr(WSREP: user message in state LEAVING), qr(WSREP: .* sending install message failed: (Transport endpoint|Socket) is not connected), qr(WSREP: .* sending install message failed: Resource temporarily unavailable), @@ -45,25 +45,25 @@ push @::global_suppressions, qr(WSREP: .*Failed to open channel 'my_wsrep_cluster' at ), qr(WSREP: gcs connect failed: Connection timed out), qr|WSREP: wsrep::connect\(.*\) failed: 7|, - qr(WSREP: SYNC message from member .* in non-primary configuration\. Ignored\.), + qr(WSREP: SYNC message from member .+ ?in non-primary configuration\. Ignored\.), qr(WSREP: Could not find peer:), qr(WSREP: TO isolation failed for: ), qr|WSREP: gcs_caused\(\) returned |, - qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(SYNCED\)\. Message ignored\.|, - qr|WSREP: Protocol violation\. JOIN message sender .* is not in state transfer \(JOINED\)\. Message ignored\.|, + qr|WSREP: Protocol violation\. JOIN message sender .+ ?is not in state transfer \(SYNCED\)\. Message ignored\.|, + qr|WSREP: Protocol violation\. JOIN message sender .+ ?is not in state transfer \(JOINED\)\. Message ignored\.|, qr|WSREP: Unsupported protocol downgrade: incremental data collection disabled\. Expect abort\.|, qr(WSREP: Action message in non-primary configuration from member [0-9]*), qr(WSREP: Last Applied Action message in non-primary configuration from member [0-9]*), qr(WSREP: discarding established ), qr|WSREP: .*core_handle_uuid_msg|, qr(WSREP: --wsrep-causal-reads=ON takes precedence over --wsrep-sync-wait=0\. WSREP_SYNC_WAIT_BEFORE_READ is on), - qr|WSREP: JOIN message from member .* in non-primary configuration\. Ignored\.|, + qr|WSREP: JOIN message from member .+ ?in non-primary configuration\. Ignored\.|, qr|WSREP: .*Query apply failed:|, qr(WSREP: Ignoring error), qr(WSREP: Failed to remove page file ), qr(WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to ), - qr|WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\)\. Will retry in new primary component\.|, - qr|WSREP: Send action \{.* STATE_REQUEST\} returned -107 \(Transport endpoint is not connected\)|, + qr+WSREP: Sending JOIN failed: -107 \((Transport endpoint|Socket) is not connected\)\. Will retry in new primary component\.+, + qr+WSREP: Send action \{.* STATE_REQUEST\} returned -107 \((Transport endpoint|Socket) is not connected\)+, qr|WSREP: Trying to continue unpaused monitor|, qr|WSREP: Wait for gtid returned error 3 while waiting for prior transactions to commit before setting position|, qr|WSREP: Failed to report last committed|, diff --git a/mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.cnf b/mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.cnf index 0bf01f81fc5..c2b7c4d415f 100644 --- a/mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.cnf +++ b/mysql-test/suite/wsrep/t/wsrep_mixed_case_cmd_arg.cnf @@ -4,4 +4,3 @@ wsrep-on=ON wsrep-provider=@ENV.WSREP_PROVIDER wsrep-cluster-address=gcomm:// - From 7bb0885397ac7e5c8594bffcd8b268c1553b6a2d Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Fri, 21 Feb 2025 13:24:27 +1100 Subject: [PATCH 030/134] fixup of MDEV-35959 --- storage/spider/mysql-test/spider/bugfix/t/mdev_35959.test | 2 ++ 1 file changed, 2 insertions(+) diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_35959.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_35959.test index 9beebaa8c1d..d2bfa6657ce 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_35959.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_35959.test @@ -14,8 +14,10 @@ OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t_remote (a INT); CREATE TABLE t (a INT) ENGINE=SPIDER COMMENT = 'wrapper "mysql", srv "srv", table "t_remote"'; +--disable_ps_protocol --error ER_NET_READ_INTERRUPTED CREATE OR REPLACE TABLE t_remote LIKE t; +--enable_ps_protocol SHOW WARNINGS; drop table t; From e95a8f84de7bc51d7e173b2623491ed258d89d3c Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 27 Feb 2025 11:33:44 +1100 Subject: [PATCH 031/134] MDEV-36156: MSAN Compile and Link flags needed for compile/run checks When MSAN adds the -fsantize=memory this significantly affects compile and link tests. Whether this is a compile/run/or looking for a symbol in a library these cmake tests require the same flags be set. Ideally the minimum invocation of cmake to create a MSAN build as investigated in MDBF-793 should be: -DWITH_MSAN=ON \ -DCMAKE_{EXE,MODULE}_LINKER_FLAGS="-L${MSAN_LIBDIR} -Wl,-rpath=${MSAN_LIBDIR}" On the assumption that the compiler supports msan and the instrumented libraries are in MSAN_LIBDIR (maybe later can be made a cmake option). Without cmake policy below, the checking of everything from libc++ to libfmt will not have the supplied linker flags or the compile options that WITH_MSAN=ON invokes. Many try_compile and CMake functions that wrapped this and headers failed to be recognised due to missing msan symbols when linking. Also without the -L path, they where applying a link test to the default path libraries rather than the MSAN instrumented ones. The CMake policy enabled is CMP0056, added CMake 3.2, applies CMAKE_EXE_LINKER_FLAGS to try_compile. With this change the MY_CHECK_AND_SET_COMPILER_FLAG remove explict build types resulting in just CMAKE_{C,CXX}_FLAGS being set rather than CMAKE_{C,CXX}_FLAGS_{DEBUG,RELWITHDEBINFO}. These are needed for the default CMP0066 policy to be correctly applied and the msan flags of -fsanitizer=memory are applied to all compile checks. Likewise with MY_CHECK_AND_SET_LINKER_FLAG for CMAKE_{EXE,MODULE,SHARED}_LINKER_FLAGS for those check that involve full linking and CHECK_CXX_SOURCE_RUNS for example. --- CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 37e7d929200..7e4d188bc49 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,7 +31,7 @@ ENDIF() # in RPM's: #set(CPACK_RPM_SPEC_MORE_DEFINE "%define __spec_install_post /bin/true") -FOREACH(p CMP0022 CMP0046 CMP0040 CMP0048 CMP0054 CMP0067 CMP0074 CMP0075 CMP0069 CMP0135) +FOREACH(p CMP0022 CMP0046 CMP0040 CMP0048 CMP0054 CMP0056 CMP0067 CMP0074 CMP0075 CMP0069 CMP0135) IF(POLICY ${p}) CMAKE_POLICY(SET ${p} NEW) ENDIF() @@ -245,7 +245,7 @@ ENDIF() OPTION(WITH_MSAN "Enable memory sanitizer" OFF) IF (WITH_MSAN) - MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=memory -fsanitize-memory-track-origins -U_FORTIFY_SOURCE" DEBUG RELWITHDEBINFO) + MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=memory -fsanitize-memory-track-origins -U_FORTIFY_SOURCE") IF(NOT (have_C__fsanitize_memory__fsanitize_memory_track_origins__U_FORTIFY_SOURCE AND have_CXX__fsanitize_memory__fsanitize_memory_track_origins__U_FORTIFY_SOURCE)) MESSAGE(FATAL_ERROR "Compiler doesn't support -fsanitize=memory flags") @@ -255,7 +255,7 @@ IF (WITH_MSAN) MESSAGE(FATAL_ERROR "C++ Compiler requires support for -stdlib=libc++") ENDIF() SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") - MY_CHECK_AND_SET_LINKER_FLAG("-fsanitize=memory" DEBUG RELWITHDEBINFO) + MY_CHECK_AND_SET_LINKER_FLAG("-fsanitize=memory") IF(NOT HAVE_LINK_FLAG__fsanitize_memory) MESSAGE(FATAL_ERROR "Linker doesn't support -fsanitize=memory flags") ENDIF() From 3deac2ea77c78c653b47774a7551a02760ed0806 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Fri, 28 Feb 2025 19:16:14 +0100 Subject: [PATCH 032/134] galera_inject_bf_log_wait mtr test: more stable test Added explicit checkpoint wait instead of implicit assumption that statement sent via --send will already be executed when lock-contesting statement is started in another session. --- mysql-test/suite/galera/r/galera_inject_bf_long_wait.result | 4 ++++ mysql-test/suite/galera/t/galera_inject_bf_long_wait.test | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/mysql-test/suite/galera/r/galera_inject_bf_long_wait.result b/mysql-test/suite/galera/r/galera_inject_bf_long_wait.result index eeacc9ab212..9ee8a4893c4 100644 --- a/mysql-test/suite/galera/r/galera_inject_bf_long_wait.result +++ b/mysql-test/suite/galera/r/galera_inject_bf_long_wait.result @@ -3,8 +3,11 @@ connection node_1; CREATE TABLE t1(id int not null primary key, b int) engine=InnoDB; INSERT INTO t1 VALUES (0,0),(1,1),(2,2),(3,3); BEGIN; +SET DEBUG_SYNC = 'wsrep_after_statement_enter SIGNAL blocked'; UPDATE t1 set b = 100 where id between 1 and 2;; connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET DEBUG_SYNC = 'now WAIT_FOR blocked'; +SET DEBUG_SYNC = 'wsrep_after_statement_enter CLEAR'; connection node_1b; SET @save_dbug = @@SESSION.debug_dbug; SET @@SESSION.innodb_lock_wait_timeout=2; @@ -20,5 +23,6 @@ id b 1 100 2 100 3 3 +SET DEBUG_SYNC = 'RESET'; disconnect node_1b; DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_inject_bf_long_wait.test b/mysql-test/suite/galera/t/galera_inject_bf_long_wait.test index f4aac7fd795..1aeb1981150 100644 --- a/mysql-test/suite/galera/t/galera_inject_bf_long_wait.test +++ b/mysql-test/suite/galera/t/galera_inject_bf_long_wait.test @@ -6,9 +6,14 @@ CREATE TABLE t1(id int not null primary key, b int) engine=InnoDB; INSERT INTO t1 VALUES (0,0),(1,1),(2,2),(3,3); BEGIN; +SET DEBUG_SYNC = 'wsrep_after_statement_enter SIGNAL blocked'; --send UPDATE t1 set b = 100 where id between 1 and 2; --connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1 + +SET DEBUG_SYNC = 'now WAIT_FOR blocked'; +SET DEBUG_SYNC = 'wsrep_after_statement_enter CLEAR'; + --connection node_1b SET @save_dbug = @@SESSION.debug_dbug; SET @@SESSION.innodb_lock_wait_timeout=2; @@ -21,5 +26,6 @@ SET @@SESSION.debug_dbug = @save_dbug; --reap COMMIT; SELECT * FROM t1; +SET DEBUG_SYNC = 'RESET'; --disconnect node_1b DROP TABLE t1; From 7544fd4caeb959bdb573a4b09fbfa225a1ab37a6 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Thu, 20 Feb 2025 00:06:09 +0100 Subject: [PATCH 033/134] fix problem of reallocated string --- sql/filesort.cc | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/sql/filesort.cc b/sql/filesort.cc index af03067257c..a0e16791f89 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -634,6 +634,9 @@ static uchar *read_buffpek_from_file(IO_CACHE *buffpek_pointers, uint count, } #ifndef DBUG_OFF + +static char dbug_row_print_buf[4096]; + /* Print table's current row into a buffer and return a pointer to it. @@ -649,11 +652,9 @@ static uchar *read_buffpek_from_file(IO_CACHE *buffpek_pointers, uint count, const char* dbug_print_row(TABLE *table, const uchar *rec, bool print_names) { Field **pfield; - const size_t alloc_size= 512; - char *row_buff= (char *) alloc_root(&table->mem_root, alloc_size); - char *row_buff_tmp= (char *) alloc_root(&table->mem_root, alloc_size); - String tmp(row_buff_tmp, alloc_size, &my_charset_bin); - String output(row_buff, alloc_size, &my_charset_bin); + char row_buff_tmp[512]; + String tmp(row_buff_tmp, sizeof(row_buff_tmp), &my_charset_bin); + String output(dbug_row_print_buf, sizeof(dbug_row_print_buf), &my_charset_bin); auto move_back_lambda= [table, rec]() mutable { table->move_fields(table->field, table->record[0], rec); @@ -717,8 +718,10 @@ const char* dbug_print_row(TABLE *table, const uchar *rec, bool print_names) } } output.append(")"); - - return output.c_ptr_safe(); + if (output.c_ptr() == dbug_row_print_buf) + return dbug_row_print_buf; + else + return "Couldn't fit into buffer"; } From 3a4c0295ae0973a068eaac5f1edef6c69bbf5e48 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 4 Mar 2025 03:22:19 +0100 Subject: [PATCH 034/134] galera: synchronization between branches and editions --- mysql-test/suite/galera/r/galera_nonPK_and_PA.result | 4 ++-- mysql-test/suite/galera/t/galera_nonPK_and_PA.test | 6 ++---- mysql-test/suite/galera/t/galera_sync_wait_upto.test | 2 -- sql/handler.cc | 6 ++++-- 4 files changed, 8 insertions(+), 10 deletions(-) diff --git a/mysql-test/suite/galera/r/galera_nonPK_and_PA.result b/mysql-test/suite/galera/r/galera_nonPK_and_PA.result index 5ad55417fd1..d440d66e8d7 100644 --- a/mysql-test/suite/galera/r/galera_nonPK_and_PA.result +++ b/mysql-test/suite/galera/r/galera_nonPK_and_PA.result @@ -8,7 +8,7 @@ connection node_2; SET SESSION wsrep_sync_wait = 0; SET GLOBAL wsrep_slave_threads = 2; *************************************************************** -scenario 1, conflicting UPDATE +scenario 1, conflicting UPDATE *************************************************************** SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_slave_enter_sync'; connection node_1; @@ -31,7 +31,7 @@ SET SESSION wsrep_on = 1; SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_slave_enter_sync'; SET GLOBAL wsrep_provider_options = 'dbug='; *************************************************************** -scenario 2, conflicting DELETE +scenario 2, conflicting DELETE *************************************************************** SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_slave_enter_sync'; connection node_1; diff --git a/mysql-test/suite/galera/t/galera_nonPK_and_PA.test b/mysql-test/suite/galera/t/galera_nonPK_and_PA.test index dbd516e9b31..c7592d8fe88 100644 --- a/mysql-test/suite/galera/t/galera_nonPK_and_PA.test +++ b/mysql-test/suite/galera/t/galera_nonPK_and_PA.test @@ -26,7 +26,6 @@ --source include/have_debug_sync.inc --source include/galera_have_debug_sync.inc - # Setup CREATE TABLE t1 (f1 VARCHAR(32) NOT NULL) ENGINE=InnoDB; @@ -44,7 +43,7 @@ SET SESSION wsrep_sync_wait = 0; SET GLOBAL wsrep_slave_threads = 2; --echo *************************************************************** ---echo scenario 1, conflicting UPDATE +--echo scenario 1, conflicting UPDATE --echo *************************************************************** # Set up a synchronization point to catch the first transaction @@ -99,9 +98,8 @@ COMMIT; --source include/galera_signal_sync_point.inc --source include/galera_clear_sync_point.inc - --echo *************************************************************** ---echo scenario 2, conflicting DELETE +--echo scenario 2, conflicting DELETE --echo *************************************************************** # Set up a synchronization point to catch the first transaction diff --git a/mysql-test/suite/galera/t/galera_sync_wait_upto.test b/mysql-test/suite/galera/t/galera_sync_wait_upto.test index aaecd8760f5..56d5aac73a7 100644 --- a/mysql-test/suite/galera/t/galera_sync_wait_upto.test +++ b/mysql-test/suite/galera/t/galera_sync_wait_upto.test @@ -4,7 +4,6 @@ --source include/galera_cluster.inc --source include/have_debug.inc ---source include/have_debug_sync.inc CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); @@ -44,7 +43,6 @@ SELECT WSREP_SYNC_WAIT_UPTO_GTID('1-1-1,1-1-2'); --eval SELECT WSREP_SYNC_WAIT_UPTO_GTID('$wsrep_last_committed_gtid') AS WSREP_SYNC_WAIT_UPTO; --enable_query_log - # Timeout if GTID is not received on time --disable_query_log diff --git a/sql/handler.cc b/sql/handler.cc index 2be0740fdd8..75c79f2bb5a 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -668,6 +668,8 @@ int ha_initialize_handlerton(void *plugin_) DBUG_EXECUTE_IF("unstable_db_type", { static int i= (int) DB_TYPE_FIRST_DYNAMIC; + while (installed_htons[i]) + i++; hton->db_type= (enum legacy_db_type)++i; }); @@ -2164,7 +2166,7 @@ int ha_rollback_trans(THD *thd, bool all) "conf %d wsrep_err %s SQL %s", thd->thread_id, thd->query_id, thd->wsrep_trx().state(), wsrep::to_c_string(thd->wsrep_cs().current_error()), - thd->query()); + wsrep_thd_query(thd)); } #endif /* WITH_WSREP */ } @@ -2180,7 +2182,7 @@ int ha_rollback_trans(THD *thd, bool all) if (WSREP(thd) && thd->is_error()) { WSREP_DEBUG("ha_rollback_trans(%lld, %s) rolled back: msg %s is_real %d wsrep_err %s", - thd->thread_id, all? "TRUE" : "FALSE", + thd->thread_id, all ? "TRUE" : "FALSE", thd->get_stmt_da()->message(), is_real_trans, wsrep::to_c_string(thd->wsrep_cs().current_error())); } From 868bc463c04948b649d907c731ca126b7f68fe4c Mon Sep 17 00:00:00 2001 From: Akshat Nehra Date: Fri, 24 Jan 2025 20:18:46 +0000 Subject: [PATCH 035/134] MDEV-4151 Mixed MySQL/MariaDB references in RPM upgrade error message Update pre-install script to fix package detection and standardize MariaDB/MySQL terminology in messages for improved upgrade reliability and reduced user confusion. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc. --- support-files/rpm/server-prein.sh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/support-files/rpm/server-prein.sh b/support-files/rpm/server-prein.sh index 17cce6b5ba8..af04b343910 100644 --- a/support-files/rpm/server-prein.sh +++ b/support-files/rpm/server-prein.sh @@ -28,10 +28,11 @@ startup script in %{_sysconfdir}/init.d/. if [ "$old_family" != "$new_family" ]; then error_text="$error_text -Upgrading directly from MySQL $old_family to MariaDB $new_family may not -be safe in all cases. A manual dump and restore using mysqldump is -recommended. It is important to review the MariaDB manual's Upgrading -section for version-specific incompatibilities. +Upgrading directly from MariaDB or MySQL $old_family +to MariaDB $new_family may not be safe in all cases. +A manual dump and restore using mariadb-dump (or mysqldump) is recommended. +It is important to review the MariaDB manual's Upgrading section for +version-specific incompatibilities. " fi @@ -39,23 +40,23 @@ section for version-specific incompatibilities. cat <&2 ****************************************************************** -A MySQL or MariaDB server package ($installed) is installed. +A MariaDB or MySQL server package ($installed) is installed. $error_text A manual upgrade is required. - Ensure that you have a complete, working backup of your data and my.cnf files -- Shut down the MySQL server cleanly -- Remove the existing MySQL packages. Usually this command will +- Shut down the MariaDB or MySQL server cleanly +- Remove the existing MariaDB or MySQL packages. Usually this command will list the packages you should remove: - rpm -qa | grep -i '^mysql-' + rpm -qa | grep -iE '^(mariadb|mysql)-' You may choose to use 'rpm --nodeps -ev ' to remove the package which contains the mysqlclient shared library. The library will be reinstalled by the MariaDB-shared package. - Install the new MariaDB packages supplied by $myvendor - Ensure that the MariaDB server is started -- Run the 'mysql_upgrade' program +- Run the 'mariadb-upgrade' program This is a brief description of the upgrade process. Important details can be found in the MariaDB manual, in the Upgrading section. @@ -65,8 +66,8 @@ HERE fi fi -# Create a MySQL user and group. Do not report any problems if it already exists. +# Create a MariaDB user and group. Do not report any problems if it already exists. groupadd -r %{mysqld_group} 2> /dev/null || true -useradd -M -r --home %{mysqldatadir} --shell /sbin/nologin --comment "MySQL server" --gid %{mysqld_group} %{mysqld_user} 2> /dev/null || true +useradd -M -r --home %{mysqldatadir} --shell /sbin/nologin --comment "MariaDB server" --gid %{mysqld_group} %{mysqld_user} 2> /dev/null || true # The user may already exist, make sure it has the proper group nevertheless (BUG#12823) usermod --gid %{mysqld_group} %{mysqld_user} 2> /dev/null || true From cc4d9200c497dc763b9c9bb8855a3ab17e9a9590 Mon Sep 17 00:00:00 2001 From: Monty Date: Wed, 26 Feb 2025 16:32:06 +0200 Subject: [PATCH 036/134] MDEV-33813 ERROR 1021 (HY000): Disk full (./org/test1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device") The problem with MariaDB waiting was fixed earlier. However the server still gives the old error,in case of disk full, that includes "waiting for someone to free some space" even if there is now wait. This commit changes the error message for the non waiting case to: Disk got full writing 'db.table' (Errcode: 28 "No space left on device") Disk got full writing 'test.t1' (Errcode: 28 "No space left on device")Disk got full writing 'test.t1' (Errcode: 28 "No space left on device")Disk got full writing 'test.t1' (Errcode: 28 "No space left on device") --- mysql-test/main/myisam-big.result | 8 ++++++++ mysql-test/main/myisam-big.test | 13 +++++++++++++ mysys/my_pread.c | 9 +++++++++ sql/handler.cc | 8 ++++++-- 4 files changed, 36 insertions(+), 2 deletions(-) diff --git a/mysql-test/main/myisam-big.result b/mysql-test/main/myisam-big.result index fd0bcb1224b..a1e483b4473 100644 --- a/mysql-test/main/myisam-big.result +++ b/mysql-test/main/myisam-big.result @@ -1,4 +1,7 @@ drop table if exists t1,t2; +call mtr.add_suppression("Index.*try to repair it"); +call mtr.add_suppression("Disk got full"); +call mtr.add_suppression("Got an error from thread_id"); create table t1 (id int, sometext varchar(100)) engine=myisam; insert into t1 values (1, "hello"),(2, "hello2"),(4, "hello3"),(4, "hello4"); create table t2 like t1; @@ -43,4 +46,9 @@ connection default; connection con2; disconnect con2; connection default; +SET @saved_dbug = @@SESSION.debug_dbug; +SET debug_dbug='+d,simulate_file_pwrite_error'; +insert into t1 select * from t2; +ERROR HY000: Disk got full writing 'test.t1' (Errcode: 28 "No space left on device") +SET debug_dbug= @saved_dbug; drop table t1,t2; diff --git a/mysql-test/main/myisam-big.test b/mysql-test/main/myisam-big.test index 2fec2450ecd..30267b2b3c7 100644 --- a/mysql-test/main/myisam-big.test +++ b/mysql-test/main/myisam-big.test @@ -1,12 +1,17 @@ # # Test bugs in the MyISAM code that require more space/time --source include/big_test.inc +--source include/have_debug.inc # Initialise --disable_warnings drop table if exists t1,t2; --enable_warnings +call mtr.add_suppression("Index.*try to repair it"); +call mtr.add_suppression("Disk got full"); +call mtr.add_suppression("Got an error from thread_id"); + # # BUG#925377: # Querying myisam table metadata while 'alter table..enable keys' is @@ -61,4 +66,12 @@ connection con2; reap; disconnect con2; connection default; + +# +# Test error message from disk full +SET @saved_dbug = @@SESSION.debug_dbug; +SET debug_dbug='+d,simulate_file_pwrite_error'; +--error ER_DISK_FULL +insert into t1 select * from t2; +SET debug_dbug= @saved_dbug; drop table t1,t2; diff --git a/mysys/my_pread.c b/mysys/my_pread.c index 56cc91ae083..28d7fc18f1b 100644 --- a/mysys/my_pread.c +++ b/mysys/my_pread.c @@ -158,6 +158,15 @@ size_t my_pwrite(int Filedes, const uchar *Buffer, size_t Count, #else writtenbytes= pwrite(Filedes, Buffer, Count, offset); #endif + + DBUG_EXECUTE_IF ("simulate_file_pwrite_error", + if (writtenbytes == Count && + my_seek(Filedes, 0, SEEK_END, MYF(0)) > 1024*1024L) + { + errno= ENOSPC; + writtenbytes= (size_t) -1; + }); + if (writtenbytes == Count) break; my_errno= errno; diff --git a/sql/handler.cc b/sql/handler.cc index ab18414e33f..ed53416157a 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -499,7 +499,7 @@ int ha_init_errors(void) SETMSG(HA_ERR_INDEX_COL_TOO_LONG, ER_DEFAULT(ER_INDEX_COLUMN_TOO_LONG)); SETMSG(HA_ERR_INDEX_CORRUPT, ER_DEFAULT(ER_INDEX_CORRUPT)); SETMSG(HA_FTS_INVALID_DOCID, "Invalid InnoDB FTS Doc ID"); - SETMSG(HA_ERR_DISK_FULL, ER_DEFAULT(ER_DISK_FULL)); + SETMSG(HA_ERR_DISK_FULL, "Disk got full writing '%s'"); SETMSG(HA_ERR_FTS_TOO_MANY_WORDS_IN_PHRASE, "Too many words in a FTS phrase or proximity search"); SETMSG(HA_ERR_FK_DEPTH_EXCEEDED, "Foreign key cascade delete/update exceeds"); SETMSG(HA_ERR_TABLESPACE_MISSING, ER_DEFAULT(ER_TABLESPACE_MISSING)); @@ -4456,8 +4456,12 @@ void handler::print_error(int error, myf errflag) break; case ENOSPC: case HA_ERR_DISK_FULL: - textno= ER_DISK_FULL; SET_FATAL_ERROR; // Ensure error is logged + my_printf_error(ER_DISK_FULL, "Disk got full writing '%s.%s' (Errcode: %M)", + MYF(errflag | ME_ERROR_LOG), + table_share->db.str, table_share->table_name.str, + error); + DBUG_VOID_RETURN; break; case HA_ERR_KEY_NOT_FOUND: case HA_ERR_NO_ACTIVE_RECORD: From 0331f1fff7346c87072ac7469399b517b9a705f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 7 Mar 2025 10:52:59 +0200 Subject: [PATCH 037/134] =?UTF-8?q?MDEV-36227=20Race=20condition=20between?= =?UTF-8?q?=20ALTER=20TABLE=E2=80=A6EXCHANGE=20PARTITION=20and=20SELECT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In commit 6e6a1b316ca8df5116613fbe4ca2dc37b3c73bd1 (MDEV-35000) a race condition was exposed. ha_innobase::check_if_incompatible_data(): If the statistics have already been initialized for the table, skip the invocation of innobase_copy_frm_flags_from_create_info() in order to avoid unexpectedly ruining things for other threads that are concurrently accessing the table. dict_stats_save(): Add debug instrumentation that is necessary for reproducing the interlocking of the failure scenario. --- .../innodb/r/alter_partitioned_debug.result | 26 +++++++++++- .../innodb/t/alter_partitioned_debug.test | 42 ++++++++++++++++++- storage/innobase/dict/dict0stats.cc | 7 ++++ storage/innobase/handler/ha_innodb.cc | 7 +++- 4 files changed, 77 insertions(+), 5 deletions(-) diff --git a/mysql-test/suite/innodb/r/alter_partitioned_debug.result b/mysql-test/suite/innodb/r/alter_partitioned_debug.result index d2ec602c6d7..29a6e5822c5 100644 --- a/mysql-test/suite/innodb/r/alter_partitioned_debug.result +++ b/mysql-test/suite/innodb/r/alter_partitioned_debug.result @@ -1,4 +1,5 @@ CREATE TABLE t1 (a INT, b VARCHAR(10)) ENGINE=InnoDB +STATS_PERSISTENT=1 STATS_AUTO_RECALC=0 PARTITION BY RANGE(a) (PARTITION pa VALUES LESS THAN (3), PARTITION pb VALUES LESS THAN (5)); @@ -19,9 +20,30 @@ connection ddl; ERROR 23000: Duplicate entry '2-two' for key 'a' connection default; DELETE FROM t1; -disconnect ddl; SET DEBUG_SYNC = 'RESET'; CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK -DROP TABLE t1; +CREATE TABLE t(a INT, b VARCHAR(10)) ENGINE=InnoDB +STATS_PERSISTENT=1 STATS_AUTO_RECALC=1; +RENAME TABLE t TO u; +DELETE FROM mysql.innodb_table_stats WHERE table_name='u'; +DELETE FROM mysql.innodb_index_stats WHERE table_name='u'; +SET STATEMENT debug_dbug='+d,dict_stats_save_exit_notify_and_wait' FOR +SELECT * FROM u; +connection ddl; +SET DEBUG_SYNC='open_tables_after_open_and_process_table +WAIT_FOR dict_stats_save_finished'; +ALTER TABLE t1 EXCHANGE PARTITION pb WITH TABLE u; +connect sync,localhost,root; +SET DEBUG_SYNC='now SIGNAL dict_stats_save_unblock'; +disconnect sync; +connection default; +a b +connection ddl; +disconnect ddl; +connection default; +SELECT * FROM u; +a b +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1,u; diff --git a/mysql-test/suite/innodb/t/alter_partitioned_debug.test b/mysql-test/suite/innodb/t/alter_partitioned_debug.test index 34565e12036..cac5f960e01 100644 --- a/mysql-test/suite/innodb/t/alter_partitioned_debug.test +++ b/mysql-test/suite/innodb/t/alter_partitioned_debug.test @@ -4,6 +4,7 @@ --source include/have_debug_sync.inc CREATE TABLE t1 (a INT, b VARCHAR(10)) ENGINE=InnoDB +STATS_PERSISTENT=1 STATS_AUTO_RECALC=0 PARTITION BY RANGE(a) (PARTITION pa VALUES LESS THAN (3), PARTITION pb VALUES LESS THAN (5)); @@ -26,9 +27,46 @@ reap; connection default; DELETE FROM t1; -disconnect ddl; SET DEBUG_SYNC = 'RESET'; CHECK TABLE t1; -DROP TABLE t1; + +CREATE TABLE t(a INT, b VARCHAR(10)) ENGINE=InnoDB +STATS_PERSISTENT=1 STATS_AUTO_RECALC=1; +RENAME TABLE t TO u; +DELETE FROM mysql.innodb_table_stats WHERE table_name='u'; +DELETE FROM mysql.innodb_index_stats WHERE table_name='u'; + +send SET STATEMENT debug_dbug='+d,dict_stats_save_exit_notify_and_wait' FOR +SELECT * FROM u; + +connection ddl; +SET DEBUG_SYNC='open_tables_after_open_and_process_table +WAIT_FOR dict_stats_save_finished'; +send ALTER TABLE t1 EXCHANGE PARTITION pb WITH TABLE u; + +connect sync,localhost,root; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = 'debug sync point: now' + and info like 'SET STATEMENT debug_dbug%SELECT * FROM u'; +--source include/wait_condition.inc +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = 'Waiting for table metadata lock' + and info like 'ALTER TABLE t1 EXCHANGE PARTITION pb WITH TABLE u'; +--source include/wait_condition.inc +SET DEBUG_SYNC='now SIGNAL dict_stats_save_unblock'; +disconnect sync; + +connection default; +reap; +connection ddl; +reap; +disconnect ddl; +connection default; +SELECT * FROM u; +SET DEBUG_SYNC = 'RESET'; + +DROP TABLE t1,u; diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc index 9cdc62bc49d..bbfa94e09a8 100644 --- a/storage/innobase/dict/dict0stats.cc +++ b/storage/innobase/dict/dict0stats.cc @@ -2887,6 +2887,13 @@ dberr_t dict_stats_save(dict_table_t* table, index_id_t index_id) STRING_WITH_LEN("now SIGNAL dict_stats_save_finished")); }); ); + DBUG_EXECUTE_IF("dict_stats_save_exit_notify_and_wait", + SCOPE_EXIT([] { + debug_sync_set_action(current_thd, + STRING_WITH_LEN("now SIGNAL dict_stats_save_finished" + " WAIT_FOR dict_stats_save_unblock")); + }); + ); #endif /* ENABLED_DEBUG_SYNC */ if (high_level_read_only) { diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 427be74e9c3..665661d28c1 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -17424,7 +17424,12 @@ ha_innobase::check_if_incompatible_data( param_new = info->option_struct; param_old = table->s->option_struct; - innobase_copy_frm_flags_from_create_info(m_prebuilt->table, info); + m_prebuilt->table->stats_mutex_lock(); + if (!m_prebuilt->table->stat_initialized()) { + innobase_copy_frm_flags_from_create_info( + m_prebuilt->table, info); + } + m_prebuilt->table->stats_mutex_unlock(); if (table_changes != IS_EQUAL_YES) { From e1277845a470fbfb090365e3f172cfdd1000cdf6 Mon Sep 17 00:00:00 2001 From: KhaledR57 Date: Sat, 8 Mar 2025 21:19:29 +0200 Subject: [PATCH 038/134] MDEV-36206: Fix mysqld deprecation warning When running mariabackup with --prepare --export options, a deprecation warning appears because the program name is set to "mysqld" instead of "mariadbd" The fix ensures that when running in mysqld mode, we properly set the program name to "mariadbd" to avoid the deprecation warning while maintaining the original functionality --- extra/mariabackup/xtrabackup.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 543052f0e49..e807cab5d25 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -2119,7 +2119,7 @@ static int prepare_export() if (strncmp(orig_argv1,"--defaults-file=", 16) == 0) { snprintf(cmdline, sizeof cmdline, - IF_WIN("\"","") "\"%s\" --mysqld \"%s\"" + IF_WIN("\"","") "\"%s\" --mariadbd \"%s\"" " --defaults-extra-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=." " --innodb --innodb-fast-shutdown=0 --loose-partition" " --innodb-buffer-pool-size=%llu" @@ -2133,7 +2133,7 @@ static int prepare_export() else { snprintf(cmdline, sizeof cmdline, - IF_WIN("\"","") "\"%s\" --mysqld" + IF_WIN("\"","") "\"%s\" --mariadbd" " --defaults-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=." " --innodb --innodb-fast-shutdown=0 --loose-partition" " --innodb-buffer-pool-size=%llu" @@ -7528,9 +7528,9 @@ int main(int argc, char **argv) { /* In "prepare export", we need to start mysqld Since it is not always be installed on the machine, - we start "mariabackup --mysqld", which acts as mysqld + we start "mariabackup --mariadbd", which acts as mysqld */ - if (strcmp(argv[1], "--mysqld") == 0) + if (strcmp(argv[1], "--mariadbd") == 0) { srv_operation= SRV_OPERATION_EXPORT_RESTORED; extern int mysqld_main(int argc, char **argv); From 1331c7324326c3707536d9aa77fc789c8581c7d7 Mon Sep 17 00:00:00 2001 From: Monty Date: Thu, 27 Feb 2025 10:24:05 +0200 Subject: [PATCH 039/134] Moved server_threads.erase(thd) to end of handle_slave_sql() The effect is that 'show processlist' will show the Slave SQL thread until the thread ends. This may help finding cases where the Slave SQL thread could hang for some time during the cleanup part. The Slave SQL thread will have the state "Slave SQL thread ending' during this stage. Reviewed-by: Kristian Nielsen --- sql/mysqld.cc | 2 ++ sql/mysqld.h | 1 + sql/slave.cc | 6 +++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 3495a300321..f1e7b786221 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -9209,6 +9209,7 @@ PSI_stage_info stage_preparing= { 0, "Preparing", 0}; PSI_stage_info stage_purging_old_relay_logs= { 0, "Purging old relay logs", 0}; PSI_stage_info stage_query_end= { 0, "Query end", 0}; PSI_stage_info stage_starting_cleanup= { 0, "Starting cleanup", 0}; +PSI_stage_info stage_slave_sql_cleanup= { 0, "Slave SQL thread ending", 0}; PSI_stage_info stage_rollback= { 0, "Rollback", 0}; PSI_stage_info stage_rollback_implicit= { 0, "Rollback_implicit", 0}; PSI_stage_info stage_commit= { 0, "Commit", 0}; @@ -9442,6 +9443,7 @@ PSI_stage_info *all_server_stages[]= & stage_preparing, & stage_purging_old_relay_logs, & stage_starting_cleanup, + & stage_slave_sql_cleanup, & stage_query_end, & stage_queueing_master_event_to_the_relay_log, & stage_reading_event_from_the_relay_log, diff --git a/sql/mysqld.h b/sql/mysqld.h index 66b2a757c14..41dea67707d 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -604,6 +604,7 @@ extern PSI_stage_info stage_preparing; extern PSI_stage_info stage_purging_old_relay_logs; extern PSI_stage_info stage_query_end; extern PSI_stage_info stage_starting_cleanup; +extern PSI_stage_info stage_slave_sql_cleanup; extern PSI_stage_info stage_rollback; extern PSI_stage_info stage_rollback_implicit; extern PSI_stage_info stage_commit; diff --git a/sql/slave.cc b/sql/slave.cc index 90680144426..149b6c47bbe 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -5404,6 +5404,7 @@ pthread_handler_t handle_slave_sql(void *arg) THD *thd; /* needs to be first for thread_stack */ char saved_log_name[FN_REFLEN]; char saved_master_log_name[FN_REFLEN]; + bool thd_initialized= 0; my_off_t UNINIT_VAR(saved_log_pos); my_off_t UNINIT_VAR(saved_master_log_pos); String saved_skip_gtid_pos; @@ -5506,6 +5507,7 @@ pthread_handler_t handle_slave_sql(void *arg) thd->variables.alter_algorithm= (ulong) Alter_info::ALTER_TABLE_ALGORITHM_DEFAULT; server_threads.insert(thd); + thd_initialized= 1; /* We are going to set slave_running to 1. Assuming slave I/O thread is alive and connected, this is going to make Seconds_Behind_Master be 0 @@ -5883,7 +5885,7 @@ pthread_handler_t handle_slave_sql(void *arg) } THD_STAGE_INFO(thd, stage_waiting_for_slave_mutex_on_exit); thd->add_status_to_global(); - server_threads.erase(thd); + THD_STAGE_INFO(thd, stage_slave_sql_cleanup); mysql_mutex_lock(&rli->run_lock); err_during_init: @@ -5954,6 +5956,8 @@ err_during_init: rpl_parallel_resize_pool_if_no_slaves(); delete serial_rgi; + if (thd_initialized) + server_threads.erase(thd); delete thd; DBUG_LEAVE; // Must match DBUG_ENTER() From b12e8d90955179f43bc0c4aa46c3e4d0522fb603 Mon Sep 17 00:00:00 2001 From: Monty Date: Mon, 3 Mar 2025 12:27:43 +0200 Subject: [PATCH 040/134] MENT-2235 Aria engine: log initialization failed Some thing causes the aria_log_control file to be larger than the expected 52 bytes. The control file has the correct information but somehow it is filled up with ox00 bytes up to 512 bytes. This could have happened in case of a file system crash that enlarged the file to the sector boundary. Fixed that aria will ignore bytes outside of it's expected Other things: - Fixed wrong DBUG_ASSERT() in my_malloc_size_cb_func() that could cause crashes in debug binaries during Aria recovery. --- sql/mysqld.cc | 10 ++++---- storage/maria/ma_control_file.c | 45 +++++++++++++++++++++++++++++---- 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/sql/mysqld.cc b/sql/mysqld.cc index f1e7b786221..3d63fc82afd 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -3635,12 +3635,12 @@ static void my_malloc_size_cb_func(long long size, my_bool is_thread_specific) #endif /* - When thread specific is set, both mysqld_server_initialized and thd - must be set, and we check that with DBUG_ASSERT. - - However, do not crash, if current_thd is NULL, in release version. + is_thread_specific is only relevant when a THD exist and the server + has fully started. is_thread_specific can be set during recovery by + Aria for functions that are normally only run in one thread. + However InnoDB sets thd early, so we can use it. */ - DBUG_ASSERT(!is_thread_specific || (mysqld_server_initialized && thd)); + DBUG_ASSERT(!is_thread_specific || thd || !plugins_are_initialized); if (is_thread_specific && likely(thd)) /* If thread specific memory */ { diff --git a/storage/maria/ma_control_file.c b/storage/maria/ma_control_file.c index a6daa8bef24..76b0ec2c0b7 100644 --- a/storage/maria/ma_control_file.c +++ b/storage/maria/ma_control_file.c @@ -275,7 +275,7 @@ CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing, my_bool wait_for_lock) { uchar buffer[CF_MAX_SIZE]; - char name[FN_REFLEN], errmsg_buff[256]; + char name[FN_REFLEN], errmsg_buff[512]; const char *errmsg, *lock_failed_errmsg= "Could not get an exclusive lock;" " file is probably in use by another process"; uint new_cf_create_time_size, new_cf_changeable_size, new_block_size; @@ -399,10 +399,14 @@ CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing, if (new_cf_create_time_size < CF_MIN_CREATE_TIME_TOTAL_SIZE || new_cf_changeable_size < CF_MIN_CHANGEABLE_TOTAL_SIZE || - new_cf_create_time_size + new_cf_changeable_size != file_size) + new_cf_create_time_size + new_cf_changeable_size > file_size) { error= CONTROL_FILE_INCONSISTENT_INFORMATION; - errmsg= "Sizes stored in control file are inconsistent"; + sprintf(errmsg_buff, + "Sizes stored in control file are inconsistent. " + "create_time_size: %u changeable_size: %u file_size: %llu", + new_cf_create_time_size, new_cf_changeable_size, (ulonglong) file_size); + errmsg= errmsg_buff; goto err; } @@ -613,6 +617,20 @@ my_bool ma_control_file_inited(void) return (control_file_fd >= 0); } + + +static int check_zerofill(uchar *buffer, ulonglong offset, ulonglong length) +{ + uchar *pos= buffer + offset, *end= buffer+length; + while (pos < end) + { + if (*pos++) + return 1; + } + return 0; +} + + /** Print content of aria_log_control file */ @@ -620,6 +638,7 @@ my_bool ma_control_file_inited(void) my_bool print_aria_log_control() { uchar buffer[CF_MAX_SIZE]; + char errmsg_buff[512]; char name[FN_REFLEN], uuid_str[MY_UUID_STRING_LENGTH+1]; const char *errmsg; uint new_cf_create_time_size, new_cf_changeable_size; @@ -696,10 +715,14 @@ my_bool print_aria_log_control() if (new_cf_create_time_size < CF_MIN_CREATE_TIME_TOTAL_SIZE || new_cf_changeable_size < CF_MIN_CHANGEABLE_TOTAL_SIZE || - new_cf_create_time_size + new_cf_changeable_size != file_size) + new_cf_create_time_size + new_cf_changeable_size > file_size) { error= CONTROL_FILE_INCONSISTENT_INFORMATION; - errmsg= "Sizes stored in control file are inconsistent"; + sprintf(errmsg_buff, + "Sizes stored in control file are inconsistent. " + "create_time_size: %u changeable_size: %u file_size: %llu", + new_cf_create_time_size, new_cf_changeable_size, (ulonglong) file_size); + errmsg= errmsg_buff; goto err; } checkpoint_lsn= lsn_korr(buffer + new_cf_create_time_size + @@ -723,6 +746,18 @@ my_bool print_aria_log_control() (buffer + new_cf_create_time_size + CF_RECOV_FAIL_OFFSET)[0]; printf("recovery_failures: %u\n", recovery_fails); } + if (check_zerofill(buffer, new_cf_create_time_size + new_cf_changeable_size, file_size)) + { + printf("Warning: %s file_size is %llu (should be %llu) and contains unknown data.\n" + "It will still work but should be examined.\n", + name, (ulonglong) file_size, + (ulonglong) (new_cf_create_time_size + new_cf_changeable_size)); + } + else if (new_cf_create_time_size + new_cf_changeable_size < file_size) + printf("Note: file_size (%llu) is bigger than the expected file size %llu.\n" + "This is unexpected but will not cause any issues.\n", + (ulonglong) file_size, + (ulonglong) (new_cf_create_time_size + new_cf_changeable_size)); mysql_file_close(file, MYF(0)); DBUG_RETURN(0); From 64a14588477245c2a64a202c20ef80a88be0302f Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 7 Mar 2025 19:24:10 +0200 Subject: [PATCH 041/134] Ensure that ER_CONNECTION_KILLED error message is not lost my_real_read() detects if the connection was killed and sets error to ER_CONNECTION_KILLED. However net_real_write() overrides the error with ER_NET_READ_INTERRUPTED or ER_NET_READ_ERROR when it tries to send the 'Connection was killed' to the user on a closed connection. Fixed by not overwriting the original error code if the connection was shutdown. Rewiewed-by: Kristian Nielsen --- sql/net_serv.cc | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/sql/net_serv.cc b/sql/net_serv.cc index e0fad74288a..35b2a24a2d2 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -773,18 +773,22 @@ net_real_write(NET *net,const uchar *packet, size_t len) } #endif /* !defined(MYSQL_SERVER) */ net->error= 2; /* Close socket */ - net->last_errno= (interrupted ? ER_NET_WRITE_INTERRUPTED : - ER_NET_ERROR_ON_WRITE); -#ifdef MYSQL_SERVER - if (global_system_variables.log_warnings > 3) + + if (net->vio->state != VIO_STATE_SHUTDOWN || net->last_errno == 0) { - sql_print_warning("Could not write packet: fd: %lld state: %d " - "errno: %d vio_errno: %d length: %ld", - (longlong) vio_fd(net->vio), (int) net->vio->state, - vio_errno(net->vio), net->last_errno, - (ulong) (end-pos)); - } + net->last_errno= (interrupted ? ER_NET_WRITE_INTERRUPTED : + ER_NET_ERROR_ON_WRITE); +#ifdef MYSQL_SERVER + if (global_system_variables.log_warnings > 3) + { + sql_print_warning("Could not write packet: fd: %lld state: %d " + "errno: %d vio_errno: %d length: %ld", + (longlong) vio_fd(net->vio), (int) net->vio->state, + vio_errno(net->vio), net->last_errno, + (ulong) (end-pos)); + } #endif + } MYSQL_SERVER_my_error(net->last_errno, MYF(0)); break; } From eef94c9d460019c05daffea9cbe0009e3556cf5d Mon Sep 17 00:00:00 2001 From: Monty Date: Sun, 9 Mar 2025 14:34:54 +0200 Subject: [PATCH 042/134] MDEV-36248 Connect crashes server because of duplicate 'free()' in GetUser If connect engineis not able to allocate connect_work_space memory for GetUser() it will call free() twice with the same value (g). g was freed first in user_connect::user_init() which calls PlugExit() on errors and then again in ~user_connect() which also calls PlugExit(). Fixed by setting g to 0 in user_init() after calling PlugExit() This code was tested 'by hand' by setting connect.work_space=600G Other things: - Removed some very old not relevant comments in touched code - Added comments to clarify how some memory was freed - Fixed indentation in changed functions. --- storage/connect/connect.cc | 8 ++++---- storage/connect/user_connect.cc | 19 ++++++++----------- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/storage/connect/connect.cc b/storage/connect/connect.cc index 72b12552b95..9cd142e9efa 100644 --- a/storage/connect/connect.cc +++ b/storage/connect/connect.cc @@ -92,11 +92,11 @@ void CntEndDB(PGLOBAL g) free(dbuserp); - if (trace(1)) - htrc("CntEndDB: Freeing Dup\n"); + if (trace(1)) + htrc("CntEndDB: Freeing Dup\n"); - g->Activityp->Aptr = NULL; - } // endif dbuserp + g->Activityp->Aptr = NULL; // Free PlgGetUser() data + } // endif dbuserp } // end of CntEndDB diff --git a/storage/connect/user_connect.cc b/storage/connect/user_connect.cc index ba446a3e2f3..23acd173f6b 100644 --- a/storage/connect/user_connect.cc +++ b/storage/connect/user_connect.cc @@ -101,9 +101,6 @@ bool user_connect::user_init() PACTIVITY ap= NULL; PDBUSER dup= NULL; - // Areasize= 64M because of VEC tables. Should be parameterisable -//g= PlugInit(NULL, 67108864); -//g= PlugInit(NULL, 134217728); // 128M was because of old embedded tests g= PlugInit(NULL, (size_t)worksize); // Check whether the initialization is complete @@ -113,12 +110,13 @@ bool user_connect::user_init() printf("%s\n", g->Message); (void) PlugExit(g); + g= 0; - if (dup) - free(dup); + if (dup) + free(dup); return true; - } // endif g-> + } // endif g-> dup->Catalog= new MYCAT(NULL); @@ -128,17 +126,16 @@ bool user_connect::user_init() g->Activityp= ap; g->Activityp->Aptr= dup; - pthread_mutex_lock(&usrmut); + pthread_mutex_lock(&usrmut); next= to_users; to_users= this; if (next) next->previous= this; - count = 1; - pthread_mutex_unlock(&usrmut); - - last_query_id= thdp->query_id; + count = 1; + pthread_mutex_unlock(&usrmut); + last_query_id= thdp->query_id; return false; } // end of user_init From 5b686cc8f99806dbd36653dc518f8cad0e0f3fd8 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Mon, 10 Mar 2025 11:11:50 +0530 Subject: [PATCH 043/134] MDEV-36253 Redundant check in wf_incremental_process() - Remove the redundant check of TRX_SYS page change in wf_incremental_process() - Remove the double casting of srv_undo_tablespaces in write_backup_config_file() - Remove the unused variables like checkpoint_lsn_start and checkpoint_no_start. This is a regression which caused by commit 1c55b845e0fe337e647ba230288ed13e966cb7c7. --- extra/mariabackup/backup_mysql.cc | 2 +- extra/mariabackup/write_filt.cc | 12 ------------ extra/mariabackup/xtrabackup.cc | 2 -- 3 files changed, 1 insertion(+), 15 deletions(-) diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc index d95b8f8f452..1d61d33468a 100644 --- a/extra/mariabackup/backup_mysql.cc +++ b/extra/mariabackup/backup_mysql.cc @@ -1893,7 +1893,7 @@ bool write_backup_config_file(ds_ctxt *datasink) srv_log_file_size, srv_page_size, srv_undo_dir, - (uint) srv_undo_tablespaces, + srv_undo_tablespaces, page_zip_level, innobase_buffer_pool_filename ? "innodb_buffer_pool_filename=" : "", diff --git a/extra/mariabackup/write_filt.cc b/extra/mariabackup/write_filt.cc index 13f19ca6b6a..052cea26ef6 100644 --- a/extra/mariabackup/write_filt.cc +++ b/extra/mariabackup/write_filt.cc @@ -144,18 +144,6 @@ wf_incremental_process(xb_write_filt_ctxt_t *ctxt, ds_file_t *dstfile) return false; } - /* Check whether TRX_SYS page has been changed */ - if (mach_read_from_4(page + FIL_PAGE_SPACE_ID) - == TRX_SYS_SPACE - && mach_read_from_4(page + FIL_PAGE_OFFSET) - == TRX_SYS_PAGE_NO) { - msg(cursor->thread_n, - "--incremental backup is impossible if " - "the server had been restarted with " - "different innodb_undo_tablespaces."); - return false; - } - /* updated page */ if (cp->npages == page_size / 4) { /* flush buffer */ diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 5ad77e3d682..3be0287b0eb 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -201,8 +201,6 @@ struct xb_filter_entry_t{ xb_filter_entry_t *name_hash; }; -lsn_t checkpoint_lsn_start; -lsn_t checkpoint_no_start; /** whether log_copying_thread() is active; protected by recv_sys.mutex */ static bool log_copying_running; /** for --backup, target LSN to copy the log to; protected by recv_sys.mutex */ From 652f33e0a44661d6093993d49d3e83d770904413 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 10 Mar 2025 08:48:43 +0200 Subject: [PATCH 044/134] MDEV-30000: Force an InnoDB checkpoint in mariadb-backup At the start of mariadb-backup --backup, trigger a flush of the InnoDB buffer pool, so that as little log as possible will have to be copied. The previously debug-build-only interface SET GLOBAL innodb_log_checkpoint_now=ON; will be made available on all builds, and mariadb-backup --backup will invoke it, unless the option --skip-innodb-log-checkpoint-now is specified. Reviewed by: Vladislav Vaintroub --- extra/mariabackup/xtrabackup.cc | 22 +++++++++++++++++++ .../suite/encryption/t/doublewrite_debug.test | 2 +- .../suite/mariabackup/full_backup.result | 5 +++++ mysql-test/suite/mariabackup/full_backup.test | 3 +++ mysql-test/suite/mariabackup/partial.result | 4 ++-- .../suite/mariabackup/partial_exclude.result | 2 +- .../suite/mariabackup/unsupported_redo.result | 4 ++-- .../suite/sys_vars/r/sysvars_innodb.result | 2 +- storage/innobase/handler/ha_innodb.cc | 14 +++++++----- 9 files changed, 45 insertions(+), 13 deletions(-) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 3be0287b0eb..bea6e064eb6 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -1381,6 +1381,7 @@ enum options_xtrabackup OPT_XTRA_MYSQLD_ARGS, OPT_XB_IGNORE_INNODB_PAGE_CORRUPTION, OPT_INNODB_FORCE_RECOVERY, + OPT_INNODB_CHECKPOINT, OPT_ARIA_LOG_DIR_PATH }; @@ -1790,6 +1791,8 @@ extern const char *io_uring_may_be_unsafe; bool innodb_use_native_aio_default(); #endif +static my_bool innodb_log_checkpoint_now; + struct my_option xb_server_options[] = { {"datadir", 'h', "Path to the database root.", (G_PTR*) &mysql_data_home, @@ -2017,6 +2020,12 @@ struct my_option xb_server_options[] = (G_PTR*)&srv_force_recovery, 0, GET_ULONG, OPT_ARG, 0, 0, SRV_FORCE_IGNORE_CORRUPT, 0, 0, 0}, + {"innodb_log_checkpoint_now", OPT_INNODB_CHECKPOINT, + "(for --backup): Force an InnoDB checkpoint", + (G_PTR*)&innodb_log_checkpoint_now, + (G_PTR*)&innodb_log_checkpoint_now, + 0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0}, + {"mysqld-args", OPT_XTRA_MYSQLD_ARGS, "All arguments that follow this argument are considered as server " "options, and if some of them are not supported by mariabackup, they " @@ -5403,6 +5412,14 @@ static bool xtrabackup_backup_func() } msg("cd to %s", mysql_real_data_home); encryption_plugin_backup_init(mysql_connection); + if (innodb_log_checkpoint_now != false && mysql_send_query( + mysql_connection, + C_STRING_WITH_LEN("SET GLOBAL " + "innodb_log_checkpoint_now=ON;"))) { + msg("initiating checkpoint failed"); + return(false); + } + msg("open files limit requested %lu, set to %lu", xb_open_files_limit, xb_set_max_open_files(xb_open_files_limit)); @@ -5515,6 +5532,11 @@ fail: goto fail; } + /* try to wait for a log checkpoint, but do not fail if the + server does not support this */ + if (innodb_log_checkpoint_now != false) { + mysql_read_query_result(mysql_connection); + } /* label it */ recv_sys.file_checkpoint = log_sys.next_checkpoint_lsn; log_hdr_init(); diff --git a/mysql-test/suite/encryption/t/doublewrite_debug.test b/mysql-test/suite/encryption/t/doublewrite_debug.test index 761f9cd3e47..608c61c6e69 100644 --- a/mysql-test/suite/encryption/t/doublewrite_debug.test +++ b/mysql-test/suite/encryption/t/doublewrite_debug.test @@ -41,7 +41,7 @@ insert into t2 values (6, repeat('%', 400)); # Copy the t1.ibd, t2.ibd file let $targetdir=$MYSQLTEST_VARDIR/tmp/backup_1; --disable_result_log -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --skip-innodb-log-checkpoint-now --target-dir=$targetdir; --enable_result_log echo # xtrabackup prepare; diff --git a/mysql-test/suite/mariabackup/full_backup.result b/mysql-test/suite/mariabackup/full_backup.result index 71525c22080..936fdce0db2 100644 --- a/mysql-test/suite/mariabackup/full_backup.result +++ b/mysql-test/suite/mariabackup/full_backup.result @@ -1,7 +1,12 @@ CREATE TABLE t(i INT) ENGINE INNODB; INSERT INTO t VALUES(1); +SET GLOBAL innodb_max_purge_lag_wait=0; # xtrabackup backup NOT FOUND /InnoDB: Allocated tablespace ID/ in backup.log +SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY'; +variable_value +0 INSERT INTO t VALUES(2); # xtrabackup prepare # shutdown server diff --git a/mysql-test/suite/mariabackup/full_backup.test b/mysql-test/suite/mariabackup/full_backup.test index d3d3661ce6c..55dce51a088 100644 --- a/mysql-test/suite/mariabackup/full_backup.test +++ b/mysql-test/suite/mariabackup/full_backup.test @@ -2,6 +2,7 @@ CREATE TABLE t(i INT) ENGINE INNODB; INSERT INTO t VALUES(1); +SET GLOBAL innodb_max_purge_lag_wait=0; echo # xtrabackup backup; let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; --let $backup_log=$MYSQLTEST_VARDIR/tmp/backup.log @@ -18,6 +19,8 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir= --source include/search_pattern_in_file.inc --remove_file $backup_log +SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY'; INSERT INTO t VALUES(2); diff --git a/mysql-test/suite/mariabackup/partial.result b/mysql-test/suite/mariabackup/partial.result index 9ff3a20c01f..cefda922868 100644 --- a/mysql-test/suite/mariabackup/partial.result +++ b/mysql-test/suite/mariabackup/partial.result @@ -4,8 +4,8 @@ CREATE TABLE t21(i INT) ENGINE INNODB; INSERT INTO t21 VALUES(1); CREATE TABLE t2(i int) ENGINE INNODB; # xtrabackup backup -t1.new -t21.new +t1.ibd +t21.ibd # xtrabackup prepare t1.cfg t21.cfg diff --git a/mysql-test/suite/mariabackup/partial_exclude.result b/mysql-test/suite/mariabackup/partial_exclude.result index f57a5f63e68..9f4c1042d93 100644 --- a/mysql-test/suite/mariabackup/partial_exclude.result +++ b/mysql-test/suite/mariabackup/partial_exclude.result @@ -14,7 +14,7 @@ INSERT INTO test.t1 VALUES(20); INSERT INTO test.t2 VALUES(20); # xtrabackup backup COMMIT; -t1.new +t1.ibd DROP TABLE t1; DROP TABLE t2; DROP DATABASE db2; diff --git a/mysql-test/suite/mariabackup/unsupported_redo.result b/mysql-test/suite/mariabackup/unsupported_redo.result index 4ba40f5a916..f2cfcc730e5 100644 --- a/mysql-test/suite/mariabackup/unsupported_redo.result +++ b/mysql-test/suite/mariabackup/unsupported_redo.result @@ -22,8 +22,8 @@ CREATE TABLE t2(i int) ENGINE INNODB; ALTER TABLE t21 FORCE, ALGORITHM=INPLACE; # Create partial backup (excluding table t21), Ignore the # unsupported redo log for the table t21. -t1.new -t2.new +t1.ibd +t2.ibd # Prepare the full backup t1.ibd t2.ibd diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index a82eab33313..1923357c0e6 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -1020,7 +1020,7 @@ SESSION_VALUE NULL DEFAULT_VALUE OFF VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT Force checkpoint now +VARIABLE_COMMENT Write back dirty pages from the buffer pool and update the log checkpoint NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 665661d28c1..966e71c17f6 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -18520,13 +18520,13 @@ static void innodb_buf_pool_update(THD *thd, st_mysql_sys_var *, mysql_mutex_unlock(&buf_pool.mutex); } +static my_bool innodb_log_checkpoint_now; #ifdef UNIV_DEBUG -static my_bool innodb_log_checkpoint_now = TRUE; static my_bool innodb_buf_flush_list_now = TRUE; static uint innodb_merge_threshold_set_all_debug = DICT_INDEX_MERGE_THRESHOLD_DEFAULT; +#endif -/** Force an InnoDB log checkpoint. */ /** Force an InnoDB log checkpoint. */ static void @@ -18552,13 +18552,15 @@ checkpoint_now_set(THD* thd, st_mysql_sys_var*, void*, const void *save) ? SIZE_OF_FILE_CHECKPOINT + 8 : SIZE_OF_FILE_CHECKPOINT; mysql_mutex_unlock(&LOCK_global_system_variables); lsn_t lsn; - while (log_sys.last_checkpoint_lsn.load(std::memory_order_acquire) + size < + while (!thd_kill_level(thd) && + log_sys.last_checkpoint_lsn.load(std::memory_order_acquire) + size < (lsn= log_sys.get_lsn(std::memory_order_acquire))) log_make_checkpoint(); mysql_mutex_lock(&LOCK_global_system_variables); } +#ifdef UNIV_DEBUG /****************************************************************//** Force a dirty pages flush now. */ static @@ -19130,12 +19132,12 @@ static MYSQL_SYSVAR_ULONG(io_capacity_max, srv_max_io_capacity, SRV_MAX_IO_CAPACITY_DUMMY_DEFAULT, 100, SRV_MAX_IO_CAPACITY_LIMIT, 0); -#ifdef UNIV_DEBUG static MYSQL_SYSVAR_BOOL(log_checkpoint_now, innodb_log_checkpoint_now, PLUGIN_VAR_OPCMDARG, - "Force checkpoint now", + "Write back dirty pages from the buffer pool and update the log checkpoint", NULL, checkpoint_now_set, FALSE); +#ifdef UNIV_DEBUG static MYSQL_SYSVAR_BOOL(buf_flush_list_now, innodb_buf_flush_list_now, PLUGIN_VAR_OPCMDARG, "Force dirty page flush now", @@ -20213,8 +20215,8 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(monitor_reset_all), MYSQL_SYSVAR(purge_threads), MYSQL_SYSVAR(purge_batch_size), -#ifdef UNIV_DEBUG MYSQL_SYSVAR(log_checkpoint_now), +#ifdef UNIV_DEBUG MYSQL_SYSVAR(buf_flush_list_now), MYSQL_SYSVAR(merge_threshold_set_all_debug), #endif /* UNIV_DEBUG */ From 55efe47d3ce0d563f32d6dbfffd1c80b6e0630c5 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Tue, 11 Mar 2025 15:28:52 +1100 Subject: [PATCH 045/134] MDEV-36118 Fix wrong result with MAX in loose index scan Loose index scan currently only supports ASC key. When searching for the next MAX value, the search starts from the rightmost range and moves towards the left. If the key has "moved" as the result of a successful ha_index_read_map() call when handling a previous range, we check if the key is to the left of the current range, and if so, we can skip to the next range. The existing check on whether the loop has iterated at least once is not sufficient, as an unsuccessful ha_index_read_map() often (always?) does not "move" the key. --- mysql-test/main/group_min_max.result | 12 ++++++++++++ mysql-test/main/group_min_max.test | 26 ++++++++++++++++++++++++++ sql/opt_range.cc | 9 +++++---- 3 files changed, 43 insertions(+), 4 deletions(-) diff --git a/mysql-test/main/group_min_max.result b/mysql-test/main/group_min_max.result index 452088f358b..b0155f4fd85 100644 --- a/mysql-test/main/group_min_max.result +++ b/mysql-test/main/group_min_max.result @@ -4349,3 +4349,15 @@ drop table t1; # # End of 10.6 tests # +# +# MDEV-36118 Wrong result in loose index scan +# +CREATE TABLE t1 (a int, b int, KEY (a, b)); +insert into t1 values (1, 3), (1, 1); +SELECT MAX(b) FROM t1 WHERE (b > 2 AND b < 4) OR (b = 5) GROUP BY a; +MAX(b) +3 +drop table t1; +# +# End of 10.11 tests +# diff --git a/mysql-test/main/group_min_max.test b/mysql-test/main/group_min_max.test index 7f974aa61e6..d3aae2e2321 100644 --- a/mysql-test/main/group_min_max.test +++ b/mysql-test/main/group_min_max.test @@ -2007,3 +2007,29 @@ drop table t1; --echo # --echo # End of 10.6 tests --echo # + +--echo # +--echo # MDEV-36118 Wrong result in loose index scan +--echo # + +CREATE TABLE t1 (a int, b int, KEY (a, b)); +insert into t1 values (1, 3), (1, 1); +--source include/maybe_debug.inc +if ($have_debug) { + --disable_query_log + set @old_debug=@@debug; + set debug="+d,force_group_by"; + --enable_query_log +} +SELECT MAX(b) FROM t1 WHERE (b > 2 AND b < 4) OR (b = 5) GROUP BY a; +if ($have_debug) { + --disable_query_log + set debug=@old_debug; + --enable_query_log +} + +drop table t1; + +--echo # +--echo # End of 10.11 tests +--echo # diff --git a/sql/opt_range.cc b/sql/opt_range.cc index d649926abf7..6985f43a623 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -16090,7 +16090,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_max_in_range() ha_rkey_function find_flag; key_part_map keypart_map; QUICK_RANGE *cur_range; - int result; + int result= HA_ERR_KEY_NOT_FOUND; DBUG_ASSERT(min_max_ranges.elements > 0); @@ -16099,10 +16099,11 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_max_in_range() get_dynamic(&min_max_ranges, (uchar*)&cur_range, range_idx - 1); /* - If the current value for the min/max argument is smaller than the left - boundary of cur_range, there is no need to check this range. + If the key has already been "moved" by a successful call to + ha_index_read_map, and the current value for the max argument + comes before the range, there is no need to check this range. */ - if (range_idx != min_max_ranges.elements && + if (!result && !(cur_range->flag & NO_MIN_RANGE) && (key_cmp(min_max_arg_part, (const uchar*) cur_range->min_key, min_max_arg_len) == -1)) From 2641409731adac014425e7a4f81c30add3962cc5 Mon Sep 17 00:00:00 2001 From: Kristian Nielsen Date: Sat, 8 Mar 2025 11:11:58 +0100 Subject: [PATCH 046/134] Fix redundant ER_PRIOR_COMMIT_FAILED in parallel replication wait_for_prior_commit() can be called multiple times per event group, only do my_error() the first time the call fails. Remove redundant set_overwrite_status() calls. Signed-off-by: Kristian Nielsen Reviewed-by: Monty --- sql/rpl_parallel.cc | 8 -------- sql/sql_class.cc | 18 ++++++++++++++++++ sql/sql_class.h | 5 +++-- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/sql/rpl_parallel.cc b/sql/rpl_parallel.cc index f2633c3e1d1..502a0501553 100644 --- a/sql/rpl_parallel.cc +++ b/sql/rpl_parallel.cc @@ -157,8 +157,6 @@ finish_event_group(rpl_parallel_thread *rpt, uint64 sub_id, wait_for_commit *wfc= &rgi->commit_orderer; int err; - thd->get_stmt_da()->set_overwrite_status(true); - if (unlikely(rgi->worker_error)) { /* @@ -317,10 +315,6 @@ finish_event_group(rpl_parallel_thread *rpt, uint64 sub_id, wait_for_pending_deadlock_kill(thd, rgi); thd->clear_error(); thd->reset_killed(); - /* - Would do thd->get_stmt_da()->set_overwrite_status(false) here, but - reset_diagnostics_area() already does that. - */ thd->get_stmt_da()->reset_diagnostics_area(); wfc->wakeup_subsequent_commits(rgi->worker_error); } @@ -1567,9 +1561,7 @@ handle_rpl_parallel_thread(void *arg) else { delete qev->ev; - thd->get_stmt_da()->set_overwrite_status(true); err= thd->wait_for_prior_commit(); - thd->get_stmt_da()->set_overwrite_status(false); } end_of_group= diff --git a/sql/sql_class.cc b/sql/sql_class.cc index b20e1052e30..0effdbfcdb5 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -8365,6 +8365,24 @@ end: } +void +wait_for_commit::prior_commit_error(THD *thd) +{ + /* + Only raise a "prior commit failed" error if we didn't already raise + an error. + + The ER_PRIOR_COMMIT_FAILED is just an internal mechanism to ensure that a + transaction does not commit successfully if a prior commit failed, so that + the parallel replication worker threads stop in an orderly fashion when + one of them get an error. Thus, if another worker already got another real + error, overriding it with ER_PRIOR_COMMIT_FAILED is not useful. + */ + if (!thd->get_stmt_da()->is_set()) + my_error(ER_PRIOR_COMMIT_FAILED, MYF(0)); +} + + /* Wakeup anyone waiting for us to have committed. diff --git a/sql/sql_class.h b/sql/sql_class.h index 4cee31b296e..69b021cd41d 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -2398,8 +2398,8 @@ struct wait_for_commit return wait_for_prior_commit2(thd, allow_kill); else { - if (wakeup_error) - my_error(ER_PRIOR_COMMIT_FAILED, MYF(0)); + if (unlikely(wakeup_error)) + prior_commit_error(thd); return wakeup_error; } } @@ -2450,6 +2450,7 @@ struct wait_for_commit void wakeup(int wakeup_error); int wait_for_prior_commit2(THD *thd, bool allow_kill); + void prior_commit_error(THD *thd); void wakeup_subsequent_commits2(int wakeup_error); void unregister_wait_for_prior_commit2(); From 6810cdae1be9033cb59d5cd1ad3feb69b43c8ca4 Mon Sep 17 00:00:00 2001 From: Kristian Nielsen Date: Thu, 13 Mar 2025 11:25:40 +0100 Subject: [PATCH 047/134] Add --source include/long_test.inc to a few long-running tests Signed-off-by: Kristian Nielsen --- mysql-test/main/mysql_upgrade.test | 2 +- mysql-test/main/mysqldump.test | 2 +- mysql-test/suite/atomic/alter_table.test | 1 + mysql-test/suite/atomic/create_table.test | 1 + mysql-test/suite/atomic/drop_table.test | 1 + mysql-test/suite/atomic/rename_table.test | 1 + mysql-test/suite/innodb_gis/t/rtree_purge.test | 1 + mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test | 1 + 8 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mysql-test/main/mysql_upgrade.test b/mysql-test/main/mysql_upgrade.test index 442d9c3ecaa..20e7c13f24b 100644 --- a/mysql-test/main/mysql_upgrade.test +++ b/mysql-test/main/mysql_upgrade.test @@ -1,8 +1,8 @@ +--source include/long_test.inc -- source include/mysql_upgrade_preparation.inc -- source include/have_working_dns.inc -- source include/have_innodb.inc -- source include/have_partition.inc --- source include/no_valgrind_without_big.inc set sql_mode=""; diff --git a/mysql-test/main/mysqldump.test b/mysql-test/main/mysqldump.test index 0b109ca1770..1cf83d2351f 100644 --- a/mysql-test/main/mysqldump.test +++ b/mysql-test/main/mysqldump.test @@ -1,4 +1,4 @@ ---source include/no_valgrind_without_big.inc +--source include/long_test.inc --source include/have_utf8mb4.inc call mtr.add_suppression("@003f.frm' \\(errno: 22\\)"); diff --git a/mysql-test/suite/atomic/alter_table.test b/mysql-test/suite/atomic/alter_table.test index 1f87b7e71b8..bad3bbad2d5 100644 --- a/mysql-test/suite/atomic/alter_table.test +++ b/mysql-test/suite/atomic/alter_table.test @@ -1,3 +1,4 @@ +--source include/long_test.inc --source include/have_debug.inc --source include/have_innodb.inc --source include/have_log_bin.inc diff --git a/mysql-test/suite/atomic/create_table.test b/mysql-test/suite/atomic/create_table.test index ff53a12ebab..2feb4e85f35 100644 --- a/mysql-test/suite/atomic/create_table.test +++ b/mysql-test/suite/atomic/create_table.test @@ -1,3 +1,4 @@ +--source include/long_test.inc --source include/have_debug.inc --source include/have_sequence.inc --source include/have_innodb.inc diff --git a/mysql-test/suite/atomic/drop_table.test b/mysql-test/suite/atomic/drop_table.test index a3635c76447..e0ad2a58622 100644 --- a/mysql-test/suite/atomic/drop_table.test +++ b/mysql-test/suite/atomic/drop_table.test @@ -1,3 +1,4 @@ +--source include/long_test.inc --source include/have_debug.inc --source include/have_innodb.inc --source include/have_csv.inc diff --git a/mysql-test/suite/atomic/rename_table.test b/mysql-test/suite/atomic/rename_table.test index ee24d1f087f..645c2d14229 100644 --- a/mysql-test/suite/atomic/rename_table.test +++ b/mysql-test/suite/atomic/rename_table.test @@ -1,3 +1,4 @@ +--source include/long_test.inc --source include/have_debug.inc --source include/have_innodb.inc --source include/have_csv.inc diff --git a/mysql-test/suite/innodb_gis/t/rtree_purge.test b/mysql-test/suite/innodb_gis/t/rtree_purge.test index 194c8a23b01..f89f590acf0 100644 --- a/mysql-test/suite/innodb_gis/t/rtree_purge.test +++ b/mysql-test/suite/innodb_gis/t/rtree_purge.test @@ -1,5 +1,6 @@ # This test case will test R-tree purge. +--source include/long_test.inc --source include/innodb_page_size.inc --source include/have_sequence.inc --source include/not_valgrind.inc diff --git a/mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test b/mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test index bc5c60749c0..348e6721b6b 100644 --- a/mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test +++ b/mysql-test/suite/rpl/t/rpl_row_drop_create_temp_table.test @@ -3,6 +3,7 @@ # tables. Specifically when drop temporary tables and create temporary tables # are used. ################################################################################### +--source include/long_test.inc --source include/have_binlog_format_row.inc --source include/have_innodb.inc --source include/master-slave.inc From 04e114aec0322e7a9a96b590ee8d4a0dbae1fcf5 Mon Sep 17 00:00:00 2001 From: Kristian Nielsen Date: Thu, 13 Mar 2025 18:58:12 +0100 Subject: [PATCH 048/134] Fix sporadic failure of rpl.parallel_backup_xa_debug The test case set debug_sync=RESET without waiting for the server thread to receive the prior signal. This can cause the signal to be lost, the thread to not wake up, and thus the test to time out. Signed-off-by: Kristian Nielsen --- mysql-test/suite/rpl/r/parallel_backup_xa_debug.result | 2 ++ mysql-test/suite/rpl/t/parallel_backup_xa_debug.test | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/rpl/r/parallel_backup_xa_debug.result b/mysql-test/suite/rpl/r/parallel_backup_xa_debug.result index aa5ff772552..cd3b335b540 100644 --- a/mysql-test/suite/rpl/r/parallel_backup_xa_debug.result +++ b/mysql-test/suite/rpl/r/parallel_backup_xa_debug.result @@ -4,6 +4,7 @@ connection master; CREATE TABLE t (a INT) ENGINE = innodb; connection slave; include/stop_slave.inc +SET STATEMENT sql_log_bin= 0 FOR ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; SET @old_parallel_threads= @@GLOBAL.slave_parallel_threads; SET @old_parallel_mode = @@GLOBAL.slave_parallel_mode; SET @@global.slave_parallel_threads= 2; @@ -19,6 +20,7 @@ xa prepare 'x'; connection slave; SET @@global.debug_dbug="+d,hold_worker_on_schedule"; start slave; +SET debug_sync = 'now WAIT_FOR reached_pause'; connection slave1; backup stage start; backup stage block_commit; diff --git a/mysql-test/suite/rpl/t/parallel_backup_xa_debug.test b/mysql-test/suite/rpl/t/parallel_backup_xa_debug.test index 03fc66d89e7..e3df0ac69a1 100644 --- a/mysql-test/suite/rpl/t/parallel_backup_xa_debug.test +++ b/mysql-test/suite/rpl/t/parallel_backup_xa_debug.test @@ -11,6 +11,7 @@ CREATE TABLE t (a INT) ENGINE = innodb; --sync_slave_with_master --source include/stop_slave.inc +SET STATEMENT sql_log_bin= 0 FOR ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; SET @old_parallel_threads= @@GLOBAL.slave_parallel_threads; SET @old_parallel_mode = @@GLOBAL.slave_parallel_mode; SET @@global.slave_parallel_threads= 2; @@ -28,20 +29,21 @@ xa prepare 'x'; --connection slave SET @@global.debug_dbug="+d,hold_worker_on_schedule"; start slave; +SET debug_sync = 'now WAIT_FOR reached_pause'; --let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for prior transaction to commit" --source include/wait_condition.inc --connection slave1 backup stage start; ---send backup stage block_commit +backup stage block_commit; --connection slave --let $wait_condition= SELECT count(*) = 1 FROM information_schema.processlist WHERE state LIKE "Waiting for backup lock" SET debug_sync = 'now SIGNAL continue_worker'; +--source include/wait_condition.inc SET debug_sync = RESET; --connection slave1 -reap; backup stage end; --connection master From c3c5cd9377d9e8305c33623f4f94cfc90ade37be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 14 Mar 2025 13:06:37 +0200 Subject: [PATCH 049/134] =?UTF-8?q?MDEV-35813=20Unnecessary=20InnoDB=20log?= =?UTF-8?q?=20writes=20in=20INSERT=E2=80=A6SELECT?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ha_innobase::extra(): Conditionally avoid a log write that had been added in commit e5b9dc15368c7597a70569048eebfc5e05e98ef4 (MDEV-25910) because it may be invoked as part of select_insert::prepare_eof() and not only during DDL operations. Reviewed by: Sergei Golubchik --- sql/sql_table.cc | 2 +- storage/innobase/handler/ha_innodb.cc | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 9837d44adf0..bf032d3ca03 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -11135,7 +11135,7 @@ do_continue:; debug_crash_here("ddl_log_alter_after_copy"); // Use old table /* - We are new ready to use the new table. Update the state in the + We are now ready to use the new table. Update the state in the ddl log so that we recovery know that the new table is ready and in case of crash it should use the new one and log the query to the binary log. diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 1f8744465a2..f147235f669 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -15958,9 +15958,22 @@ ha_innobase::extra( break; case HA_EXTRA_END_ALTER_COPY: trx = check_trx_exists(ha_thd()); + if (!m_prebuilt->table->skip_alter_undo) { + /* This could be invoked inside INSERT...SELECT. + We do not want any extra log writes, because + they could cause a severe performance regression. */ + break; + } m_prebuilt->table->skip_alter_undo = 0; if (!m_prebuilt->table->is_temporary() && !high_level_read_only) { + /* The extra log write is necessary for + ALTER TABLE...ALGORITHM=COPY, because + a normal transaction commit would be a no-op + because no undo log records were generated. + This log write will also be unnecessarily executed + during CREATE...SELECT, which is the other caller of + handler::extra(HA_EXTRA_BEGIN_ALTER_COPY). */ log_buffer_flush_to_disk(); } break; From b6b6bb8d36b8dd72150647570833ec60a037a237 Mon Sep 17 00:00:00 2001 From: Kristian Nielsen Date: Sat, 8 Mar 2025 07:27:04 +0100 Subject: [PATCH 050/134] Fix sporadic failures of rpl.rpl_gtid_crash - Suppress a couple errors the slave can get as the master crashes. - The mysql-test-run occasionally takes 120 seconds between crashing the master and starting it back up for some (unknown) reason. For now, work-around that by letting the slave try for 500 seconds to connect to master before giving up instead of only 100 seconds. Reviewed-by: Brandon Nesterenko Signed-off-by: Kristian Nielsen --- mysql-test/suite/rpl/r/rpl_gtid_crash.result | 2 ++ mysql-test/suite/rpl/t/rpl_gtid_crash-slave.opt | 2 +- mysql-test/suite/rpl/t/rpl_gtid_crash.test | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/rpl/r/rpl_gtid_crash.result b/mysql-test/suite/rpl/r/rpl_gtid_crash.result index 4e74a3b25ac..181db3e28cb 100644 --- a/mysql-test/suite/rpl/r/rpl_gtid_crash.result +++ b/mysql-test/suite/rpl/r/rpl_gtid_crash.result @@ -11,6 +11,8 @@ INSERT INTO t1 VALUES (1, 0); connection server_2; SET sql_log_bin=0; call mtr.add_suppression('Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again'); +call mtr.add_suppression('Slave I/O: .*Lost connection to server during query'); +call mtr.add_suppression("Slave I/O thread couldn't register on master"); SET sql_log_bin=1; include/stop_slave.inc CHANGE MASTER TO master_host = '127.0.0.1', master_port = MASTER_PORT, diff --git a/mysql-test/suite/rpl/t/rpl_gtid_crash-slave.opt b/mysql-test/suite/rpl/t/rpl_gtid_crash-slave.opt index 5b3fb44c910..13232d12992 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_crash-slave.opt +++ b/mysql-test/suite/rpl/t/rpl_gtid_crash-slave.opt @@ -1 +1 @@ ---master-retry-count=100 --slave-net-timeout=10 +--master-retry-count=500 --slave-net-timeout=10 diff --git a/mysql-test/suite/rpl/t/rpl_gtid_crash.test b/mysql-test/suite/rpl/t/rpl_gtid_crash.test index f2167911101..032150d2003 100644 --- a/mysql-test/suite/rpl/t/rpl_gtid_crash.test +++ b/mysql-test/suite/rpl/t/rpl_gtid_crash.test @@ -23,6 +23,8 @@ INSERT INTO t1 VALUES (1, 0); --sync_with_master SET sql_log_bin=0; call mtr.add_suppression('Master command COM_REGISTER_SLAVE failed: failed registering on master, reconnecting to try again'); +call mtr.add_suppression('Slave I/O: .*Lost connection to server during query'); +call mtr.add_suppression("Slave I/O thread couldn't register on master"); SET sql_log_bin=1; --source include/stop_slave.inc --replace_result $MASTER_MYPORT MASTER_PORT From acaf07daed13e723db29adb35a73a218f15d24b2 Mon Sep 17 00:00:00 2001 From: Kristian Nielsen Date: Thu, 13 Mar 2025 10:43:21 +0100 Subject: [PATCH 051/134] Add --source include/long_test.inc to some tests This will make mysql-test-run.pl try to schedule these long-running (> 60 seconds) tests early in --parallel runs, which helps avoid that the testsuite gets stuck with a few long-running tests at the end while most other test workers are idle. This speed up mtr --parallel=96 with 25 seconds for me. Reviewed-by: Brandon Nesterenko Signed-off-by: Kristian Nielsen --- mysql-test/include/long_test.inc | 2 +- mysql-test/main/backup_locks.test | 1 + mysql-test/suite/binlog_encryption/encrypted_master.test | 1 + mysql-test/suite/funcs_2/t/innodb_charset.test | 2 +- mysql-test/suite/innodb/t/innodb_bug52663.test | 1 + mysql-test/suite/mariabackup/log_page_corruption.test | 2 +- mysql-test/suite/parts/t/partition_exchange_innodb.test | 1 + mysql-test/suite/parts/t/partition_exchange_memory.test | 1 + mysql-test/suite/parts/t/partition_exchange_myisam.test | 1 + mysql-test/suite/rpl/t/rpl_heartbeat_basic.test | 1 + mysql-test/suite/rpl/t/rpl_semi_sync.test | 1 + mysql-test/suite/rpl/t/rpl_semi_sync_after_sync.test | 1 + mysql-test/suite/rpl/t/rpl_semi_sync_after_sync_row.test | 1 + mysql-test/suite/rpl/t/rpl_typeconv.test | 1 + 14 files changed, 14 insertions(+), 3 deletions(-) diff --git a/mysql-test/include/long_test.inc b/mysql-test/include/long_test.inc index 765f88b8037..7f3a3a61778 100644 --- a/mysql-test/include/long_test.inc +++ b/mysql-test/include/long_test.inc @@ -1,6 +1,6 @@ # We use this --source include to mark a test as taking long to run. # We can use this to schedule such test early (to not be left with -# only one or two long tests running, and rests of works idle), or to +# only one or two long tests running, and rests of workers idle), or to # run a quick test skipping long-running test cases. --source include/no_valgrind_without_big.inc diff --git a/mysql-test/main/backup_locks.test b/mysql-test/main/backup_locks.test index 40f12bb7ef8..6a1fe9f6094 100644 --- a/mysql-test/main/backup_locks.test +++ b/mysql-test/main/backup_locks.test @@ -2,6 +2,7 @@ # Tests BACKUP STAGE locking ######################################################################## +--source include/long_test.inc --source include/have_innodb.inc --source include/have_metadata_lock_info.inc --source include/not_embedded.inc diff --git a/mysql-test/suite/binlog_encryption/encrypted_master.test b/mysql-test/suite/binlog_encryption/encrypted_master.test index f6fc172c79e..1539ad29f00 100644 --- a/mysql-test/suite/binlog_encryption/encrypted_master.test +++ b/mysql-test/suite/binlog_encryption/encrypted_master.test @@ -18,6 +18,7 @@ # - with annotated events, default checksums and minimal binlog row image # +--source include/long_test.inc # The test can take very long time with valgrind --source include/not_valgrind.inc diff --git a/mysql-test/suite/funcs_2/t/innodb_charset.test b/mysql-test/suite/funcs_2/t/innodb_charset.test index 631c20352d4..c91a9c4d5d6 100644 --- a/mysql-test/suite/funcs_2/t/innodb_charset.test +++ b/mysql-test/suite/funcs_2/t/innodb_charset.test @@ -6,7 +6,7 @@ # Checking of other prerequisites is in charset_master.test # ################################################################################ ---source include/no_valgrind_without_big.inc +--source include/long_test.inc --source include/have_innodb.inc # Starting with MariaDB 10.6, ensure that DDL recovery will have completed diff --git a/mysql-test/suite/innodb/t/innodb_bug52663.test b/mysql-test/suite/innodb/t/innodb_bug52663.test index fcf97531e00..dd246297d94 100644 --- a/mysql-test/suite/innodb/t/innodb_bug52663.test +++ b/mysql-test/suite/innodb/t/innodb_bug52663.test @@ -1,3 +1,4 @@ +--source include/long_test.inc --source include/have_innodb.inc set session transaction isolation level read committed; diff --git a/mysql-test/suite/mariabackup/log_page_corruption.test b/mysql-test/suite/mariabackup/log_page_corruption.test index 27f2d383b47..e556cba4661 100644 --- a/mysql-test/suite/mariabackup/log_page_corruption.test +++ b/mysql-test/suite/mariabackup/log_page_corruption.test @@ -1,5 +1,5 @@ +--source include/long_test.inc --source include/have_debug.inc ---source include/no_valgrind_without_big.inc --source include/innodb_undo_tablespaces.inc --echo ######## diff --git a/mysql-test/suite/parts/t/partition_exchange_innodb.test b/mysql-test/suite/parts/t/partition_exchange_innodb.test index 31ea61bbb7b..73dd5500a43 100644 --- a/mysql-test/suite/parts/t/partition_exchange_innodb.test +++ b/mysql-test/suite/parts/t/partition_exchange_innodb.test @@ -1,3 +1,4 @@ +--source include/long_test.inc --source include/have_innodb.inc --source include/have_partition.inc --source include/have_debug_sync.inc diff --git a/mysql-test/suite/parts/t/partition_exchange_memory.test b/mysql-test/suite/parts/t/partition_exchange_memory.test index 7384a49f829..431a662f056 100644 --- a/mysql-test/suite/parts/t/partition_exchange_memory.test +++ b/mysql-test/suite/parts/t/partition_exchange_memory.test @@ -1,3 +1,4 @@ +--source include/long_test.inc --source include/have_partition.inc --source include/have_debug_sync.inc diff --git a/mysql-test/suite/parts/t/partition_exchange_myisam.test b/mysql-test/suite/parts/t/partition_exchange_myisam.test index 68e55090a9c..ab3fb388efd 100644 --- a/mysql-test/suite/parts/t/partition_exchange_myisam.test +++ b/mysql-test/suite/parts/t/partition_exchange_myisam.test @@ -1,3 +1,4 @@ +--source include/long_test.inc --source include/have_partition.inc --source include/have_debug_sync.inc diff --git a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test index a8857091ef6..0e1ac93882d 100644 --- a/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test +++ b/mysql-test/suite/rpl/t/rpl_heartbeat_basic.test @@ -9,6 +9,7 @@ # * Various states of master and heartbeat # * Circular replication ############################################################# +--source include/long_test.inc --source include/master-slave.inc # # The test runs long and does not have any specifics to diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync.test index c3cd918b5fc..0c8c797af56 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync.test @@ -4,6 +4,7 @@ # Please check all dependent tests after modifying it # +source include/long_test.inc; source include/not_embedded.inc; source include/have_innodb.inc; source include/master-slave.inc; diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync.test b/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync.test index 2d91d2e4118..015dcceb043 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync.test @@ -1,3 +1,4 @@ +--source include/long_test.inc --source include/have_binlog_format_statement.inc set global rpl_semi_sync_master_wait_point=AFTER_SYNC; source rpl_semi_sync.test; diff --git a/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync_row.test b/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync_row.test index 47af6c34fcf..0ce94b82a67 100644 --- a/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync_row.test +++ b/mysql-test/suite/rpl/t/rpl_semi_sync_after_sync_row.test @@ -1,3 +1,4 @@ +--source include/long_test.inc --source include/have_binlog_format_row.inc set global rpl_semi_sync_master_wait_point=AFTER_SYNC; source rpl_semi_sync.test; diff --git a/mysql-test/suite/rpl/t/rpl_typeconv.test b/mysql-test/suite/rpl/t/rpl_typeconv.test index 9e566258882..5d8dc67c463 100644 --- a/mysql-test/suite/rpl/t/rpl_typeconv.test +++ b/mysql-test/suite/rpl/t/rpl_typeconv.test @@ -4,6 +4,7 @@ # Please check all dependent tests after modifying it # +--source include/long_test.inc --source include/have_binlog_format_row.inc --source include/master-slave.inc From d931bb8174dd09998493547799a627e92603e863 Mon Sep 17 00:00:00 2001 From: Kristian Nielsen Date: Thu, 13 Mar 2025 14:50:25 +0100 Subject: [PATCH 052/134] MDEV-36287: Server crash in SHOW SLAVE STATUS concurrent with STOP SLAVE In SHOW SLAVE STATUS, do not access members of the SQL thread's THD without holding mi->run_lock. Otherwise the THD can go away in case of concurrent STOP SLAVE, leading to invalid memory references and server crash. Reviewed-by: Monty Reviewed-by: Brandon Nesterenko Signed-off-by: Kristian Nielsen --- sql/slave.cc | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/sql/slave.cc b/sql/slave.cc index 6f4176f233d..8006c528195 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -3162,19 +3162,24 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full, if (full) protocol->store(mi->connection_name.str, mi->connection_name.length, &my_charset_bin); + mysql_mutex_lock(&mi->run_lock); + THD *sql_thd= mi->rli.sql_driver_thd; + const char *slave_sql_running_state= + sql_thd ? sql_thd->get_proc_info() : ""; + THD *io_thd= mi->io_thd; + const char *slave_io_running_state= io_thd ? io_thd->get_proc_info() : ""; + mysql_mutex_unlock(&mi->run_lock); + if (full) { /* Show what the sql driver replication thread is doing This is only meaningful if there is only one slave thread. */ - protocol->store(mi->rli.sql_driver_thd ? - mi->rli.sql_driver_thd->get_proc_info() : "", - &my_charset_bin); + protocol->store(slave_sql_running_state, &my_charset_bin); } - protocol->store(mi->io_thd ? mi->io_thd->get_proc_info() : "", &my_charset_bin); - mysql_mutex_unlock(&mi->run_lock); + protocol->store(slave_io_running_state, &my_charset_bin); mysql_mutex_lock(&mi->data_lock); mysql_mutex_lock(&mi->rli.data_lock); @@ -3341,10 +3346,6 @@ static bool send_show_master_info_data(THD *thd, Master_info *mi, bool full, protocol->store((uint32) mi->rli.get_sql_delay()); // SQL_Remaining_Delay - // THD::proc_info is not protected by any lock, so we read it once - // to ensure that we use the same value throughout this function. - const char *slave_sql_running_state= - mi->rli.sql_driver_thd ? mi->rli.sql_driver_thd->proc_info : ""; if (slave_sql_running_state == stage_sql_thd_waiting_until_delay.m_name) { time_t t= my_time(0), sql_delay_end= mi->rli.get_sql_delay_end(); From 839828e57fdf734b15c81cb9cb76d3760a9161f1 Mon Sep 17 00:00:00 2001 From: Sam Bull Date: Tue, 5 Nov 2024 12:44:58 +0000 Subject: [PATCH 053/134] MDEV-36009: Systemd: Restart on OOM Per https://github.com/systemd/systemd/issues/36529 OOM counts as a on-abnormal condition. To ensure that MariaDB testart on OOM the Restart is changes to on-abnormal which an extension on the current on-abort condition. --- support-files/mariadb.service.in | 2 +- support-files/mariadb@.service.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/support-files/mariadb.service.in b/support-files/mariadb.service.in index e47a67f6880..0feb86c7140 100644 --- a/support-files/mariadb.service.in +++ b/support-files/mariadb.service.in @@ -105,7 +105,7 @@ SendSIGKILL=no # Restart crashed server only, on-failure would also restart, for example, when # my.cnf contains unknown option -Restart=on-abort +Restart=on-abnormal RestartSec=5s UMask=007 diff --git a/support-files/mariadb@.service.in b/support-files/mariadb@.service.in index 31f1586f1bf..0c5372ce1c2 100644 --- a/support-files/mariadb@.service.in +++ b/support-files/mariadb@.service.in @@ -219,7 +219,7 @@ SendSIGKILL=no # Restart crashed server only, on-failure would also restart, for example, when # my.cnf contains unknown option -Restart=on-abort +Restart=on-abnormal RestartSec=5s UMask=007 From a8e35a1cc69d398e6770fa42dd21e9a0fc573511 Mon Sep 17 00:00:00 2001 From: mariadb-DebarunBanerjee Date: Tue, 11 Mar 2025 12:13:05 +0530 Subject: [PATCH 054/134] MDEV-36149 UBSAN in X is outside the range of representable values of type 'unsigned long' | page_cleaner_flush_pages_recommendation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently it is allowed to set innodb_io_capacity to very large value up to unsigned 8 byte maximum value 18446744073709551615. While calculating the number of pages to flush, we could sometime go beyond innodb_io_capacity. Specifically, MDEV-24369 has introduced a logic for aggressive flushing when dirty page percentage in buffer pool exceeds innodb_max_dirty_pages_pct. So, when innodb_io_capacity is set to very large value and dirty page percentage exceeds the threshold, there is a multiplication overflow in Innodb page cleaner. Fix: We should prevent setting io_capacity to unrealistic values and define a practical limit to it. The patch introduces limits for innodb_io_capacity_max and innodb_io_capacity to the maximum of 4 byte unsigned integer i.e. 4294967295 (2^32-1). For 16k page size this limit translates to 64 TiB/sec write IO speed which looks sufficient. Reviewed by: Marko Mäkelä --- .../sys_vars/r/sysvars_innodb,32bit.rdiff | 80 ++++++++----------- .../suite/sys_vars/r/sysvars_innodb.result | 6 +- storage/innobase/buf/buf0flu.cc | 22 +++-- storage/innobase/handler/ha_innodb.cc | 5 +- storage/innobase/include/srv0srv.h | 4 +- 5 files changed, 59 insertions(+), 58 deletions(-) diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff index 47c5b70feb4..185abfd6f14 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff @@ -9,7 +9,7 @@ VARIABLE_COMMENT Number of InnoDB Adaptive Hash Index Partitions (default 8) NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 512 -@@ -71,7 +71,7 @@ +@@ -83,7 +83,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1 VARIABLE_SCOPE GLOBAL @@ -18,7 +18,7 @@ VARIABLE_COMMENT The AUTOINC lock modes supported by InnoDB: 0 => Old style AUTOINC locking (for backward compatibility); 1 => New style AUTOINC locking; 2 => No AUTOINC locking (unsafe for SBR) NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 2 -@@ -83,10 +83,10 @@ +@@ -95,10 +95,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -31,7 +31,7 @@ NUMERIC_BLOCK_SIZE 1048576 ENUM_VALUE_LIST NULL READ_ONLY YES -@@ -119,7 +119,7 @@ +@@ -131,7 +131,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 25 VARIABLE_SCOPE GLOBAL @@ -40,7 +40,7 @@ VARIABLE_COMMENT Dump only the hottest N% of each buffer pool, defaults to 25 NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 100 -@@ -203,7 +203,7 @@ +@@ -215,7 +215,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -49,7 +49,7 @@ VARIABLE_COMMENT A number between [0, 100] that tells how oftern buffer pool dump status in percentages should be printed. E.g. 10 means that buffer pool dump status is printed when every 10% of number of buffer pool pages are dumped. Default is 0 (only start and end status is printed). NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 100 -@@ -323,7 +323,7 @@ +@@ -335,7 +335,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 5 VARIABLE_SCOPE GLOBAL @@ -58,7 +58,7 @@ VARIABLE_COMMENT If the compression failure rate of a table is greater than this number more padding is added to the pages to reduce the failures. A value of zero implies no padding NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 100 -@@ -347,7 +347,7 @@ +@@ -359,7 +359,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 50 VARIABLE_SCOPE GLOBAL @@ -67,7 +67,7 @@ VARIABLE_COMMENT Percentage of empty space on a data page that can be reserved to make the page compressible. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 75 -@@ -623,7 +623,7 @@ +@@ -647,7 +647,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 600 VARIABLE_SCOPE GLOBAL @@ -76,7 +76,7 @@ VARIABLE_COMMENT Maximum number of seconds that semaphore times out in InnoDB. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -671,7 +671,7 @@ +@@ -695,7 +695,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 30 VARIABLE_SCOPE GLOBAL @@ -85,7 +85,7 @@ VARIABLE_COMMENT Number of iterations over which the background flushing is averaged. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1000 -@@ -695,7 +695,7 @@ +@@ -719,7 +719,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1 VARIABLE_SCOPE GLOBAL @@ -94,7 +94,7 @@ VARIABLE_COMMENT Controls the durability/speed trade-off for commits. Set to 0 (write and flush redo log to disk only once per second), 1 (flush to disk at each commit), 2 (write to log at commit but flush to disk only once per second) or 3 (flush to disk at prepare and at commit, slower and usually redundant). 1 and 3 guarantees that after a crash, committed transactions will not be lost and will be consistent with the binlog and other transactional engines. 2 can get inconsistent and lose transactions if there is a power failure or kernel crash but not if mysqld crashes. 0 has no guarantees in case of crash. 0 and 2 can be faster than 1 or 3. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 3 -@@ -719,7 +719,7 @@ +@@ -743,7 +743,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1 VARIABLE_SCOPE GLOBAL @@ -103,7 +103,7 @@ VARIABLE_COMMENT Set to 0 (don't flush neighbors from buffer pool), 1 (flush contiguous neighbors from buffer pool) or 2 (flush neighbors from buffer pool), when flushing a block NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 2 -@@ -755,7 +755,7 @@ +@@ -779,7 +779,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -112,7 +112,7 @@ VARIABLE_COMMENT Helps to save your data in case the disk image of the database becomes corrupt. Value 5 can return bogus data, and 6 can permanently corrupt data. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 6 -@@ -779,10 +779,10 @@ +@@ -803,10 +803,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 8000000 VARIABLE_SCOPE GLOBAL @@ -125,7 +125,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -815,7 +815,7 @@ +@@ -839,7 +839,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 84 VARIABLE_SCOPE GLOBAL @@ -134,7 +134,7 @@ VARIABLE_COMMENT InnoDB Fulltext search maximum token size in characters NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 84 -@@ -827,7 +827,7 @@ +@@ -851,7 +851,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 3 VARIABLE_SCOPE GLOBAL @@ -143,7 +143,7 @@ VARIABLE_COMMENT InnoDB Fulltext search minimum token size in characters NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16 -@@ -839,7 +839,7 @@ +@@ -863,7 +863,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 2000 VARIABLE_SCOPE GLOBAL @@ -152,7 +152,7 @@ VARIABLE_COMMENT InnoDB Fulltext search number of words to optimize for each optimize table call NUMERIC_MIN_VALUE 1000 NUMERIC_MAX_VALUE 10000 -@@ -851,10 +851,10 @@ +@@ -875,10 +875,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 2000000000 VARIABLE_SCOPE GLOBAL @@ -165,7 +165,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -875,7 +875,7 @@ +@@ -899,7 +899,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 2 VARIABLE_SCOPE GLOBAL @@ -174,7 +174,7 @@ VARIABLE_COMMENT InnoDB Fulltext search parallel sort degree, will round up to nearest power of 2 number NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 16 -@@ -887,10 +887,10 @@ +@@ -911,10 +911,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 640000000 VARIABLE_SCOPE GLOBAL @@ -187,7 +187,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -935,22 +935,22 @@ +@@ -959,7 +959,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 200 VARIABLE_SCOPE GLOBAL @@ -195,27 +195,17 @@ +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT Number of IOPs the server can do. Tunes the background IO rate NUMERIC_MIN_VALUE 100 --NUMERIC_MAX_VALUE 18446744073709551615 -+NUMERIC_MAX_VALUE 4294967295 - NUMERIC_BLOCK_SIZE 0 - ENUM_VALUE_LIST NULL - READ_ONLY NO - COMMAND_LINE_ARGUMENT REQUIRED - VARIABLE_NAME INNODB_IO_CAPACITY_MAX + NUMERIC_MAX_VALUE 4294967295 +@@ -971,7 +971,7 @@ SESSION_VALUE NULL --DEFAULT_VALUE 18446744073709551615 -+DEFAULT_VALUE 4294967295 + DEFAULT_VALUE 4294967295 VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT Limit to which innodb_io_capacity can be inflated. NUMERIC_MIN_VALUE 100 --NUMERIC_MAX_VALUE 18446744073709551615 -+NUMERIC_MAX_VALUE 4294967295 - NUMERIC_BLOCK_SIZE 0 - ENUM_VALUE_LIST NULL - READ_ONLY NO -@@ -1043,10 +1043,10 @@ + NUMERIC_MAX_VALUE 4294967295 +@@ -1091,10 +1091,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 32 VARIABLE_SCOPE GLOBAL @@ -228,7 +218,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1055,10 +1055,10 @@ +@@ -1103,10 +1103,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 1536 VARIABLE_SCOPE GLOBAL @@ -241,7 +231,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1091,10 +1091,10 @@ +@@ -1139,10 +1139,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -254,7 +244,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1103,7 +1103,7 @@ +@@ -1151,7 +1151,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -263,7 +253,7 @@ VARIABLE_COMMENT Maximum delay of user threads in micro-seconds NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 10000000 -@@ -1235,10 +1235,10 @@ +@@ -1283,10 +1283,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -276,7 +266,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY YES -@@ -1259,7 +1259,7 @@ +@@ -1307,7 +1307,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 16384 VARIABLE_SCOPE GLOBAL @@ -285,16 +275,16 @@ VARIABLE_COMMENT Page size to use for all InnoDB tablespaces. NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 65536 -@@ -1295,7 +1295,7 @@ +@@ -1343,7 +1343,7 @@ SESSION_VALUE NULL - DEFAULT_VALUE 1000 + DEFAULT_VALUE 127 VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT Number of UNDO log pages to purge in one batch from the history list. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 5000 -@@ -1307,7 +1307,7 @@ +@@ -1355,7 +1355,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 128 VARIABLE_SCOPE GLOBAL @@ -303,7 +293,7 @@ VARIABLE_COMMENT Deprecated parameter with no effect NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 128 -@@ -1343,7 +1343,7 @@ +@@ -1391,7 +1391,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 56 VARIABLE_SCOPE GLOBAL @@ -312,7 +302,7 @@ VARIABLE_COMMENT Number of pages that must be accessed sequentially for InnoDB to trigger a readahead. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 64 -@@ -1427,7 +1427,7 @@ +@@ -1475,7 +1475,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1048576 VARIABLE_SCOPE GLOBAL @@ -321,7 +311,7 @@ VARIABLE_COMMENT Memory buffer size for index creation NUMERIC_MIN_VALUE 65536 NUMERIC_MAX_VALUE 67108864 -@@ -1595,10 +1595,10 @@ +@@ -1643,10 +1643,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 30 VARIABLE_SCOPE GLOBAL diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 1923357c0e6..0f84e3e17ba 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -962,19 +962,19 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Number of IOPs the server can do. Tunes the background IO rate NUMERIC_MIN_VALUE 100 -NUMERIC_MAX_VALUE 18446744073709551615 +NUMERIC_MAX_VALUE 4294967295 NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_IO_CAPACITY_MAX SESSION_VALUE NULL -DEFAULT_VALUE 18446744073709551615 +DEFAULT_VALUE 4294967295 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Limit to which innodb_io_capacity can be inflated. NUMERIC_MIN_VALUE 100 -NUMERIC_MAX_VALUE 18446744073709551615 +NUMERIC_MAX_VALUE 4294967295 NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 5ef6af65f6f..1a3368c9f94 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -2310,13 +2310,23 @@ static ulint page_cleaner_flush_pages_recommendation(ulint last_pages_in, if (!prev_lsn || !pct_for_lsn) { prev_time = curr_time; prev_lsn = cur_lsn; - if (max_pct > 0.0) { - dirty_pct /= max_pct; - } - n_pages = ulint(dirty_pct * double(srv_io_capacity)); - if (n_pages < dirty_blocks) { - n_pages= std::min(srv_io_capacity, dirty_blocks); + if (srv_io_capacity >= dirty_blocks) { + n_pages = dirty_blocks; + } else { + if (max_pct > 1.0) { + dirty_pct/= max_pct; + } + n_pages= ulint(dirty_pct * double(srv_io_capacity)); + + if (n_pages < dirty_blocks) { + n_pages= srv_io_capacity; + + } else { + /* Set maximum IO capacity upper bound. */ + n_pages= std::min(srv_max_io_capacity, + dirty_blocks); + } } func_exit: diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 966e71c17f6..0f250f49360 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -17518,7 +17518,8 @@ innodb_io_capacity_update( " higher than innodb_io_capacity_max %lu", in_val, srv_max_io_capacity); - srv_max_io_capacity = (in_val & ~(~0UL >> 1)) + /* Avoid overflow. */ + srv_max_io_capacity = (in_val >= SRV_MAX_IO_CAPACITY_LIMIT / 2) ? in_val : in_val * 2; push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, @@ -19123,7 +19124,7 @@ static MYSQL_SYSVAR_ENUM(instant_alter_column_allowed, static MYSQL_SYSVAR_ULONG(io_capacity, srv_io_capacity, PLUGIN_VAR_RQCMDARG, "Number of IOPs the server can do. Tunes the background IO rate", - NULL, innodb_io_capacity_update, 200, 100, ~0UL, 0); + NULL, innodb_io_capacity_update, 200, 100, SRV_MAX_IO_CAPACITY_LIMIT, 0); static MYSQL_SYSVAR_ULONG(io_capacity_max, srv_max_io_capacity, PLUGIN_VAR_RQCMDARG, diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 374b15f0d66..bf3778a33c5 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -267,8 +267,8 @@ extern ulong srv_io_capacity; /* We use this dummy default value at startup for max_io_capacity. The real value is set based on the value of io_capacity. */ -#define SRV_MAX_IO_CAPACITY_DUMMY_DEFAULT (~0UL) -#define SRV_MAX_IO_CAPACITY_LIMIT (~0UL) +#define SRV_MAX_IO_CAPACITY_DUMMY_DEFAULT (UINT32_MAX) +#define SRV_MAX_IO_CAPACITY_LIMIT (UINT32_MAX) extern ulong srv_max_io_capacity; /* The "innodb_stats_method" setting, decides how InnoDB is going From 408a637b87cba62506a4fbf363424ccc8530df12 Mon Sep 17 00:00:00 2001 From: Dmitry Shulga Date: Fri, 14 Mar 2025 12:43:22 +0700 Subject: [PATCH 055/134] MDEV-29344: engines/iuds.insert_time cannot run with PS protocol (syntax error) The syntax error produced on running the test engines/iuds.insert_time in PS-mode was caused by presence of the C-Style comment containing the single quote at the end of SQL statement, something like the following one: /* doesn't throw error */; Presence of the single quote was interpreted by mysqltest utility as indication of real string literal, that resulted in consuming every characters following that mark as a literal, including the delimiter character ';'. It led to concatenation of lines into a single multi-statement that was sent from mysqltest to MariaDB server for processing. In case mysqltest is run in regular mode (that is, not PS-mode), multi-statement is handled successfully on server side, but in case PS-mode is on, multi-statement is supplied in COM_STMT_PREPARE that caused the parsing error since multi-statements is not supported by statement prepare command. To fix the issue, in case mysqltest encounters the C-Style comment is should switch to reading next following characters without any processing until it hit the closing C-style comment marks '*/', with one exception if the sequence of characters '/*' followed by the exclamation mark, that means the hint introducer has been read. --- client/mysqltest.cc | 16 +++++++++++++++- mysql-test/main/mysqltest.result | 9 +++++++++ mysql-test/main/mysqltest.test | 6 ++++++ .../suite/engines/iuds/r/insert_time.result | 4 ++++ 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 2ff00260c05..14f1d7a981c 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -6744,7 +6744,7 @@ int read_line() my_bool have_slash= FALSE; enum {R_NORMAL, R_Q, R_SLASH_IN_Q, - R_COMMENT, R_LINE_START} state= R_LINE_START; + R_COMMENT, R_LINE_START, R_CSTYLE_COMMENT} state= R_LINE_START; DBUG_ENTER("read_line"); *p= 0; @@ -6831,9 +6831,23 @@ int read_line() state= R_Q; } } + else if (c == '*' && last_char == '/') + { + state= R_CSTYLE_COMMENT; + break; + } have_slash= is_escape_char(c, last_quote); break; + case R_CSTYLE_COMMENT: + if (c == '!') + // Got the hint introducer '/*!'. Switch to normal processing of + // next following characters + state= R_NORMAL; + else if (c == '/' && last_char == '*') + state= R_NORMAL; + break; + case R_COMMENT: if (c == '\n') { diff --git a/mysql-test/main/mysqltest.result b/mysql-test/main/mysqltest.result index 478ef82ca1f..fbc723bbe1d 100644 --- a/mysql-test/main/mysqltest.result +++ b/mysql-test/main/mysqltest.result @@ -989,4 +989,13 @@ select "foo\""bar"; foo\"bar foo\"bar set sql_mode=default; +# +# MDEV-29344: engines/iuds.insert_time cannot run with PS protocol (syntax error) +# +SELECT 1 /* doesn't throw error */; +1 +1 +SELECT 1 /* doesn't throw error */; +1 +1 End of tests diff --git a/mysql-test/main/mysqltest.test b/mysql-test/main/mysqltest.test index b545e354040..4895d06f66e 100644 --- a/mysql-test/main/mysqltest.test +++ b/mysql-test/main/mysqltest.test @@ -2954,6 +2954,12 @@ set sql_mode=no_backslash_escapes; select "foo\""bar"; set sql_mode=default; +--echo # +--echo # MDEV-29344: engines/iuds.insert_time cannot run with PS protocol (syntax error) +--echo # +SELECT 1 /* doesn't throw error */; +SELECT 1 /* doesn't throw error */; + --echo End of tests # Wait till we reached the initial number of concurrent sessions diff --git a/mysql-test/suite/engines/iuds/r/insert_time.result b/mysql-test/suite/engines/iuds/r/insert_time.result index fdda49a36c1..5bfc3b7893b 100644 --- a/mysql-test/suite/engines/iuds/r/insert_time.result +++ b/mysql-test/suite/engines/iuds/r/insert_time.result @@ -5073,10 +5073,14 @@ ERROR 23000: Duplicate entry '825:23:00' for key 'c2' INSERT INTO t3(c1,c2) VALUES('34 9:23','34 9:23') /* throws error as row exists with c1='34 9:23',c2='34 9:23' */; ERROR 23000: Duplicate entry '825:23:00-825:23:00' for key 'idx' INSERT IGNORE INTO t1(c1,c2) VALUES('10:22:33','10:22:34') /* doesn't throw error */; +Warnings: +Warning 1062 Duplicate entry '10:22:33' for key 'PRIMARY' INSERT IGNORE INTO t2(c1,c2) VALUES('12:34:56.78','12:34:56.78') /*doesn't throw error */; Warnings: Warning 1062 Duplicate entry '12:34:56-12:34:56' for key 'PRIMARY' INSERT IGNORE INTO t1(c1,c2) VALUES('10:22:34','34 9:23') /*doesn't throw error */; +Warnings: +Warning 1062 Duplicate entry '825:23:00' for key 'c2' INSERT IGNORE INTO t3(c1,c2) VALUES('34 9:23','34 9:23') /*doesn't throw error */; Warnings: Warning 1062 Duplicate entry '825:23:00-825:23:00' for key 'idx' From 0e8e0065d61e6666992864f77b2ef532db8370e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 17 Mar 2025 16:21:09 +0200 Subject: [PATCH 056/134] MDEV-35813 test case --- mysql-test/suite/innodb/r/log_write.result | 11 +++++++++++ mysql-test/suite/innodb/t/log_write.test | 12 ++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 mysql-test/suite/innodb/r/log_write.result create mode 100644 mysql-test/suite/innodb/t/log_write.test diff --git a/mysql-test/suite/innodb/r/log_write.result b/mysql-test/suite/innodb/r/log_write.result new file mode 100644 index 00000000000..5a9739edf98 --- /dev/null +++ b/mysql-test/suite/innodb/r/log_write.result @@ -0,0 +1,11 @@ +# MDEV-35813 Unnecessary InnoDB log writes in INSERT…SELECT +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0; +SET GLOBAL innodb_max_purge_lag_wait=0; +SELECT variable_value INTO @log_writes FROM information_schema.global_status +WHERE variable_name='innodb_log_writes'; +INSERT INTO t1 SELECT * FROM t1; +SELECT variable_value-@log_writes FROM information_schema.global_status +WHERE variable_name='innodb_log_writes'; +variable_value-@log_writes +0 +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/log_write.test b/mysql-test/suite/innodb/t/log_write.test new file mode 100644 index 00000000000..0527f1f8f89 --- /dev/null +++ b/mysql-test/suite/innodb/t/log_write.test @@ -0,0 +1,12 @@ +--source include/have_innodb.inc + +--echo # MDEV-35813 Unnecessary InnoDB log writes in INSERT…SELECT + +CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0; +SET GLOBAL innodb_max_purge_lag_wait=0; +SELECT variable_value INTO @log_writes FROM information_schema.global_status +WHERE variable_name='innodb_log_writes'; +INSERT INTO t1 SELECT * FROM t1; +SELECT variable_value-@log_writes FROM information_schema.global_status +WHERE variable_name='innodb_log_writes'; +DROP TABLE t1; From 1756b0f37dd8e5ce8c9cdb9fec8299ba64dd5dee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 18 Mar 2025 10:41:38 +0200 Subject: [PATCH 057/134] MDEV-35813: more robust test case Let us integrate the test case with innodb.page_cleaner so that there will be less interference from log writes due to checkpoints. Also, make the test compatible with ./mtr --cursor-protocol. --- mysql-test/suite/innodb/r/log_write.result | 11 -------- mysql-test/suite/innodb/r/page_cleaner.result | 25 ++++++++++++++++- mysql-test/suite/innodb/t/log_write.test | 12 -------- mysql-test/suite/innodb/t/page_cleaner.test | 28 ++++++++++++++++++- 4 files changed, 51 insertions(+), 25 deletions(-) delete mode 100644 mysql-test/suite/innodb/r/log_write.result delete mode 100644 mysql-test/suite/innodb/t/log_write.test diff --git a/mysql-test/suite/innodb/r/log_write.result b/mysql-test/suite/innodb/r/log_write.result deleted file mode 100644 index 5a9739edf98..00000000000 --- a/mysql-test/suite/innodb/r/log_write.result +++ /dev/null @@ -1,11 +0,0 @@ -# MDEV-35813 Unnecessary InnoDB log writes in INSERT…SELECT -CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0; -SET GLOBAL innodb_max_purge_lag_wait=0; -SELECT variable_value INTO @log_writes FROM information_schema.global_status -WHERE variable_name='innodb_log_writes'; -INSERT INTO t1 SELECT * FROM t1; -SELECT variable_value-@log_writes FROM information_schema.global_status -WHERE variable_name='innodb_log_writes'; -variable_value-@log_writes -0 -DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/page_cleaner.result b/mysql-test/suite/innodb/r/page_cleaner.result index 97dd012054b..93c986a93c9 100644 --- a/mysql-test/suite/innodb/r/page_cleaner.result +++ b/mysql-test/suite/innodb/r/page_cleaner.result @@ -2,8 +2,31 @@ SET @save_pct= @@GLOBAL.innodb_max_dirty_pages_pct; SET @save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm; SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0; SET GLOBAL innodb_max_dirty_pages_pct=0.0; +CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0; +connect prevent_purge,localhost,root; +START TRANSACTION WITH CONSISTENT SNAPSHOT; +connection default; +SET GLOBAL innodb_max_purge_lag_wait=0; SET GLOBAL innodb_max_dirty_pages_pct=90.0; -CREATE TABLE t ENGINE=InnoDB SELECT * FROM seq_1_to_10000; +SELECT variable_value INTO @log_writes FROM information_schema.global_status +WHERE variable_name='innodb_log_writes'; +BEGIN; +INSERT INTO t SELECT * FROM seq_1_to_500; +INSERT INTO t SELECT * FROM seq_501_to_1000; +INSERT INTO t SELECT * FROM seq_1001_to_1500; +INSERT INTO t SELECT * FROM seq_1501_to_2000; +INSERT INTO t SELECT * FROM seq_2001_to_2500; +INSERT INTO t SELECT * FROM seq_2501_to_3000; +INSERT INTO t SELECT * FROM seq_3001_to_3500; +INSERT INTO t SELECT * FROM seq_3501_to_4000; +INSERT INTO t SELECT * FROM seq_4001_to_4500; +INSERT INTO t SELECT * FROM seq_4501_to_5000; +ROLLBACK; +SELECT if(variable_value-@log_writes<10,'ok',variable_value-@log_writes) +FROM information_schema.global_status WHERE variable_name='innodb_log_writes'; +if(variable_value-@log_writes<10,'ok',variable_value-@log_writes) +ok +disconnect prevent_purge; SELECT variable_value>0 FROM information_schema.global_status WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY'; variable_value>0 diff --git a/mysql-test/suite/innodb/t/log_write.test b/mysql-test/suite/innodb/t/log_write.test deleted file mode 100644 index 0527f1f8f89..00000000000 --- a/mysql-test/suite/innodb/t/log_write.test +++ /dev/null @@ -1,12 +0,0 @@ ---source include/have_innodb.inc - ---echo # MDEV-35813 Unnecessary InnoDB log writes in INSERT…SELECT - -CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0; -SET GLOBAL innodb_max_purge_lag_wait=0; -SELECT variable_value INTO @log_writes FROM information_schema.global_status -WHERE variable_name='innodb_log_writes'; -INSERT INTO t1 SELECT * FROM t1; -SELECT variable_value-@log_writes FROM information_schema.global_status -WHERE variable_name='innodb_log_writes'; -DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/page_cleaner.test b/mysql-test/suite/innodb/t/page_cleaner.test index f597619aa08..8568bc7ae6f 100644 --- a/mysql-test/suite/innodb/t/page_cleaner.test +++ b/mysql-test/suite/innodb/t/page_cleaner.test @@ -7,6 +7,12 @@ SET @save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm; SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0; SET GLOBAL innodb_max_dirty_pages_pct=0.0; +CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0; +--connect (prevent_purge,localhost,root) +START TRANSACTION WITH CONSISTENT SNAPSHOT; +--connection default +SET GLOBAL innodb_max_purge_lag_wait=0; + let $wait_condition = SELECT variable_value = 0 FROM information_schema.global_status @@ -15,7 +21,27 @@ WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY'; SET GLOBAL innodb_max_dirty_pages_pct=90.0; -CREATE TABLE t ENGINE=InnoDB SELECT * FROM seq_1_to_10000; +--disable_cursor_protocol +SELECT variable_value INTO @log_writes FROM information_schema.global_status +WHERE variable_name='innodb_log_writes'; +--enable_cursor_protocol + +BEGIN; +INSERT INTO t SELECT * FROM seq_1_to_500; +INSERT INTO t SELECT * FROM seq_501_to_1000; +INSERT INTO t SELECT * FROM seq_1001_to_1500; +INSERT INTO t SELECT * FROM seq_1501_to_2000; +INSERT INTO t SELECT * FROM seq_2001_to_2500; +INSERT INTO t SELECT * FROM seq_2501_to_3000; +INSERT INTO t SELECT * FROM seq_3001_to_3500; +INSERT INTO t SELECT * FROM seq_3501_to_4000; +INSERT INTO t SELECT * FROM seq_4001_to_4500; +INSERT INTO t SELECT * FROM seq_4501_to_5000; +ROLLBACK; + +SELECT if(variable_value-@log_writes<10,'ok',variable_value-@log_writes) +FROM information_schema.global_status WHERE variable_name='innodb_log_writes'; +--disconnect prevent_purge SELECT variable_value>0 FROM information_schema.global_status WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY'; From 15848a75a7c81d0d746166294d6db9879641aef1 Mon Sep 17 00:00:00 2001 From: ParadoxV5 Date: Thu, 6 Mar 2025 22:06:53 -0700 Subject: [PATCH 058/134] MDEV-36238 Functional Tests for --master-info-file and --show-slave-auth-info Add MTR tests in the `multi_source` suite to validate future changes that they does not affect the function of these two `mariadbd` options ``` master_info_file rpl_show_slave_auth_info ``` Reviewed-by: Susil Kumar Behera --- .../suite/multi_source/master_info_file.opt | 1 + .../multi_source/master_info_file.result | 18 ++++ .../suite/multi_source/master_info_file.test | 38 +++++++++ .../multi_source/show_slave_auth_info.cnf | 13 +++ .../multi_source/show_slave_auth_info.result | 45 ++++++++++ .../multi_source/show_slave_auth_info.test | 83 +++++++++++++++++++ 6 files changed, 198 insertions(+) create mode 100644 mysql-test/suite/multi_source/master_info_file.opt create mode 100644 mysql-test/suite/multi_source/master_info_file.result create mode 100644 mysql-test/suite/multi_source/master_info_file.test create mode 100644 mysql-test/suite/multi_source/show_slave_auth_info.cnf create mode 100644 mysql-test/suite/multi_source/show_slave_auth_info.result create mode 100644 mysql-test/suite/multi_source/show_slave_auth_info.test diff --git a/mysql-test/suite/multi_source/master_info_file.opt b/mysql-test/suite/multi_source/master_info_file.opt new file mode 100644 index 00000000000..33315660f0d --- /dev/null +++ b/mysql-test/suite/multi_source/master_info_file.opt @@ -0,0 +1 @@ +--master-info-file=$MYSQL_TMP_DIR/master_info_file.txt diff --git a/mysql-test/suite/multi_source/master_info_file.result b/mysql-test/suite/multi_source/master_info_file.result new file mode 100644 index 00000000000..08fe34677be --- /dev/null +++ b/mysql-test/suite/multi_source/master_info_file.result @@ -0,0 +1,18 @@ +CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=SERVER_MYPORT_1; +CHANGE MASTER 'named' TO master_host='localhost', master_user='test', master_port=SERVER_MYPORT_2; +--list_files @@datadir *.info +relay-log-named.info +relay-log.info +--list_files MYSQL_TMP_DIR *.txt +master_info_file-named.txt +master_info_file.txt +multi-master_info_file.txt +--cat_file MYSQL_TMP_DIR/multi-master_info_file.txt +named +FOUND 1 matches in master_info_file.txt +FOUND 1 matches in master_info_file.txt +FOUND 1 matches in master_info_file.txt +FOUND 1 matches in master_info_file-named.txt +FOUND 1 matches in master_info_file-named.txt +FOUND 1 matches in master_info_file-named.txt +RESET REPLICA 'named' ALL; diff --git a/mysql-test/suite/multi_source/master_info_file.test b/mysql-test/suite/multi_source/master_info_file.test new file mode 100644 index 00000000000..812b22b5706 --- /dev/null +++ b/mysql-test/suite/multi_source/master_info_file.test @@ -0,0 +1,38 @@ +# MDEV-36238: Test `--master-info-file` +# +# Other tests (such as `info_logs`) work explicitly with `(multi-)master.info`. +# This test sees that `--master-info-file` moves/renames this file. + +--source include/not_embedded.inc +--replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1 +--eval CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=$SERVER_MYPORT_1 +--replace_result $SERVER_MYPORT_2 SERVER_MYPORT_2 +--eval CHANGE MASTER 'named' TO master_host='localhost', master_user='test', master_port=$SERVER_MYPORT_2 + +--let $datadir = `SELECT @@datadir` +--echo --list_files @@datadir *.info +--list_files $datadir *.info +--echo --list_files MYSQL_TMP_DIR *.txt +--list_files $MYSQL_TMP_DIR *.txt + +--echo --cat_file MYSQL_TMP_DIR/multi-master_info_file.txt +--cat_file $MYSQL_TMP_DIR/multi-master_info_file.txt +--let SEARCH_OUTPUT= count + +--let SEARCH_FILE= $MYSQL_TMP_DIR/master_info_file.txt +--let SEARCH_PATTERN= \\n127.0.0.1\\n +--source include/search_pattern_in_file.inc +--let SEARCH_PATTERN= \\nroot\\n +--source include/search_pattern_in_file.inc +--let SEARCH_PATTERN= \\n$SERVER_MYPORT_1\\n +--source include/search_pattern_in_file.inc + +--let SEARCH_FILE= $MYSQL_TMP_DIR/master_info_file-named.txt +--let SEARCH_PATTERN= \\nlocalhost\\n +--source include/search_pattern_in_file.inc +--let SEARCH_PATTERN= \\ntest\\n +--source include/search_pattern_in_file.inc +--let SEARCH_PATTERN= \\n$SERVER_MYPORT_2\\n +--source include/search_pattern_in_file.inc + +RESET REPLICA 'named' ALL; diff --git a/mysql-test/suite/multi_source/show_slave_auth_info.cnf b/mysql-test/suite/multi_source/show_slave_auth_info.cnf new file mode 100644 index 00000000000..50761676fd6 --- /dev/null +++ b/mysql-test/suite/multi_source/show_slave_auth_info.cnf @@ -0,0 +1,13 @@ +!include ./my.cnf + +[mysqld.1] +show-slave-auth-info + +[mysqld.4] +server-id=4 +log-warnings=2 +report-user=my_user +report-password=my_password + +[ENV] +SERVER_MYPORT_4= @mysqld.4.port diff --git a/mysql-test/suite/multi_source/show_slave_auth_info.result b/mysql-test/suite/multi_source/show_slave_auth_info.result new file mode 100644 index 00000000000..eff87e2fcd4 --- /dev/null +++ b/mysql-test/suite/multi_source/show_slave_auth_info.result @@ -0,0 +1,45 @@ +# Setup +connect master1,127.0.0.1,root,,,$SERVER_MYPORT_1; +connect master2,127.0.0.1,root,,,$SERVER_MYPORT_2; +connect slave1,127.0.0.1,root,,,$SERVER_MYPORT_3; +connect slave2,127.0.0.1,root,,,$SERVER_MYPORT_4; +connection slave2; +CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=SERVER_MYPORT_1; +CHANGE MASTER 'control sample' TO master_host='127.0.0.1', master_user='root', master_port=SERVER_MYPORT_2; +START ALL SLAVES; +connection slave1; +CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=SERVER_MYPORT_1; +CHANGE MASTER 'control sample' TO master_host='127.0.0.1', master_user='root', master_port=SERVER_MYPORT_2; +START ALL SLAVES; +# Test +connection master2; +SHOW SLAVE HOSTS; +Server_id Host Port Master_id +3 localhost SERVER_MYPORT_3 2 +4 localhost SERVER_MYPORT_4 2 +connection master1; +SHOW SLAVE HOSTS; +Server_id Host User Password Port Master_id +3 localhost SERVER_MYPORT_3 1 +4 localhost my_user my_password SERVER_MYPORT_4 1 +SHOW REPLICA HOSTS; +Server_id Host User Password Port Master_id +3 localhost SERVER_MYPORT_3 1 +4 localhost my_user my_password SERVER_MYPORT_4 1 +# Cleanup +connection slave2; +STOP ALL SLAVES; +include/wait_for_slave_to_stop.inc +SET @@SESSION.default_master_connection= 'control sample'; +include/wait_for_slave_to_stop.inc +RESET SLAVE ALL; +connection slave1; +STOP ALL SLAVES; +include/wait_for_slave_to_stop.inc +SET @@SESSION.default_master_connection= 'control sample'; +include/wait_for_slave_to_stop.inc +RESET SLAVE ALL; +disconnect master1; +disconnect master2; +disconnect slave1; +disconnect slave2; diff --git a/mysql-test/suite/multi_source/show_slave_auth_info.test b/mysql-test/suite/multi_source/show_slave_auth_info.test new file mode 100644 index 00000000000..a94ff0e6ccb --- /dev/null +++ b/mysql-test/suite/multi_source/show_slave_auth_info.test @@ -0,0 +1,83 @@ +# MDEV-36238: Test `--show-slave-auth-info` (and `--report-user`/`password`) +# +# `rpl.rpl_show_slave_hosts` and `rpl.rpl_slave_alias_replica` +# (and several others) test SHOW SLAVE HOSTS without `--show-slave-auth-info`. +# This test supplements them with a comparison between with and without. + +# SHOW SLAVE HOSTS is agnostic of binlog formats +--source include/have_binlog_format_mixed.inc + +--echo # Setup + +# This server has `--show-slave-auth-info`. +--connect (master1,127.0.0.1,root,,,$SERVER_MYPORT_1) +# This `--show-slave-auth-info`-less server asserts that it is per-master. +--connect (master2,127.0.0.1,root,,,$SERVER_MYPORT_2) +# This is a non-reporting slave. +--connect (slave1,127.0.0.1,root,,,$SERVER_MYPORT_3) +# This is a self-reporting slave. +--connect (slave2,127.0.0.1,root,,,$SERVER_MYPORT_4) + +--let $rpl_server_number= 2 +while ($rpl_server_number) +{ + --connection slave$rpl_server_number + + --replace_result $SERVER_MYPORT_1 SERVER_MYPORT_1 + --eval CHANGE MASTER TO master_host='127.0.0.1', master_user='root', master_port=$SERVER_MYPORT_1 + --replace_result $SERVER_MYPORT_2 SERVER_MYPORT_2 + --eval CHANGE MASTER 'control sample' TO master_host='127.0.0.1', master_user='root', master_port=$SERVER_MYPORT_2 + --disable_warnings + START ALL SLAVES; + --enable_warnings + + --dec $rpl_server_number +} + +--echo # Test + +--let $rpl_server_number= 2 +while ($rpl_server_number) +{ + --connection master$rpl_server_number + + # Make sure the master's synced up + --let $show_statement= SHOW SLAVE HOSTS + --let $field= Server_id + --let $condition= =3 + --source include/wait_show_condition.inc + --let $condition= =4 + --source include/wait_show_condition.inc + + --replace_result $SERVER_MYPORT_3 SERVER_MYPORT_3 $SERVER_MYPORT_4 SERVER_MYPORT_4 + SHOW SLAVE HOSTS; + + --dec $rpl_server_number +} + +# MDEV-20601 Make REPLICA a synonym for SLAVE in SQL statements +--replace_result $SERVER_MYPORT_3 SERVER_MYPORT_3 $SERVER_MYPORT_4 SERVER_MYPORT_4 +SHOW REPLICA HOSTS; + +--echo # Cleanup + +--let $rpl_server_number= 2 +while ($rpl_server_number) +{ + --connection slave$rpl_server_number + + --disable_warnings + STOP ALL SLAVES; + --enable_warnings + --source include/wait_for_slave_to_stop.inc + SET @@SESSION.default_master_connection= 'control sample'; + --source include/wait_for_slave_to_stop.inc + RESET SLAVE ALL; + + --dec $rpl_server_number +} + +--disconnect master1 +--disconnect master2 +--disconnect slave1 +--disconnect slave2 From 2ae721f2ad391e7b18a56aed2e18d0f12670dfab Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 19 Mar 2025 16:05:35 +0400 Subject: [PATCH 059/134] MDEV-36179 Assertion `0' failed in virtual bool Type_handler_row::Item_save_in_value(THD*, Item*, st_value*) const sp_head::execute_procedure() and sp_head::execute_function() did not check that Item_param could be passed as an actual parameter to a ROW type formal parameter of a stored routine. Example: CREATE PROCEDURE p0(OUT a ROW(a INT,b INT)) ...; PREPARE s0 'CALL p0(?)'; EXECUTE p0 USING @a; In case of passing a user variable as an OUT parameter it led to a crash after executing routine instructions, when copying formal OUT parameters to the bound actual parameters. Fix: Check cases when Item_param is being bound to a ROW type formal parameter. Raise an error if so. The new check is done for all parameter modes: IN, OUT, INOUT, for a consistent error message. The new check is done before executing the routine instructions. --- mysql-test/main/sp-row.result | 41 +++++++++++++++++++++++ mysql-test/main/sp-row.test | 61 +++++++++++++++++++++++++++++++++++ sql/sp_head.cc | 37 +++++++++++++++++++++ 3 files changed, 139 insertions(+) diff --git a/mysql-test/main/sp-row.result b/mysql-test/main/sp-row.result index 36a371d8c04..48b33eebc7a 100644 --- a/mysql-test/main/sp-row.result +++ b/mysql-test/main/sp-row.result @@ -2313,3 +2313,44 @@ SELECT 1 LIKE 2 ESCAPE a; END; $$ ERROR 21000: Operand should contain 1 column(s) +# Start of 10.6 tests +# +# MDEV-36179 Assertion `0' failed in virtual bool Type_handler_row::Item_save_in_value(THD*, Item*, st_value*) const +# +CREATE PROCEDURE p0 (IN a ROW(a INT,b INT)) +BEGIN +SET a=ROW(0,0); +END; +/ +PREPARE s0 FROM 'CALL p0(?)'; +EXECUTE s0 USING @a; +ERROR HY000: Illegal parameter data type row for operation 'EXECUTE ... USING ?' +DROP PROCEDURE p0; +CREATE PROCEDURE p0 (INOUT a ROW(a INT,b INT)) +BEGIN +SET a=ROW(0,0); +END; +/ +PREPARE s0 FROM 'CALL p0(?)'; +EXECUTE s0 USING @a; +ERROR HY000: Illegal parameter data type row for operation 'EXECUTE ... USING ?' +DROP PROCEDURE p0; +CREATE PROCEDURE p0 (OUT a ROW(a INT,b INT)) +BEGIN +SET a=ROW(0,0); +END; +/ +PREPARE s0 FROM 'CALL p0(?)'; +EXECUTE s0 USING @a; +ERROR HY000: Illegal parameter data type row for operation 'EXECUTE ... USING ?' +DROP PROCEDURE p0; +CREATE FUNCTION f0(a ROW(a INT,b INT)) RETURNS BOOLEAN +BEGIN +RETURN FALSE; +END; +/ +PREPARE s0 FROM 'SELECT f0(?)'; +EXECUTE s0 USING @a; +ERROR HY000: Illegal parameter data type row for operation 'EXECUTE ... USING ?' +DROP FUNCTION f0; +# End of 10.6 tests diff --git a/mysql-test/main/sp-row.test b/mysql-test/main/sp-row.test index 527ff9455bd..f6bad0011d1 100644 --- a/mysql-test/main/sp-row.test +++ b/mysql-test/main/sp-row.test @@ -1544,3 +1544,64 @@ BEGIN NOT ATOMIC END; $$ DELIMITER ;$$ + + +--echo # Start of 10.6 tests + + +--echo # +--echo # MDEV-36179 Assertion `0' failed in virtual bool Type_handler_row::Item_save_in_value(THD*, Item*, st_value*) const +--echo # + +DELIMITER /; +CREATE PROCEDURE p0 (IN a ROW(a INT,b INT)) +BEGIN + SET a=ROW(0,0); +END; +/ +DELIMITER ;/ +PREPARE s0 FROM 'CALL p0(?)'; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +EXECUTE s0 USING @a; +DROP PROCEDURE p0; + + +DELIMITER /; +CREATE PROCEDURE p0 (INOUT a ROW(a INT,b INT)) +BEGIN + SET a=ROW(0,0); +END; +/ +DELIMITER ;/ +PREPARE s0 FROM 'CALL p0(?)'; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +EXECUTE s0 USING @a; +DROP PROCEDURE p0; + + +DELIMITER /; +CREATE PROCEDURE p0 (OUT a ROW(a INT,b INT)) +BEGIN + SET a=ROW(0,0); +END; +/ +DELIMITER ;/ +PREPARE s0 FROM 'CALL p0(?)'; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +EXECUTE s0 USING @a; +DROP PROCEDURE p0; + + +DELIMITER /; +CREATE FUNCTION f0(a ROW(a INT,b INT)) RETURNS BOOLEAN +BEGIN + RETURN FALSE; +END; +/ +DELIMITER ;/ +PREPARE s0 FROM 'SELECT f0(?)'; +--error ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION +EXECUTE s0 USING @a; +DROP FUNCTION f0; + +--echo # End of 10.6 tests diff --git a/sql/sp_head.cc b/sql/sp_head.cc index dcd46a55e13..926da91ae0b 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -2114,6 +2114,27 @@ sp_head::execute_function(THD *thd, Item **argp, uint argcount, /* Arguments must be fixed in Item_func_sp::fix_fields */ DBUG_ASSERT(argp[arg_no]->fixed()); + sp_variable *spvar= m_pcont->find_variable(arg_no); + + if (!spvar) + continue; + + /* + When you get a merge conflict, please move this code + into bind_input_param(). This also applies to the similar + code in execute_procedure(). + */ + if (!spvar->field_def.type_handler()->is_scalar_type() && + dynamic_cast(argp[arg_no])) + { + // Item_param cannot store values of non-scalar data types yet + my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0), + spvar->field_def.type_handler()->name().ptr(), + "EXECUTE ... USING ?"); + err_status= true; + goto err_with_cleanup; + } + if ((err_status= (*func_ctx)->set_parameter(thd, arg_no, &(argp[arg_no])))) goto err_with_cleanup; } @@ -2359,11 +2380,27 @@ sp_head::execute_procedure(THD *thd, List *args) if (!arg_item) break; + /* + When you get a merge conflict, please move this code + into bind_input_param(). This also applies to the similar + code in execute_function(). + */ sp_variable *spvar= m_pcont->find_variable(i); if (!spvar) continue; + if (!spvar->field_def.type_handler()->is_scalar_type() && + dynamic_cast(arg_item)) + { + // Item_param cannot store values of non-scalar data types yet + my_error(ER_ILLEGAL_PARAMETER_DATA_TYPE_FOR_OPERATION, MYF(0), + spvar->field_def.type_handler()->name().ptr(), + "EXECUTE ... USING ?"); + err_status= true; + break; + } + if (spvar->mode != sp_variable::MODE_IN) { Settable_routine_parameter *srp= From b50df7bbd4f189ac6117b3ff5eb1d79fe83fa7e2 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Thu, 6 Mar 2025 11:21:18 +1100 Subject: [PATCH 060/134] MDEV-36220 Correct length in memcpy saving and restoring found NULL record in loose index scan of min Use reclength because rec_buff_length is the actual reclength with padding, whose use could cause ASAN unknown-crash, presumably caused by memory violation. --- mysql-test/main/group_min_max.result | 12 ++++++++++++ mysql-test/main/group_min_max.test | 10 ++++++++++ sql/opt_range.cc | 4 ++-- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/mysql-test/main/group_min_max.result b/mysql-test/main/group_min_max.result index b0155f4fd85..1716db76227 100644 --- a/mysql-test/main/group_min_max.result +++ b/mysql-test/main/group_min_max.result @@ -4359,5 +4359,17 @@ MAX(b) 3 drop table t1; # +# MDEV-36220 ASAN unknown-crash in loose index scan of MIN with IS NULL +# +CREATE TABLE t1 (a int, b int, KEY (a, b)); +insert into t1 values (4, NULL), (1, 14), (4, 3); +SELECT MIN(b) FROM t1 WHERE b = 3 OR b IS NULL GROUP BY a; +MIN(b) +3 +SELECT MIN(b) FROM t1 WHERE b IS NULL GROUP BY a; +MIN(b) +NULL +drop table t1; +# # End of 10.11 tests # diff --git a/mysql-test/main/group_min_max.test b/mysql-test/main/group_min_max.test index d3aae2e2321..9e62f755b08 100644 --- a/mysql-test/main/group_min_max.test +++ b/mysql-test/main/group_min_max.test @@ -2030,6 +2030,16 @@ if ($have_debug) { drop table t1; +--echo # +--echo # MDEV-36220 ASAN unknown-crash in loose index scan of MIN with IS NULL +--echo # + +CREATE TABLE t1 (a int, b int, KEY (a, b)); +insert into t1 values (4, NULL), (1, 14), (4, 3); +SELECT MIN(b) FROM t1 WHERE b = 3 OR b IS NULL GROUP BY a; +SELECT MIN(b) FROM t1 WHERE b IS NULL GROUP BY a; +drop table t1; + --echo # --echo # End of 10.11 tests --echo # diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 6985f43a623..3f9c5663b26 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -16017,7 +16017,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min_in_range() Remember this key, and continue looking for a non-NULL key that satisfies some other condition. */ - memcpy(tmp_record, record, head->s->rec_buff_length); + memcpy(tmp_record, record, head->s->reclength); found_null= TRUE; continue; } @@ -16057,7 +16057,7 @@ int QUICK_GROUP_MIN_MAX_SELECT::next_min_in_range() */ if (found_null && result) { - memcpy(record, tmp_record, head->s->rec_buff_length); + memcpy(record, tmp_record, head->s->reclength); result= 0; } return result; From 0b8762822eb36523239de5ba994f71f1630c3173 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 29 Jan 2025 11:42:56 +0100 Subject: [PATCH 061/134] MDEV-35969 wsrep: add more details in service manager status Let's show the difference between donor and joiner. Signed-off-by: Julius Goryavsky --- sql/wsrep_sst.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index 5b67716dcbe..ba74fb6f29f 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -125,7 +125,7 @@ static void* wsrep_sst_donor_monitor_thread(void *arg __attribute__((unused))) "is not completed", time_waited); service_manager_extend_timeout(WSREP_EXTEND_TIMEOUT_INTERVAL, - "WSREP state transfer ongoing..."); + "WSREP state transfer (role donor) ongoing..."); } } @@ -162,7 +162,7 @@ static void* wsrep_sst_joiner_monitor_thread(void *arg __attribute__((unused))) "is not completed", time_waited); service_manager_extend_timeout(WSREP_EXTEND_TIMEOUT_INTERVAL, - "WSREP state transfer ongoing..."); + "WSREP state transfer (role joiner) ongoing..."); } } From 02893e875bc346cc930ce0418e9e7a09986354b9 Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Wed, 29 Jan 2025 11:45:15 +0100 Subject: [PATCH 062/134] MDEV-35969 wsrep: set new status for service manager On WSREP state transfer the status in service manager changes to: WSREP state transfer (role ...) ongoing... This status was not changed after state transfer was complete. Let's change it again to reflect now situation: WSREP state transfer (role ...) comleted. Signed-off-by: Julius Goryavsky --- sql/wsrep_sst.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index ba74fb6f29f..eb9b2cbb8a7 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -132,6 +132,8 @@ static void* wsrep_sst_donor_monitor_thread(void *arg __attribute__((unused))) WSREP_INFO("Donor monitor thread ended with total time %lu sec", time_waited); mysql_mutex_unlock(&LOCK_wsrep_donor_monitor); + sd_notify(0, "STATUS=WSREP state transfer (role donor) completed.\n"); + return NULL; } @@ -169,6 +171,8 @@ static void* wsrep_sst_joiner_monitor_thread(void *arg __attribute__((unused))) WSREP_INFO("Joiner monitor thread ended with total time %lu sec", time_waited); mysql_mutex_unlock(&LOCK_wsrep_joiner_monitor); + sd_notify(0, "STATUS=WSREP state transfer (role joiner) completed.\n"); + return NULL; } From 2a92cf8b0c15d4ce53a39a48a4ad584732507ed9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 20 Mar 2025 15:29:43 +0200 Subject: [PATCH 063/134] MDEV-35000 fixup: GCC 4.8.5 -Wconversion Old GCC versions would issue bogus -Wconversion. Let us silence this one with a redundant cast. --- storage/innobase/handler/ha_innodb.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 0f250f49360..17c1bcf6370 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3002,8 +3002,9 @@ static bool innodb_copy_stat_flags(dict_table_t *table, static_assert(HA_OPTION_NO_STATS_PERSISTENT == dict_table_t::STATS_PERSISTENT_OFF << 11, ""); uint32_t stat= - (table_options & - (HA_OPTION_STATS_PERSISTENT | HA_OPTION_NO_STATS_PERSISTENT)) >> 11; + uint32_t(table_options & + (HA_OPTION_STATS_PERSISTENT | + HA_OPTION_NO_STATS_PERSISTENT)) >> 11; static_assert(uint32_t{HA_STATS_AUTO_RECALC_ON} << 3 == dict_table_t::STATS_AUTO_RECALC_ON, ""); static_assert(uint32_t{HA_STATS_AUTO_RECALC_OFF} << 3 == From 64ea539f7666eca7151b23587fe8903b45f67876 Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Mon, 17 Mar 2025 11:46:34 +0300 Subject: [PATCH 064/134] MDEV-36208 dbug_print_table_row is broken: prints empty rows in debugger --- sql/filesort.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/filesort.cc b/sql/filesort.cc index a0e16791f89..442597efe49 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -667,7 +667,7 @@ const char* dbug_print_row(TABLE *table, const uchar *rec, bool print_names) move_back_guard.engage(); } - SCOPE_VALUE(table->read_set, (table->read_set && table->write_set) ? + SCOPE_VALUE(table->read_set, (table->reginfo.lock_type >= TL_WRITE_ALLOW_WRITE) ? table->write_set : table->read_set); output.length(0); From 56bc6901d6b3fda9fbf7798ed6c764cb0e09f879 Mon Sep 17 00:00:00 2001 From: Dmitry Shulga Date: Wed, 19 Mar 2025 00:03:03 +0700 Subject: [PATCH 065/134] MDEV-34501: SIGSEGV in pfs_start_mutex_wait_v1, __strlen_avx2, or __strlen_evex from safe_mutex_lock on CREATE DEFINER when using skip-grant-tables Attempt to create a procedure with the DEFINER clause resulted in abnormal server termination in case the server run with the option --skip-grant-tables=1. The reason of abnormal termination is that on handling of the DEFINER clause, not initialized data members of acl_cache is accessed, that led to server crash. Behaviour of the server for considered use case must be the same as for embedded server. Than means, if a security subsytem wasn't initialized (server is started with the option --skip-grant-tables=1) return success from get_current_user() without further access to the acl_cache that obviously not initialized. Additionlly, AUTHID::is_role was modified to handle the case when a host part of the user name isn't provided. Treat this case as if the empty host name is provided. --- mysql-test/main/skip_grants.result | 8 ++++++++ mysql-test/main/skip_grants.test | 11 +++++++++++ mysql-test/main/sp-bugs.result | 9 +++++++++ mysql-test/main/sp-bugs.test | 20 ++++++++++++++++++++ sql/sql_acl.cc | 3 +++ sql/structs.h | 2 +- 6 files changed, 52 insertions(+), 1 deletion(-) diff --git a/mysql-test/main/skip_grants.result b/mysql-test/main/skip_grants.result index a8633807571..daf4191a555 100644 --- a/mysql-test/main/skip_grants.result +++ b/mysql-test/main/skip_grants.result @@ -139,3 +139,11 @@ drop user baz@baz; # # End of 10.3 tests # +# +# MDEV-34501: SIGSEGV in pfs_start_mutex_wait_v1, __strlen_avx2, or __strlen_evex from safe_mutex_lock on CREATE DEFINER when using skip-grant-tables +# +CREATE DEFINER=a PROCEDURE p() SELECT 1; +CREATE DEFINER=a FUNCTION f() RETURNS INT RETURN 100; +DROP PROCEDURE p; +DROP FUNCTION f; +# End of 10.5 tests diff --git a/mysql-test/main/skip_grants.test b/mysql-test/main/skip_grants.test index eb8d3c3df88..2c4eddda2b2 100644 --- a/mysql-test/main/skip_grants.test +++ b/mysql-test/main/skip_grants.test @@ -164,3 +164,14 @@ drop user baz@baz; --echo # --echo # End of 10.3 tests --echo # + +--echo # +--echo # MDEV-34501: SIGSEGV in pfs_start_mutex_wait_v1, __strlen_avx2, or __strlen_evex from safe_mutex_lock on CREATE DEFINER when using skip-grant-tables +--echo # +CREATE DEFINER=a PROCEDURE p() SELECT 1; +CREATE DEFINER=a FUNCTION f() RETURNS INT RETURN 100; + +DROP PROCEDURE p; +DROP FUNCTION f; + +--echo # End of 10.5 tests diff --git a/mysql-test/main/sp-bugs.result b/mysql-test/main/sp-bugs.result index bd5883f0a04..c1f64a1fa14 100644 --- a/mysql-test/main/sp-bugs.result +++ b/mysql-test/main/sp-bugs.result @@ -388,5 +388,14 @@ ERROR 23000: Column 'c2' in from clause is ambiguous DROP PROCEDURE p2; DROP TABLE t1, t2; # +# MDEV-34501: SIGSEGV in pfs_start_mutex_wait_v1, __strlen_avx2, or __strlen_evex from safe_mutex_lock on CREATE DEFINER when using skip-grant-tables +# +# This test is a duplicate of the one located in the file skip_grants.test +# and placed here to check the same test case against embedded-server +CREATE DEFINER=a PROCEDURE p() SELECT 1; +CREATE DEFINER=a FUNCTION f() RETURNS INT RETURN 100; +DROP PROCEDURE p; +DROP FUNCTION f; +# # End of 10.5 tests # diff --git a/mysql-test/main/sp-bugs.test b/mysql-test/main/sp-bugs.test index f44216fbf46..9a4b867a92b 100644 --- a/mysql-test/main/sp-bugs.test +++ b/mysql-test/main/sp-bugs.test @@ -414,6 +414,26 @@ CALL p2 (@a,@c); DROP PROCEDURE p2; DROP TABLE t1, t2; +--echo # +--echo # MDEV-34501: SIGSEGV in pfs_start_mutex_wait_v1, __strlen_avx2, or __strlen_evex from safe_mutex_lock on CREATE DEFINER when using skip-grant-tables +--echo # +--echo # This test is a duplicate of the one located in the file skip_grants.test +--echo # and placed here to check the same test case against embedded-server + +# Disable warnings before running the following CREATE PROCEDURE/FUNCTION +# statement since the warning message +# "The user specified as a definer ('a'@'%') does not exist" +# is output in case the test be run against a regular server +# and isn't output if embedded server is used (@sa sp_process_definer() +# in sql_parse.cc). +--disable_warnings +CREATE DEFINER=a PROCEDURE p() SELECT 1; +CREATE DEFINER=a FUNCTION f() RETURNS INT RETURN 100; +--enable_warnings + +DROP PROCEDURE p; +DROP FUNCTION f; + --echo # --echo # End of 10.5 tests --echo # diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index a7e9ea7d6f7..385d3da18e2 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -12944,6 +12944,9 @@ LEX_USER *get_current_user(THD *thd, LEX_USER *user, bool lock) if (is_invalid_role_name(user->user.str)) return 0; + if (!initialized) + return dup; + if (lock) mysql_mutex_lock(&acl_cache->lock); if (find_acl_role(dup->user.str)) diff --git a/sql/structs.h b/sql/structs.h index aa50035ac7a..2fbd263c825 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -227,7 +227,7 @@ struct AUTHID LEX_CSTRING user, host; void init() { memset(this, 0, sizeof(*this)); } void copy(MEM_ROOT *root, const LEX_CSTRING *usr, const LEX_CSTRING *host); - bool is_role() const { return user.str[0] && !host.str[0]; } + bool is_role() const { return user.str[0] && (!host.str || !host.str[0]); } void set_lex_string(LEX_CSTRING *l, char *buf) { if (is_role()) From f813c8541a26eb03c04a85008e483aa67741f0af Mon Sep 17 00:00:00 2001 From: KhaledR57 Date: Fri, 14 Mar 2025 03:30:33 +0200 Subject: [PATCH 066/134] MDEV-34621 Fix division by zero in mariadb-slap when iterations=0 mariadb-slap crashes with a floating point exception when run with -iterations=0 due to division by zero in generate_stats(). This occurs when calculating average timing by dividing by the number of iterations. To fix this, the solution checks if iterations == 0 before performing the division, and returns early from the function in such cases. --- client/mysqlslap.c | 12 +++++++----- mysql-test/main/mysqlslap.result | 3 +++ mysql-test/main/mysqlslap.test | 6 ++++++ 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 035a7f0d7ae..7c9e1104901 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -2237,6 +2237,13 @@ generate_stats(conclusions *con, option_string *eng, stats *sptr) stats *ptr; unsigned int x; + if (eng && eng->string) + con->engine= eng->string; + + /* Early return when iterations is 0 to avoid accessing uninitialized sptr */ + if (iterations == 0) + return; + con->min_timing= sptr->timing; con->max_timing= sptr->timing; con->min_rows= sptr->rows; @@ -2257,11 +2264,6 @@ generate_stats(conclusions *con, option_string *eng, stats *sptr) con->min_timing= ptr->timing; } con->avg_timing= con->avg_timing/iterations; - - if (eng && eng->string) - con->engine= eng->string; - else - con->engine= NULL; } void diff --git a/mysql-test/main/mysqlslap.result b/mysql-test/main/mysqlslap.result index 78560903fb7..db3582ac3c0 100644 --- a/mysql-test/main/mysqlslap.result +++ b/mysql-test/main/mysqlslap.result @@ -260,3 +260,6 @@ DROP TABLE t1; # # Bug MDEV-15789 (Upstream: #80329): MYSQLSLAP OPTIONS --AUTO-GENERATE-SQL-GUID-PRIMARY and --AUTO-GENERATE-SQL-SECONDARY-INDEXES DONT WORK # +# +# Bug MDEV-34621: Fix division by zero in mariadb-slap when iterations=0 +# diff --git a/mysql-test/main/mysqlslap.test b/mysql-test/main/mysqlslap.test index 81115d59d09..f38284b1b1c 100644 --- a/mysql-test/main/mysqlslap.test +++ b/mysql-test/main/mysqlslap.test @@ -88,3 +88,9 @@ DROP TABLE t1; --exec $MYSQL_SLAP --concurrency=1 --silent --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-guid-primary --create-schema=slap --exec $MYSQL_SLAP --concurrency=1 --silent --iterations=1 --number-int-cols=2 --number-char-cols=3 --auto-generate-sql --auto-generate-sql-secondary-indexes=1 --create-schema=slap + +--echo # +--echo # Bug MDEV-34621: Fix division by zero in mariadb-slap when iterations=0 +--echo # + +--exec $MYSQL_SLAP -i0 --only-print From f1deebbb0bcff9bd83c057c3164eefb345619a6f Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Fri, 14 Mar 2025 13:45:09 +0530 Subject: [PATCH 067/134] MDEV-35420 Server aborts while deleting the record in spatial index - This issue caused by commit a032f14b342c782b82dfcd9235805bee446e6fe8(MDEV-33559). In MDEV-33559, matched_rec::block was changed to pointer and assinged with the help of buf_block_alloc(). But patch fails to check for the block can be nullptr in rtr_check_discard_page(). rtr_cur_search_with_match(): Acquire rtr_match_mutex before creating shadow block for the matched records rtr_pcur_move_to_next(): Copy the shadow block to page cursor block under rtr_match_mutex --- mysql-test/suite/innodb_gis/r/rollback.result | 13 ++++++++++ mysql-test/suite/innodb_gis/t/rollback.test | 13 ++++++++++ storage/innobase/gis/gis0sea.cc | 26 +++++++++++++------ 3 files changed, 44 insertions(+), 8 deletions(-) diff --git a/mysql-test/suite/innodb_gis/r/rollback.result b/mysql-test/suite/innodb_gis/r/rollback.result index 9e0db79667e..29d4f0884ba 100644 --- a/mysql-test/suite/innodb_gis/r/rollback.result +++ b/mysql-test/suite/innodb_gis/r/rollback.result @@ -412,3 +412,16 @@ update t1 set a=point(5,5), b=point(5,5), c=5 where i < 3; ERROR HY000: Lost connection to MySQL server during query insert into t1 values(5, point(5,5), point(5,5), 5); drop table t1; +# +# MDEV-35420 Server aborts while deleting the record +# in spatial index +# +CREATE TABLE t1 (c POINT NOT NULL, SPATIAL(c)) engine=InnoDB; +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SET STATEMENT unique_checks=0,foreign_key_checks=0 FOR +START TRANSACTION; +INSERT INTO t1 SELECT ST_GeomFromText('POINT(114368751 656950466)') FROM seq_1_to_512; +ROLLBACK; +DROP TABLE t1; diff --git a/mysql-test/suite/innodb_gis/t/rollback.test b/mysql-test/suite/innodb_gis/t/rollback.test index a09986692ee..06fe6591a9a 100644 --- a/mysql-test/suite/innodb_gis/t/rollback.test +++ b/mysql-test/suite/innodb_gis/t/rollback.test @@ -8,6 +8,7 @@ # Avoid CrashReporter popup on Mac --source include/not_crashrep.inc --source include/have_innodb_16k.inc +--source include/have_sequence.inc CREATE TABLE t4 (id bigint(12) unsigned NOT NULL auto_increment, c2 varchar(15) collate utf8_bin default NULL, @@ -475,3 +476,15 @@ update t1 set a=point(5,5), b=point(5,5), c=5 where i < 3; insert into t1 values(5, point(5,5), point(5,5), 5); drop table t1; + +--echo # +--echo # MDEV-35420 Server aborts while deleting the record +--echo # in spatial index +--echo # +CREATE TABLE t1 (c POINT NOT NULL, SPATIAL(c)) engine=InnoDB; +CHECK TABLE t1; +SET STATEMENT unique_checks=0,foreign_key_checks=0 FOR +START TRANSACTION; +INSERT INTO t1 SELECT ST_GeomFromText('POINT(114368751 656950466)') FROM seq_1_to_512; +ROLLBACK; +DROP TABLE t1; diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc index b9567ff03c3..66537a1ee11 100644 --- a/storage/innobase/gis/gis0sea.cc +++ b/storage/innobase/gis/gis0sea.cc @@ -495,10 +495,10 @@ rtr_pcur_move_to_next( rtr_rec_t rec; rec = rtr_info->matches->matched_recs->back(); rtr_info->matches->matched_recs->pop_back(); + cursor->btr_cur.page_cur.block = rtr_info->matches->block; mutex_exit(&rtr_info->matches->rtr_match_mutex); cursor->btr_cur.page_cur.rec = rec.r_rec; - cursor->btr_cur.page_cur.block = rtr_info->matches->block; DEBUG_SYNC_C("rtr_pcur_move_to_next_return"); return(true); @@ -1204,8 +1204,11 @@ rtr_check_discard_page( if (rtr_info->matches) { mutex_enter(&rtr_info->matches->rtr_match_mutex); - if (rtr_info->matches->block->page.id().page_no() - == pageno) { + /* matches->block could be nullptr when cursor + encounters empty table */ + if (rtr_info->matches->block + && rtr_info->matches->block->page.id().page_no() + == pageno) { if (!rtr_info->matches->matched_recs->empty()) { rtr_info->matches->matched_recs->clear(); } @@ -1849,6 +1852,15 @@ rtr_cur_search_with_match( ut_ad(orig_mode != PAGE_CUR_RTREE_LOCATE); + /* Collect matched records on page */ + offsets = rec_get_offsets( + rec, index, offsets, + index->n_fields, + ULINT_UNDEFINED, &heap); + + mutex_enter( + &rtr_info->matches->rtr_match_mutex); + if (!match_init) { rtr_init_match( rtr_info->matches, @@ -1856,14 +1868,12 @@ rtr_cur_search_with_match( match_init = true; } - /* Collect matched records on page */ - offsets = rec_get_offsets( - rec, index, offsets, - index->n_fields, - ULINT_UNDEFINED, &heap); rtr_leaf_push_match_rec( rec, rtr_info, offsets, page_is_comp(page)); + + mutex_exit( + &rtr_info->matches->rtr_match_mutex); } last_match_rec = rec; From 05be1865a9c16e34296ea0fa28b9bee921f0b907 Mon Sep 17 00:00:00 2001 From: Brad Smith Date: Fri, 7 Mar 2025 02:04:01 -0500 Subject: [PATCH 068/134] Fix building with Clang and GCC on RISC-V Clang does not have the builtin __builtin_riscv_pause(). --- include/my_cpu.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/my_cpu.h b/include/my_cpu.h index bd5fca5f21b..2b34e03fce3 100644 --- a/include/my_cpu.h +++ b/include/my_cpu.h @@ -97,7 +97,12 @@ static inline void MY_RELAX_CPU(void) /* Changed from __ppc_get_timebase for musl and clang compatibility */ __builtin_ppc_get_timebase(); #elif defined __GNUC__ && defined __riscv - __builtin_riscv_pause(); + /* The GCC-only __builtin_riscv_pause() or the pause instruction is + encoded like a fence instruction with special parameters. On RISC-V + implementations that do not support arch=+zihintpause this + instruction could be interpreted as a more expensive memory fence; + it should not be an illegal instruction. */ + __asm__ volatile(".long 0x0100000f" ::: "memory"); #elif defined __GNUC__ /* Mainly, prevent the compiler from optimizing away delay loops */ __asm__ __volatile__ ("":::"memory"); From 4c695c85bdb9e3d17833e1ab08d0d0180b8d945f Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Mon, 24 Mar 2025 09:01:07 +0300 Subject: [PATCH 069/134] MDEV-34775 Wrong reopen of already open routine due to auto-create in SP MDEV-34171 denied removing indirect routines/tables after recover_from_failed_open() for auto-create partition case. Now we are going further and keep them for any failed table reopen. MDEV-34171 did not handle correctly open_and_process_routine() after that skip of sp_remove_not_own_routines(). Now it is fixed by sroutine_to_open correct usage. --- .../suite/versioning/r/partition.result | 21 +++++++++++++++ mysql-test/suite/versioning/t/partition.test | 27 +++++++++++++++++++ sql/sql_base.cc | 16 +++++------ sql/sql_base.h | 19 +------------ 4 files changed, 57 insertions(+), 26 deletions(-) diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result index b15b9dd6d7e..497bcafdab3 100644 --- a/mysql-test/suite/versioning/r/partition.result +++ b/mysql-test/suite/versioning/r/partition.result @@ -3470,4 +3470,25 @@ drop table t; # # End of 10.9 tests # +# +# MDEV-34775 Wrong reopen of already open routine due to auto-create in SP +# +create table t (a int) with system versioning +partition by system_time +interval 1 minute auto; +create function f() +returns int +begin +replace into t select * from t; +return 0; +end $ +set timestamp= @@timestamp + 61; +select f(); +f() +0 +drop table t; +drop function f; +# +# End of 10.11 tests +# set global innodb_stats_persistent= @save_persistent; diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index f6b2dcb49f7..cbb83e1330b 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -2717,5 +2717,32 @@ drop table t; --echo # End of 10.9 tests --echo # +--echo # +--echo # MDEV-34775 Wrong reopen of already open routine due to auto-create in SP +--echo # + +create table t (a int) with system versioning +partition by system_time +interval 1 minute auto; + +--delimiter $ +create function f() +returns int +begin + replace into t select * from t; + return 0; +end $ +--delimiter ; + +set timestamp= @@timestamp + 61; +select f(); + +drop table t; +drop function f; + +--echo # +--echo # End of 10.11 tests +--echo # + set global innodb_stats_persistent= @save_persistent; --source suite/versioning/common_finish.inc diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 2162afb17e5..294c4330135 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -4561,6 +4561,7 @@ bool open_tables(THD *thd, const DDL_options_st &options, } thd->current_tablenr= 0; + sroutine_to_open= &thd->lex->sroutines_list.first; restart: /* @@ -4576,7 +4577,6 @@ restart: has_prelocking_list= thd->lex->requires_prelocking(); table_to_open= start; - sroutine_to_open= &thd->lex->sroutines_list.first; *counter= 0; THD_STAGE_INFO(thd, stage_opening_tables); prelocking_strategy->reset(thd); @@ -4673,7 +4673,7 @@ restart: elements from the table list (if MERGE tables are involved), */ close_tables_for_reopen(thd, start, ot_ctx.start_of_statement_svp(), - ot_ctx.remove_implicitly_used_deps()); + false); /* Here we rely on the fact that 'tables' still points to the valid @@ -4741,10 +4741,9 @@ restart: /* F.ex. deadlock happened */ if (ot_ctx.can_recover_from_failed_open()) { - DBUG_ASSERT(ot_ctx.remove_implicitly_used_deps()); close_tables_for_reopen(thd, start, ot_ctx.start_of_statement_svp(), - ot_ctx.remove_implicitly_used_deps()); + true); if (ot_ctx.recover_from_failed_open()) goto error; @@ -4753,6 +4752,7 @@ restart: goto error; error= FALSE; + sroutine_to_open= &thd->lex->sroutines_list.first; goto restart; } /* @@ -6034,19 +6034,19 @@ bool restart_trans_for_tables(THD *thd, TABLE_LIST *table) trying to reopen tables. NULL if no metadata locks were held and thus all metadata locks should be released. - @param[in] remove_implicit_deps True in case routines and tables implicitly + @param[in] remove_indirect True in case routines and tables implicitly used by a statement should be removed. */ void close_tables_for_reopen(THD *thd, TABLE_LIST **tables, const MDL_savepoint &start_of_statement_svp, - bool remove_implicit_deps) + bool remove_indirect) { - TABLE_LIST *first_not_own_table= thd->lex->first_not_own_table(); TABLE_LIST *tmp; - if (remove_implicit_deps) + if (remove_indirect) { + TABLE_LIST *first_not_own_table= thd->lex->first_not_own_table(); /* If table list consists only from tables from prelocking set, table list for new attempt should be empty, so we have to update list's root pointer. diff --git a/sql/sql_base.h b/sql/sql_base.h index efcdd79a3cb..742f268c586 100644 --- a/sql/sql_base.h +++ b/sql/sql_base.h @@ -157,7 +157,7 @@ thr_lock_type read_lock_type_for_table(THD *thd, my_bool mysql_rm_tmp_tables(void); void close_tables_for_reopen(THD *thd, TABLE_LIST **tables, const MDL_savepoint &start_of_statement_svp, - bool remove_implicit_dependencies); + bool remove_indirect); bool table_already_fk_prelocked(TABLE_LIST *tl, LEX_CSTRING *db, LEX_CSTRING *table, thr_lock_type lock_type); TABLE_LIST *find_table_in_list(TABLE_LIST *table, @@ -568,23 +568,6 @@ public: return m_timeout; } - /** - Return true in case tables and routines the statement implicilty - dependent on should be removed, else return false. - - @note The use case when routines and tables the statement implicitly - dependent on shouldn't be removed is the one when a new partition be - created on handling the INSERT statement against a versioning partitioned - table. For this case re-opening a versioning table would result in adding - implicitly dependent routines (e.g. table's triggers) that lead to - allocation of memory on PS mem_root and so leaking a memory until the PS - statement be deallocated. - */ - bool remove_implicitly_used_deps() const - { - return m_action != OT_ADD_HISTORY_PARTITION; - } - uint get_flags() const { return m_flags; } /** From b0ec99398ffa16496b05c37d6b7cd1b57b9a0dff Mon Sep 17 00:00:00 2001 From: Amar Jilani Date: Mon, 20 Jan 2025 23:16:53 +0000 Subject: [PATCH 070/134] MDEV-21375: Get option group suffix from $MARIADB_GROUP_SUFFIX in addition to $MYSQL_GROUP_SUFFIX Add check for MARIADB_GROUP_SUFFIX environment variable when --default-group-suffix argument is not passed. This environment variable will take precedence over the MYSQL_GROUP_SUFFIX environment variable if both are set. All new code of the whole pull request, including one or several files that are either new files or modified ones, are contributed under the BSD-new license. I am contributing on behalf of my employer Amazon Web Services, Inc. --- mysys/my_default.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/mysys/my_default.c b/mysys/my_default.c index e63a3a8abd3..0b50235aa69 100644 --- a/mysys/my_default.c +++ b/mysys/my_default.c @@ -317,6 +317,9 @@ int get_defaults_options(char **argv) argv++; } + if (! my_defaults_group_suffix) + my_defaults_group_suffix= getenv("MARIADB_GROUP_SUFFIX"); + if (! my_defaults_group_suffix) my_defaults_group_suffix= getenv("MYSQL_GROUP_SUFFIX"); From 3bbe11acd93ad63ed1d90656e11a665d6326996f Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 24 Mar 2025 18:54:45 +0400 Subject: [PATCH 071/134] MDEV-20912 Add support for utf8mb4_0900_* collations in MariaDB Server Fixing a wrong alias utf8mb4_0900_bin: - was utf8mb4_bin - changed to utf8mb4_nopad_bin MySQL 0900 collations are NOPAD, including utf8mb4_0900_bin. --- mysql-test/main/ctype_utf8mb4_0900.result | 15 ++++++++++++++- mysql-test/main/ctype_utf8mb4_0900.test | 13 +++++++++++++ strings/ctype-uca.c | 8 +++++--- 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/mysql-test/main/ctype_utf8mb4_0900.result b/mysql-test/main/ctype_utf8mb4_0900.result index 9e85fe6d7dc..83718c7a126 100644 --- a/mysql-test/main/ctype_utf8mb4_0900.result +++ b/mysql-test/main/ctype_utf8mb4_0900.result @@ -91,7 +91,7 @@ utf8mb4_hu_0900_as_cs utf8mb4 297 Yes 8 Alias for utf8mb4_uca1400_hungarian_nop utf8mb4_hr_0900_as_cs utf8mb4 298 Yes 8 Alias for utf8mb4_uca1400_croatian_nopad_as_cs utf8mb4_vi_0900_as_cs utf8mb4 300 Yes 8 Alias for utf8mb4_uca1400_vietnamese_nopad_as_cs utf8mb4_0900_as_ci utf8mb4 305 Yes 8 Alias for utf8mb4_uca1400_nopad_as_ci -utf8mb4_0900_bin utf8mb4 309 Yes 1 Alias for utf8mb4_bin +utf8mb4_0900_bin utf8mb4 309 Yes 1 Alias for utf8mb4_nopad_bin # # MDEV-20912 Add support for utf8mb4_0900_* collations in MariaDB Server # @@ -198,3 +198,16 @@ drop table t1,t2; CREATE OR REPLACE TABLE t1 (p int primary key auto_increment, a VARCHAR(10), key (a)) engine=aria, COLLATE utf8mb4_sv_0900_ai_ci; alter table t1 modify a varchar(10) collate utf8mb4_uca1400_swedish_nopad_ai_ci, algorithm=nocopy; drop table t1; +# +# MDEV-36361 Wrong utf8mb4_0900_bin alias for utf8mb4_bin (should be utf8mb4_nopad_bin) +# +SELECT collation_name, id, comment +FROM information_schema.collations +WHERE collation_name='utf8mb4_0900_bin'; +collation_name id comment +utf8mb4_0900_bin 309 Alias for utf8mb4_nopad_bin +SET NAMES utf8mb4 COLLATE utf8mb4_0900_bin; +SELECT 'a\t'<'a' AS c1; +c1 +0 +# End of 11.4 tests diff --git a/mysql-test/main/ctype_utf8mb4_0900.test b/mysql-test/main/ctype_utf8mb4_0900.test index 8114ab2348f..0be9542fa7a 100644 --- a/mysql-test/main/ctype_utf8mb4_0900.test +++ b/mysql-test/main/ctype_utf8mb4_0900.test @@ -83,3 +83,16 @@ drop table t1,t2; CREATE OR REPLACE TABLE t1 (p int primary key auto_increment, a VARCHAR(10), key (a)) engine=aria, COLLATE utf8mb4_sv_0900_ai_ci; alter table t1 modify a varchar(10) collate utf8mb4_uca1400_swedish_nopad_ai_ci, algorithm=nocopy; drop table t1; + +--echo # +--echo # MDEV-36361 Wrong utf8mb4_0900_bin alias for utf8mb4_bin (should be utf8mb4_nopad_bin) +--echo # + +SELECT collation_name, id, comment +FROM information_schema.collations +WHERE collation_name='utf8mb4_0900_bin'; + +SET NAMES utf8mb4 COLLATE utf8mb4_0900_bin; +SELECT 'a\t'<'a' AS c1; + +--echo # End of 11.4 tests diff --git a/strings/ctype-uca.c b/strings/ctype-uca.c index a291a4889ec..3650eca61b9 100644 --- a/strings/ctype-uca.c +++ b/strings/ctype-uca.c @@ -39646,8 +39646,9 @@ struct mysql_0900_to_mariadb_1400_mapping mysql_0900_mapping[]= }; -static LEX_CSTRING mysql_utf8_bin= { STRING_WITH_LEN("utf8mb4_0900_bin") }; -static LEX_CSTRING mariadb_utf8_bin= { STRING_WITH_LEN("utf8mb4_bin") }; +static LEX_CSTRING + mysql_utf8mb4_0900_bin= {STRING_WITH_LEN("utf8mb4_0900_bin")}, + mariadb_utf8mb4_nopad_bin= {STRING_WITH_LEN("utf8mb4_nopad_bin")}; /* Map mysql character sets to MariaDB using the same definition but with @@ -39691,7 +39692,8 @@ my_bool mysql_utf8mb4_0900_collation_definitions_add() } } - if (add_alias_for_collation(&mariadb_utf8_bin, 46, &mysql_utf8_bin, 309)) + if (add_alias_for_collation(&mariadb_utf8mb4_nopad_bin, 1070, + &mysql_utf8mb4_0900_bin, 309)) return 1; return 0; } From 1277f9b4513a0f4c3303a41e142465dc7e403ad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 24 Mar 2025 12:00:30 +0200 Subject: [PATCH 072/134] MDEV-36372: Compilation is broken with the PLUGIN_PARTITION=NO Fixed a compilation error caused by MDEV-27861 that occurs when building with cmake -DPLUGIN_PARTITION=NO, because the default_part_plugin variable is only visible when WITH_PARTITION_STORAGE_ENGINE is defined. Signed-off-by: Julius Goryavsky --- sql/sql_truncate.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc index e86325d31a5..863c1bd795e 100644 --- a/sql/sql_truncate.cc +++ b/sql/sql_truncate.cc @@ -271,7 +271,7 @@ Sql_cmd_truncate_table::handler_truncate(THD *thd, TABLE_LIST *table_ref, bool Sql_cmd_truncate_table::lock_table(THD *thd, TABLE_LIST *table_ref, bool *hton_can_recreate) { - handlerton *hton; + const handlerton *hton; bool versioned; bool sequence= false; TABLE *table= NULL; @@ -342,8 +342,12 @@ bool Sql_cmd_truncate_table::lock_table(THD *thd, TABLE_LIST *table_ref, table we need to find out default partition handlerton. */ - const handlerton *ht= share->default_part_plugin ? - plugin_hton(share->default_part_plugin) : hton; + const handlerton* const ht= +#ifdef WITH_PARTITION_STORAGE_ENGINE + share->default_part_plugin ? + plugin_hton(share->default_part_plugin) : +#endif + hton; if (ht && !wsrep_should_replicate_ddl(thd, ht)) { From 33a462e0b18b4fb2fa4e254aac3e00447a831411 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 25 Mar 2025 08:48:08 +0200 Subject: [PATCH 073/134] MDEV-36373 Bogus Warning: ... storage is corrupted ha_innobase::statistics_init(), ha_innobase::info_low(): Correctly handle a DB_READ_ONLY return value from dict_stats_save(). Fixes up commit 6e6a1b316ca8df5116613fbe4ca2dc37b3c73bd1 (MDEV-35000) --- mysql-test/suite/innodb/r/stat_tables.result | 10 ++++++++++ mysql-test/suite/innodb/t/stat_tables.test | 9 +++++++++ storage/innobase/handler/ha_innodb.cc | 3 ++- 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/innodb/r/stat_tables.result b/mysql-test/suite/innodb/r/stat_tables.result index a50e6fb1886..21aca9e96bc 100644 --- a/mysql-test/suite/innodb/r/stat_tables.result +++ b/mysql-test/suite/innodb/r/stat_tables.result @@ -101,3 +101,13 @@ DROP TABLE t1; CREATE TABLE t1 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1; DROP TABLE t1; # End of 10.6 tests +# +# MDEV-36373 Warning: ... persistent statistics storage is corrupted +# +CREATE TABLE t1 (c INT) ENGINE=InnoDB; +SET STATEMENT tx_read_only=1 FOR ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +DROP TABLE t1; +# End of 10.11 tests diff --git a/mysql-test/suite/innodb/t/stat_tables.test b/mysql-test/suite/innodb/t/stat_tables.test index d606ad27709..81f205467b3 100644 --- a/mysql-test/suite/innodb/t/stat_tables.test +++ b/mysql-test/suite/innodb/t/stat_tables.test @@ -110,3 +110,12 @@ CREATE TABLE t1 (c1 INT) ENGINE=InnoDB STATS_PERSISTENT 1; DROP TABLE t1; --echo # End of 10.6 tests + +--echo # +--echo # MDEV-36373 Warning: ... persistent statistics storage is corrupted +--echo # +CREATE TABLE t1 (c INT) ENGINE=InnoDB; +SET STATEMENT tx_read_only=1 FOR ANALYZE TABLE t1; +DROP TABLE t1; + +--echo # End of 10.11 tests diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 17c1bcf6370..4da8e94a2d3 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -5872,7 +5872,7 @@ dberr_t ha_innobase::statistics_init(dict_table_t *table, bool recalc) if (err == DB_STATS_DO_NOT_EXIST && table->stats_is_auto_recalc()) goto recalc; } - if (err == DB_SUCCESS) + if (err == DB_SUCCESS || err == DB_READ_ONLY) return err; if (!recalc) break; @@ -14934,6 +14934,7 @@ recalc: ret = statistics_init(ib_table, is_analyze); switch (ret) { case DB_SUCCESS: + case DB_READ_ONLY: break; default: goto error; From 3d54cd6cf56447b9e9783092f51b67352a6b78d8 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Tue, 25 Mar 2025 10:13:47 +1100 Subject: [PATCH 074/134] update C/C --- libmariadb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmariadb b/libmariadb index 2d56f340c4a..a7ad25b01bd 160000 --- a/libmariadb +++ b/libmariadb @@ -1 +1 @@ -Subproject commit 2d56f340c4a0f2c636e317a3efd41b8c5f554088 +Subproject commit a7ad25b01bd7716d24181657abd4fb203a883371 From d84ceb586a38992ea846dc419961a1473a7d4f66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 25 Mar 2025 12:15:46 +0200 Subject: [PATCH 075/134] MDEV-36378 Recognize innodb_purge_rseg_truncate_frequency In commit bda40ccb854cc1531ec7bd1ab779504c7e00bd87 (MDEV-34803) there was a spelling mistake that somehow causes the deprecated parameter innodb_purge_rseg_truncate_frequency to be rejected at server startup. --- mysql-test/suite/sys_vars/t/sysvars_innodb.opt | 4 +++- mysql-test/suite/sys_vars/t/sysvars_innodb.test | 4 ++++ sql/mysqld.cc | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/sys_vars/t/sysvars_innodb.opt b/mysql-test/suite/sys_vars/t/sysvars_innodb.opt index c3eec59bc17..19ecb6c65f9 100644 --- a/mysql-test/suite/sys_vars/t/sysvars_innodb.opt +++ b/mysql-test/suite/sys_vars/t/sysvars_innodb.opt @@ -1,2 +1,4 @@ ---loose-innodb-flush-log-at-timeout=3 +--innodb +--innodb-purge-rseg-truncate-frequency=64 +--innodb-flush-log-at-timeout=3 --table_open_cache=200 diff --git a/mysql-test/suite/sys_vars/t/sysvars_innodb.test b/mysql-test/suite/sys_vars/t/sysvars_innodb.test index 15fd99e9984..83869fb96b3 100644 --- a/mysql-test/suite/sys_vars/t/sysvars_innodb.test +++ b/mysql-test/suite/sys_vars/t/sysvars_innodb.test @@ -3,6 +3,10 @@ --source include/not_valgrind.inc --source include/word_size.inc +--disable_query_log +call mtr.add_suppression("'innodb-purge-rseg-truncate-frequency' was removed"); +--enable_query_log + --vertical_results --replace_regex /^\/\S+/PATH/ /\.\//PATH/ select VARIABLE_NAME, SESSION_VALUE, DEFAULT_VALUE, VARIABLE_SCOPE, VARIABLE_TYPE, VARIABLE_COMMENT, NUMERIC_MIN_VALUE, NUMERIC_MAX_VALUE, NUMERIC_BLOCK_SIZE, ENUM_VALUE_LIST, READ_ONLY, COMMAND_LINE_ARGUMENT from information_schema.system_variables diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 3d63fc82afd..a3b48bc20d7 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -5220,7 +5220,7 @@ static int init_server_components() MARIADB_REMOVED_OPTION("innodb-log-optimize-ddl"), MARIADB_REMOVED_OPTION("innodb-lru-flush-size"), MARIADB_REMOVED_OPTION("innodb-page-cleaners"), - MARIADB_REMOVED_OPTION("innodb-purge-truncate-frequency"), + MARIADB_REMOVED_OPTION("innodb-purge-rseg-truncate-frequency"), MARIADB_REMOVED_OPTION("innodb-replication-delay"), MARIADB_REMOVED_OPTION("innodb-scrub-log"), MARIADB_REMOVED_OPTION("innodb-scrub-log-speed"), From 2469963f052b4dcb11ecfc0fcf5a38881c426df0 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Fri, 14 Mar 2025 11:32:27 +0530 Subject: [PATCH 076/134] MDEV-36270 mariabackup.incremental_compressed fails in 10.11+ - During prepare of incremental backup, mariabackup does create new file in target directory with default file size of 4 * innodb_page_size. While applying .delta file to corresponding data file, it encounters the FSP_SIZE modification on page0 and tries to extend the file to the size which is 4 in our case. Since the table is in compressed row format, page_size for the table is 8k. This lead to shrinking of tablespace file from 65536 to 32768. This issue happens only in windows because os_file_set_size() doesn't check for the current size and shrinks the file. Solution: ======== xtrabackup_apply_delta(): Check for the current size before doing setting size for the file. --- extra/mariabackup/xtrabackup.cc | 13 +++++++++++++ .../suite/mariabackup/incremental_compressed.result | 3 +++ .../suite/mariabackup/incremental_compressed.test | 12 +++++++++--- 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index a59e8f0858f..9b6a8b4c316 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -5508,9 +5508,22 @@ xtrabackup_apply_delta( buf + FSP_HEADER_OFFSET + FSP_SIZE); if (mach_read_from_4(buf + FIL_PAGE_SPACE_ID)) { +#ifdef _WIN32 + os_offset_t last_page = + os_file_get_size(dst_file) / + page_size; + + /* os_file_set_size() would + shrink the size of the file */ + if (last_page < n_pages && + !os_file_set_size( + dst_path, dst_file, + n_pages * page_size)) +#else if (!os_file_set_size( dst_path, dst_file, n_pages * page_size)) +#endif /* _WIN32 */ goto error; } else if (fil_space_t* space = fil_system.sys_space) { diff --git a/mysql-test/suite/mariabackup/incremental_compressed.result b/mysql-test/suite/mariabackup/incremental_compressed.result index f8b01808642..aeb52019aa0 100644 --- a/mysql-test/suite/mariabackup/incremental_compressed.result +++ b/mysql-test/suite/mariabackup/incremental_compressed.result @@ -4,6 +4,9 @@ # CREATE TABLE t (pk INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; ALTER TABLE t PARTITION BY KEY(pk); +# Incremental backup +# Prepare fullbackup +# Prepare incremental backup # shutdown server # remove datadir # xtrabackup move back diff --git a/mysql-test/suite/mariabackup/incremental_compressed.test b/mysql-test/suite/mariabackup/incremental_compressed.test index 15aff909a43..de7f588290f 100644 --- a/mysql-test/suite/mariabackup/incremental_compressed.test +++ b/mysql-test/suite/mariabackup/incremental_compressed.test @@ -16,12 +16,18 @@ CREATE TABLE t (pk INT PRIMARY KEY) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; ALTER TABLE t PARTITION BY KEY(pk); +--echo # Incremental backup --exec $XTRABACKUP --backup --target-dir=$incremental_dir --incremental-basedir=$basedir --protocol=tcp --port=$MASTER_MYPORT --user=root > $incremental_dir.log 2>&1 +--echo # Prepare fullbackup --exec $XTRABACKUP --prepare --target-dir=$basedir --user=root > $MYSQL_TMP_DIR/backup_prepare_0.log 2>&1 ---exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir --user=root > $MYSQL_TMP_DIR/backup_prepare_1.log ---cat_file $MYSQL_TMP_DIR/backup_prepare_1.log +--echo # Prepare incremental backup +--exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir --user=root > $MYSQL_TMP_DIR/backup_prepare_1.log 2>&1 let $targetdir=$basedir; -- source include/restart_and_restore.inc - SHOW CREATE TABLE t; DROP TABLE t; +remove_file $incremental_dir.log; +remove_file $MYSQL_TMP_DIR/backup_prepare_0.log; +remove_file $MYSQL_TMP_DIR/backup_prepare_1.log; +rmdir $basedir; +rmdir $incremental_dir; From 47d11328c9e61a6667b6f333c02ebdd2bb152cea Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Tue, 25 Mar 2025 14:42:58 +0200 Subject: [PATCH 077/134] MDEV-36381: Comment "Procedure of keys generation ..." is in the wrong place Move it from the middle of table.cc to sql_select.cc:generate_derived_keys() --- sql/sql_select.cc | 30 ++++++++++++++++++++++++++++++ sql/table.cc | 31 ------------------------------- 2 files changed, 30 insertions(+), 31 deletions(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 13802a91591..3c4b7b3ec03 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -14059,6 +14059,36 @@ bool generate_derived_keys_for_table(KEYUSE *keyuse, uint count, uint keys) } +/* + Procedure of keys generation for result tables of materialized derived + tables/views. + + A key is generated for each equi-join pair {derived_table, some_other_table}. + Each generated key consists of fields of derived table used in equi-join. + Example: + + SELECT * FROM (SELECT * FROM t1 GROUP BY 1) tt JOIN + t1 ON tt.f1=t1.f3 and tt.f2.=t1.f4; + In this case for the derived table tt one key will be generated. It will + consist of two parts f1 and f2. + Example: + + SELECT * FROM (SELECT * FROM t1 GROUP BY 1) tt JOIN + t1 ON tt.f1=t1.f3 JOIN + t2 ON tt.f2=t2.f4; + In this case for the derived table tt two keys will be generated. + One key over f1 field, and another key over f2 field. + Currently optimizer may choose to use only one such key, thus the second + one will be dropped after range optimizer is finished. + See also JOIN::drop_unused_derived_keys function. + Example: + + SELECT * FROM (SELECT * FROM t1 GROUP BY 1) tt JOIN + t1 ON tt.f1=a_function(t1.f3); + In this case for the derived table tt one key will be generated. It will + consist of one field - f1. +*/ + static bool generate_derived_keys(DYNAMIC_ARRAY *keyuse_array) { diff --git a/sql/table.cc b/sql/table.cc index ddc8aa2f432..1b2b70d8450 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -9956,37 +9956,6 @@ int TABLE_LIST::fetch_number_of_rows() return error; } -/* - Procedure of keys generation for result tables of materialized derived - tables/views. - - A key is generated for each equi-join pair derived table-another table. - Each generated key consists of fields of derived table used in equi-join. - Example: - - SELECT * FROM (SELECT * FROM t1 GROUP BY 1) tt JOIN - t1 ON tt.f1=t1.f3 and tt.f2.=t1.f4; - In this case for the derived table tt one key will be generated. It will - consist of two parts f1 and f2. - Example: - - SELECT * FROM (SELECT * FROM t1 GROUP BY 1) tt JOIN - t1 ON tt.f1=t1.f3 JOIN - t2 ON tt.f2=t2.f4; - In this case for the derived table tt two keys will be generated. - One key over f1 field, and another key over f2 field. - Currently optimizer may choose to use only one such key, thus the second - one will be dropped after range optimizer is finished. - See also JOIN::drop_unused_derived_keys function. - Example: - - SELECT * FROM (SELECT * FROM t1 GROUP BY 1) tt JOIN - t1 ON tt.f1=a_function(t1.f3); - In this case for the derived table tt one key will be generated. It will - consist of one field - f1. -*/ - - /* @brief From 85ecb80fa3192035b3beff9578dc254a857175dc Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 6 Mar 2025 15:29:17 +1100 Subject: [PATCH 078/134] MDEV-36229: Remove CAP_DAC_OVERRIDE CAP_AUDIT_WRITE from AmbientCapabilities In resolving MDEV-33301 (76a27155b4cd8174e900577dd01df2db1327b120) we moved all the capabilities from CapabilityBoundingSet to AmbientCapabilities where only add/moving CAP_IPC_LOCK was intended. The effect of this is the defaulting running MariaDB HAS the capabiltiy CAP_DAC_OVERRIDE CAP_AUDIT_WRITE allowing it to access any file, even while running as a non-root user. Resolve this by making CAP_IPC_LOCK apply to AmbientCapabilities and leave the remaining CAP_DAC_OVERRIDE CAP_AUDIT_WRITE to CapabilityBoundingSet for the use by auth_pam_tool. --- support-files/mariadb.service.in | 5 ++++- support-files/mariadb@.service.in | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/support-files/mariadb.service.in b/support-files/mariadb.service.in index 27e6ac08184..f53a0b8ceda 100644 --- a/support-files/mariadb.service.in +++ b/support-files/mariadb.service.in @@ -48,10 +48,13 @@ User=mysql Group=mysql # CAP_IPC_LOCK To allow memlock to be used as non-root user +# These are enabled by default +AmbientCapabilities=CAP_IPC_LOCK + # CAP_DAC_OVERRIDE To allow auth_pam_tool (which is SUID root) to read /etc/shadow when it's chmod 0 # does nothing for non-root, not needed if /etc/shadow is u+r # CAP_AUDIT_WRITE auth_pam_tool needs it on Debian for whatever reason -AmbientCapabilities=CAP_IPC_LOCK CAP_DAC_OVERRIDE CAP_AUDIT_WRITE +CapabilityBoundingSet=CAP_DAC_OVERRIDE CAP_AUDIT_WRITE # PrivateDevices=true implies NoNewPrivileges=true and # SUID auth_pam_tool suddenly doesn't do setuid anymore diff --git a/support-files/mariadb@.service.in b/support-files/mariadb@.service.in index b53711ef7e0..cb5e885e1aa 100644 --- a/support-files/mariadb@.service.in +++ b/support-files/mariadb@.service.in @@ -178,10 +178,13 @@ PrivateNetwork=false ## # CAP_IPC_LOCK To allow memlock to be used as non-root user +# These are enabled by default +AmbientCapabilities=CAP_IPC_LOCK + # CAP_DAC_OVERRIDE To allow auth_pam_tool (which is SUID root) to read /etc/shadow when it's chmod 0 # does nothing for non-root, not needed if /etc/shadow is u+r # CAP_AUDIT_WRITE auth_pam_tool needs it on Debian for whatever reason -AmbientCapabilities=CAP_IPC_LOCK CAP_DAC_OVERRIDE CAP_AUDIT_WRITE +CapabilityBoundingSet=CAP_DAC_OVERRIDE CAP_AUDIT_WRITE # PrivateDevices=true implies NoNewPrivileges=true and # SUID auth_pam_tool suddenly doesn't do setuid anymore From 19c4e1abe48bed3eca0f743080b99adf248c6699 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 20 Mar 2025 15:20:44 +0200 Subject: [PATCH 079/134] MDEV-24035 fixup: GCC 4.8.5 CMAKE_BUILD_TYPE=Debug --- storage/innobase/trx/trx0trx.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index ade8dea929a..560489cd9d0 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -452,7 +452,7 @@ void trx_t::free() /** Transition to committed state, to release implicit locks. */ TRANSACTIONAL_INLINE inline void trx_t::commit_state() { - ut_d(auto trx_state{state}); + ut_d(auto trx_state= state); ut_ad(trx_state == TRX_STATE_PREPARED || trx_state == TRX_STATE_PREPARED_RECOVERED || trx_state == TRX_STATE_ACTIVE); From a390aaaf23f147f597d059e3f75c5c1ea100fdf1 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Wed, 26 Mar 2025 11:15:09 +0530 Subject: [PATCH 080/134] MDEV-36180 Doublewrite recovery of innodb_checksum_algorithm=full_crc32 page_compressed pages does not work - InnoDB fails to recover the full crc32 page_compressed page from doublewrite buffer. The reason is that buf_dblwr_t::recover() fails to identify the space id from the page because the page has compressed from FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION bytes. Fix: === recv_dblwr_t::find_deferred_page(): Find the page which has the same page number and try to decompress/decrypt the page based on the tablespace metadata. After the decompression/decryption, compare the space id and write the recovered page back to the file. buf_page_t::read_complete(): Page read from disk is corrupted then try to read the page from deferred pages in doublewrite buffer. --- .../encryption/r/doublewrite_debug.result | 24 +++++++++++--- .../suite/encryption/t/doublewrite_debug.opt | 2 +- .../suite/encryption/t/doublewrite_debug.test | 28 ++++++++++++++--- storage/innobase/buf/buf0buf.cc | 7 ++--- storage/innobase/buf/buf0dblwr.cc | 15 ++++----- storage/innobase/include/log0recv.h | 12 ++++--- storage/innobase/log/log0recv.cc | 31 ++++++++++++++----- 7 files changed, 85 insertions(+), 34 deletions(-) diff --git a/mysql-test/suite/encryption/r/doublewrite_debug.result b/mysql-test/suite/encryption/r/doublewrite_debug.result index b289df9f77d..da97fd92360 100644 --- a/mysql-test/suite/encryption/r/doublewrite_debug.result +++ b/mysql-test/suite/encryption/r/doublewrite_debug.result @@ -3,8 +3,9 @@ call mtr.add_suppression("InnoDB: Unable to apply log to corrupted page "); call mtr.add_suppression("InnoDB: Plugin initialization aborted"); call mtr.add_suppression("Plugin 'InnoDB' init function returned error"); call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed"); -create table t1 (f1 int primary key, f2 blob)page_compressed = 1 engine=innodb stats_persistent=0; -create table t2(f1 int primary key, f2 blob)engine=innodb stats_persistent=0; +create table t1 (f1 int primary key, f2 blob)page_compressed=1 engine=innodb encrypted=yes stats_persistent=0; +create table t2(f1 int primary key, f2 blob)engine=innodb encrypted=yes stats_persistent=0; +create table t3(f1 int primary key, f2 blob)page_compressed=1 engine=innodb encrypted=no stats_persistent=0; start transaction; insert into t1 values(1, repeat('#',12)); insert into t1 values(2, repeat('+',12)); @@ -12,29 +13,37 @@ insert into t1 values(3, repeat('/',12)); insert into t1 values(4, repeat('-',12)); insert into t1 values(5, repeat('.',12)); insert into t2 select * from t1; +insert into t3 select * from t1; commit work; SET GLOBAL innodb_fast_shutdown = 0; # restart: --debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0 select space into @t1_space_id from information_schema.innodb_sys_tablespaces where name='test/t1'; select space into @t2_space_id from information_schema.innodb_sys_tablespaces where name='test/t2'; +select space into @t3_space_id from information_schema.innodb_sys_tablespaces where name='test/t3'; begin; insert into t1 values (6, repeat('%', 400)); insert into t2 values (6, repeat('%', 400)); +insert into t3 values (6, repeat('%', 400)); # xtrabackup prepare set global innodb_saved_page_number_debug = 3; set global innodb_fil_make_page_dirty_debug = @t1_space_id; set global innodb_saved_page_number_debug = 3; set global innodb_fil_make_page_dirty_debug = @t2_space_id; +set global innodb_saved_page_number_debug = 3; +set global innodb_fil_make_page_dirty_debug = @t3_space_id; set global innodb_buf_flush_list_now = 1; # Kill the server # restart -FOUND 2 /InnoDB: Recovered page \[page id: space=[1-9]*, page number=3\]/ in mysqld.1.err +FOUND 3 /InnoDB: Recovered page \[page id: space=[1-9]*, page number=3\]/ in mysqld.1.err check table t1; Table Op Msg_type Msg_text test.t1 check status OK check table t2; Table Op Msg_type Msg_text test.t2 check status OK +check table t3; +Table Op Msg_type Msg_text +test.t3 check status OK select f1, f2 from t1; f1 f2 1 ############ @@ -49,6 +58,13 @@ f1 f2 3 //////////// 4 ------------ 5 ............ +select f1, f2 from t3; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ SET GLOBAL innodb_fast_shutdown = 0; # shutdown server # remove datadir @@ -78,4 +94,4 @@ f1 f2 3 //////////// 4 ------------ 5 ............ -drop table t2, t1; +drop table t3, t2, t1; diff --git a/mysql-test/suite/encryption/t/doublewrite_debug.opt b/mysql-test/suite/encryption/t/doublewrite_debug.opt index ed86654270b..827b043547b 100644 --- a/mysql-test/suite/encryption/t/doublewrite_debug.opt +++ b/mysql-test/suite/encryption/t/doublewrite_debug.opt @@ -1,3 +1,3 @@ --innodb-use-atomic-writes=0 ---innodb-encrypt-tables=FORCE +--innodb-encrypt-tables=on --innodb_sys_tablespaces diff --git a/mysql-test/suite/encryption/t/doublewrite_debug.test b/mysql-test/suite/encryption/t/doublewrite_debug.test index 761f9cd3e47..6ca29161d56 100644 --- a/mysql-test/suite/encryption/t/doublewrite_debug.test +++ b/mysql-test/suite/encryption/t/doublewrite_debug.test @@ -12,8 +12,9 @@ let INNODB_PAGE_SIZE=`select @@innodb_page_size`; let MYSQLD_DATADIR=`select @@datadir`; let ALGO=`select @@innodb_checksum_algorithm`; -create table t1 (f1 int primary key, f2 blob)page_compressed = 1 engine=innodb stats_persistent=0; -create table t2(f1 int primary key, f2 blob)engine=innodb stats_persistent=0; +create table t1 (f1 int primary key, f2 blob)page_compressed=1 engine=innodb encrypted=yes stats_persistent=0; +create table t2(f1 int primary key, f2 blob)engine=innodb encrypted=yes stats_persistent=0; +create table t3(f1 int primary key, f2 blob)page_compressed=1 engine=innodb encrypted=no stats_persistent=0; start transaction; insert into t1 values(1, repeat('#',12)); @@ -22,6 +23,7 @@ insert into t1 values(3, repeat('/',12)); insert into t1 values(4, repeat('-',12)); insert into t1 values(5, repeat('.',12)); insert into t2 select * from t1; +insert into t3 select * from t1; commit work; # Slow shutdown and restart to make sure ibuf merge is finished @@ -33,12 +35,14 @@ let $restart_parameters=--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_fl select space into @t1_space_id from information_schema.innodb_sys_tablespaces where name='test/t1'; select space into @t2_space_id from information_schema.innodb_sys_tablespaces where name='test/t2'; +select space into @t3_space_id from information_schema.innodb_sys_tablespaces where name='test/t3'; begin; insert into t1 values (6, repeat('%', 400)); insert into t2 values (6, repeat('%', 400)); +insert into t3 values (6, repeat('%', 400)); -# Copy the t1.ibd, t2.ibd file +# Copy the t1.ibd, t2.ibd, t3.ibd file let $targetdir=$MYSQLTEST_VARDIR/tmp/backup_1; --disable_result_log exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir; @@ -54,8 +58,11 @@ set global innodb_fil_make_page_dirty_debug = @t1_space_id; set global innodb_saved_page_number_debug = 3; set global innodb_fil_make_page_dirty_debug = @t2_space_id; +set global innodb_saved_page_number_debug = 3; +set global innodb_fil_make_page_dirty_debug = @t3_space_id; + set global innodb_buf_flush_list_now = 1; ---let CLEANUP_IF_CHECKPOINT=drop table t1, t2, unexpected_checkpoint; +--let CLEANUP_IF_CHECKPOINT=drop table t1, t2, t3, unexpected_checkpoint; --source ../../suite/innodb/include/no_checkpoint_end.inc # Corrupt the page 3 in t1.ibd, t2.ibd file perl; @@ -103,6 +110,15 @@ binmode FILE; sysseek(FILE, 3*$page_size, 0); print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}); close FILE; + +# Zero the complete page +my $fname= "$ENV{'MYSQLD_DATADIR'}test/t3.ibd"; +open(FILE, "+<", $fname) or die; +FILE->autoflush(1); +binmode FILE; +sysseek(FILE, 3*$page_size, 0); +print FILE chr(0) x ($ENV{'INNODB_PAGE_SIZE'}); +close FILE; EOF # Successful recover from doublewrite buffer @@ -114,8 +130,10 @@ let SEARCH_PATTERN=InnoDB: Recovered page \\[page id: space=[1-9]*, page number= check table t1; check table t2; +check table t3; select f1, f2 from t1; select f1, f2 from t2; +select f1, f2 from t3; SET GLOBAL innodb_fast_shutdown = 0; let $shutdown_timeout=; @@ -220,4 +238,4 @@ select * from t1; --source ../../mariabackup/include/restart_and_restore.inc select * from t1; -drop table t2, t1; +drop table t3, t2, t1; diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index f9388a11d23..2ea1909036d 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -3766,10 +3766,9 @@ database_corrupted_compressed: if (err == DB_PAGE_CORRUPTED || err == DB_DECRYPTION_FAILED) { release_page: - if (node.space->full_crc32() && node.space->crypt_data && - recv_recovery_is_on() && - recv_sys.dblwr.find_encrypted_page(node, id().page_no(), - const_cast(read_frame))) + if (node.space->full_crc32() && recv_recovery_is_on() && + recv_sys.dblwr.find_deferred_page(node, id().page_no(), + const_cast(read_frame))) { /* Recover from doublewrite buffer */ err= DB_SUCCESS; diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index 9165f8e4a02..b04460a020f 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -377,7 +377,7 @@ void buf_dblwr_t::recover() noexcept srv_page_size)); byte *const buf= read_buf + srv_page_size; - std::deque encrypted_pages; + std::deque deferred_pages; for (recv_dblwr_t::list::iterator i= recv_sys.dblwr.pages.begin(); i != recv_sys.dblwr.pages.end(); ++i, ++page_no_dblwr) { @@ -396,11 +396,12 @@ void buf_dblwr_t::recover() noexcept { /* These pages does not appear to belong to any tablespace. There is a possibility that this page could be - encrypted using full_crc32 format. If innodb encounters - any corrupted encrypted page during recovery then - InnoDB should use this page to find the valid page. - See find_encrypted_page() */ - encrypted_pages.push_back(*i); + encrypted/compressed using full_crc32 format. + If innodb encounters any corrupted encrypted/compressed + page during recovery then InnoDB should use this page to + find the valid page. + See find_encrypted_page()/find_page_compressed() */ + deferred_pages.push_back(*i); continue; } @@ -481,7 +482,7 @@ next_page: } recv_sys.dblwr.pages.clear(); - for (byte *page : encrypted_pages) + for (byte *page : deferred_pages) recv_sys.dblwr.pages.push_back(page); fil_flush_file_spaces(); aligned_free(read_buf); diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index f58543d7683..a4365706d5b 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -150,15 +150,17 @@ struct recv_dblwr_t const fil_space_t *space= nullptr, byte *tmp_buf= nullptr) const noexcept; - /** Find the doublewrite copy of an encrypted page with the - smallest FIL_PAGE_LSN that is large enough for recovery. + /** Find the doublewrite copy of an encrypted/page_compressed + page with the smallest FIL_PAGE_LSN that is large enough for + recovery. @param space tablespace object @param page_no page number to find - @param buf buffer for unencrypted page + @param buf buffer for unencrypted/uncompressed page @return buf @retval nullptr if the page was not found in doublewrite buffer */ - byte *find_encrypted_page(const fil_node_t &space, uint32_t page_no, - byte *buf) noexcept; + ATTRIBUTE_COLD byte *find_deferred_page(const fil_node_t &space, + uint32_t page_no, + byte *buf) noexcept; /** Restore the first page of the given tablespace from doublewrite buffer. diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 96c964e6de7..9a71521d707 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -4842,28 +4842,43 @@ bool recv_dblwr_t::validate_page(const page_id_t page_id, lsn_t max_lsn, goto check_if_corrupted; } -byte *recv_dblwr_t::find_encrypted_page(const fil_node_t &node, - uint32_t page_no, - byte *buf) noexcept +ATTRIBUTE_COLD +byte *recv_dblwr_t::find_deferred_page(const fil_node_t &node, + uint32_t page_no, + byte *buf) noexcept { - ut_ad(node.space->crypt_data); ut_ad(node.space->full_crc32()); mysql_mutex_lock(&recv_sys.mutex); byte *result_page= nullptr; + bool is_encrypted= node.space->crypt_data && + node.space->crypt_data->is_encrypted(); for (list::iterator page_it= pages.begin(); page_it != pages.end(); page_it++) { if (page_get_page_no(*page_it) != page_no || buf_page_is_corrupted(true, *page_it, node.space->flags)) continue; + + if (is_encrypted && + !mach_read_from_4(*page_it + FIL_PAGE_FCRC32_KEY_VERSION)) + continue; + memcpy(buf, *page_it, node.space->physical_size()); buf_tmp_buffer_t *slot= buf_pool.io_buf_reserve(false); ut_a(slot); slot->allocate(); - bool invalidate= - !fil_space_decrypt(node.space, slot->crypt_buf, buf) || - (node.space->is_compressed() && - !fil_page_decompress(slot->crypt_buf, buf, node.space->flags)); + + bool invalidate= false; + if (is_encrypted) + { + invalidate= !fil_space_decrypt(node.space, slot->crypt_buf, buf); + if (!invalidate && node.space->is_compressed()) + goto decompress; + } + else +decompress: + invalidate= !fil_page_decompress(slot->crypt_buf, buf, + node.space->flags); slot->release(); if (invalidate || From 1f4a90157639bdb73e023997e46b701b3b9bd835 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Tue, 25 Mar 2025 20:03:14 +0530 Subject: [PATCH 081/134] MDEV-36281 DML aborts during online virtual index Reason: ======= - InnoDB DML commit aborts the server when InnoDB does online virtual index. During online DDL, concurrent DML commit operation does read the undo log record and their related current version of the clustered index record. Based on the operation, InnoDB do build the old tuple and new tuple for the table. If the concurrent online index can be affected by the operation, InnoDB does build the entry for the index and log the operation. Problematic case is update operation, InnoDB does build the update vector. But while building the old row, InnoDB fails to fill the non-affected virtual column. This lead to server abort while build the entry for index. Fix: === - First, fill the virtual column entries for the new row. Duplicate the old row based on new row and change only the affected fields in old row based on the update vector. --- .../suite/innodb/r/innodb-index-online.result | 26 ++++++++++++++++++- .../suite/innodb/t/innodb-index-online.test | 25 +++++++++++++++++- storage/innobase/row/row0log.cc | 15 +++++------ 3 files changed, 56 insertions(+), 10 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb-index-online.result b/mysql-test/suite/innodb/r/innodb-index-online.result index 5a287e58d8a..eb1daa5a2d3 100644 --- a/mysql-test/suite/innodb/r/innodb-index-online.result +++ b/mysql-test/suite/innodb/r/innodb-index-online.result @@ -534,7 +534,6 @@ INSERT INTO t1 VALUES(1,1); ROLLBACK; SET DEBUG_SYNC = 'now SIGNAL inserted'; connection con1; -disconnect con1; connection default; SELECT * FROM t1; a b @@ -543,6 +542,31 @@ CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK DROP TABLE t1; +# +# MDEV-36281 DML aborts during online virtual index +# +CREATE TABLE t1(f1 INT NOT NULL PRIMARY KEY, f2 INT NOT NULL, +f3 INT NOT NULL, f4 INT AS (f3) VIRTUAL, +f5 INT AS (f1) VIRTUAL, INDEX(f4))ENGINE=InnoDB; +INSERT INTO t1(f1, f2, f3) VALUES(1, 2, 3); +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL dml_start WAIT_FOR dml_finish'; +ALTER TABLE t1 ADD INDEX v1(f5, f2, f4), ADD INDEX v2(f3, f5); +connection con1; +set DEBUG_SYNC="now WAIT_FOR dml_start"; +UPDATE t1 SET f3= f3 + 1; +set DEBUG_SYNC="now SIGNAL dml_finish"; +disconnect con1; +connection default; +CHECK TABLE t1 EXTENDED; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT f5, f2, f4 FROM t1 USE INDEX(v1); +f5 f2 f4 +1 2 4 +SELECT f3, f5 FROM t1 USE INDEX(v2); +f3 f5 +4 1 +DROP TABLE t1; SET DEBUG_SYNC = 'RESET'; SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig; SET GLOBAL innodb_monitor_enable = default; diff --git a/mysql-test/suite/innodb/t/innodb-index-online.test b/mysql-test/suite/innodb/t/innodb-index-online.test index 96ee3149518..97ca25b1420 100644 --- a/mysql-test/suite/innodb/t/innodb-index-online.test +++ b/mysql-test/suite/innodb/t/innodb-index-online.test @@ -510,12 +510,35 @@ SET DEBUG_SYNC = 'now SIGNAL inserted'; connection con1; reap; -disconnect con1; connection default; SELECT * FROM t1; CHECK TABLE t1; DROP TABLE t1; + +--echo # +--echo # MDEV-36281 DML aborts during online virtual index +--echo # +CREATE TABLE t1(f1 INT NOT NULL PRIMARY KEY, f2 INT NOT NULL, + f3 INT NOT NULL, f4 INT AS (f3) VIRTUAL, + f5 INT AS (f1) VIRTUAL, INDEX(f4))ENGINE=InnoDB; +INSERT INTO t1(f1, f2, f3) VALUES(1, 2, 3); +SET DEBUG_SYNC = 'innodb_inplace_alter_table_enter SIGNAL dml_start WAIT_FOR dml_finish'; +send ALTER TABLE t1 ADD INDEX v1(f5, f2, f4), ADD INDEX v2(f3, f5); + +connection con1; +set DEBUG_SYNC="now WAIT_FOR dml_start"; +UPDATE t1 SET f3= f3 + 1; +set DEBUG_SYNC="now SIGNAL dml_finish"; + +disconnect con1; +connection default; +reap; +CHECK TABLE t1 EXTENDED; +SELECT f5, f2, f4 FROM t1 USE INDEX(v1); +SELECT f3, f5 FROM t1 USE INDEX(v2); +DROP TABLE t1; + SET DEBUG_SYNC = 'RESET'; # Check that all connections opened by test cases in this file are really diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc index 6f3425aab17..702e7098839 100644 --- a/storage/innobase/row/row0log.cc +++ b/storage/innobase/row/row0log.cc @@ -4065,14 +4065,7 @@ void UndorecApplier::log_update(const dtuple_t &tuple, if (!(this->cmpl_info & UPD_NODE_NO_ORD_CHANGE)) { for (ulint i = 0; i < dict_table_get_n_v_cols(table); i++) - dfield_get_type( - dtuple_get_nth_v_field(row, i))->mtype = DATA_MISSING; - } - - if (is_update) - { - old_row= dtuple_copy(row, heap); - row_upd_replace(old_row, &old_ext, clust_index, update, heap); + dfield_get_type(dtuple_get_nth_v_field(row, i))->mtype = DATA_MISSING; } if (table->n_v_cols) @@ -4080,6 +4073,12 @@ void UndorecApplier::log_update(const dtuple_t &tuple, (cmpl_info & UPD_NODE_NO_ORD_CHANGE) ? nullptr : undo_rec); + if (is_update) + { + old_row= dtuple_copy(row, heap); + row_upd_replace(old_row, &old_ext, clust_index, update, heap); + } + bool success= true; dict_index_t *index= dict_table_get_next_index(clust_index); while (index) From 337bf8ac4bb9a89f51cd35ec867c74fbb8d23faa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 26 Mar 2025 14:22:40 +0200 Subject: [PATCH 082/134] MDEV-36122 Assertion ctx0->old_table->get_ref_count() == 1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit trx_purge_close_tables(): Before releasing any metadata locks (MDL), release all table references, in case an ALTER TABLE…ALGORITHM=COPY operation has confused our logic. trx_purge_table_acquire(), trx_purge_table_open(): Do not acquire any table reference before successfully acquiring a necessary metadata lock. In this way, if purge is waiting for MDL, a concurrent ha_innobase::commit_inplace_alter_table(commit=true) that is holding a conflicting MDL_EXCLUSIVE will only observe its own reference on the table that it may need to replace. dict_acquire_mdl_shared(): Unless we hold an MDL or one is not needed, do not hold a table reference when releasing dict_sys.latch. After loading a table into the dictionary cache, we will look up the table again, because the table could be evicted or dropped while we were not holding any dict_sys.latch. Reviewed by: Debarun Banerjee --- storage/innobase/dict/dict0dict.cc | 80 +++++++++++++++++------------- storage/innobase/trx/trx0purge.cc | 70 ++++++++++++++------------ 2 files changed, 84 insertions(+), 66 deletions(-) diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index dd0b4c714bf..328d2b9be84 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -694,35 +694,37 @@ dict_acquire_mdl_shared(dict_table_t *table, MDL_context *mdl_context, MDL_ticket **mdl, dict_table_op_t table_op) { - table_id_t table_id= table->id; char db_buf[NAME_LEN + 1], db_buf1[NAME_LEN + 1]; char tbl_buf[NAME_LEN + 1], tbl_buf1[NAME_LEN + 1]; size_t db_len, tbl_len; - bool unaccessible= false; if (!table->parse_name(db_buf, tbl_buf, &db_len, &tbl_len)) /* The name of an intermediate table starts with #sql */ return table; retry: - if (!unaccessible && (!table->is_readable() || table->corrupted)) + ut_ad(!trylock == dict_sys.frozen()); + ut_ad(trylock || table->get_ref_count()); + + if (!table->is_readable() || table->corrupted) { + if (!trylock) + table->release(); if (*mdl) { mdl_context->release_lock(*mdl); *mdl= nullptr; } - unaccessible= true; + return nullptr; } + const table_id_t table_id{table->id}; + if (!trylock) + { table->release(); - - if (unaccessible) - return nullptr; - - if (!trylock) dict_sys.unfreeze(); + } { MDL_request request; @@ -748,11 +750,37 @@ retry: } } + size_t db1_len, tbl1_len; +lookup: dict_sys.freeze(SRW_LOCK_CALL); table= dict_sys.find_table(table_id); if (table) + { + if (!table->is_accessible()) + { + table= nullptr; + unlock_and_return_without_mdl: + if (trylock) + dict_sys.unfreeze(); + return_without_mdl: + if (*mdl) + { + mdl_context->release_lock(*mdl); + *mdl= nullptr; + } + return table; + } + table->acquire(); - if (!table && table_op != DICT_TABLE_OP_OPEN_ONLY_IF_CACHED) + + if (!table->parse_name(db_buf1, tbl_buf1, &db1_len, &tbl1_len)) + { + /* The table was renamed to #sql prefix. + Release MDL (if any) for the old name and return. */ + goto unlock_and_return_without_mdl; + } + } + else if (table_op != DICT_TABLE_OP_OPEN_ONLY_IF_CACHED) { dict_sys.unfreeze(); dict_sys.lock(SRW_LOCK_CALL); @@ -760,31 +788,15 @@ retry: table_op == DICT_TABLE_OP_LOAD_TABLESPACE ? DICT_ERR_IGNORE_RECOVER_LOCK : DICT_ERR_IGNORE_FK_NOKEY); - if (table) - table->acquire(); dict_sys.unlock(); - dict_sys.freeze(SRW_LOCK_CALL); - } - - if (!table || !table->is_accessible()) - { -return_without_mdl: - if (trylock) - dict_sys.unfreeze(); - if (*mdl) - { - mdl_context->release_lock(*mdl); - *mdl= nullptr; - } - return nullptr; - } - - size_t db1_len, tbl1_len; - - if (!table->parse_name(db_buf1, tbl_buf1, &db1_len, &tbl1_len)) - { - /* The table was renamed to #sql prefix. - Release MDL (if any) for the old name and return. */ + /* At this point, the freshly loaded table may already have been evicted. + We must look it up again while holding a shared dict_sys.latch. We keep + trying this until the table is found in the cache or it cannot be found + in the dictionary (because the table has been dropped or rebuilt). */ + if (table) + goto lookup; + if (!trylock) + dict_sys.freeze(SRW_LOCK_CALL); goto return_without_mdl; } diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 08134665fb7..ef85dd7dbda 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -1051,16 +1051,25 @@ inline trx_purge_rec_t purge_sys_t::fetch_next_rec() /** Close all tables that were opened in a purge batch for a worker. @param node purge task context @param thd purge coordinator thread handle */ -static void trx_purge_close_tables(purge_node_t *node, THD *thd) +static void trx_purge_close_tables(purge_node_t *node, THD *thd) noexcept { for (auto &t : node->tables) { - if (!t.second.first); - else if (t.second.first == reinterpret_cast(-1)); - else + dict_table_t *table= t.second.first; + if (table != nullptr && table != reinterpret_cast(-1)) + dict_table_close(table); + } + + MDL_context *mdl_context= static_cast(thd_mdl_context(thd)); + + for (auto &t : node->tables) + { + dict_table_t *table= t.second.first; + if (table != nullptr && table != reinterpret_cast(-1)) { - dict_table_close(t.second.first, false, thd, t.second.second); t.second.first= reinterpret_cast(-1); + if (mdl_context != nullptr && t.second.second != nullptr) + mdl_context->release_lock(t.second.second); } } } @@ -1072,36 +1081,35 @@ void purge_sys_t::wait_FTS(bool also_sys) } __attribute__((nonnull)) -/** Aqcuire a metadata lock on a table. +/** Acquire a metadata lock on a table. @param table table handle @param mdl_context metadata lock acquisition context -@param mdl metadata lcok +@param mdl metadata lock @return table handle @retval nullptr if the table is not found or accessible @retval -1 if the purge of history must be suspended due to DDL */ static dict_table_t *trx_purge_table_acquire(dict_table_t *table, MDL_context *mdl_context, - MDL_ticket **mdl) + MDL_ticket **mdl) noexcept { ut_ad(dict_sys.frozen_not_locked()); *mdl= nullptr; if (!table->is_readable() || table->corrupted) - { - table->release(); return nullptr; - } size_t db_len= dict_get_db_name_len(table->name.m_name); if (db_len == 0) - return table; /* InnoDB system tables are not covered by MDL */ + { + /* InnoDB system tables are not covered by MDL */ + got_table: + table->acquire(); + return table; + } if (purge_sys.must_wait_FTS()) - { must_wait: - table->release(); return reinterpret_cast(-1); - } char db_buf[NAME_LEN + 1]; char tbl_buf[NAME_LEN + 1]; @@ -1109,7 +1117,7 @@ static dict_table_t *trx_purge_table_acquire(dict_table_t *table, if (!table->parse_name(db_buf, tbl_buf, &db_len, &tbl_len)) /* The name of an intermediate table starts with #sql */ - return table; + goto got_table; { MDL_request request; @@ -1122,37 +1130,38 @@ static dict_table_t *trx_purge_table_acquire(dict_table_t *table, goto must_wait; } - return table; + goto got_table; } /** Open a table handle for the purge of committed transaction history @param table_id InnoDB table identifier @param mdl_context metadata lock acquisition context -@param mdl metadata lcok +@param mdl metadata lock @return table handle @retval nullptr if the table is not found or accessible @retval -1 if the purge of history must be suspended due to DDL */ static dict_table_t *trx_purge_table_open(table_id_t table_id, MDL_context *mdl_context, - MDL_ticket **mdl) + MDL_ticket **mdl) noexcept { - dict_sys.freeze(SRW_LOCK_CALL); + dict_table_t *table; - dict_table_t *table= dict_sys.find_table(table_id); - - if (table) - table->acquire(); - else + for (;;) { + dict_sys.freeze(SRW_LOCK_CALL); + table= dict_sys.find_table(table_id); + if (table) + break; dict_sys.unfreeze(); dict_sys.lock(SRW_LOCK_CALL); table= dict_load_table_on_id(table_id, DICT_ERR_IGNORE_FK_NOKEY); - if (table) - table->acquire(); dict_sys.unlock(); if (!table) return nullptr; - dict_sys.freeze(SRW_LOCK_CALL); + /* At this point, the freshly loaded table may already have been evicted. + We must look it up again while holding a shared dict_sys.latch. We keep + trying this until the table is found in the cache or it cannot be found + in the dictionary (because the table has been dropped or rebuilt). */ } table= trx_purge_table_acquire(table, mdl_context, mdl); @@ -1171,10 +1180,7 @@ dict_table_t *purge_sys_t::close_and_reopen(table_id_t id, THD *thd, for (que_thr_t *thr= UT_LIST_GET_FIRST(purge_sys.query->thrs); thr; thr= UT_LIST_GET_NEXT(thrs, thr)) - { - purge_node_t *node= static_cast(thr->child); - trx_purge_close_tables(node, thd); - } + trx_purge_close_tables(static_cast(thr->child), thd); m_active= false; wait_FTS(false); From 67caeca2849384b4e77f8741c6461a5162e3b7bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 26 Mar 2025 14:22:58 +0200 Subject: [PATCH 083/134] MDEV-36122: Protect table references with a lock dict_table_open_on_id(): Simplify the logic. dict_stats: A helper for acquiring MDL and opening the tables mysql.innodb_table_stats and mysql.innodb_index_stats. innodb_ft_aux_table_validate(): Contiguously hold dict_sys.latch while accessing the table that we open with dict_table_open_on_name(). lock_table_children(): Do not hold a table reference while invoking dict_acquire_mdl_shared(), which may temporarily release and reacquire the shared dict_sys.latch that we are holding. With these changes, no caller of dict_acquire_mdl_shared should be holding a table reference. All remaining calls to dict_table_open_on_name(dict_locked=false) except the one in fts_lock_table() and possibly in the DDL recovery predicate innodb_check_version() should be protected by MDL, but there currently is no assertion that would enforce this. Reviewed by: Debarun Banerjee --- storage/innobase/dict/dict0defrag_bg.cc | 90 ++-------- storage/innobase/dict/dict0dict.cc | 93 +++++++--- storage/innobase/dict/dict0stats.cc | 98 ++--------- storage/innobase/handler/ha_innodb.cc | 202 ++++++---------------- storage/innobase/handler/handler0alter.cc | 69 +++----- storage/innobase/include/dict0dict.h | 21 +++ storage/innobase/lock/lock0lock.cc | 5 +- 7 files changed, 192 insertions(+), 386 deletions(-) diff --git a/storage/innobase/dict/dict0defrag_bg.cc b/storage/innobase/dict/dict0defrag_bg.cc index bec6da8e6af..7771335b6d2 100644 --- a/storage/innobase/dict/dict0defrag_bg.cc +++ b/storage/innobase/dict/dict0defrag_bg.cc @@ -217,47 +217,17 @@ dberr_t dict_stats_save_defrag_summary(dict_index_t *index, THD *thd) if (index->is_ibuf()) return DB_SUCCESS; - MDL_ticket *mdl_table= nullptr, *mdl_index= nullptr; - dict_table_t *table_stats= dict_table_open_on_name(TABLE_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (table_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - table_stats= dict_acquire_mdl_shared(table_stats, thd, &mdl_table); - dict_sys.unfreeze(); - } - if (!table_stats || strcmp(table_stats->name.m_name, TABLE_STATS_NAME)) - { -release_and_exit: - if (table_stats) - dict_table_close(table_stats, false, thd, mdl_table); + dict_stats stats; + if (stats.open(thd)) return DB_STATS_DO_NOT_EXIST; - } - - dict_table_t *index_stats= dict_table_open_on_name(INDEX_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (index_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - index_stats= dict_acquire_mdl_shared(index_stats, thd, &mdl_index); - dict_sys.unfreeze(); - } - if (!index_stats) - goto release_and_exit; - if (strcmp(index_stats->name.m_name, INDEX_STATS_NAME)) - { - dict_table_close(index_stats, false, thd, mdl_index); - goto release_and_exit; - } - trx_t *trx= trx_create(); trx->mysql_thd= thd; trx_start_internal(trx); dberr_t ret= trx->read_only ? DB_READ_ONLY - : lock_table_for_trx(table_stats, trx, LOCK_X); + : lock_table_for_trx(stats.table(), trx, LOCK_X); if (ret == DB_SUCCESS) - ret= lock_table_for_trx(index_stats, trx, LOCK_X); + ret= lock_table_for_trx(stats.index(), trx, LOCK_X); row_mysql_lock_data_dictionary(trx); if (ret == DB_SUCCESS) ret= dict_stats_save_index_stat(index, time(nullptr), "n_pages_freed", @@ -271,13 +241,9 @@ release_and_exit: else trx->rollback(); - if (table_stats) - dict_table_close(table_stats, true, thd, mdl_table); - if (index_stats) - dict_table_close(index_stats, true, thd, mdl_index); - row_mysql_unlock_data_dictionary(trx); trx->free(); + stats.close(); return ret; } @@ -353,49 +319,18 @@ dict_stats_save_defrag_stats( if (n_leaf_reserved == ULINT_UNDEFINED) return DB_SUCCESS; - THD *thd= current_thd; - MDL_ticket *mdl_table= nullptr, *mdl_index= nullptr; - dict_table_t* table_stats= dict_table_open_on_name(TABLE_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (table_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - table_stats= dict_acquire_mdl_shared(table_stats, thd, &mdl_table); - dict_sys.unfreeze(); - } - if (!table_stats || strcmp(table_stats->name.m_name, TABLE_STATS_NAME)) - { -release_and_exit: - if (table_stats) - dict_table_close(table_stats, false, thd, mdl_table); + THD *const thd= current_thd; + dict_stats stats; + if (stats.open(thd)) return DB_STATS_DO_NOT_EXIST; - } - - dict_table_t *index_stats= dict_table_open_on_name(INDEX_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (index_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - index_stats= dict_acquire_mdl_shared(index_stats, thd, &mdl_index); - dict_sys.unfreeze(); - } - if (!index_stats) - goto release_and_exit; - - if (strcmp(index_stats->name.m_name, INDEX_STATS_NAME)) - { - dict_table_close(index_stats, false, thd, mdl_index); - goto release_and_exit; - } - trx_t *trx= trx_create(); trx->mysql_thd= thd; trx_start_internal(trx); dberr_t ret= trx->read_only ? DB_READ_ONLY - : lock_table_for_trx(table_stats, trx, LOCK_X); + : lock_table_for_trx(stats.table(), trx, LOCK_X); if (ret == DB_SUCCESS) - ret= lock_table_for_trx(index_stats, trx, LOCK_X); + ret= lock_table_for_trx(stats.index(), trx, LOCK_X); row_mysql_lock_data_dictionary(trx); @@ -423,12 +358,9 @@ release_and_exit: else trx->rollback(); - if (table_stats) - dict_table_close(table_stats, true, thd, mdl_table); - if (index_stats) - dict_table_close(index_stats, true, thd, mdl_index); row_mysql_unlock_data_dictionary(trx); trx->free(); + stats.close(); return ret; } diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index 328d2b9be84..a08b8812e6d 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -704,12 +704,9 @@ dict_acquire_mdl_shared(dict_table_t *table, retry: ut_ad(!trylock == dict_sys.frozen()); - ut_ad(trylock || table->get_ref_count()); if (!table->is_readable() || table->corrupted) { - if (!trylock) - table->release(); if (*mdl) { mdl_context->release_lock(*mdl); @@ -721,10 +718,7 @@ retry: const table_id_t table_id{table->id}; if (!trylock) - { - table->release(); dict_sys.unfreeze(); - } { MDL_request request; @@ -771,7 +765,8 @@ lookup: return table; } - table->acquire(); + if (trylock) + table->acquire(); if (!table->parse_name(db_buf1, tbl_buf1, &db1_len, &tbl1_len)) { @@ -885,6 +880,7 @@ dict_table_t *dict_table_open_on_id(table_id_t table_id, bool dict_locked, dict_table_op_t table_op, THD *thd, MDL_ticket **mdl) { +retry: if (!dict_locked) dict_sys.freeze(SRW_LOCK_CALL); @@ -892,9 +888,21 @@ dict_table_t *dict_table_open_on_id(table_id_t table_id, bool dict_locked, if (table) { - table->acquire(); - if (thd && !dict_locked) - table= dict_acquire_mdl_shared(table, thd, mdl, table_op); + if (!dict_locked) + { + if (thd) + { + table= dict_acquire_mdl_shared(table, thd, mdl, table_op); + if (table) + goto acquire; + } + else + acquire: + table->acquire(); + dict_sys.unfreeze(); + } + else + table->acquire(); } else if (table_op != DICT_TABLE_OP_OPEN_ONLY_IF_CACHED) { @@ -907,24 +915,16 @@ dict_table_t *dict_table_open_on_id(table_id_t table_id, bool dict_locked, table_op == DICT_TABLE_OP_LOAD_TABLESPACE ? DICT_ERR_IGNORE_RECOVER_LOCK : DICT_ERR_IGNORE_FK_NOKEY); - if (table) - table->acquire(); if (!dict_locked) { dict_sys.unlock(); - if (table && thd) - { - dict_sys.freeze(SRW_LOCK_CALL); - table= dict_acquire_mdl_shared(table, thd, mdl, table_op); - dict_sys.unfreeze(); - } - return table; + if (table) + goto retry; } + else if (table) + table->acquire(); } - if (!dict_locked) - dict_sys.unfreeze(); - return table; } @@ -1119,6 +1119,55 @@ dict_table_open_on_name( DBUG_RETURN(table); } +bool dict_stats::open(THD *thd) noexcept +{ + ut_ad(!mdl_table); + ut_ad(!mdl_index); + ut_ad(!table_stats); + ut_ad(!index_stats); + ut_ad(!mdl_context); + + mdl_context= static_cast(thd_mdl_context(thd)); + if (!mdl_context) + return true; + /* FIXME: use compatible type, and maybe remove this parameter altogether! */ + const double timeout= double(global_system_variables.lock_wait_timeout); + MDL_request request; + MDL_REQUEST_INIT(&request, MDL_key::TABLE, "mysql", "innodb_table_stats", + MDL_SHARED, MDL_EXPLICIT); + if (UNIV_UNLIKELY(mdl_context->acquire_lock(&request, timeout))) + return true; + mdl_table= request.ticket; + MDL_REQUEST_INIT(&request, MDL_key::TABLE, "mysql", "innodb_index_stats", + MDL_SHARED, MDL_EXPLICIT); + if (UNIV_UNLIKELY(mdl_context->acquire_lock(&request, timeout))) + goto release_mdl; + mdl_index= request.ticket; + table_stats= dict_table_open_on_name("mysql/innodb_table_stats", false, + DICT_ERR_IGNORE_NONE); + if (!table_stats) + goto release_mdl; + index_stats= dict_table_open_on_name("mysql/innodb_index_stats", false, + DICT_ERR_IGNORE_NONE); + if (index_stats) + return false; + + dict_table_close(table_stats); +release_mdl: + if (mdl_index) + mdl_context->release_lock(mdl_index); + mdl_context->release_lock(mdl_table); + return true; +} + +void dict_stats::close() noexcept +{ + dict_table_close(table_stats); + dict_table_close(index_stats); + mdl_context->release_lock(mdl_table); + mdl_context->release_lock(mdl_index); +} + /**********************************************************************//** Adds system columns to a table object. */ void diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc index 4d1e28b912a..ddd5ee03f0d 100644 --- a/storage/innobase/dict/dict0stats.cc +++ b/storage/innobase/dict/dict0stats.cc @@ -2896,11 +2896,12 @@ dict_stats_save( pars_info_t* pinfo; char db_utf8[MAX_DB_UTF8_LEN]; char table_utf8[MAX_TABLE_UTF8_LEN]; + THD* const thd = current_thd; #ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("dict_stats_save_exit_notify", - SCOPE_EXIT([] { - debug_sync_set_action(current_thd, + SCOPE_EXIT([thd] { + debug_sync_set_action(thd, STRING_WITH_LEN("now SIGNAL dict_stats_save_finished")); }); ); @@ -2914,41 +2915,10 @@ dict_stats_save( return (dict_stats_report_error(table)); } - THD* thd = current_thd; - MDL_ticket *mdl_table = nullptr, *mdl_index = nullptr; - dict_table_t* table_stats = dict_table_open_on_name( - TABLE_STATS_NAME, false, DICT_ERR_IGNORE_NONE); - if (table_stats) { - dict_sys.freeze(SRW_LOCK_CALL); - table_stats = dict_acquire_mdl_shared(table_stats, thd, - &mdl_table); - dict_sys.unfreeze(); - } - if (!table_stats - || strcmp(table_stats->name.m_name, TABLE_STATS_NAME)) { -release_and_exit: - if (table_stats) { - dict_table_close(table_stats, false, thd, mdl_table); - } + dict_stats stats; + if (stats.open(thd)) { return DB_STATS_DO_NOT_EXIST; } - - dict_table_t* index_stats = dict_table_open_on_name( - INDEX_STATS_NAME, false, DICT_ERR_IGNORE_NONE); - if (index_stats) { - dict_sys.freeze(SRW_LOCK_CALL); - index_stats = dict_acquire_mdl_shared(index_stats, thd, - &mdl_index); - dict_sys.unfreeze(); - } - if (!index_stats) { - goto release_and_exit; - } - if (strcmp(index_stats->name.m_name, INDEX_STATS_NAME)) { - dict_table_close(index_stats, false, thd, mdl_index); - goto release_and_exit; - } - dict_fs2utf8(table->name.m_name, db_utf8, sizeof(db_utf8), table_utf8, sizeof(table_utf8)); const time_t now = time(NULL); @@ -2957,9 +2927,9 @@ release_and_exit: trx_start_internal(trx); dberr_t ret = trx->read_only ? DB_READ_ONLY - : lock_table_for_trx(table_stats, trx, LOCK_X); + : lock_table_for_trx(stats.table(), trx, LOCK_X); if (ret == DB_SUCCESS) { - ret = lock_table_for_trx(index_stats, trx, LOCK_X); + ret = lock_table_for_trx(stats.index(), trx, LOCK_X); } if (ret != DB_SUCCESS) { if (trx->state != TRX_STATE_NOT_STARTED) { @@ -3014,8 +2984,7 @@ free_and_exit: dict_sys.unlock(); unlocked_free_and_exit: trx->free(); - dict_table_close(table_stats, false, thd, mdl_table); - dict_table_close(index_stats, false, thd, mdl_index); + stats.close(); return ret; } @@ -3495,42 +3464,11 @@ dict_stats_fetch_from_ps( stats. */ dict_stats_empty_table(table, true); - THD* thd = current_thd; - MDL_ticket *mdl_table = nullptr, *mdl_index = nullptr; - dict_table_t* table_stats = dict_table_open_on_name( - TABLE_STATS_NAME, false, DICT_ERR_IGNORE_NONE); - if (!table_stats) { + THD* const thd = current_thd; + dict_stats stats; + if (stats.open(thd)) { return DB_STATS_DO_NOT_EXIST; } - dict_table_t* index_stats = dict_table_open_on_name( - INDEX_STATS_NAME, false, DICT_ERR_IGNORE_NONE); - if (!index_stats) { - dict_table_close(table_stats); - return DB_STATS_DO_NOT_EXIST; - } - - dict_sys.freeze(SRW_LOCK_CALL); - table_stats = dict_acquire_mdl_shared(table_stats, thd, - &mdl_table); - if (!table_stats - || strcmp(table_stats->name.m_name, TABLE_STATS_NAME)) { -release_and_exit: - if (table_stats) { - dict_table_close(table_stats, true, thd, mdl_table); - } - if (index_stats) { - dict_table_close(index_stats, true, thd, mdl_index); - } - dict_sys.unfreeze(); - return DB_STATS_DO_NOT_EXIST; - } - - index_stats = dict_acquire_mdl_shared(index_stats, thd, - &mdl_index); - if (!index_stats - || strcmp(index_stats->name.m_name, INDEX_STATS_NAME)) { - goto release_and_exit; - } #ifdef ENABLED_DEBUG_SYNC DEBUG_SYNC(thd, "dict_stats_mdl_acquired"); @@ -3556,7 +3494,6 @@ release_and_exit: "fetch_index_stats_step", dict_stats_fetch_index_stats_step, &index_fetch_arg); - dict_sys.unfreeze(); dict_sys.lock(SRW_LOCK_CALL); que_t* graph = pars_sql( pinfo, @@ -3622,18 +3559,11 @@ release_and_exit: trx_start_internal_read_only(trx); que_run_threads(que_fork_start_command(graph)); que_graph_free(graph); - - dict_table_close(table_stats, false, thd, mdl_table); - dict_table_close(index_stats, false, thd, mdl_index); - trx_commit_for_mysql(trx); - dberr_t ret = trx->error_state; + dberr_t ret = index_fetch_arg.stats_were_modified + ? trx->error_state : DB_STATS_DO_NOT_EXIST; trx->free(); - - if (!index_fetch_arg.stats_were_modified) { - return DB_STATS_DO_NOT_EXIST; - } - + stats.close(); return ret; } diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index f147235f669..4d2b179738f 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -1357,38 +1357,17 @@ static void innodb_drop_database(handlerton*, char *path) dict_sys.unlock(); - dict_table_t *table_stats, *index_stats; - MDL_ticket *mdl_table= nullptr, *mdl_index= nullptr; - table_stats= dict_table_open_on_name(TABLE_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (table_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - table_stats= dict_acquire_mdl_shared(table_stats, - thd, &mdl_table); - dict_sys.unfreeze(); - } - index_stats= dict_table_open_on_name(INDEX_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (index_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - index_stats= dict_acquire_mdl_shared(index_stats, - thd, &mdl_index); - dict_sys.unfreeze(); - } - + dict_stats stats; + const bool stats_failed{stats.open(thd)}; trx_start_for_ddl(trx); uint errors= 0; char db[NAME_LEN + 1]; strconvert(&my_charset_filename, namebuf, len, system_charset_info, db, sizeof db, &errors); - if (!errors && table_stats && index_stats && - !strcmp(table_stats->name.m_name, TABLE_STATS_NAME) && - !strcmp(index_stats->name.m_name, INDEX_STATS_NAME) && - lock_table_for_trx(table_stats, trx, LOCK_X) == DB_SUCCESS && - lock_table_for_trx(index_stats, trx, LOCK_X) == DB_SUCCESS) + if (!errors && !stats_failed && + lock_table_for_trx(stats.table(), trx, LOCK_X) == DB_SUCCESS && + lock_table_for_trx(stats.index(), trx, LOCK_X) == DB_SUCCESS) { row_mysql_lock_data_dictionary(trx); if (dict_stats_delete(db, trx)) @@ -1484,19 +1463,16 @@ static void innodb_drop_database(handlerton*, char *path) if (err != DB_SUCCESS) { trx->rollback(); - namebuf[len] = '\0'; - ib::error() << "DROP DATABASE " << namebuf << ": " << err; + sql_print_error("InnoDB: DROP DATABASE %.*s: %s", + int(len), namebuf, ut_strerr(err)); } else trx->commit(); - if (table_stats) - dict_table_close(table_stats, true, thd, mdl_table); - if (index_stats) - dict_table_close(index_stats, true, thd, mdl_index); row_mysql_unlock_data_dictionary(trx); - trx->free(); + if (!stats_failed) + stats.close(); if (err == DB_SUCCESS) { @@ -13682,8 +13658,6 @@ int ha_innobase::delete_table(const char *name) err= lock_table_children(table, trx); } - dict_table_t *table_stats= nullptr, *index_stats= nullptr; - MDL_ticket *mdl_table= nullptr, *mdl_index= nullptr; if (err == DB_SUCCESS) err= lock_table_for_trx(table, trx, LOCK_X); @@ -13722,37 +13696,18 @@ int ha_innobase::delete_table(const char *name) #endif DEBUG_SYNC(thd, "before_delete_table_stats"); + dict_stats stats; + bool stats_failed= true; if (err == DB_SUCCESS && dict_stats_is_persistent_enabled(table) && !table->is_stats_table()) { - table_stats= dict_table_open_on_name(TABLE_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (table_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - table_stats= dict_acquire_mdl_shared(table_stats, - thd, &mdl_table); - dict_sys.unfreeze(); - } - - index_stats= dict_table_open_on_name(INDEX_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (index_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - index_stats= dict_acquire_mdl_shared(index_stats, - thd, &mdl_index); - dict_sys.unfreeze(); - } - + stats_failed= stats.open(thd); const bool skip_wait{table->name.is_temporary()}; - if (table_stats && index_stats && - !strcmp(table_stats->name.m_name, TABLE_STATS_NAME) && - !strcmp(index_stats->name.m_name, INDEX_STATS_NAME) && - !(err= lock_table_for_trx(table_stats, trx, LOCK_X, skip_wait))) - err= lock_table_for_trx(index_stats, trx, LOCK_X, skip_wait); + if (!stats_failed && + !(err= lock_table_for_trx(stats.table(), trx, LOCK_X, skip_wait))) + err= lock_table_for_trx(stats.index(), trx, LOCK_X, skip_wait); if (err != DB_SUCCESS && skip_wait) { @@ -13761,10 +13716,8 @@ int ha_innobase::delete_table(const char *name) ut_ad(err == DB_LOCK_WAIT); ut_ad(trx->error_state == DB_SUCCESS); err= DB_SUCCESS; - dict_table_close(table_stats, false, thd, mdl_table); - dict_table_close(index_stats, false, thd, mdl_index); - table_stats= nullptr; - index_stats= nullptr; + stats.close(); + stats_failed= true; } } @@ -13835,13 +13788,11 @@ err_exit: else if (rollback_add_partition) purge_sys.resume_FTS(); #endif - if (table_stats) - dict_table_close(table_stats, true, thd, mdl_table); - if (index_stats) - dict_table_close(index_stats, true, thd, mdl_index); row_mysql_unlock_data_dictionary(trx); if (trx != parent_trx) trx->free(); + if (!stats_failed) + stats.close(); DBUG_RETURN(convert_error_code_to_mysql(err, 0, NULL)); } @@ -13856,7 +13807,7 @@ err_exit: err= trx->drop_table_foreign(table->name); } - if (err == DB_SUCCESS && table_stats && index_stats) + if (err == DB_SUCCESS && !stats_failed) err= trx->drop_table_statistics(table->name); if (err != DB_SUCCESS) goto err_exit; @@ -13867,11 +13818,9 @@ err_exit: std::vector deleted; trx->commit(deleted); - if (table_stats) - dict_table_close(table_stats, true, thd, mdl_table); - if (index_stats) - dict_table_close(index_stats, true, thd, mdl_index); row_mysql_unlock_data_dictionary(trx); + if (!stats_failed) + stats.close(); for (pfs_os_file_t d : deleted) os_file_close(d); log_write_up_to(trx->commit_lsn, true); @@ -14067,9 +14016,6 @@ int ha_innobase::truncate() ib_table->name.m_name, ib_table->id); const char *name= mem_heap_strdup(heap, ib_table->name.m_name); - dict_table_t *table_stats = nullptr, *index_stats = nullptr; - MDL_ticket *mdl_table = nullptr, *mdl_index = nullptr; - dberr_t error= lock_table_children(ib_table, trx); if (error == DB_SUCCESS) @@ -14096,33 +14042,16 @@ int ha_innobase::truncate() std::this_thread::sleep_for(std::chrono::milliseconds(50)); } + dict_stats stats; + bool stats_failed= true; + if (error == DB_SUCCESS && dict_stats_is_persistent_enabled(ib_table) && !ib_table->is_stats_table()) { - table_stats= dict_table_open_on_name(TABLE_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (table_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - table_stats= dict_acquire_mdl_shared(table_stats, m_user_thd, - &mdl_table); - dict_sys.unfreeze(); - } - index_stats= dict_table_open_on_name(INDEX_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (index_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - index_stats= dict_acquire_mdl_shared(index_stats, m_user_thd, - &mdl_index); - dict_sys.unfreeze(); - } - - if (table_stats && index_stats && - !strcmp(table_stats->name.m_name, TABLE_STATS_NAME) && - !strcmp(index_stats->name.m_name, INDEX_STATS_NAME) && - !(error= lock_table_for_trx(table_stats, trx, LOCK_X))) - error= lock_table_for_trx(index_stats, trx, LOCK_X); + stats_failed= stats.open(m_user_thd); + if (!stats_failed && + !(error= lock_table_for_trx(stats.table(), trx, LOCK_X))) + error= lock_table_for_trx(stats.index(), trx, LOCK_X); } if (error == DB_SUCCESS) @@ -14214,14 +14143,9 @@ int ha_innobase::truncate() } trx->free(); - + if (!stats_failed) + stats.close(); mem_heap_free(heap); - - if (table_stats) - dict_table_close(table_stats, false, m_user_thd, mdl_table); - if (index_stats) - dict_table_close(index_stats, false, m_user_thd, mdl_index); - DBUG_RETURN(err); } @@ -14247,8 +14171,6 @@ ha_innobase::rename_table( trx_t* trx = innobase_trx_allocate(thd); trx_start_for_ddl(trx); - dict_table_t *table_stats = nullptr, *index_stats = nullptr; - MDL_ticket *mdl_table = nullptr, *mdl_index = nullptr; char norm_from[MAX_FULL_NAME_LEN]; char norm_to[MAX_FULL_NAME_LEN]; @@ -14269,34 +14191,19 @@ ha_innobase::rename_table( table->release(); } + dict_stats stats; + bool stats_fail = true; + if (strcmp(norm_from, TABLE_STATS_NAME) && strcmp(norm_from, INDEX_STATS_NAME) && strcmp(norm_to, TABLE_STATS_NAME) && strcmp(norm_to, INDEX_STATS_NAME)) { - table_stats = dict_table_open_on_name(TABLE_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (table_stats) { - dict_sys.freeze(SRW_LOCK_CALL); - table_stats = dict_acquire_mdl_shared( - table_stats, thd, &mdl_table); - dict_sys.unfreeze(); - } - index_stats = dict_table_open_on_name(INDEX_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (index_stats) { - dict_sys.freeze(SRW_LOCK_CALL); - index_stats = dict_acquire_mdl_shared( - index_stats, thd, &mdl_index); - dict_sys.unfreeze(); - } - - if (error == DB_SUCCESS && table_stats && index_stats - && !strcmp(table_stats->name.m_name, TABLE_STATS_NAME) - && !strcmp(index_stats->name.m_name, INDEX_STATS_NAME)) { - error = lock_table_for_trx(table_stats, trx, LOCK_X, - from_temp); + stats_fail = stats.open(thd); + if (!stats_fail && error == DB_SUCCESS) { + error = lock_table_for_trx(stats.table(), trx, + LOCK_X, from_temp); if (error == DB_SUCCESS) { - error = lock_table_for_trx(index_stats, trx, + error = lock_table_for_trx(stats.index(), trx, LOCK_X, from_temp); } if (error != DB_SUCCESS && from_temp) { @@ -14307,12 +14214,8 @@ ha_innobase::rename_table( we cannot lock the tables, when the table is being renamed from from a temporary name. */ - dict_table_close(table_stats, false, thd, - mdl_table); - dict_table_close(index_stats, false, thd, - mdl_index); - table_stats = nullptr; - index_stats = nullptr; + stats.close(); + stats_fail = true; } } } @@ -14339,7 +14242,7 @@ ha_innobase::rename_table( DEBUG_SYNC(thd, "after_innobase_rename_table"); - if (error == DB_SUCCESS && table_stats && index_stats) { + if (error == DB_SUCCESS && !stats_fail) { error = dict_stats_rename_table(norm_from, norm_to, trx); if (error == DB_DUPLICATE_KEY) { /* The duplicate may also occur in @@ -14357,18 +14260,15 @@ ha_innobase::rename_table( trx->rollback(); } - if (table_stats) { - dict_table_close(table_stats, true, thd, mdl_table); - } - if (index_stats) { - dict_table_close(index_stats, true, thd, mdl_index); - } row_mysql_unlock_data_dictionary(trx); if (error == DB_SUCCESS) { log_write_up_to(trx->commit_lsn, true); } trx->flush_log_later = false; trx->free(); + if (!stats_fail) { + stats.close(); + } if (error == DB_DUPLICATE_KEY) { /* We are not able to deal with handler::get_dup_key() @@ -17615,11 +17515,16 @@ static int innodb_ft_aux_table_validate(THD *thd, st_mysql_sys_var*, int len = sizeof buf; if (const char* table_name = value->val_str(value, buf, &len)) { + /* Because we are not acquiring MDL on the table name, + we must contiguously hold dict_sys.latch while we are + examining the table, to protect us against concurrent DDL. */ + dict_sys.lock(SRW_LOCK_CALL); if (dict_table_t* table = dict_table_open_on_name( - table_name, false, DICT_ERR_IGNORE_NONE)) { + table_name, true, DICT_ERR_IGNORE_NONE)) { + table->release(); const table_id_t id = dict_table_has_fts_index(table) ? table->id : 0; - dict_table_close(table); + dict_sys.unlock(); if (id) { innodb_ft_aux_table_id = id; if (table_name == buf) { @@ -17630,12 +17535,11 @@ static int innodb_ft_aux_table_validate(THD *thd, st_mysql_sys_var*, len); } - *static_cast(save) = table_name; return 0; } } - + dict_sys.unlock(); return 1; } else { *static_cast(save) = NULL; diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 5749049da03..09c1febf61d 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -11547,34 +11547,16 @@ err_index: } } - dict_table_t *table_stats = nullptr, *index_stats = nullptr; - MDL_ticket *mdl_table = nullptr, *mdl_index = nullptr; + dict_stats stats; + bool stats_failed = true; dberr_t error = DB_SUCCESS; if (!ctx0->old_table->is_stats_table() && !ctx0->new_table->is_stats_table()) { - table_stats = dict_table_open_on_name( - TABLE_STATS_NAME, false, DICT_ERR_IGNORE_NONE); - if (table_stats) { - dict_sys.freeze(SRW_LOCK_CALL); - table_stats = dict_acquire_mdl_shared( - table_stats, m_user_thd, &mdl_table); - dict_sys.unfreeze(); - } - index_stats = dict_table_open_on_name( - INDEX_STATS_NAME, false, DICT_ERR_IGNORE_NONE); - if (index_stats) { - dict_sys.freeze(SRW_LOCK_CALL); - index_stats = dict_acquire_mdl_shared( - index_stats, m_user_thd, &mdl_index); - dict_sys.unfreeze(); - } - - if (table_stats && index_stats - && !strcmp(table_stats->name.m_name, TABLE_STATS_NAME) - && !strcmp(index_stats->name.m_name, INDEX_STATS_NAME) - && !(error = lock_table_for_trx(table_stats, + stats_failed = stats.open(m_user_thd); + if (!stats_failed + && !(error = lock_table_for_trx(stats.table(), trx, LOCK_X))) { - error = lock_table_for_trx(index_stats, trx, LOCK_X); + error = lock_table_for_trx(stats.index(), trx, LOCK_X); } } @@ -11588,15 +11570,9 @@ err_index: error = lock_sys_tables(trx); } if (error != DB_SUCCESS) { - if (table_stats) { - dict_table_close(table_stats, false, m_user_thd, - mdl_table); + if (!stats_failed) { + stats.close(); } - if (index_stats) { - dict_table_close(index_stats, false, m_user_thd, - mdl_index); - } - my_error_innodb(error, table_share->table_name.str, 0); if (fts_exist) { purge_sys.resume_FTS(); } @@ -11612,6 +11588,7 @@ err_index: trx_start_for_ddl(trx); } + my_error_innodb(error, table_share->table_name.str, 0); DBUG_RETURN(true); } @@ -11629,15 +11606,10 @@ err_index: fail: trx->rollback(); ut_ad(!trx->fts_trx); - if (table_stats) { - dict_table_close(table_stats, true, m_user_thd, - mdl_table); - } - if (index_stats) { - dict_table_close(index_stats, true, m_user_thd, - mdl_index); - } row_mysql_unlock_data_dictionary(trx); + if (!stats_failed) { + stats.close(); + } if (fts_exist) { purge_sys.resume_FTS(); } @@ -11657,14 +11629,14 @@ fail: if (commit_try_rebuild(ha_alter_info, ctx, altered_table, table, - table_stats && index_stats, + !stats_failed, trx, table_share->table_name.str)) { goto fail; } } else if (commit_try_norebuild(ha_alter_info, ctx, altered_table, table, - table_stats && index_stats, + !stats_failed, trx, table_share->table_name.str)) { goto fail; @@ -11687,13 +11659,6 @@ fail: #endif } - if (table_stats) { - dict_table_close(table_stats, true, m_user_thd, mdl_table); - } - if (index_stats) { - dict_table_close(index_stats, true, m_user_thd, mdl_index); - } - /* Commit or roll back the changes to the data dictionary. */ DEBUG_SYNC(m_user_thd, "innodb_alter_inplace_before_commit"); @@ -11843,6 +11808,9 @@ foreign_fail: DBUG_EXECUTE_IF("innodb_alter_commit_crash_after_commit", DBUG_SUICIDE();); trx->free(); + if (!stats_failed) { + stats.close(); + } if (fts_exist) { purge_sys.resume_FTS(); } @@ -11900,6 +11868,9 @@ foreign_fail: DBUG_EXECUTE_IF("innodb_alter_commit_crash_after_commit", DBUG_SUICIDE();); trx->free(); + if (!stats_failed) { + stats.close(); + } if (fts_exist) { purge_sys.resume_FTS(); } diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index 519e1c5bd10..64050d26d44 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -1660,6 +1660,27 @@ bool dict_table_have_virtual_index( dict_table_t* table); +/** Helper for opening the InnoDB persistent statistics tables */ +class dict_stats final +{ + MDL_context *mdl_context= nullptr; + MDL_ticket *mdl_table= nullptr, *mdl_index= nullptr; + dict_table_t *table_stats= nullptr, *index_stats= nullptr; + +public: + dict_stats()= default; + + /** Open the statistics tables. + @return whether the operation failed */ + bool open(THD *thd) noexcept; + + /** Close the statistics tables after !open_tables(thd). */ + void close() noexcept; + + dict_table_t *table() const noexcept { return table_stats; } + dict_table_t *index() const noexcept { return index_stats; } +}; + #include "dict0dict.inl" #endif diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 4601fb4394d..d258e5c6b27 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -4140,13 +4140,12 @@ dberr_t lock_table_children(dict_table_t *table, trx_t *trx) children.end()) continue; /* We already acquired MDL on this child table. */ MDL_ticket *mdl= nullptr; - child->acquire(); child= dict_acquire_mdl_shared(child, mdl_context, &mdl, DICT_TABLE_OP_NORMAL); if (child) { - if (!mdl) - child->release(); + if (mdl) + child->acquire(); children.emplace_back(table_mdl{child, mdl}); goto rescan; } From 6066e5d13c2154e4348f40d59eb3af32eb5734c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 26 Mar 2025 14:23:45 +0200 Subject: [PATCH 084/134] MDEV-36122: Work around missing MDL in purge prepare_inplace_alter_table_dict(): If an unexpected reference to the table exists, wait for the purge subsystem to release its table handle, similar to how we would do in case FULLTEXT INDEX existed. This function is supposed to be protected by MDL_EXCLUSIVE on the table name. If purge is going to access the table again later during is ALTER TABLE operation, it will have access to an MDL compatible name for it and therefore should conflict with any MDL_EXCLUSIVE that would cover ha_innobase::commit_inplace_alter_table(commit=true). This change should prevent race conditions where purge had initially looked up a table for which row-level undo log records had been written by ALTER IGNORE TABLE, and purge did not finish before a subsequent ALTER TABLE is trying to rebuild the table. trx_purge_attach_undo_recs(), purge_sys_t::batch_cleanup(): Clear purge_sys.m_active only after all table handles have been released. ha_innobase::truncate(): Before locking the data dictionary, ensure that the purge subsystem is not holding a reference to the table due to insufficient metadata locking related to an earlier ALTER IGNORE TABLE operation. Reviewed by: Debarun Banerjee --- storage/innobase/handler/ha_innodb.cc | 3 +++ storage/innobase/handler/handler0alter.cc | 18 ++++++++++++------ storage/innobase/trx/trx0purge.cc | 4 ++-- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 4d2b179738f..fdfd0cb395d 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -14023,6 +14023,7 @@ int ha_innobase::truncate() const bool fts= error == DB_SUCCESS && ib_table->flags2 & (DICT_TF2_FTS_HAS_DOC_ID | DICT_TF2_FTS); + const bool pause_purge= error == DB_SUCCESS && ib_table->get_ref_count() > 1; if (fts) { @@ -14030,6 +14031,8 @@ int ha_innobase::truncate() purge_sys.stop_FTS(*ib_table); error= fts_lock_tables(trx, *ib_table); } + else if (pause_purge) + purge_sys.stop_FTS(); /* Wait for purge threads to stop using the table. */ for (uint n = 15; ib_table->get_ref_count() > 1; ) diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 09c1febf61d..3fe02af5beb 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -6603,8 +6603,9 @@ prepare_inplace_alter_table_dict( mem_heap_alloc(ctx->heap, ctx->num_to_add_index * sizeof *ctx->add_key_numbers)); - const bool fts_exist = ctx->new_table->flags2 + const bool have_fts = user_table->flags2 & (DICT_TF2_FTS_HAS_DOC_ID | DICT_TF2_FTS); + const bool pause_purge = have_fts || user_table->get_ref_count() > 1; /* Acquire a lock on the table before creating any indexes. */ bool table_lock_failed = false; @@ -6631,13 +6632,18 @@ acquire_lock: user_table->lock_shared_unlock(); } - if (fts_exist) { - purge_sys.stop_FTS(*ctx->new_table); + if (pause_purge) { + purge_sys.stop_FTS(); + if (have_fts) { + purge_sys.stop_FTS(*user_table, true); + } if (error == DB_SUCCESS) { - error = fts_lock_tables(ctx->trx, *ctx->new_table); + error = fts_lock_tables(ctx->trx, *user_table); } } + ut_ad(user_table->get_ref_count() == 1); + if (error == DB_SUCCESS) { error = lock_sys_tables(ctx->trx); } @@ -7470,7 +7476,7 @@ error_handling_drop_uncached: /* fts_create_common_tables() may drop old common tables, whose files would be deleted here. */ commit_unlock_and_unlink(ctx->trx); - if (fts_exist) { + if (pause_purge) { purge_sys.resume_FTS(); } @@ -7566,7 +7572,7 @@ err_exit: ctx->trx->free(); } trx_commit_for_mysql(ctx->prebuilt->trx); - if (fts_exist) { + if (pause_purge) { purge_sys.resume_FTS(); } diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index ef85dd7dbda..8292bb063b4 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -1292,8 +1292,6 @@ static purge_sys_t::iterator trx_purge_attach_undo_recs(THD *thd, break; } - purge_sys.m_active= false; - #ifdef UNIV_DEBUG thr= UT_LIST_GET_FIRST(purge_sys.query->thrs); for (ulint i= 0; thr && i < *n_work_items; @@ -1342,6 +1340,8 @@ static void trx_purge_wait_for_workers_to_complete() TRANSACTIONAL_INLINE void purge_sys_t::batch_cleanup(const purge_sys_t::iterator &head) { + m_active= false; + /* Release the undo pages. */ for (auto p : pages) p.second->unfix(); From 4a21cba7fcb573ba2f826a1d410c95651caf1ba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 26 Mar 2025 14:30:46 +0200 Subject: [PATCH 085/134] MDEV-36122 Assertion ctx0->old_table->get_ref_count() == 1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit trx_purge_close_tables(): Before releasing any metadata locks (MDL), release all table references, in case an ALTER TABLE…ALGORITHM=COPY operation has confused our logic. trx_purge_table_acquire(), trx_purge_table_open(): Do not acquire any table reference before successfully acquiring a necessary metadata lock. In this way, if purge is waiting for MDL, a concurrent ha_innobase::commit_inplace_alter_table(commit=true) that is holding a conflicting MDL_EXCLUSIVE will only observe its own reference on the table that it may need to replace. dict_acquire_mdl_shared(): Unless we hold an MDL or one is not needed, do not hold a table reference when releasing dict_sys.latch. After loading a table into the dictionary cache, we will look up the table again, because the table could be evicted or dropped while we were not holding any dict_sys.latch. Reviewed by: Debarun Banerjee --- storage/innobase/dict/dict0dict.cc | 80 +++++++++++++++++------------- storage/innobase/trx/trx0purge.cc | 70 ++++++++++++++------------ 2 files changed, 84 insertions(+), 66 deletions(-) diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index 1540d0f812a..8d74557a2cf 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -637,35 +637,37 @@ dict_acquire_mdl_shared(dict_table_t *table, MDL_context *mdl_context, MDL_ticket **mdl, dict_table_op_t table_op) { - table_id_t table_id= table->id; char db_buf[NAME_LEN + 1], db_buf1[NAME_LEN + 1]; char tbl_buf[NAME_LEN + 1], tbl_buf1[NAME_LEN + 1]; size_t db_len, tbl_len; - bool unaccessible= false; if (!table->parse_name(db_buf, tbl_buf, &db_len, &tbl_len)) /* The name of an intermediate table starts with #sql */ return table; retry: - if (!unaccessible && (!table->is_readable() || table->corrupted)) + ut_ad(!trylock == dict_sys.frozen()); + ut_ad(trylock || table->get_ref_count()); + + if (!table->is_readable() || table->corrupted) { + if (!trylock) + table->release(); if (*mdl) { mdl_context->release_lock(*mdl); *mdl= nullptr; } - unaccessible= true; + return nullptr; } + const table_id_t table_id{table->id}; + if (!trylock) + { table->release(); - - if (unaccessible) - return nullptr; - - if (!trylock) dict_sys.unfreeze(); + } { MDL_request request; @@ -691,11 +693,37 @@ retry: } } + size_t db1_len, tbl1_len; +lookup: dict_sys.freeze(SRW_LOCK_CALL); table= dict_sys.find_table(table_id); if (table) + { + if (!table->is_accessible()) + { + table= nullptr; + unlock_and_return_without_mdl: + if (trylock) + dict_sys.unfreeze(); + return_without_mdl: + if (*mdl) + { + mdl_context->release_lock(*mdl); + *mdl= nullptr; + } + return table; + } + table->acquire(); - if (!table && table_op != DICT_TABLE_OP_OPEN_ONLY_IF_CACHED) + + if (!table->parse_name(db_buf1, tbl_buf1, &db1_len, &tbl1_len)) + { + /* The table was renamed to #sql prefix. + Release MDL (if any) for the old name and return. */ + goto unlock_and_return_without_mdl; + } + } + else if (table_op != DICT_TABLE_OP_OPEN_ONLY_IF_CACHED) { dict_sys.unfreeze(); dict_sys.lock(SRW_LOCK_CALL); @@ -703,31 +731,15 @@ retry: table_op == DICT_TABLE_OP_LOAD_TABLESPACE ? DICT_ERR_IGNORE_RECOVER_LOCK : DICT_ERR_IGNORE_FK_NOKEY); - if (table) - table->acquire(); dict_sys.unlock(); - dict_sys.freeze(SRW_LOCK_CALL); - } - - if (!table || !table->is_accessible()) - { -return_without_mdl: - if (trylock) - dict_sys.unfreeze(); - if (*mdl) - { - mdl_context->release_lock(*mdl); - *mdl= nullptr; - } - return nullptr; - } - - size_t db1_len, tbl1_len; - - if (!table->parse_name(db_buf1, tbl_buf1, &db1_len, &tbl1_len)) - { - /* The table was renamed to #sql prefix. - Release MDL (if any) for the old name and return. */ + /* At this point, the freshly loaded table may already have been evicted. + We must look it up again while holding a shared dict_sys.latch. We keep + trying this until the table is found in the cache or it cannot be found + in the dictionary (because the table has been dropped or rebuilt). */ + if (table) + goto lookup; + if (!trylock) + dict_sys.freeze(SRW_LOCK_CALL); goto return_without_mdl; } diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 6b96d388fea..397d5ae2ee5 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -1052,16 +1052,25 @@ inline trx_purge_rec_t purge_sys_t::fetch_next_rec() /** Close all tables that were opened in a purge batch for a worker. @param node purge task context @param thd purge coordinator thread handle */ -static void trx_purge_close_tables(purge_node_t *node, THD *thd) +static void trx_purge_close_tables(purge_node_t *node, THD *thd) noexcept { for (auto &t : node->tables) { - if (!t.second.first); - else if (t.second.first == reinterpret_cast(-1)); - else + dict_table_t *table= t.second.first; + if (table != nullptr && table != reinterpret_cast(-1)) + table->release(); + } + + MDL_context *mdl_context= static_cast(thd_mdl_context(thd)); + + for (auto &t : node->tables) + { + dict_table_t *table= t.second.first; + if (table != nullptr && table != reinterpret_cast(-1)) { - dict_table_close(t.second.first, thd, t.second.second); t.second.first= reinterpret_cast(-1); + if (mdl_context != nullptr && t.second.second != nullptr) + mdl_context->release_lock(t.second.second); } } } @@ -1073,36 +1082,35 @@ void purge_sys_t::wait_FTS(bool also_sys) } __attribute__((nonnull)) -/** Aqcuire a metadata lock on a table. +/** Acquire a metadata lock on a table. @param table table handle @param mdl_context metadata lock acquisition context -@param mdl metadata lcok +@param mdl metadata lock @return table handle @retval nullptr if the table is not found or accessible @retval -1 if the purge of history must be suspended due to DDL */ static dict_table_t *trx_purge_table_acquire(dict_table_t *table, MDL_context *mdl_context, - MDL_ticket **mdl) + MDL_ticket **mdl) noexcept { ut_ad(dict_sys.frozen_not_locked()); *mdl= nullptr; if (!table->is_readable() || table->corrupted) - { - table->release(); return nullptr; - } size_t db_len= dict_get_db_name_len(table->name.m_name); if (db_len == 0) - return table; /* InnoDB system tables are not covered by MDL */ + { + /* InnoDB system tables are not covered by MDL */ + got_table: + table->acquire(); + return table; + } if (purge_sys.must_wait_FTS()) - { must_wait: - table->release(); return reinterpret_cast(-1); - } char db_buf[NAME_LEN + 1]; char tbl_buf[NAME_LEN + 1]; @@ -1110,7 +1118,7 @@ static dict_table_t *trx_purge_table_acquire(dict_table_t *table, if (!table->parse_name(db_buf, tbl_buf, &db_len, &tbl_len)) /* The name of an intermediate table starts with #sql */ - return table; + goto got_table; { MDL_request request; @@ -1123,37 +1131,38 @@ static dict_table_t *trx_purge_table_acquire(dict_table_t *table, goto must_wait; } - return table; + goto got_table; } /** Open a table handle for the purge of committed transaction history @param table_id InnoDB table identifier @param mdl_context metadata lock acquisition context -@param mdl metadata lcok +@param mdl metadata lock @return table handle @retval nullptr if the table is not found or accessible @retval -1 if the purge of history must be suspended due to DDL */ static dict_table_t *trx_purge_table_open(table_id_t table_id, MDL_context *mdl_context, - MDL_ticket **mdl) + MDL_ticket **mdl) noexcept { - dict_sys.freeze(SRW_LOCK_CALL); + dict_table_t *table; - dict_table_t *table= dict_sys.find_table(table_id); - - if (table) - table->acquire(); - else + for (;;) { + dict_sys.freeze(SRW_LOCK_CALL); + table= dict_sys.find_table(table_id); + if (table) + break; dict_sys.unfreeze(); dict_sys.lock(SRW_LOCK_CALL); table= dict_load_table_on_id(table_id, DICT_ERR_IGNORE_FK_NOKEY); - if (table) - table->acquire(); dict_sys.unlock(); if (!table) return nullptr; - dict_sys.freeze(SRW_LOCK_CALL); + /* At this point, the freshly loaded table may already have been evicted. + We must look it up again while holding a shared dict_sys.latch. We keep + trying this until the table is found in the cache or it cannot be found + in the dictionary (because the table has been dropped or rebuilt). */ } table= trx_purge_table_acquire(table, mdl_context, mdl); @@ -1172,10 +1181,7 @@ dict_table_t *purge_sys_t::close_and_reopen(table_id_t id, THD *thd, for (que_thr_t *thr= UT_LIST_GET_FIRST(purge_sys.query->thrs); thr; thr= UT_LIST_GET_NEXT(thrs, thr)) - { - purge_node_t *node= static_cast(thr->child); - trx_purge_close_tables(node, thd); - } + trx_purge_close_tables(static_cast(thr->child), thd); m_active= false; wait_FTS(false); From d1a67923244d835b4dad53842dc53a7cb3ff6053 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 26 Mar 2025 14:31:44 +0200 Subject: [PATCH 086/134] MDEV-36122: Protect table references with a lock dict_table_open_on_id(): Simplify the logic. dict_stats: A helper for acquiring MDL and opening the tables mysql.innodb_table_stats and mysql.innodb_index_stats. innodb_ft_aux_table_validate(): Contiguously hold dict_sys.latch while accessing the table that we open with dict_table_open_on_name(). lock_table_children(): Do not hold a table reference while invoking dict_acquire_mdl_shared(), which may temporarily release and reacquire the shared dict_sys.latch that we are holding. prepare_inplace_alter_table_dict(): If an unexpected reference to the table exists, wait for the purge subsystem to release its table handle, similar to how we would do in case FULLTEXT INDEX existed. This function is supposed to be protected by MDL_EXCLUSIVE on the table name. If purge is going to access the table again later during is ALTER TABLE operation, it will have access to an MDL compatible name for it and therefore should conflict with any MDL_EXCLUSIVE that would cover ha_innobase::commit_inplace_alter_table(commit=true). ha_innobase::rename_table(): Before locking the data dictionary, ensure that the purge subsystem is not holding a reference to the table due to the lack of metadata locking, related to FULLTEXT INDEX or the row-level undo logging of ALTER IGNORE TABLE. ha_innobase::truncate(): Before locking the data dictionary, ensure that the purge subsystem is not holding a reference to the table due to insufficient metadata locking related to an earlier ALTER IGNORE TABLE operation. trx_purge_attach_undo_recs(), purge_sys_t::batch_cleanup(): Clear purge_sys.m_active only after all table handles have been released. With these changes, no caller of dict_acquire_mdl_shared should be holding a table reference. All remaining calls to dict_table_open_on_name(dict_locked=false) except the one in fts_lock_table() and possibly in the DDL recovery predicate innodb_check_version() should be protected by MDL, but there currently is no assertion that would enforce this. Reviewed by: Debarun Banerjee --- storage/innobase/dict/dict0defrag_bg.cc | 90 ++------- storage/innobase/dict/dict0dict.cc | 93 ++++++--- storage/innobase/dict/dict0stats.cc | 98 ++------- storage/innobase/handler/ha_innodb.cc | 230 ++++++++-------------- storage/innobase/handler/handler0alter.cc | 85 +++----- storage/innobase/include/dict0dict.h | 21 ++ storage/innobase/lock/lock0lock.cc | 5 +- storage/innobase/trx/trx0purge.cc | 4 +- 8 files changed, 235 insertions(+), 391 deletions(-) diff --git a/storage/innobase/dict/dict0defrag_bg.cc b/storage/innobase/dict/dict0defrag_bg.cc index 32470a4e2e0..9820bb20f8b 100644 --- a/storage/innobase/dict/dict0defrag_bg.cc +++ b/storage/innobase/dict/dict0defrag_bg.cc @@ -217,47 +217,17 @@ dberr_t dict_stats_save_defrag_summary(dict_index_t *index, THD *thd) if (index->is_ibuf()) return DB_SUCCESS; - MDL_ticket *mdl_table= nullptr, *mdl_index= nullptr; - dict_table_t *table_stats= dict_table_open_on_name(TABLE_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (table_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - table_stats= dict_acquire_mdl_shared(table_stats, thd, &mdl_table); - dict_sys.unfreeze(); - } - if (!table_stats || strcmp(table_stats->name.m_name, TABLE_STATS_NAME)) - { -release_and_exit: - if (table_stats) - dict_table_close(table_stats, thd, mdl_table); + dict_stats stats; + if (stats.open(thd)) return DB_STATS_DO_NOT_EXIST; - } - - dict_table_t *index_stats= dict_table_open_on_name(INDEX_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (index_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - index_stats= dict_acquire_mdl_shared(index_stats, thd, &mdl_index); - dict_sys.unfreeze(); - } - if (!index_stats) - goto release_and_exit; - if (strcmp(index_stats->name.m_name, INDEX_STATS_NAME)) - { - dict_table_close(index_stats, thd, mdl_index); - goto release_and_exit; - } - trx_t *trx= trx_create(); trx->mysql_thd= thd; trx_start_internal(trx); dberr_t ret= trx->read_only ? DB_READ_ONLY - : lock_table_for_trx(table_stats, trx, LOCK_X); + : lock_table_for_trx(stats.table(), trx, LOCK_X); if (ret == DB_SUCCESS) - ret= lock_table_for_trx(index_stats, trx, LOCK_X); + ret= lock_table_for_trx(stats.index(), trx, LOCK_X); row_mysql_lock_data_dictionary(trx); if (ret == DB_SUCCESS) ret= dict_stats_save_index_stat(index, time(nullptr), "n_pages_freed", @@ -271,13 +241,9 @@ release_and_exit: else trx->rollback(); - if (table_stats) - dict_table_close(table_stats, thd, mdl_table); - if (index_stats) - dict_table_close(index_stats, thd, mdl_index); - row_mysql_unlock_data_dictionary(trx); trx->free(); + stats.close(); return ret; } @@ -353,49 +319,18 @@ dict_stats_save_defrag_stats( if (!n_leaf_reserved) return DB_SUCCESS; - THD *thd= current_thd; - MDL_ticket *mdl_table= nullptr, *mdl_index= nullptr; - dict_table_t* table_stats= dict_table_open_on_name(TABLE_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (table_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - table_stats= dict_acquire_mdl_shared(table_stats, thd, &mdl_table); - dict_sys.unfreeze(); - } - if (!table_stats || strcmp(table_stats->name.m_name, TABLE_STATS_NAME)) - { -release_and_exit: - if (table_stats) - dict_table_close(table_stats, thd, mdl_table); + THD *const thd= current_thd; + dict_stats stats; + if (stats.open(thd)) return DB_STATS_DO_NOT_EXIST; - } - - dict_table_t *index_stats= dict_table_open_on_name(INDEX_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (index_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - index_stats= dict_acquire_mdl_shared(index_stats, thd, &mdl_index); - dict_sys.unfreeze(); - } - if (!index_stats) - goto release_and_exit; - - if (strcmp(index_stats->name.m_name, INDEX_STATS_NAME)) - { - dict_table_close(index_stats, thd, mdl_index); - goto release_and_exit; - } - trx_t *trx= trx_create(); trx->mysql_thd= thd; trx_start_internal(trx); dberr_t ret= trx->read_only ? DB_READ_ONLY - : lock_table_for_trx(table_stats, trx, LOCK_X); + : lock_table_for_trx(stats.table(), trx, LOCK_X); if (ret == DB_SUCCESS) - ret= lock_table_for_trx(index_stats, trx, LOCK_X); + ret= lock_table_for_trx(stats.index(), trx, LOCK_X); row_mysql_lock_data_dictionary(trx); @@ -423,12 +358,9 @@ release_and_exit: else trx->rollback(); - if (table_stats) - dict_table_close(table_stats, thd, mdl_table); - if (index_stats) - dict_table_close(index_stats, thd, mdl_index); row_mysql_unlock_data_dictionary(trx); trx->free(); + stats.close(); return ret; } diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index 8d74557a2cf..26177c701ad 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -647,12 +647,9 @@ dict_acquire_mdl_shared(dict_table_t *table, retry: ut_ad(!trylock == dict_sys.frozen()); - ut_ad(trylock || table->get_ref_count()); if (!table->is_readable() || table->corrupted) { - if (!trylock) - table->release(); if (*mdl) { mdl_context->release_lock(*mdl); @@ -664,10 +661,7 @@ retry: const table_id_t table_id{table->id}; if (!trylock) - { - table->release(); dict_sys.unfreeze(); - } { MDL_request request; @@ -714,7 +708,8 @@ lookup: return table; } - table->acquire(); + if (trylock) + table->acquire(); if (!table->parse_name(db_buf1, tbl_buf1, &db1_len, &tbl1_len)) { @@ -828,6 +823,7 @@ dict_table_t *dict_table_open_on_id(table_id_t table_id, bool dict_locked, dict_table_op_t table_op, THD *thd, MDL_ticket **mdl) { +retry: if (!dict_locked) dict_sys.freeze(SRW_LOCK_CALL); @@ -835,9 +831,21 @@ dict_table_t *dict_table_open_on_id(table_id_t table_id, bool dict_locked, if (table) { - table->acquire(); - if (thd && !dict_locked) - table= dict_acquire_mdl_shared(table, thd, mdl, table_op); + if (!dict_locked) + { + if (thd) + { + table= dict_acquire_mdl_shared(table, thd, mdl, table_op); + if (table) + goto acquire; + } + else + acquire: + table->acquire(); + dict_sys.unfreeze(); + } + else + table->acquire(); } else if (table_op != DICT_TABLE_OP_OPEN_ONLY_IF_CACHED) { @@ -850,24 +858,16 @@ dict_table_t *dict_table_open_on_id(table_id_t table_id, bool dict_locked, table_op == DICT_TABLE_OP_LOAD_TABLESPACE ? DICT_ERR_IGNORE_RECOVER_LOCK : DICT_ERR_IGNORE_FK_NOKEY); - if (table) - table->acquire(); if (!dict_locked) { dict_sys.unlock(); - if (table && thd) - { - dict_sys.freeze(SRW_LOCK_CALL); - table= dict_acquire_mdl_shared(table, thd, mdl, table_op); - dict_sys.unfreeze(); - } - return table; + if (table) + goto retry; } + else if (table) + table->acquire(); } - if (!dict_locked) - dict_sys.unfreeze(); - return table; } @@ -1084,6 +1084,55 @@ dict_table_open_on_name( DBUG_RETURN(table); } +bool dict_stats::open(THD *thd) noexcept +{ + ut_ad(!mdl_table); + ut_ad(!mdl_index); + ut_ad(!table_stats); + ut_ad(!index_stats); + ut_ad(!mdl_context); + + mdl_context= static_cast(thd_mdl_context(thd)); + if (!mdl_context) + return true; + /* FIXME: use compatible type, and maybe remove this parameter altogether! */ + const double timeout= double(global_system_variables.lock_wait_timeout); + MDL_request request; + MDL_REQUEST_INIT(&request, MDL_key::TABLE, "mysql", "innodb_table_stats", + MDL_SHARED, MDL_EXPLICIT); + if (UNIV_UNLIKELY(mdl_context->acquire_lock(&request, timeout))) + return true; + mdl_table= request.ticket; + MDL_REQUEST_INIT(&request, MDL_key::TABLE, "mysql", "innodb_index_stats", + MDL_SHARED, MDL_EXPLICIT); + if (UNIV_UNLIKELY(mdl_context->acquire_lock(&request, timeout))) + goto release_mdl; + mdl_index= request.ticket; + table_stats= dict_table_open_on_name("mysql/innodb_table_stats", false, + DICT_ERR_IGNORE_NONE); + if (!table_stats) + goto release_mdl; + index_stats= dict_table_open_on_name("mysql/innodb_index_stats", false, + DICT_ERR_IGNORE_NONE); + if (index_stats) + return false; + + table_stats->release(); +release_mdl: + if (mdl_index) + mdl_context->release_lock(mdl_index); + mdl_context->release_lock(mdl_table); + return true; +} + +void dict_stats::close() noexcept +{ + table_stats->release(); + index_stats->release(); + mdl_context->release_lock(mdl_table); + mdl_context->release_lock(mdl_index); +} + /**********************************************************************//** Adds system columns to a table object. */ void diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc index bbfa94e09a8..b9a20f8e020 100644 --- a/storage/innobase/dict/dict0stats.cc +++ b/storage/innobase/dict/dict0stats.cc @@ -2879,11 +2879,12 @@ dberr_t dict_stats_save(dict_table_t* table, index_id_t index_id) pars_info_t* pinfo; char db_utf8[MAX_DB_UTF8_LEN]; char table_utf8[MAX_TABLE_UTF8_LEN]; + THD* const thd = current_thd; #ifdef ENABLED_DEBUG_SYNC DBUG_EXECUTE_IF("dict_stats_save_exit_notify", - SCOPE_EXIT([] { - debug_sync_set_action(current_thd, + SCOPE_EXIT([thd] { + debug_sync_set_action(thd, STRING_WITH_LEN("now SIGNAL dict_stats_save_finished")); }); ); @@ -2904,41 +2905,10 @@ dberr_t dict_stats_save(dict_table_t* table, index_id_t index_id) return (dict_stats_report_error(table)); } - THD* thd = current_thd; - MDL_ticket *mdl_table = nullptr, *mdl_index = nullptr; - dict_table_t* table_stats = dict_table_open_on_name( - TABLE_STATS_NAME, false, DICT_ERR_IGNORE_NONE); - if (table_stats) { - dict_sys.freeze(SRW_LOCK_CALL); - table_stats = dict_acquire_mdl_shared(table_stats, thd, - &mdl_table); - dict_sys.unfreeze(); - } - if (!table_stats - || strcmp(table_stats->name.m_name, TABLE_STATS_NAME)) { -release_and_exit: - if (table_stats) { - dict_table_close(table_stats, thd, mdl_table); - } + dict_stats stats; + if (stats.open(thd)) { return DB_STATS_DO_NOT_EXIST; } - - dict_table_t* index_stats = dict_table_open_on_name( - INDEX_STATS_NAME, false, DICT_ERR_IGNORE_NONE); - if (index_stats) { - dict_sys.freeze(SRW_LOCK_CALL); - index_stats = dict_acquire_mdl_shared(index_stats, thd, - &mdl_index); - dict_sys.unfreeze(); - } - if (!index_stats) { - goto release_and_exit; - } - if (strcmp(index_stats->name.m_name, INDEX_STATS_NAME)) { - dict_table_close(index_stats, thd, mdl_index); - goto release_and_exit; - } - dict_fs2utf8(table->name.m_name, db_utf8, sizeof(db_utf8), table_utf8, sizeof(table_utf8)); const time_t now = time(NULL); @@ -2947,9 +2917,9 @@ release_and_exit: trx_start_internal(trx); dberr_t ret = trx->read_only ? DB_READ_ONLY - : lock_table_for_trx(table_stats, trx, LOCK_X); + : lock_table_for_trx(stats.table(), trx, LOCK_X); if (ret == DB_SUCCESS) { - ret = lock_table_for_trx(index_stats, trx, LOCK_X); + ret = lock_table_for_trx(stats.index(), trx, LOCK_X); } if (ret != DB_SUCCESS) { if (trx->state != TRX_STATE_NOT_STARTED) { @@ -3010,8 +2980,7 @@ free_and_exit: dict_sys.unlock(); unlocked_free_and_exit: trx->free(); - dict_table_close(table_stats, thd, mdl_table); - dict_table_close(index_stats, thd, mdl_index); + stats.close(); return ret; } @@ -3486,42 +3455,11 @@ dberr_t dict_stats_fetch_from_ps(dict_table_t *table) stats. */ dict_stats_empty_table(table, true); - THD* thd = current_thd; - MDL_ticket *mdl_table = nullptr, *mdl_index = nullptr; - dict_table_t* table_stats = dict_table_open_on_name( - TABLE_STATS_NAME, false, DICT_ERR_IGNORE_NONE); - if (!table_stats) { + THD* const thd = current_thd; + dict_stats stats; + if (stats.open(thd)) { return DB_STATS_DO_NOT_EXIST; } - dict_table_t* index_stats = dict_table_open_on_name( - INDEX_STATS_NAME, false, DICT_ERR_IGNORE_NONE); - if (!index_stats) { - table_stats->release(); - return DB_STATS_DO_NOT_EXIST; - } - - dict_sys.freeze(SRW_LOCK_CALL); - table_stats = dict_acquire_mdl_shared(table_stats, thd, - &mdl_table); - if (!table_stats - || strcmp(table_stats->name.m_name, TABLE_STATS_NAME)) { -release_and_exit: - dict_sys.unfreeze(); - if (table_stats) { - dict_table_close(table_stats, thd, mdl_table); - } - if (index_stats) { - dict_table_close(index_stats, thd, mdl_index); - } - return DB_STATS_DO_NOT_EXIST; - } - - index_stats = dict_acquire_mdl_shared(index_stats, thd, - &mdl_index); - if (!index_stats - || strcmp(index_stats->name.m_name, INDEX_STATS_NAME)) { - goto release_and_exit; - } #ifdef ENABLED_DEBUG_SYNC DEBUG_SYNC(thd, "dict_stats_mdl_acquired"); @@ -3547,7 +3485,6 @@ release_and_exit: "fetch_index_stats_step", dict_stats_fetch_index_stats_step, &index_fetch_arg); - dict_sys.unfreeze(); dict_sys.lock(SRW_LOCK_CALL); que_t* graph = pars_sql( pinfo, @@ -3613,18 +3550,11 @@ release_and_exit: trx_start_internal_read_only(trx); que_run_threads(que_fork_start_command(graph)); que_graph_free(graph); - - dict_table_close(table_stats, thd, mdl_table); - dict_table_close(index_stats, thd, mdl_index); - trx_commit_for_mysql(trx); - dberr_t ret = trx->error_state; + dberr_t ret = index_fetch_arg.stats_were_modified + ? trx->error_state : DB_STATS_DO_NOT_EXIST; trx->free(); - - if (!index_fetch_arg.stats_were_modified) { - return DB_STATS_DO_NOT_EXIST; - } - + stats.close(); return ret; } diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 4da8e94a2d3..b407ed3e4d4 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -1330,38 +1330,17 @@ static void innodb_drop_database(handlerton*, char *path) dict_sys.unlock(); - dict_table_t *table_stats, *index_stats; - MDL_ticket *mdl_table= nullptr, *mdl_index= nullptr; - table_stats= dict_table_open_on_name(TABLE_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (table_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - table_stats= dict_acquire_mdl_shared(table_stats, - thd, &mdl_table); - dict_sys.unfreeze(); - } - index_stats= dict_table_open_on_name(INDEX_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (index_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - index_stats= dict_acquire_mdl_shared(index_stats, - thd, &mdl_index); - dict_sys.unfreeze(); - } - + dict_stats stats; + const bool stats_failed{stats.open(thd)}; trx_start_for_ddl(trx); uint errors= 0; char db[NAME_LEN + 1]; strconvert(&my_charset_filename, namebuf, len, system_charset_info, db, sizeof db, &errors); - if (!errors && table_stats && index_stats && - !strcmp(table_stats->name.m_name, TABLE_STATS_NAME) && - !strcmp(index_stats->name.m_name, INDEX_STATS_NAME) && - lock_table_for_trx(table_stats, trx, LOCK_X) == DB_SUCCESS && - lock_table_for_trx(index_stats, trx, LOCK_X) == DB_SUCCESS) + if (!errors && !stats_failed && + lock_table_for_trx(stats.table(), trx, LOCK_X) == DB_SUCCESS && + lock_table_for_trx(stats.index(), trx, LOCK_X) == DB_SUCCESS) { row_mysql_lock_data_dictionary(trx); if (dict_stats_delete(db, trx)) @@ -1457,19 +1436,16 @@ static void innodb_drop_database(handlerton*, char *path) if (err != DB_SUCCESS) { trx->rollback(); - namebuf[len] = '\0'; - ib::error() << "DROP DATABASE " << namebuf << ": " << err; + sql_print_error("InnoDB: DROP DATABASE %.*s: %s", + int(len), namebuf, ut_strerr(err)); } else trx->commit(); - if (table_stats) - dict_table_close(table_stats, thd, mdl_table); - if (index_stats) - dict_table_close(index_stats, thd, mdl_index); row_mysql_unlock_data_dictionary(trx); - trx->free(); + if (!stats_failed) + stats.close(); if (err == DB_SUCCESS) { @@ -13680,8 +13656,6 @@ int ha_innobase::delete_table(const char *name) err= lock_table_children(table, trx); } - dict_table_t *table_stats= nullptr, *index_stats= nullptr; - MDL_ticket *mdl_table= nullptr, *mdl_index= nullptr; if (err == DB_SUCCESS) err= lock_table_for_trx(table, trx, LOCK_X); @@ -13720,37 +13694,18 @@ int ha_innobase::delete_table(const char *name) #endif DEBUG_SYNC(thd, "before_delete_table_stats"); + dict_stats stats; + bool stats_failed= true; if (err == DB_SUCCESS && table->stats_is_persistent() && !table->is_stats_table()) { - table_stats= dict_table_open_on_name(TABLE_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (table_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - table_stats= dict_acquire_mdl_shared(table_stats, - thd, &mdl_table); - dict_sys.unfreeze(); - } - - index_stats= dict_table_open_on_name(INDEX_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (index_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - index_stats= dict_acquire_mdl_shared(index_stats, - thd, &mdl_index); - dict_sys.unfreeze(); - } - + stats_failed= stats.open(thd); const bool skip_wait{table->name.is_temporary()}; - if (table_stats && index_stats && - !strcmp(table_stats->name.m_name, TABLE_STATS_NAME) && - !strcmp(index_stats->name.m_name, INDEX_STATS_NAME) && - !(err= lock_table_for_trx(table_stats, trx, LOCK_X, skip_wait))) - err= lock_table_for_trx(index_stats, trx, LOCK_X, skip_wait); + if (!stats_failed && + !(err= lock_table_for_trx(stats.table(), trx, LOCK_X, skip_wait))) + err= lock_table_for_trx(stats.index(), trx, LOCK_X, skip_wait); if (err != DB_SUCCESS && skip_wait) { @@ -13759,10 +13714,8 @@ int ha_innobase::delete_table(const char *name) ut_ad(err == DB_LOCK_WAIT); ut_ad(trx->error_state == DB_SUCCESS); err= DB_SUCCESS; - dict_table_close(table_stats, thd, mdl_table); - dict_table_close(index_stats, thd, mdl_index); - table_stats= nullptr; - index_stats= nullptr; + stats.close(); + stats_failed= true; } } @@ -13833,13 +13786,11 @@ err_exit: else if (rollback_add_partition) purge_sys.resume_FTS(); #endif - if (table_stats) - dict_table_close(table_stats, thd, mdl_table); - if (index_stats) - dict_table_close(index_stats, thd, mdl_index); row_mysql_unlock_data_dictionary(trx); if (trx != parent_trx) trx->free(); + if (!stats_failed) + stats.close(); DBUG_RETURN(convert_error_code_to_mysql(err, 0, NULL)); } @@ -13854,7 +13805,7 @@ err_exit: err= trx->drop_table_foreign(table->name); } - if (err == DB_SUCCESS && table_stats && index_stats) + if (err == DB_SUCCESS && !stats_failed) err= trx->drop_table_statistics(table->name); if (err != DB_SUCCESS) goto err_exit; @@ -13865,11 +13816,9 @@ err_exit: std::vector deleted; trx->commit(deleted); - if (table_stats) - dict_table_close(table_stats, thd, mdl_table); - if (index_stats) - dict_table_close(index_stats, thd, mdl_index); row_mysql_unlock_data_dictionary(trx); + if (!stats_failed) + stats.close(); for (pfs_os_file_t d : deleted) os_file_close(d); log_write_up_to(trx->commit_lsn, true); @@ -14065,9 +14014,6 @@ int ha_innobase::truncate() ib_table->name.m_name, ib_table->id); const char *name= mem_heap_strdup(heap, ib_table->name.m_name); - dict_table_t *table_stats = nullptr, *index_stats = nullptr; - MDL_ticket *mdl_table = nullptr, *mdl_index = nullptr; - dberr_t error= lock_table_children(ib_table, trx); if (error == DB_SUCCESS) @@ -14075,6 +14021,7 @@ int ha_innobase::truncate() const bool fts= error == DB_SUCCESS && ib_table->flags2 & (DICT_TF2_FTS_HAS_DOC_ID | DICT_TF2_FTS); + const bool pause_purge= error == DB_SUCCESS && ib_table->get_ref_count() > 1; if (fts) { @@ -14082,6 +14029,8 @@ int ha_innobase::truncate() purge_sys.stop_FTS(*ib_table); error= fts_lock_tables(trx, *ib_table); } + else if (pause_purge) + purge_sys.stop_FTS(); if (error == DB_SUCCESS) { @@ -14097,33 +14046,16 @@ int ha_innobase::truncate() } } + dict_stats stats; + bool stats_failed= true; + if (error == DB_SUCCESS && ib_table->stats_is_persistent() && !ib_table->is_stats_table()) { - table_stats= dict_table_open_on_name(TABLE_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (table_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - table_stats= dict_acquire_mdl_shared(table_stats, m_user_thd, - &mdl_table); - dict_sys.unfreeze(); - } - index_stats= dict_table_open_on_name(INDEX_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (index_stats) - { - dict_sys.freeze(SRW_LOCK_CALL); - index_stats= dict_acquire_mdl_shared(index_stats, m_user_thd, - &mdl_index); - dict_sys.unfreeze(); - } - - if (table_stats && index_stats && - !strcmp(table_stats->name.m_name, TABLE_STATS_NAME) && - !strcmp(index_stats->name.m_name, INDEX_STATS_NAME) && - !(error= lock_table_for_trx(table_stats, trx, LOCK_X))) - error= lock_table_for_trx(index_stats, trx, LOCK_X); + stats_failed= stats.open(m_user_thd); + if (!stats_failed && + !(error= lock_table_for_trx(stats.table(), trx, LOCK_X))) + error= lock_table_for_trx(stats.index(), trx, LOCK_X); } if (error == DB_SUCCESS) @@ -14215,14 +14147,9 @@ int ha_innobase::truncate() } trx->free(); - + if (!stats_failed) + stats.close(); mem_heap_free(heap); - - if (table_stats) - dict_table_close(table_stats, m_user_thd, mdl_table); - if (index_stats) - dict_table_close(index_stats, m_user_thd, mdl_index); - DBUG_RETURN(err); } @@ -14284,8 +14211,6 @@ ha_innobase::rename_table( trx_t* trx = innobase_trx_allocate(thd); trx_start_for_ddl(trx); - dict_table_t *table_stats = nullptr, *index_stats = nullptr; - MDL_ticket *mdl_table = nullptr, *mdl_index = nullptr; char norm_from[MAX_FULL_NAME_LEN]; char norm_to[MAX_FULL_NAME_LEN]; @@ -14296,6 +14221,7 @@ ha_innobase::rename_table( const bool from_temp = dict_table_t::is_temporary_name(norm_from); dict_table_t* t; + bool pause_purge = false, fts_exist = false; if (from_temp) { /* There is no need to lock any FOREIGN KEY child tables. */ @@ -14308,37 +14234,35 @@ ha_innobase::rename_table( if (error == DB_SUCCESS) { error = lock_table_for_trx(t, trx, LOCK_X); } + fts_exist = error == DB_SUCCESS && t->flags2 + & (DICT_TF2_FTS_HAS_DOC_ID | DICT_TF2_FTS); + pause_purge = error == DB_SUCCESS + && t->get_ref_count() > 1; + if (fts_exist) { + fts_optimize_remove_table(t); + purge_sys.stop_FTS(*t); + if (error == DB_SUCCESS) { + error = fts_lock_tables(trx, *t); + } + } else if (pause_purge) { + purge_sys.stop_FTS(); + } } } + dict_stats stats; + bool stats_fail = true; + if (strcmp(norm_from, TABLE_STATS_NAME) && strcmp(norm_from, INDEX_STATS_NAME) && strcmp(norm_to, TABLE_STATS_NAME) && strcmp(norm_to, INDEX_STATS_NAME)) { - table_stats = dict_table_open_on_name(TABLE_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (table_stats) { - dict_sys.freeze(SRW_LOCK_CALL); - table_stats = dict_acquire_mdl_shared( - table_stats, thd, &mdl_table); - dict_sys.unfreeze(); - } - index_stats = dict_table_open_on_name(INDEX_STATS_NAME, false, - DICT_ERR_IGNORE_NONE); - if (index_stats) { - dict_sys.freeze(SRW_LOCK_CALL); - index_stats = dict_acquire_mdl_shared( - index_stats, thd, &mdl_index); - dict_sys.unfreeze(); - } - - if (error == DB_SUCCESS && table_stats && index_stats - && !strcmp(table_stats->name.m_name, TABLE_STATS_NAME) - && !strcmp(index_stats->name.m_name, INDEX_STATS_NAME)) { - error = lock_table_for_trx(table_stats, trx, LOCK_X, - from_temp); + stats_fail = stats.open(thd); + if (!stats_fail && error == DB_SUCCESS) { + error = lock_table_for_trx(stats.table(), trx, + LOCK_X, from_temp); if (error == DB_SUCCESS) { - error = lock_table_for_trx(index_stats, trx, + error = lock_table_for_trx(stats.index(), trx, LOCK_X, from_temp); } if (error != DB_SUCCESS && from_temp) { @@ -14349,10 +14273,8 @@ ha_innobase::rename_table( we cannot lock the tables, when the table is being renamed from from a temporary name. */ - dict_table_close(table_stats, thd, mdl_table); - dict_table_close(index_stats, thd, mdl_index); - table_stats = nullptr; - index_stats = nullptr; + stats.close(); + stats_fail = true; } } } @@ -14379,7 +14301,7 @@ ha_innobase::rename_table( DEBUG_SYNC(thd, "after_innobase_rename_table"); - if (error == DB_SUCCESS && table_stats && index_stats) { + if (error == DB_SUCCESS && !stats_fail) { error = dict_stats_rename_table(norm_from, norm_to, trx); if (error == DB_DUPLICATE_KEY) { /* The duplicate may also occur in @@ -14393,7 +14315,10 @@ ha_innobase::rename_table( if (error == DB_SUCCESS) { trx->flush_log_later = true; if (t) { - ut_ad(dict_sys.frozen()); + ut_ad(dict_sys.locked()); + if (fts_exist) { + fts_optimize_add_table(t); + } if (UNIV_LIKELY(t->release())) { stats_deinit(t); } else { @@ -14403,23 +14328,28 @@ ha_innobase::rename_table( innobase_commit_low(trx); } else { if (t) { + if (fts_exist) { + fts_optimize_add_table(t); + } t->release(); } trx->rollback(); } - if (table_stats) { - dict_table_close(table_stats, thd, mdl_table); - } - if (index_stats) { - dict_table_close(index_stats, thd, mdl_index); - } row_mysql_unlock_data_dictionary(trx); + + if (fts_exist || pause_purge) { + purge_sys.resume_FTS(); + } + if (error == DB_SUCCESS) { log_write_up_to(trx->commit_lsn, true); } trx->flush_log_later = false; trx->free(); + if (!stats_fail) { + stats.close(); + } if (error == DB_DUPLICATE_KEY) { /* We are not able to deal with handler::get_dup_key() @@ -17714,11 +17644,16 @@ static int innodb_ft_aux_table_validate(THD *thd, st_mysql_sys_var*, int len = sizeof buf; if (const char* table_name = value->val_str(value, buf, &len)) { + /* Because we are not acquiring MDL on the table name, + we must contiguously hold dict_sys.latch while we are + examining the table, to protect us against concurrent DDL. */ + dict_sys.lock(SRW_LOCK_CALL); if (dict_table_t* table = dict_table_open_on_name( - table_name, false, DICT_ERR_IGNORE_NONE)) { + table_name, true, DICT_ERR_IGNORE_NONE)) { + table->release(); const table_id_t id = dict_table_has_fts_index(table) ? table->id : 0; - table->release(); + dict_sys.unlock(); if (id) { innodb_ft_aux_table_id = id; if (table_name == buf) { @@ -17729,12 +17664,11 @@ static int innodb_ft_aux_table_validate(THD *thd, st_mysql_sys_var*, len); } - *static_cast(save) = table_name; return 0; } } - + dict_sys.unlock(); return 1; } else { *static_cast(save) = NULL; diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index e44cd9f476f..85bc2927c67 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -6611,8 +6611,9 @@ prepare_inplace_alter_table_dict( mem_heap_alloc(ctx->heap, ctx->num_to_add_index * sizeof *ctx->add_key_numbers)); - const bool fts_exist = ctx->new_table->flags2 + const bool have_fts = user_table->flags2 & (DICT_TF2_FTS_HAS_DOC_ID | DICT_TF2_FTS); + const bool pause_purge = have_fts || user_table->get_ref_count() > 1; /* Acquire a lock on the table before creating any indexes. */ bool table_lock_failed = false; @@ -6639,13 +6640,18 @@ acquire_lock: user_table->lock_shared_unlock(); } - if (fts_exist) { - purge_sys.stop_FTS(*ctx->new_table); + if (pause_purge) { + purge_sys.stop_FTS(); + if (have_fts) { + purge_sys.stop_FTS(*user_table, true); + } if (error == DB_SUCCESS) { - error = fts_lock_tables(ctx->trx, *ctx->new_table); + error = fts_lock_tables(ctx->trx, *user_table); } } + ut_ad(user_table->get_ref_count() == 1); + if (error == DB_SUCCESS) { error = lock_sys_tables(ctx->trx); } @@ -7478,7 +7484,7 @@ error_handling_drop_uncached: /* fts_create_common_tables() may drop old common tables, whose files would be deleted here. */ commit_unlock_and_unlink(ctx->trx); - if (fts_exist) { + if (pause_purge) { purge_sys.resume_FTS(); } @@ -7575,7 +7581,7 @@ err_exit: ctx->trx->free(); } trx_commit_for_mysql(ctx->prebuilt->trx); - if (fts_exist) { + if (pause_purge) { purge_sys.resume_FTS(); } @@ -11572,34 +11578,16 @@ err_index: } } - dict_table_t *table_stats = nullptr, *index_stats = nullptr; - MDL_ticket *mdl_table = nullptr, *mdl_index = nullptr; + dict_stats stats; + bool stats_failed = true; dberr_t error = DB_SUCCESS; if (!ctx0->old_table->is_stats_table() && !ctx0->new_table->is_stats_table()) { - table_stats = dict_table_open_on_name( - TABLE_STATS_NAME, false, DICT_ERR_IGNORE_NONE); - if (table_stats) { - dict_sys.freeze(SRW_LOCK_CALL); - table_stats = dict_acquire_mdl_shared( - table_stats, m_user_thd, &mdl_table); - dict_sys.unfreeze(); - } - index_stats = dict_table_open_on_name( - INDEX_STATS_NAME, false, DICT_ERR_IGNORE_NONE); - if (index_stats) { - dict_sys.freeze(SRW_LOCK_CALL); - index_stats = dict_acquire_mdl_shared( - index_stats, m_user_thd, &mdl_index); - dict_sys.unfreeze(); - } - - if (table_stats && index_stats - && !strcmp(table_stats->name.m_name, TABLE_STATS_NAME) - && !strcmp(index_stats->name.m_name, INDEX_STATS_NAME) - && !(error = lock_table_for_trx(table_stats, + stats_failed = stats.open(m_user_thd); + if (!stats_failed + && !(error = lock_table_for_trx(stats.table(), trx, LOCK_X))) { - error = lock_table_for_trx(index_stats, trx, LOCK_X); + error = lock_table_for_trx(stats.index(), trx, LOCK_X); } } @@ -11613,13 +11601,9 @@ err_index: error = lock_sys_tables(trx); } if (error != DB_SUCCESS) { - if (table_stats) { - dict_table_close(table_stats, m_user_thd, mdl_table); + if (!stats_failed) { + stats.close(); } - if (index_stats) { - dict_table_close(index_stats, m_user_thd, mdl_index); - } - my_error_innodb(error, table_share->table_name.str, 0); if (fts_exist) { purge_sys.resume_FTS(); } @@ -11635,6 +11619,7 @@ err_index: trx_start_for_ddl(trx); } + my_error_innodb(error, table_share->table_name.str, 0); DBUG_RETURN(true); } @@ -11652,15 +11637,10 @@ err_index: fail: trx->rollback(); ut_ad(!trx->fts_trx); - if (table_stats) { - dict_table_close(table_stats, m_user_thd, - mdl_table); - } - if (index_stats) { - dict_table_close(index_stats, m_user_thd, - mdl_index); - } row_mysql_unlock_data_dictionary(trx); + if (!stats_failed) { + stats.close(); + } if (fts_exist) { purge_sys.resume_FTS(); } @@ -11680,14 +11660,14 @@ fail: if (commit_try_rebuild(ha_alter_info, ctx, altered_table, table, - table_stats && index_stats, + !stats_failed, trx, table_share->table_name.str)) { goto fail; } } else if (commit_try_norebuild(ha_alter_info, ctx, altered_table, table, - table_stats && index_stats, + !stats_failed, trx, table_share->table_name.str)) { goto fail; @@ -11710,13 +11690,6 @@ fail: #endif } - if (table_stats) { - dict_table_close(table_stats, m_user_thd, mdl_table); - } - if (index_stats) { - dict_table_close(index_stats, m_user_thd, mdl_index); - } - /* Commit or roll back the changes to the data dictionary. */ DEBUG_SYNC(m_user_thd, "innodb_alter_inplace_before_commit"); @@ -11865,6 +11838,9 @@ foreign_fail: DBUG_EXECUTE_IF("innodb_alter_commit_crash_after_commit", DBUG_SUICIDE();); trx->free(); + if (!stats_failed) { + stats.close(); + } if (fts_exist) { purge_sys.resume_FTS(); } @@ -11921,6 +11897,9 @@ foreign_fail: DBUG_EXECUTE_IF("innodb_alter_commit_crash_after_commit", DBUG_SUICIDE();); trx->free(); + if (!stats_failed) { + stats.close(); + } if (fts_exist) { purge_sys.resume_FTS(); } diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index 64f8d0a95da..a56d01d13ca 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -1657,6 +1657,27 @@ bool dict_table_have_virtual_index( dict_table_t* table); +/** Helper for opening the InnoDB persistent statistics tables */ +class dict_stats final +{ + MDL_context *mdl_context= nullptr; + MDL_ticket *mdl_table= nullptr, *mdl_index= nullptr; + dict_table_t *table_stats= nullptr, *index_stats= nullptr; + +public: + dict_stats()= default; + + /** Open the statistics tables. + @return whether the operation failed */ + bool open(THD *thd) noexcept; + + /** Close the statistics tables after !open_tables(thd). */ + void close() noexcept; + + dict_table_t *table() const noexcept { return table_stats; } + dict_table_t *index() const noexcept { return index_stats; } +}; + #include "dict0dict.inl" #endif diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 4601fb4394d..d258e5c6b27 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -4140,13 +4140,12 @@ dberr_t lock_table_children(dict_table_t *table, trx_t *trx) children.end()) continue; /* We already acquired MDL on this child table. */ MDL_ticket *mdl= nullptr; - child->acquire(); child= dict_acquire_mdl_shared(child, mdl_context, &mdl, DICT_TABLE_OP_NORMAL); if (child) { - if (!mdl) - child->release(); + if (mdl) + child->acquire(); children.emplace_back(table_mdl{child, mdl}); goto rescan; } diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 397d5ae2ee5..d6feb820a62 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -1293,8 +1293,6 @@ static purge_sys_t::iterator trx_purge_attach_undo_recs(THD *thd, break; } - purge_sys.m_active= false; - #ifdef UNIV_DEBUG thr= UT_LIST_GET_FIRST(purge_sys.query->thrs); for (ulint i= 0; thr && i < *n_work_items; @@ -1343,6 +1341,8 @@ static void trx_purge_wait_for_workers_to_complete() TRANSACTIONAL_INLINE void purge_sys_t::batch_cleanup(const purge_sys_t::iterator &head) { + m_active= false; + /* Release the undo pages. */ for (auto p : pages) p.second->unfix(); From 3b4de4c281cb3e33e6d3ee9537e542bf0a84b83e Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Mon, 24 Mar 2025 13:07:36 +0200 Subject: [PATCH 087/134] MDEV-32084: Assertion in best_extension_by_limited_search() ... When subquery with LEFT JOIN is converted into semi-join, it is possible to construct cases where the LEFT JOIN's ON expression refers to a table in the current select but not in the current join nest. For example: t1 SEMI JOIN ( t2 LEFT JOIN (t3 LEFT JOIN t4 ON t4.col=t1.col) ON expr ) here, ON t4.col=t1.col" has this property. Let's denote it as ON-EXPR-HAS-REF-OUTSIDE-NEST. The optimizer handles LEFT JOINs like so: - Outer join runtime requires that "inner tables follow outer" in any join order. - Join optimizer enforces this by constructing join orders that follow table dependencies as they are specified in TABLE_LIST::dep_tables. - The dep_tables are set in simplify_joins() according to the contents of ON expressions and LEFT JOIN structure. However, the logic in simplify_joins() failed to account for possible ON-EXPR-HAS-REF-OUTSIDE-NEST. It assumed that references outside of the current join nest could only be OUTER_REF_TABLE_BIT or RAND_TABLE_BIT. The fix was to add the missing logic. --- mysql-test/main/join_nested.result | 12 +++++ mysql-test/main/join_nested.test | 13 ++++++ mysql-test/main/join_nested_jcl6.result | 12 +++++ sql/sql_select.cc | 58 +++++++++++++++++++++++-- 4 files changed, 91 insertions(+), 4 deletions(-) diff --git a/mysql-test/main/join_nested.result b/mysql-test/main/join_nested.result index cb9dffc837d..564685188bf 100644 --- a/mysql-test/main/join_nested.result +++ b/mysql-test/main/join_nested.result @@ -2051,3 +2051,15 @@ a b c a a b DROP TABLE t1, t2, t3; set join_cache_level= @save_join_cache_level; # end of 10.3 tests +# +# MDEV-32084: Assertion in best_extension_by_limited_search(), or crash elsewhere in release +# +CREATE TABLE t1 (i int); +INSERT INTO t1 values (1),(2); +SELECT 1 FROM t1 WHERE i IN +(SELECT 1 FROM t1 c +LEFT JOIN (t1 a LEFT JOIN t1 b ON t1.i = b.i) ON c.i = t1.i); +1 +1 +DROP TABLE t1; +# end of 10.11 tests diff --git a/mysql-test/main/join_nested.test b/mysql-test/main/join_nested.test index ed1fe4c9f7e..62370b95262 100644 --- a/mysql-test/main/join_nested.test +++ b/mysql-test/main/join_nested.test @@ -1458,3 +1458,16 @@ DROP TABLE t1, t2, t3; set join_cache_level= @save_join_cache_level; --echo # end of 10.3 tests + +--echo # +--echo # MDEV-32084: Assertion in best_extension_by_limited_search(), or crash elsewhere in release +--echo # +CREATE TABLE t1 (i int); +INSERT INTO t1 values (1),(2); + +SELECT 1 FROM t1 WHERE i IN + (SELECT 1 FROM t1 c + LEFT JOIN (t1 a LEFT JOIN t1 b ON t1.i = b.i) ON c.i = t1.i); + +DROP TABLE t1; +--echo # end of 10.11 tests diff --git a/mysql-test/main/join_nested_jcl6.result b/mysql-test/main/join_nested_jcl6.result index 0bda8d43a69..50a1e83a5ab 100644 --- a/mysql-test/main/join_nested_jcl6.result +++ b/mysql-test/main/join_nested_jcl6.result @@ -2060,6 +2060,18 @@ a b c a a b DROP TABLE t1, t2, t3; set join_cache_level= @save_join_cache_level; # end of 10.3 tests +# +# MDEV-32084: Assertion in best_extension_by_limited_search(), or crash elsewhere in release +# +CREATE TABLE t1 (i int); +INSERT INTO t1 values (1),(2); +SELECT 1 FROM t1 WHERE i IN +(SELECT 1 FROM t1 c +LEFT JOIN (t1 a LEFT JOIN t1 b ON t1.i = b.i) ON c.i = t1.i); +1 +1 +DROP TABLE t1; +# end of 10.11 tests CREATE TABLE t5 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b)); CREATE TABLE t6 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b)); CREATE TABLE t7 (a int, b int, c int, PRIMARY KEY(a), KEY b_i (b)); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 3c4b7b3ec03..85d65400224 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -18628,6 +18628,8 @@ simplify_joins(JOIN *join, List *join_list, COND *conds, bool top, prev_table->dep_tables|= used_tables; if (prev_table->on_expr) { + /* If the ON expression is still there, it's an outer join */ + DBUG_ASSERT(prev_table->outer_join); prev_table->dep_tables|= table->on_expr_dep_tables; table_map prev_used_tables= prev_table->nested_join ? prev_table->nested_join->used_tables : @@ -18642,11 +18644,59 @@ simplify_joins(JOIN *join, List *join_list, COND *conds, bool top, prevents update of inner table dependences. For example it might happen if RAND() function is used in JOIN ON clause. - */ - if (!((prev_table->on_expr->used_tables() & - ~(OUTER_REF_TABLE_BIT | RAND_TABLE_BIT)) & - ~prev_used_tables)) + */ + table_map prev_on_expr_deps= prev_table->on_expr->used_tables() & + ~(OUTER_REF_TABLE_BIT | RAND_TABLE_BIT); + prev_on_expr_deps&= ~prev_used_tables; + + if (!prev_on_expr_deps) prev_table->dep_tables|= used_tables; + else + { + /* + Another possible case is when prev_on_expr_deps!=0 but it depends + on a table outside this join nest. SQL name resolution don't allow + this but it is possible when LEFT JOIN is inside a subquery which + is converted into a semi-join nest, Example: + + t1 SEMI JOIN ( + t2 + LEFT JOIN (t3 LEFT JOIN t4 ON t4.col=t1.col) ON expr + ) ON ... + + here, we would have prev_table=t4, table=t3. The condition + "ON t4.col=t1.col" depends on tables {t1, t4}. To make sure the + optimizer puts t3 before t4 we need to make sure t4.dep_tables + includes t3. + */ + + DBUG_ASSERT(table->embedding == prev_table->embedding); + if (table->embedding) + { + /* + Find what are the "peers" of "table" in the join nest. Normally, + it is table->embedding->nested_join->used_tables, but here we are + in the process of recomputing that value. + So, we walk the join list and collect the bitmap of peers: + */ + table_map peers= 0; + List_iterator_fast li(*join_list); + TABLE_LIST *peer; + while ((peer= li++)) + { + table_map curmap= peer->nested_join + ? peer->nested_join->used_tables + : peer->get_map(); + peers|= curmap; + } + /* + If prev_table doesn't depend on any of its peers, add a + dependency on nearest peer, that is, on 'table'. + */ + if (!(prev_on_expr_deps & peers)) + prev_table->dep_tables|= used_tables; + } + } } } prev_table= table; From b6923420f326ac030e4f3ef89a2acddb45eccb30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 26 Mar 2025 17:05:44 +0200 Subject: [PATCH 088/134] MDEV-29445: Reimplement SET GLOBAL innodb_buffer_pool_size We deprecate and ignore the parameter innodb_buffer_pool_chunk_size and let the buffer pool size to be changed in arbitrary 1-megabyte increments. innodb_buffer_pool_size_max: A new read-only startup parameter that specifies the maximum innodb_buffer_pool_size. If 0 or unspecified, it will default to the specified innodb_buffer_pool_size rounded up to the allocation unit (2 MiB or 8 MiB). The maximum value is 4GiB-2MiB on 32-bit systems and 16EiB-8MiB on 64-bit systems. This maximum is very likely to be limited further by the operating system. The status variable Innodb_buffer_pool_resize_status will reflect the status of shrinking the buffer pool. When no shrinking is in progress, the string will be empty. Unlike before, the execution of SET GLOBAL innodb_buffer_pool_size will block until the requested buffer pool size change has been implemented, or the execution is interrupted by a KILL statement a client disconnect, or server shutdown. If the buf_flush_page_cleaner() thread notices that we are running out of memory, the operation may fail with ER_WRONG_USAGE. SET GLOBAL innodb_buffer_pool_size will be refused if the server was started with --large-pages (even if no HugeTLB pages were successfully allocated). This functionality is somewhat exercised by the test main.large_pages, which now runs also on Microsoft Windows. On Linux, explicit HugeTLB mappings are apparently excluded from the reported Redident Set Size (RSS), and apparently unshrinkable between mmap(2) and munmap(2). The buffer pool will be mapped to a contiguous virtual memory area that will be aligned and partitioned into extents of 8 MiB on 64-bit systems and 2 MiB on 32-bit systems. Within an extent, the first few innodb_page_size blocks contain buf_block_t objects that will cover the page frames in the rest of the extent. The number of such frames is precomputed in the array first_page_in_extent[] for each innodb_page_size. In this way, there is a trivial mapping between page frames and block descriptors and we do not need any lookup tables like buf_pool.zip_hash or buf_pool_t::chunk_t::map. We will always allocate the same number of block descriptors for an extent, even if we do not need all the buf_block_t in the last extent in case the innodb_buffer_pool_size is not an integer multiple of the of extents size. The minimum innodb_buffer_pool_size is 256*5/4 pages. At the default innodb_page_size=16k this corresponds to 5 MiB. However, now that the innodb_buffer_pool_size includes the memory allocated for the block descriptors, the minimum would be innodb_buffer_pool_size=6m. my_large_virtual_alloc(): A new function, similar to my_large_malloc(). my_virtual_mem_reserve(), my_virtual_mem_commit(), my_virtual_mem_decommit(), my_virtual_mem_release(): New interface mostly by Vladislav Vaintroub, to separately reserve and release virtual address space, as well as to commit and decommit memory within it. After my_virtual_mem_decommit(), the virtual memory range will be read-only or unaccessible, depending on whether the build option cmake -DHAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT=1 has been specified. This option is hard-coded on Microsoft Windows, where VirtualMemory(MEM_DECOMMIT) will make the memory unaccessible. On IBM AIX, Linux, Illumos and possibly Apple macOS, the virtual memory will be zeroed out immediately. On other POSIX-like systems, madvise(MADV_FREE) will be used if available, to give the operating system kernel a permission to zero out the virtual memory range. We prefer immediate freeing so that the reported resident set size (RSS) of the process will reflect the current innodb_buffer_pool_size. Shrinking the buffer pool is a rarely executed resource intensive operation, and the immediate configuration of the MMU mappings should not incur significant additional penalty. opt_super_large_pages: Declare only on Solaris. Actually, this is specific to the SPARC implementation of Solaris, but because we lack access to a Solaris development environment, we will not revise this for other MMU and ISA. buf_pool_t::chunk_t::create(): Remove. buf_pool_t::create(): Initialize all n_blocks of the buf_pool.free list. buf_pool_t::allocate(): Renamed from buf_LRU_get_free_only(). buf_pool_t::LRU_warned: Changed to Atomic_relaxed, only to be modified by the buf_flush_page_cleaner() thread. buf_pool_t::shrink(): Attempt to shrink the buffer pool. There are 3 possible outcomes: SHRINK_DONE (success), SHRINK_IN_PROGRESS (the caller may keep trying), and SHRINK_ABORT (we seem to be running out of buffer pool). While traversing buf_pool.LRU, release the contended buf_pool.mutex once in every 32 iterations in order to reduce starvation. Use lru_scan_itr for efficient traversal, similar to buf_LRU_free_from_common_LRU_list(). buf_pool_t::shrunk(): Update the reduced size of the buffer pool in a way that is compatible with buf_pool_t::page_guess(), and invoke my_virtual_mem_decommit(). buf_pool_t::resize(): Before invoking shrink(), run one batch of buf_flush_page_cleaner() in order to prevent LRU_warn(). Abort if shrink() recommends it, or no blocks were withdrawn in the past 15 seconds, or the execution of the statement SET GLOBAL innodb_buffer_pool_size was interrupted. buf_pool_t::first_to_withdraw: The first block descriptor that is out of the bounds of the shrunk buffer pool. buf_pool_t::withdrawn: The list of withdrawn blocks. If buf_pool_t::resize() is aborted before shrink() completes, we must be able to resurrect the withdrawn blocks in the free list. buf_pool_t::contains_zip(): Added a parameter for the number of least significant pointer bits to disregard, so that we can find any pointers to within a block that is supposed to be free. buf_pool_t::is_shrinking(): Return the total number or blocks that were withdrawn or are to be withdrawn. buf_pool_t::to_withdraw(): Return the number of blocks that will need to be withdrawn. buf_pool_t::usable_size(): Number of usable pages, considering possible in-progress attempt at shrinking the buffer pool. buf_pool_t::page_guess(): Try to buffer-fix a guessed block pointer. If HAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT is set, the pointer will be validated before being dereferenced. buf_pool_t::get_info(): Replaces buf_stats_get_pool_info(). innodb_init_param(): Refactored. We must first compute srv_page_size_shift and then determine the valid bounds of innodb_buffer_pool_size. buf_buddy_shrink(): Replaces buf_buddy_realloc(). Part of the work is deferred to buf_buddy_condense_free(), which is being executed when we are not holding any buf_pool.page_hash latch. buf_buddy_condense_free(): Do not relocate blocks. buf_buddy_free_low(): Do not care about buffer pool shrinking. This will be handled by buf_buddy_shrink() and buf_buddy_condense_free(). buf_buddy_alloc_zip(): Assert !buf_pool.contains_zip() when we are allocating from the binary buddy system. Previously we were asserting this on multiple recursion levels. buf_buddy_block_free(), buf_buddy_free_low(): Assert !buf_pool.contains_zip(). buf_buddy_alloc_from(): Remove the redundant parameter j. buf_flush_LRU_list_batch(): Add the parameter to_withdraw to keep track of buf_pool.n_blocks_to_withdraw. buf_do_LRU_batch(): Skip buf_free_from_unzip_LRU_list_batch() if we are shrinking the buffer pool. In that case, we want to minimize the page relocations and just finish as quickly as possible. trx_purge_attach_undo_recs(): Limit purge_sys.n_pages_handled() in every iteration, in case the buffer pool is being shrunk in the middle of a purge batch. Reviewed by: Debarun Banerjee --- cmake/os/Windows.cmake | 1 + config.h.cmake | 5 + extra/mariabackup/innobackupex.cc | 7 +- extra/mariabackup/xtrabackup.cc | 13 +- include/my_sys.h | 6 +- include/my_virtual_mem.h | 35 + mysql-test/main/large_pages.opt | 2 +- mysql-test/main/large_pages.result | 1 + mysql-test/main/large_pages.test | 4 +- .../t/innodb_encrypt_temporary_tables.opt | 2 +- .../suite/innodb/r/buf_pool_resize_oom.result | 8 - .../innodb/r/innodb_buffer_pool_fail.result | 4 +- .../innodb/r/innodb_buffer_pool_resize.result | 35 +- .../innodb_buffer_pool_resize_bigtest.result | 14 - ...innodb_buffer_pool_resize_temporary.result | 25 + ...nodb_buffer_pool_resize_with_chunks.result | 26 - .../suite/innodb/r/lock_memory_debug.result | 2 +- .../innodb/r/log_upgrade_101_flags.result | 2 +- .../suite/innodb/r/recovery_memory.result | 2 +- mysql-test/suite/innodb/r/restart,16k.rdiff | 16 - mysql-test/suite/innodb/r/restart,32k.rdiff | 16 - mysql-test/suite/innodb/r/restart,4k.rdiff | 16 - mysql-test/suite/innodb/r/restart,64k.rdiff | 16 - mysql-test/suite/innodb/r/restart,8k.rdiff | 16 - mysql-test/suite/innodb/r/restart.result | 13 - .../suite/innodb/t/buf_pool_resize_oom.opt | 1 - .../suite/innodb/t/buf_pool_resize_oom.test | 27 - .../suite/innodb/t/innodb-index-online.opt | 2 +- .../innodb/t/innodb-table-online-master.opt | 2 +- .../innodb/t/innodb_buffer_pool_fail.opt | 1 + .../innodb/t/innodb_buffer_pool_fail.test | 4 +- .../innodb/t/innodb_buffer_pool_resize.opt | 1 + .../innodb/t/innodb_buffer_pool_resize.test | 64 +- .../t/innodb_buffer_pool_resize_bigtest.opt | 2 - .../t/innodb_buffer_pool_resize_bigtest.test | 28 - .../t/innodb_buffer_pool_resize_debug.opt | 1 - .../t/innodb_buffer_pool_resize_temporary.opt | 1 + .../innodb_buffer_pool_resize_temporary.test | 35 +- .../innodb_buffer_pool_resize_with_chunks.opt | 3 - ...innodb_buffer_pool_resize_with_chunks.test | 61 - .../suite/innodb/t/lock_memory_debug.opt | 2 +- .../suite/innodb/t/lock_memory_debug.test | 2 +- .../suite/innodb/t/log_upgrade_101_flags.test | 2 +- mysql-test/suite/innodb/t/mem_pressure.opt | 2 + mysql-test/suite/innodb/t/mem_pressure.test | 1 - mysql-test/suite/innodb/t/purge_secondary.opt | 2 +- .../suite/innodb/t/recovery_memory.test | 6 +- mysql-test/suite/innodb/t/restart.opt | 2 - mysql-test/suite/innodb/t/restart.test | 25 - .../suite/innodb/t/update_time-master.opt | 1 - .../r/innodb_buffer_pool_size_basic.result | 30 +- .../sys_vars/r/sysvars_innodb,32bit.rdiff | 86 +- .../suite/sys_vars/r/sysvars_innodb.result | 17 +- .../innodb_buffer_pool_size_basic-master.opt | 1 - .../t/innodb_buffer_pool_size_basic.opt | 1 + .../t/innodb_buffer_pool_size_basic.test | 37 +- .../suite/sys_vars/t/sysvars_innodb.test | 1 + mysys/CMakeLists.txt | 3 +- mysys/my_largepage.c | 151 +- mysys/my_virtual_mem.c | 207 ++ sql/mysql_install_db.cc | 2 +- sql/mysqld.cc | 6 +- storage/innobase/btr/btr0sea.cc | 104 +- storage/innobase/buf/buf0buddy.cc | 294 +- storage/innobase/buf/buf0buf.cc | 2730 ++++++++--------- storage/innobase/buf/buf0dump.cc | 8 +- storage/innobase/buf/buf0flu.cc | 48 +- storage/innobase/buf/buf0lru.cc | 136 +- storage/innobase/buf/buf0rea.cc | 7 +- storage/innobase/dict/dict0dict.cc | 4 +- storage/innobase/handler/ha_innodb.cc | 702 ++--- storage/innobase/handler/i_s.cc | 108 +- storage/innobase/ibuf/ibuf0ibuf.cc | 7 +- storage/innobase/include/btr0sea.h | 10 +- storage/innobase/include/buf0buddy.h | 38 +- storage/innobase/include/buf0buf.h | 433 ++- storage/innobase/include/buf0buf.inl | 2 +- storage/innobase/include/buf0lru.h | 4 - storage/innobase/include/srv0srv.h | 13 +- storage/innobase/log/log0log.cc | 9 +- storage/innobase/log/log0recv.cc | 40 +- storage/innobase/mtr/mtr0mtr.cc | 2 +- storage/innobase/srv/srv0mon.cc | 9 +- storage/innobase/srv/srv0srv.cc | 24 +- storage/innobase/srv/srv0start.cc | 21 - storage/innobase/trx/trx0purge.cc | 7 +- 86 files changed, 2692 insertions(+), 3175 deletions(-) create mode 100644 include/my_virtual_mem.h delete mode 100644 mysql-test/suite/innodb/r/buf_pool_resize_oom.result delete mode 100644 mysql-test/suite/innodb/r/innodb_buffer_pool_resize_bigtest.result delete mode 100644 mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result delete mode 100644 mysql-test/suite/innodb/r/restart,16k.rdiff delete mode 100644 mysql-test/suite/innodb/r/restart,32k.rdiff delete mode 100644 mysql-test/suite/innodb/r/restart,4k.rdiff delete mode 100644 mysql-test/suite/innodb/r/restart,64k.rdiff delete mode 100644 mysql-test/suite/innodb/r/restart,8k.rdiff delete mode 100644 mysql-test/suite/innodb/t/buf_pool_resize_oom.opt delete mode 100644 mysql-test/suite/innodb/t/buf_pool_resize_oom.test create mode 100644 mysql-test/suite/innodb/t/innodb_buffer_pool_fail.opt delete mode 100644 mysql-test/suite/innodb/t/innodb_buffer_pool_resize_bigtest.opt delete mode 100644 mysql-test/suite/innodb/t/innodb_buffer_pool_resize_bigtest.test delete mode 100644 mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.opt create mode 100644 mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.opt delete mode 100644 mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.opt delete mode 100644 mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.test create mode 100644 mysql-test/suite/innodb/t/mem_pressure.opt delete mode 100644 mysql-test/suite/innodb/t/restart.opt delete mode 100644 mysql-test/suite/innodb/t/update_time-master.opt delete mode 100644 mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic-master.opt create mode 100644 mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.opt create mode 100644 mysys/my_virtual_mem.c diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index ec1029e20ac..ac8779f3ad8 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -282,6 +282,7 @@ STRING(APPEND CMAKE_CXX_STANDARD_LIBRARIES " ws2_32.lib synchronization.lib") # System checks SET(SIGNAL_WITH_VIO_CLOSE 1) # Something that runtime team needs +SET(HAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT 1) # IPv6 constants appeared in Vista SDK first. We need to define them in any case if they are # not in headers, to handle dual mode sockets correctly. diff --git a/config.h.cmake b/config.h.cmake index 15f02d0e916..6d2fbee55d1 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -457,6 +457,11 @@ /* This should mean case insensitive file system */ #cmakedefine FN_NO_CASE_SENSE 1 +/* Whether an anonymous private mapping is unaccessible after +madvise(MADV_DONTNEED) or madvise(MADV_FREE) or similar has been invoked; +this is the case with Microsoft Windows VirtualFree(MEM_DECOMMIT) */ +#cmakedefine HAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT 1 + #cmakedefine HAVE_CHARSET_armscii8 1 #cmakedefine HAVE_CHARSET_ascii 1 #cmakedefine HAVE_CHARSET_big5 1 diff --git a/extra/mariabackup/innobackupex.cc b/extra/mariabackup/innobackupex.cc index 2de57a14c85..20e1654564a 100644 --- a/extra/mariabackup/innobackupex.cc +++ b/extra/mariabackup/innobackupex.cc @@ -44,8 +44,8 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA #include #include #include -#include #include +#include "buf0buf.h" #include #include #include @@ -594,8 +594,9 @@ static struct my_option ibx_long_options[] = "--apply-log.", (uchar*) &ibx_xtrabackup_use_memory, (uchar*) &ibx_xtrabackup_use_memory, - 0, GET_LL, REQUIRED_ARG, 100*1024*1024L, 1024*1024L, LONGLONG_MAX, 0, - 1024*1024L, 0}, + 0, GET_LL, REQUIRED_ARG, 96 << 20, + innodb_buffer_pool_extent_size, SIZE_T_MAX, 0, + innodb_buffer_pool_extent_size, 0}, {"innodb-force-recovery", OPT_INNODB_FORCE_RECOVERY, "This option starts up the embedded InnoDB instance in crash " diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index bea6e064eb6..382536cdf88 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -1413,8 +1413,8 @@ struct my_option xb_client_options[]= { "The value is used in place of innodb_buffer_pool_size. " "This option is only relevant when the --prepare option is specified.", (G_PTR *) &xtrabackup_use_memory, (G_PTR *) &xtrabackup_use_memory, 0, - GET_LL, REQUIRED_ARG, 100 * 1024 * 1024L, 1024 * 1024L, LONGLONG_MAX, 0, - 1024 * 1024L, 0}, + GET_LL, REQUIRED_ARG, 96 << 20, innodb_buffer_pool_extent_size, + SIZE_T_MAX, 0, innodb_buffer_pool_extent_size, 0}, {"throttle", OPT_XTRA_THROTTLE, "limit count of IO operations (pairs of read&write) per second to IOS " "values (for '--backup')", @@ -2489,7 +2489,7 @@ static bool innodb_init_param() } srv_sys_space.normalize_size(); - srv_lock_table_size = 5 * (srv_buf_pool_size >> srv_page_size_shift); + srv_lock_table_size = 5 * buf_pool.curr_size(); /* -------------- Log files ---------------------------*/ @@ -2511,11 +2511,8 @@ static bool innodb_init_param() srv_adaptive_flushing = FALSE; - /* We set srv_pool_size here in units of 1 kB. InnoDB internally - changes the value so that it becomes the number of database pages. */ - - srv_buf_pool_size = (ulint) xtrabackup_use_memory; - srv_buf_pool_chunk_unit = srv_buf_pool_size; + buf_pool.size_in_bytes_max = size_t(xtrabackup_use_memory); + buf_pool.size_in_bytes_requested = buf_pool.size_in_bytes_max; srv_n_read_io_threads = (uint) innobase_read_io_threads; srv_n_write_io_threads = (uint) innobase_write_io_threads; diff --git a/include/my_sys.h b/include/my_sys.h index 4a227db0bbe..5eca29b3274 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -173,9 +173,13 @@ extern void my_free(void *ptr); extern void *my_memdup(PSI_memory_key key, const void *from,size_t length,myf MyFlags); extern char *my_strdup(PSI_memory_key key, const char *from,myf MyFlags); extern char *my_strndup(PSI_memory_key key, const char *from, size_t length, myf MyFlags); +extern my_bool my_use_large_pages; -int my_init_large_pages(my_bool super_large_pages); +int my_init_large_pages(void); uchar *my_large_malloc(size_t *size, myf my_flags); +#if defined _WIN32 || defined HAVE_MMAP +char *my_large_virtual_alloc(size_t *size); +#endif void my_large_free(void *ptr, size_t size); void my_large_page_truncate(size_t *size); diff --git a/include/my_virtual_mem.h b/include/my_virtual_mem.h new file mode 100644 index 00000000000..56b2f03b329 --- /dev/null +++ b/include/my_virtual_mem.h @@ -0,0 +1,35 @@ +/* Copyright (c) 2025, MariaDB + + 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 + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ + +#pragma once +/* + Functionality for handling virtual memory + (reserve, commit, decommit, release) +*/ +#include /*size_t*/ + +#ifdef __cplusplus +extern "C" { +#endif + +char *my_virtual_mem_reserve(size_t *size); +char *my_virtual_mem_commit(char *ptr, size_t size); +void my_virtual_mem_decommit(char *ptr, size_t size); +void my_virtual_mem_release(char *ptr, size_t size); + +#ifdef __cplusplus +} +#endif + diff --git a/mysql-test/main/large_pages.opt b/mysql-test/main/large_pages.opt index 857c9c1ecee..bff2c2f6898 100644 --- a/mysql-test/main/large_pages.opt +++ b/mysql-test/main/large_pages.opt @@ -1 +1 @@ ---large-pages +--large-pages --loose-innodb-buffer-pool-size-max=16m diff --git a/mysql-test/main/large_pages.result b/mysql-test/main/large_pages.result index 9d03e646ddf..c5e73f044a9 100644 --- a/mysql-test/main/large_pages.result +++ b/mysql-test/main/large_pages.result @@ -1,4 +1,5 @@ call mtr.add_suppression("\\[Warning\\] (mysqld|mariadbd): Couldn't allocate [0-9]+ bytes \\((Large/HugeTLB memory|MEMLOCK) page size [0-9]+\\).*"); +call mtr.add_suppression("\\[ERROR\\]*Lock Pages in memory access rights required.*"); create table t1 ( a int not null auto_increment, b char(16) not null, diff --git a/mysql-test/main/large_pages.test b/mysql-test/main/large_pages.test index 136273a2821..7c0f497c6d3 100644 --- a/mysql-test/main/large_pages.test +++ b/mysql-test/main/large_pages.test @@ -1,11 +1,9 @@ # Test of large pages (or at least the fallback to conventional allocation) -# Windows needs SeLockMemoryPrivilege ---source include/not_windows.inc --source include/have_innodb.inc call mtr.add_suppression("\\[Warning\\] (mysqld|mariadbd): Couldn't allocate [0-9]+ bytes \\((Large/HugeTLB memory|MEMLOCK) page size [0-9]+\\).*"); - +call mtr.add_suppression("\\[ERROR\\]*Lock Pages in memory access rights required.*"); create table t1 ( a int not null auto_increment, b char(16) not null, diff --git a/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.opt b/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.opt index 70797302d01..788e69a612d 100644 --- a/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.opt +++ b/mysql-test/suite/encryption/t/innodb_encrypt_temporary_tables.opt @@ -1,2 +1,2 @@ ---innodb_buffer_pool_size=5M +--innodb_buffer_pool_size=6M --innodb_encrypt_temporary_tables=1 diff --git a/mysql-test/suite/innodb/r/buf_pool_resize_oom.result b/mysql-test/suite/innodb/r/buf_pool_resize_oom.result deleted file mode 100644 index 0bff75701a0..00000000000 --- a/mysql-test/suite/innodb/r/buf_pool_resize_oom.result +++ /dev/null @@ -1,8 +0,0 @@ -# -# Bug #21348684 SIGABRT DURING RESIZING THE INNODB BUFFER POOL -# ONLINE WITH MEMORY FULL CONDITION -# -call mtr.add_suppression("InnoDB: failed to allocate the chunk array"); -SET GLOBAL debug_dbug='+d,buf_pool_resize_chunk_null'; -SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size + 1048576; -# restart diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_fail.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_fail.result index 1a8f16e4efb..ea053308b2e 100644 --- a/mysql-test/suite/innodb/r/innodb_buffer_pool_fail.result +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_fail.result @@ -1,4 +1,4 @@ -call mtr.add_suppression("InnoDB: Cannot allocate memory for the buffer pool"); +call mtr.add_suppression("InnoDB: Cannot map innodb_buffer_pool_size_max="); call mtr.add_suppression("InnoDB: Plugin initialization aborted at srv0start.cc.*"); call mtr.add_suppression("Plugin 'InnoDB' init function returned error."); call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed."); @@ -6,4 +6,4 @@ call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE faile # MDEV-25019 memory allocation failures during startup cause server failure in different, confusing ways # # restart: --debug_dbug=+d,ib_buf_chunk_init_fails -FOUND 1 /\[ERROR\] InnoDB: Cannot allocate memory for the buffer pool/ in mysqld.1.err +FOUND 1 /\[ERROR\] InnoDB: Cannot map innodb_buffer_pool_size_max=16m/ in mysqld.1.err diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result index cafa3f45eab..5db74a71636 100644 --- a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize.result @@ -1,27 +1,28 @@ +# +# MDEV-29445: Reorganize buffer pool (and remove chunks) +# set global innodb_adaptive_hash_index=ON; select @@innodb_buffer_pool_size; @@innodb_buffer_pool_size 8388608 +set global innodb_buffer_pool_size = 9437184; set global innodb_buffer_pool_size = 10485760; select @@innodb_buffer_pool_size; @@innodb_buffer_pool_size 10485760 -create table t1 (id int not null, val int not null default '0', primary key (id)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; -create or replace view view0 as select 1 union all select 1; -set @`v_id` := 0; -set @`v_val` := 0; -replace into t1 select (@`v_id` := (@`v_id` + 4) mod 4294967296) as id, (@`v_val` := (@`v_val` + 4) mod 4294967296) as val from view0 v0, view0 v1, view0 v2, view0 v3, view0 v4, view0 v5, view0 v6, view0 v7, view0 v8, view0 v9, view0 v10, view0 v11, view0 v12, view0 v13, view0 v14, view0 v15, view0 v16, view0 v17; -set global innodb_buffer_pool_size = 64 * 1024 * 1024 + 512 * 1024; -Warnings: -Warning 1292 Truncated incorrect innodb_buffer_pool_size value: '67633152' -select @@innodb_buffer_pool_size; -@@innodb_buffer_pool_size -68157440 +create table t1 (id int primary key, val int not null) +ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +SET STATEMENT foreign_key_checks=0, unique_checks=0 FOR +INSERT INTO t1 SELECT seq*4,seq*4 FROM seq_1_to_262144; +set global innodb_buffer_pool_size = 7340032; select count(val) from t1; count(val) 262144 set global innodb_adaptive_hash_index=OFF; -set global innodb_buffer_pool_size = 25165824; +set global innodb_buffer_pool_size = 24117248; +set global innodb_buffer_pool_size = 26214400; +Warnings: +Warning 1292 Truncated incorrect innodb_buffer_pool_size value: '26214400' select @@innodb_buffer_pool_size; @@innodb_buffer_pool_size 25165824 @@ -29,4 +30,12 @@ select count(val) from t1; count(val) 262144 drop table t1; -drop view view0; +SET GLOBAL innodb_max_purge_lag_wait = 0; +SET @save_pct= @@GLOBAL.innodb_max_dirty_pages_pct; +SET @save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm; +SET GLOBAL innodb_max_dirty_pages_pct_lwm = 0.0; +SET GLOBAL innodb_max_dirty_pages_pct = 0.0; +SET GLOBAL innodb_buffer_pool_size = @old_innodb_buffer_pool_size; +SET GLOBAL innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index; +SET GLOBAL innodb_max_dirty_pages_pct = @save_pct; +SET GLOBAL innodb_max_dirty_pages_pct_lwm = @save_pct_lwm; diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_bigtest.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_bigtest.result deleted file mode 100644 index d6b29060dc7..00000000000 --- a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_bigtest.result +++ /dev/null @@ -1,14 +0,0 @@ -SET @save_size=@@innodb_buffer_pool_size; -# -# MDEV-27891: Delayed SIGSEGV in InnoDB buffer pool resize -# after or during DROP TABLE -# -select @@innodb_buffer_pool_chunk_size; -@@innodb_buffer_pool_chunk_size -1048576 -CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; -SET GLOBAL innodb_buffer_pool_size=256*1024*1024; -DROP TABLE t1; -SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size + @@innodb_buffer_pool_chunk_size; -# End of 10.6 tests -SET GLOBAL innodb_buffer_pool_size=@save_size; diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_temporary.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_temporary.result index 43d48023958..ec61bb9c0c3 100644 --- a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_temporary.result +++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_temporary.result @@ -4,7 +4,32 @@ SET GLOBAL innodb_limit_optimistic_insert_debug=2; SET GLOBAL innodb_buffer_pool_size=16777216; CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 SELECT seq FROM seq_1_to_200; +SET GLOBAL innodb_max_purge_lag_wait=0; +SET @save_pct= @@GLOBAL.innodb_max_dirty_pages_pct; +SET @save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm; +SET GLOBAL innodb_max_dirty_pages_pct_lwm = 0.0; +SET GLOBAL innodb_max_dirty_pages_pct = 0.0; +SHOW STATUS LIKE 'innodb_buffer_pool_resize_status'; +Variable_name Value +Innodb_buffer_pool_resize_status +connect con1,localhost,root; +SET DEBUG_SYNC='buf_pool_shrink_before_wakeup SIGNAL blocked WAIT_FOR go'; SET GLOBAL innodb_buffer_pool_size=8388608; +connection default; +SET DEBUG_SYNC='now WAIT_FOR blocked'; +SHOW STATUS LIKE 'innodb_buffer_pool_resize_status'; +Variable_name Value +Innodb_buffer_pool_resize_status Withdrawing blocks. (505/505). +SET DEBUG_SYNC='now SIGNAL go'; +connection con1; +disconnect con1; +connection default; +SHOW STATUS LIKE 'innodb_buffer_pool_resize_status'; +Variable_name Value +Innodb_buffer_pool_resize_status +SET DEBUG_SYNC=RESET; +SET GLOBAL innodb_max_dirty_pages_pct = @save_pct; +SET GLOBAL innodb_max_dirty_pages_pct_lwm = @save_pct_lwm; SELECT COUNT(*),MIN(a),MAX(a) FROM t1; COUNT(*) MIN(a) MAX(a) 200 1 200 diff --git a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result b/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result deleted file mode 100644 index efb652091bf..00000000000 --- a/mysql-test/suite/innodb/r/innodb_buffer_pool_resize_with_chunks.result +++ /dev/null @@ -1,26 +0,0 @@ -select @@innodb_buffer_pool_chunk_size; -@@innodb_buffer_pool_chunk_size -4194304 -create table t1 (id int not null, val int not null default '0', primary key (id)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; -create or replace view view0 as select 1 union all select 1; -set @`v_id` := 0; -set @`v_val` := 0; -replace into t1 select (@`v_id` := (@`v_id` + 4) mod 4294967296) as id, (@`v_val` := (@`v_val` + 4) mod 4294967296) as val from view0 v0, view0 v1, view0 v2, view0 v3, view0 v4, view0 v5, view0 v6, view0 v7, view0 v8, view0 v9, view0 v10, view0 v11, view0 v12, view0 v13, view0 v14, view0 v15, view0 v16, view0 v17; -set global innodb_buffer_pool_size = 7340032; -Warnings: -Warning 1292 Truncated incorrect innodb_buffer_pool_size value: '7340032' -select count(val) from t1; -count(val) -262144 -set global innodb_buffer_pool_size = 16777216; -select count(val) from t1; -count(val) -262144 -drop table t1; -drop view view0; -set global innodb_buffer_pool_size = 2*1048576; -Warnings: -Warning 1292 Truncated incorrect innodb_buffer_pool_size value: '2097152' -select @@innodb_buffer_pool_size; -@@innodb_buffer_pool_size -4194304 diff --git a/mysql-test/suite/innodb/r/lock_memory_debug.result b/mysql-test/suite/innodb/r/lock_memory_debug.result index 36d7433974e..90150805707 100644 --- a/mysql-test/suite/innodb/r/lock_memory_debug.result +++ b/mysql-test/suite/innodb/r/lock_memory_debug.result @@ -5,7 +5,7 @@ call mtr.add_suppression("\\[Warning\\] InnoDB: Over 67 percent of the buffer po CREATE TABLE t1 (col1 INT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1),(2),(3),(4),(5); SET STATEMENT debug_dbug='+d,innodb_skip_lock_bitmap' FOR -INSERT INTO t1 SELECT a.* FROM t1 a, t1 b, t1 c, t1 d, t1 e, t1 f, t1 g LIMIT 45000; +INSERT INTO t1 SELECT a.* FROM t1 a, t1 b, t1 c, t1 d, t1 e, t1 f, t1 g; ERROR HY000: The total number of locks exceeds the lock table size SELECT COUNT(*) FROM t1; COUNT(*) diff --git a/mysql-test/suite/innodb/r/log_upgrade_101_flags.result b/mysql-test/suite/innodb/r/log_upgrade_101_flags.result index 6ae7c84807f..f33c0d0798e 100644 --- a/mysql-test/suite/innodb/r/log_upgrade_101_flags.result +++ b/mysql-test/suite/innodb/r/log_upgrade_101_flags.result @@ -1,7 +1,7 @@ call mtr.add_suppression("InnoDB: The change buffer is corrupted"); call mtr.add_suppression("InnoDB: Tablespace size stored in header is 768 pages, but the sum of data file sizes is 384 pages"); call mtr.add_suppression("InnoDB: adjusting FSP_SPACE_FLAGS of file"); -# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-force-recovery=5 --innodb-log-file-size=4m --innodb_page_size=32k --innodb_buffer_pool_size=10M +# restart: --innodb-data-home-dir=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-log-group-home-dir=MYSQLTEST_VARDIR/tmp/log_upgrade --innodb-force-recovery=5 --innodb-log-file-size=4m --innodb_page_size=32k --innodb_buffer_pool_size=11M SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' AND support IN ('YES', 'DEFAULT', 'ENABLED'); diff --git a/mysql-test/suite/innodb/r/recovery_memory.result b/mysql-test/suite/innodb/r/recovery_memory.result index 9aba9bccdb3..372adbf4f9d 100644 --- a/mysql-test/suite/innodb/r/recovery_memory.result +++ b/mysql-test/suite/innodb/r/recovery_memory.result @@ -12,7 +12,7 @@ END LOOP connect con1,localhost,root,,,; CALL dorepeat(); connection default; -# restart: --innodb_buffer_pool_size=5242880 +# restart: --innodb_buffer_pool_size=6m DROP TABLE t1; DROP PROCEDURE dorepeat; # diff --git a/mysql-test/suite/innodb/r/restart,16k.rdiff b/mysql-test/suite/innodb/r/restart,16k.rdiff deleted file mode 100644 index 3149b9aeab0..00000000000 --- a/mysql-test/suite/innodb/r/restart,16k.rdiff +++ /dev/null @@ -1,16 +0,0 @@ ---- ./suite/innodb/r/restart.result -+++ suite/innodb/r/restart.reject -@@ -32,10 +32,10 @@ - SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; - SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; - EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); --ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -+ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '5242879' - SHOW WARNINGS; - Level Code Message --Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE --Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -+Warning 1210 innodb_buffer_pool_size must be at least 5242880 for innodb_page_size=16384 -+Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '5242879' - EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); - SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; diff --git a/mysql-test/suite/innodb/r/restart,32k.rdiff b/mysql-test/suite/innodb/r/restart,32k.rdiff deleted file mode 100644 index 3f00646cb37..00000000000 --- a/mysql-test/suite/innodb/r/restart,32k.rdiff +++ /dev/null @@ -1,16 +0,0 @@ ---- ./suite/innodb/r/restart.result -+++ suite/innodb/r/restart.reject -@@ -32,10 +32,10 @@ - SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; - SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; - EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); --ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -+ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '10485759' - SHOW WARNINGS; - Level Code Message --Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE --Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -+Warning 1210 innodb_buffer_pool_size must be at least 10485760 for innodb_page_size=32768 -+Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '10485759' - EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); - SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; diff --git a/mysql-test/suite/innodb/r/restart,4k.rdiff b/mysql-test/suite/innodb/r/restart,4k.rdiff deleted file mode 100644 index b00c56ef81f..00000000000 --- a/mysql-test/suite/innodb/r/restart,4k.rdiff +++ /dev/null @@ -1,16 +0,0 @@ ---- ./suite/innodb/r/restart.result -+++ suite/innodb/r/restart.reject -@@ -32,10 +32,10 @@ - SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; - SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; - EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); --ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -+ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '2097151' - SHOW WARNINGS; - Level Code Message --Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE --Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -+Warning 1210 innodb_buffer_pool_size must be at least 2097152 for innodb_page_size=4096 -+Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '2097151' - EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); - SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; diff --git a/mysql-test/suite/innodb/r/restart,64k.rdiff b/mysql-test/suite/innodb/r/restart,64k.rdiff deleted file mode 100644 index 886cbcde7d9..00000000000 --- a/mysql-test/suite/innodb/r/restart,64k.rdiff +++ /dev/null @@ -1,16 +0,0 @@ ---- ./suite/innodb/r/restart.result -+++ suite/innodb/r/restart.reject -@@ -32,10 +32,10 @@ - SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; - SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; - EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); --ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -+ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '20971519' - SHOW WARNINGS; - Level Code Message --Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE --Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -+Warning 1210 innodb_buffer_pool_size must be at least 20971520 for innodb_page_size=65536 -+Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '20971519' - EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); - SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; diff --git a/mysql-test/suite/innodb/r/restart,8k.rdiff b/mysql-test/suite/innodb/r/restart,8k.rdiff deleted file mode 100644 index 40a9e1bad1c..00000000000 --- a/mysql-test/suite/innodb/r/restart,8k.rdiff +++ /dev/null @@ -1,16 +0,0 @@ ---- ./suite/innodb/r/restart.result -+++ suite/innodb/r/restart.reject -@@ -32,10 +32,10 @@ - SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; - SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; - EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); --ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -+ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of '3145727' - SHOW WARNINGS; - Level Code Message --Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE --Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -+Warning 1210 innodb_buffer_pool_size must be at least 3145728 for innodb_page_size=8192 -+Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of '3145727' - EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); - SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; diff --git a/mysql-test/suite/innodb/r/restart.result b/mysql-test/suite/innodb/r/restart.result index 95d79a0ab14..ba6a87b5ef7 100644 --- a/mysql-test/suite/innodb/r/restart.result +++ b/mysql-test/suite/innodb/r/restart.result @@ -30,19 +30,6 @@ SELECT * FROM td; a DROP TABLE tr,tc,td; # -# MDEV-27467 innodb to enfore the minimum innodb_buffer_pool_size in SET (resize) the same as startup -# -SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; -SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; -EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); -ERROR 42000: Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -SHOW WARNINGS; -Level Code Message -Warning 1210 innodb_buffer_pool_size must be at least MIN_VAL for innodb_page_size=PAGE_SIZE -Error 1231 Variable 'innodb_buffer_pool_size' can't be set to the value of 'WRONG_VALUE' -EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); -SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; -# # MDEV-27882 Innodb - recognise MySQL-8.0 innodb flags and give a specific error message # FOUND 1 /InnoDB: MySQL-8\.0 tablespace in \./ibdata1/ in attempted_start.err diff --git a/mysql-test/suite/innodb/t/buf_pool_resize_oom.opt b/mysql-test/suite/innodb/t/buf_pool_resize_oom.opt deleted file mode 100644 index 09fd8bd8e35..00000000000 --- a/mysql-test/suite/innodb/t/buf_pool_resize_oom.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb-buffer-pool-size=8m --innodb-buffer-pool-chunk-size=1m diff --git a/mysql-test/suite/innodb/t/buf_pool_resize_oom.test b/mysql-test/suite/innodb/t/buf_pool_resize_oom.test deleted file mode 100644 index ea13129e8b1..00000000000 --- a/mysql-test/suite/innodb/t/buf_pool_resize_oom.test +++ /dev/null @@ -1,27 +0,0 @@ ---source include/have_innodb.inc ---source include/have_debug.inc ---source include/not_embedded.inc - ---echo # ---echo # Bug #21348684 SIGABRT DURING RESIZING THE INNODB BUFFER POOL ---echo # ONLINE WITH MEMORY FULL CONDITION ---echo # - -call mtr.add_suppression("InnoDB: failed to allocate the chunk array"); - -SET GLOBAL debug_dbug='+d,buf_pool_resize_chunk_null'; - ---disable_warnings -SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size + 1048576; ---enable_warnings - -let $wait_timeout = 60; -let $wait_condition = - SELECT SUBSTR(variable_value, 1, 27) = 'Resizing buffer pool failed' - FROM information_schema.global_status - WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; - ---source include/wait_condition.inc -# Restart the server, because the buffer pool would not necessarily be -# shrunk afterwards even if we request it. ---source include/restart_mysqld.inc diff --git a/mysql-test/suite/innodb/t/innodb-index-online.opt b/mysql-test/suite/innodb/t/innodb-index-online.opt index 1837463f07a..0aa69cc9e20 100644 --- a/mysql-test/suite/innodb/t/innodb-index-online.opt +++ b/mysql-test/suite/innodb/t/innodb-index-online.opt @@ -1,5 +1,5 @@ --loose-innodb-sort-buffer-size=64k --loose-innodb-online-alter-log-max-size=128k ---loose-innodb-buffer-pool-size=5M +--loose-innodb-buffer-pool-size=6M --loose-innodb-sys-indexes --loose-innodb-sys-fields diff --git a/mysql-test/suite/innodb/t/innodb-table-online-master.opt b/mysql-test/suite/innodb/t/innodb-table-online-master.opt index 1eafb5ac188..42f6b2832e5 100644 --- a/mysql-test/suite/innodb/t/innodb-table-online-master.opt +++ b/mysql-test/suite/innodb/t/innodb-table-online-master.opt @@ -1 +1 @@ ---innodb-sort-buffer-size=64k --innodb-online-alter-log-max-size=512k --innodb-buffer-pool-size=5M +--innodb-sort-buffer-size=64k --innodb-online-alter-log-max-size=512k --innodb-buffer-pool-size=6M diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_fail.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_fail.opt new file mode 100644 index 00000000000..95f86e59920 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_fail.opt @@ -0,0 +1 @@ +--innodb-buffer-pool-size-max=16m diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_fail.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_fail.test index e8e070c5061..f082e7d7fd4 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_fail.test +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_fail.test @@ -1,6 +1,6 @@ --source include/have_innodb.inc --source include/have_debug.inc -call mtr.add_suppression("InnoDB: Cannot allocate memory for the buffer pool"); +call mtr.add_suppression("InnoDB: Cannot map innodb_buffer_pool_size_max="); call mtr.add_suppression("InnoDB: Plugin initialization aborted at srv0start.cc.*"); call mtr.add_suppression("Plugin 'InnoDB' init function returned error."); call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE failed."); @@ -10,5 +10,5 @@ call mtr.add_suppression("Plugin 'InnoDB' registration as a STORAGE ENGINE faile let restart_parameters=--debug_dbug=+d,ib_buf_chunk_init_fails; --source include/restart_mysqld.inc let SEARCH_FILE = $MYSQLTEST_VARDIR/log/mysqld.1.err; -let SEARCH_PATTERN=\[ERROR\] InnoDB: Cannot allocate memory for the buffer pool; +let SEARCH_PATTERN=\[ERROR\] InnoDB: Cannot map innodb_buffer_pool_size_max=16m; --source include/search_pattern_in_file.inc diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.opt index 39543543a53..19074aa9024 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.opt +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.opt @@ -1,2 +1,3 @@ --innodb-buffer-pool-size=8M +--innodb-buffer-pool-size-max=24M --innodb-page-size=4k diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test index 051f38a572e..612a0c1be64 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.test @@ -1,17 +1,13 @@ -# -# WL6117 : Resize the InnoDB Buffer Pool Online -# - --source include/have_innodb.inc ---source include/big_test.inc +--source include/have_sequence.inc -let $wait_timeout = 180; -let $wait_condition = - SELECT SUBSTR(variable_value, 1, 30) = 'Completed resizing buffer pool' - FROM information_schema.global_status - WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; +--echo # +--echo # MDEV-29445: Reorganize buffer pool (and remove chunks) +--echo # --disable_query_log +call mtr.add_suppression("InnoDB: Over 67 percent of the buffer pool is occupied by lock heaps"); +call mtr.add_suppression("innodb_buffer_pool_size change aborted"); set @old_innodb_buffer_pool_size = @@innodb_buffer_pool_size; set @old_innodb_adaptive_hash_index = @@innodb_adaptive_hash_index; --enable_query_log @@ -21,10 +17,9 @@ set global innodb_adaptive_hash_index=ON; select @@innodb_buffer_pool_size; # Expand buffer pool +set global innodb_buffer_pool_size = 9437184; set global innodb_buffer_pool_size = 10485760; ---source include/wait_condition.inc - select @@innodb_buffer_pool_size; # fill buffer pool @@ -32,41 +27,48 @@ select @@innodb_buffer_pool_size; SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed; SET GLOBAL innodb_read_only_compressed=OFF; --enable_query_log -create table t1 (id int not null, val int not null default '0', primary key (id)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; -create or replace view view0 as select 1 union all select 1; +create table t1 (id int primary key, val int not null) +ENGINE=InnoDB ROW_FORMAT=COMPRESSED; -set @`v_id` := 0; -set @`v_val` := 0; +SET STATEMENT foreign_key_checks=0, unique_checks=0 FOR +INSERT INTO t1 SELECT seq*4,seq*4 FROM seq_1_to_262144; -# 2^18 == 262144 records -replace into t1 select (@`v_id` := (@`v_id` + 4) mod 4294967296) as id, (@`v_val` := (@`v_val` + 4) mod 4294967296) as val from view0 v0, view0 v1, view0 v2, view0 v3, view0 v4, view0 v5, view0 v6, view0 v7, view0 v8, view0 v9, view0 v10, view0 v11, view0 v12, view0 v13, view0 v14, view0 v15, view0 v16, view0 v17; --disable_query_log SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed; --enable_query_log -# Shrink buffer pool -set global innodb_buffer_pool_size = 64 * 1024 * 1024 + 512 * 1024; ---source include/wait_condition.inc - -select @@innodb_buffer_pool_size; +# Attempt to shrink the buffer pool. This may occasionally fail. +--error 0,ER_WRONG_USAGE +set global innodb_buffer_pool_size = 7340032; select count(val) from t1; set global innodb_adaptive_hash_index=OFF; -# Expand buffer pool to 24MB -set global innodb_buffer_pool_size = 25165824; ---source include/wait_condition.inc +# Expand buffer pool to 23 and then 24 MiB (requesting 25 MiB) +set global innodb_buffer_pool_size = 24117248; +set global innodb_buffer_pool_size = 26214400; select @@innodb_buffer_pool_size; select count(val) from t1; drop table t1; -drop view view0; ---disable_query_log -set global innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index; -set global innodb_buffer_pool_size = @old_innodb_buffer_pool_size; ---enable_query_log +SET GLOBAL innodb_max_purge_lag_wait = 0; +SET @save_pct= @@GLOBAL.innodb_max_dirty_pages_pct; +SET @save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm; + +SET GLOBAL innodb_max_dirty_pages_pct_lwm = 0.0; +SET GLOBAL innodb_max_dirty_pages_pct = 0.0; +let $wait_condition = +SELECT variable_value = 0 +FROM information_schema.global_status +WHERE variable_name = 'INNODB_BUFFER_POOL_PAGES_DIRTY'; --source include/wait_condition.inc +# this may occasionally be aborted on a heavily loaded builder +--error 0,ER_WRONG_USAGE +SET GLOBAL innodb_buffer_pool_size = @old_innodb_buffer_pool_size; +SET GLOBAL innodb_adaptive_hash_index = @old_innodb_adaptive_hash_index; +SET GLOBAL innodb_max_dirty_pages_pct = @save_pct; +SET GLOBAL innodb_max_dirty_pages_pct_lwm = @save_pct_lwm; diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_bigtest.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_bigtest.opt deleted file mode 100644 index 72f055d3b58..00000000000 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_bigtest.opt +++ /dev/null @@ -1,2 +0,0 @@ ---innodb-buffer-pool-chunk-size=1M ---loose-skip-innodb-disable-resize_buffer_pool_debug diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_bigtest.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_bigtest.test deleted file mode 100644 index db5da2924fa..00000000000 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_bigtest.test +++ /dev/null @@ -1,28 +0,0 @@ ---source include/have_innodb.inc ---source include/big_test.inc - -SET @save_size=@@innodb_buffer_pool_size; - -let $wait_timeout = 60; -let $wait_condition = - SELECT SUBSTR(variable_value, 1, 30) = 'Completed resizing buffer pool' - FROM information_schema.global_status - WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; - ---echo # ---echo # MDEV-27891: Delayed SIGSEGV in InnoDB buffer pool resize ---echo # after or during DROP TABLE ---echo # - -select @@innodb_buffer_pool_chunk_size; -CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; -SET GLOBAL innodb_buffer_pool_size=256*1024*1024; -DROP TABLE t1; ---source include/wait_condition.inc -SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size + @@innodb_buffer_pool_chunk_size; ---source include/wait_condition.inc - ---echo # End of 10.6 tests - -SET GLOBAL innodb_buffer_pool_size=@save_size; ---source include/wait_condition.inc diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.opt deleted file mode 100644 index dca040ea893..00000000000 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_debug.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb-buffer-pool-size=8M --innodb-buffer-pool-chunk-size=2M diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.opt new file mode 100644 index 00000000000..95f86e59920 --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.opt @@ -0,0 +1 @@ +--innodb-buffer-pool-size-max=16m diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test index c49ae451638..59afed24521 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_temporary.test @@ -1,24 +1,43 @@ --source include/have_innodb.inc --source include/have_sequence.inc --source include/have_debug.inc +--source include/have_debug_sync.inc SET @save_limit=@@GLOBAL.innodb_limit_optimistic_insert_debug; SET @save_size=@@GLOBAL.innodb_buffer_pool_size; SET GLOBAL innodb_limit_optimistic_insert_debug=2; - SET GLOBAL innodb_buffer_pool_size=16777216; CREATE TEMPORARY TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 SELECT seq FROM seq_1_to_200; -SET GLOBAL innodb_buffer_pool_size=8388608; +# Flush the buffer pool to prevent +# "innodb_buffer_pool_size change aborted" error with ./mtr --repeat=3 +SET GLOBAL innodb_max_purge_lag_wait=0; +SET @save_pct= @@GLOBAL.innodb_max_dirty_pages_pct; +SET @save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm; +SET GLOBAL innodb_max_dirty_pages_pct_lwm = 0.0; +SET GLOBAL innodb_max_dirty_pages_pct = 0.0; -let $wait_timeout = 60; -let $wait_condition = - SELECT SUBSTR(variable_value, 1, 30) = 'Completed resizing buffer pool' - FROM information_schema.global_status - WHERE variable_name = 'INNODB_BUFFER_POOL_RESIZE_STATUS'; ---source include/wait_condition.inc +SHOW STATUS LIKE 'innodb_buffer_pool_resize_status'; +connect con1,localhost,root; +SET DEBUG_SYNC='buf_pool_shrink_before_wakeup SIGNAL blocked WAIT_FOR go'; +send SET GLOBAL innodb_buffer_pool_size=8388608; +connection default; +SET DEBUG_SYNC='now WAIT_FOR blocked'; +# adjust for 32-bit +--replace_result 504/504 505/505 +SHOW STATUS LIKE 'innodb_buffer_pool_resize_status'; +SET DEBUG_SYNC='now SIGNAL go'; +connection con1; +reap; +disconnect con1; +connection default; +SHOW STATUS LIKE 'innodb_buffer_pool_resize_status'; +SET DEBUG_SYNC=RESET; + +SET GLOBAL innodb_max_dirty_pages_pct = @save_pct; +SET GLOBAL innodb_max_dirty_pages_pct_lwm = @save_pct_lwm; SELECT COUNT(*),MIN(a),MAX(a) FROM t1; DROP TEMPORARY TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.opt deleted file mode 100644 index ade197de338..00000000000 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.opt +++ /dev/null @@ -1,3 +0,0 @@ ---innodb-buffer-pool-size=16M ---innodb-buffer-pool-chunk-size=4M ---innodb-page-size=4k diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.test b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.test deleted file mode 100644 index 78db6bf0d5a..00000000000 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize_with_chunks.test +++ /dev/null @@ -1,61 +0,0 @@ -# -# WL6117 : Resize the InnoDB Buffer Pool Online -# (innodb_buffer_pool_chunk_size used case) -# - ---source include/have_innodb.inc ---source include/big_test.inc - -let $wait_timeout = 180; -let $wait_condition = - SELECT SUBSTR(variable_value, 1, 30) = 'Completed resizing buffer pool' - FROM information_schema.global_status - WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; - ---disable_query_log -set @old_innodb_buffer_pool_size = @@innodb_buffer_pool_size; ---enable_query_log - -select @@innodb_buffer_pool_chunk_size; - -# fill buffer pool ---disable_query_log -SET @save_innodb_read_only_compressed=@@GLOBAL.innodb_read_only_compressed; -SET GLOBAL innodb_read_only_compressed=OFF; ---enable_query_log -create table t1 (id int not null, val int not null default '0', primary key (id)) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; -create or replace view view0 as select 1 union all select 1; - -set @`v_id` := 0; -set @`v_val` := 0; - -# 2^18 == 262144 records -replace into t1 select (@`v_id` := (@`v_id` + 4) mod 4294967296) as id, (@`v_val` := (@`v_val` + 4) mod 4294967296) as val from view0 v0, view0 v1, view0 v2, view0 v3, view0 v4, view0 v5, view0 v6, view0 v7, view0 v8, view0 v9, view0 v10, view0 v11, view0 v12, view0 v13, view0 v14, view0 v15, view0 v16, view0 v17; ---disable_query_log -SET GLOBAL innodb_read_only_compressed=@save_innodb_read_only_compressed; ---enable_query_log - -# Shrink buffer pool to 7MB -set global innodb_buffer_pool_size = 7340032; ---source include/wait_condition.inc - -select count(val) from t1; - -# Expand buffer pool to 16MB -set global innodb_buffer_pool_size = 16777216; ---source include/wait_condition.inc - -select count(val) from t1; - -drop table t1; -drop view view0; - -# Try to shrink buffer pool to smaller than chunk size -set global innodb_buffer_pool_size = 2*1048576; ---source include/wait_condition.inc -select @@innodb_buffer_pool_size; - ---disable_query_log -set global innodb_buffer_pool_size = @old_innodb_buffer_pool_size; ---enable_query_log ---source include/wait_condition.inc diff --git a/mysql-test/suite/innodb/t/lock_memory_debug.opt b/mysql-test/suite/innodb/t/lock_memory_debug.opt index 67c8423cf2a..184ec4096a8 100644 --- a/mysql-test/suite/innodb/t/lock_memory_debug.opt +++ b/mysql-test/suite/innodb/t/lock_memory_debug.opt @@ -1 +1 @@ ---innodb_buffer_pool_size=5M +--innodb_buffer_pool_size=6M diff --git a/mysql-test/suite/innodb/t/lock_memory_debug.test b/mysql-test/suite/innodb/t/lock_memory_debug.test index 588356f7fa4..58a76740dcb 100644 --- a/mysql-test/suite/innodb/t/lock_memory_debug.test +++ b/mysql-test/suite/innodb/t/lock_memory_debug.test @@ -15,7 +15,7 @@ INSERT INTO t1 VALUES (1),(2),(3),(4),(5); --error ER_LOCK_TABLE_FULL SET STATEMENT debug_dbug='+d,innodb_skip_lock_bitmap' FOR -INSERT INTO t1 SELECT a.* FROM t1 a, t1 b, t1 c, t1 d, t1 e, t1 f, t1 g LIMIT 45000; +INSERT INTO t1 SELECT a.* FROM t1 a, t1 b, t1 c, t1 d, t1 e, t1 f, t1 g; SELECT COUNT(*) FROM t1; diff --git a/mysql-test/suite/innodb/t/log_upgrade_101_flags.test b/mysql-test/suite/innodb/t/log_upgrade_101_flags.test index 4358ccfa1ca..a9b567bfbb3 100644 --- a/mysql-test/suite/innodb/t/log_upgrade_101_flags.test +++ b/mysql-test/suite/innodb/t/log_upgrade_101_flags.test @@ -73,7 +73,7 @@ print OUT chr(0); close OUT or die; EOF ---let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=4m --innodb_page_size=32k --innodb_buffer_pool_size=10M +--let $restart_parameters= $dirs --innodb-force-recovery=5 --innodb-log-file-size=4m --innodb_page_size=32k --innodb_buffer_pool_size=11M --source include/start_mysqld.inc SELECT COUNT(*) FROM INFORMATION_SCHEMA.ENGINES WHERE engine = 'innodb' diff --git a/mysql-test/suite/innodb/t/mem_pressure.opt b/mysql-test/suite/innodb/t/mem_pressure.opt new file mode 100644 index 00000000000..8c6cf8729eb --- /dev/null +++ b/mysql-test/suite/innodb/t/mem_pressure.opt @@ -0,0 +1,2 @@ +--innodb-buffer-pool-size-max=17m +--innodb-buffer-pool-size=17m diff --git a/mysql-test/suite/innodb/t/mem_pressure.test b/mysql-test/suite/innodb/t/mem_pressure.test index 5dbcea439a3..578d6d44841 100644 --- a/mysql-test/suite/innodb/t/mem_pressure.test +++ b/mysql-test/suite/innodb/t/mem_pressure.test @@ -1,5 +1,4 @@ --source include/have_debug.inc ---source include/have_cgroupv2.inc --source include/not_embedded.inc --source include/have_innodb.inc --source include/have_sequence.inc diff --git a/mysql-test/suite/innodb/t/purge_secondary.opt b/mysql-test/suite/innodb/t/purge_secondary.opt index 2821c98397c..fd3b12811e8 100644 --- a/mysql-test/suite/innodb/t/purge_secondary.opt +++ b/mysql-test/suite/innodb/t/purge_secondary.opt @@ -1,4 +1,4 @@ --innodb-sys-tablestats ---innodb_buffer_pool_size=5M +--innodb_buffer_pool_size=6M --innodb_monitor_enable=module_buffer --skip-innodb-stats-persistent diff --git a/mysql-test/suite/innodb/t/recovery_memory.test b/mysql-test/suite/innodb/t/recovery_memory.test index 06101377f10..51c0ce73b78 100644 --- a/mysql-test/suite/innodb/t/recovery_memory.test +++ b/mysql-test/suite/innodb/t/recovery_memory.test @@ -22,7 +22,7 @@ send CALL dorepeat(); connection default; sleep 10; let $shutdown_timeout=0; -let $restart_parameters=--innodb_buffer_pool_size=5242880; +let $restart_parameters=--innodb_buffer_pool_size=6m; --source include/restart_mysqld.inc DROP TABLE t1; DROP PROCEDURE dorepeat; @@ -33,11 +33,11 @@ DROP PROCEDURE dorepeat; --echo # if ($have_debug) { SET DEBUG_DBUG="+d,ib_log_checkpoint_avoid_hard"; -let $restart_parameters=--innodb_buffer_pool_size=5242880 --debug_dbug=+d,ibuf_init_corrupt; +let $restart_parameters=--innodb_buffer_pool_size=6m --debug_dbug=+d,ibuf_init_corrupt; } if (!$have_debug) { --echo SET DEBUG_DBUG="+d,ib_log_checkpoint_avoid_hard"; -let $restart_parameters=--innodb_buffer_pool_size=5242880; +let $restart_parameters=--innodb_buffer_pool_size=6m; } CREATE TABLE t1(f1 INT NOT NULL)ENGINE=InnoDB; INSERT INTO t1 SELECT * FROM seq_1_to_65536; diff --git a/mysql-test/suite/innodb/t/restart.opt b/mysql-test/suite/innodb/t/restart.opt deleted file mode 100644 index ce43e89cb2b..00000000000 --- a/mysql-test/suite/innodb/t/restart.opt +++ /dev/null @@ -1,2 +0,0 @@ ---loose-innodb_disable_resize_buffer_pool_debug=0 ---innodb-buffer-pool-chunk-size=1M diff --git a/mysql-test/suite/innodb/t/restart.test b/mysql-test/suite/innodb/t/restart.test index 727353b2492..fc6c2bfabd5 100644 --- a/mysql-test/suite/innodb/t/restart.test +++ b/mysql-test/suite/innodb/t/restart.test @@ -92,31 +92,6 @@ SELECT * FROM tc; SELECT * FROM td; DROP TABLE tr,tc,td; ---echo # ---echo # MDEV-27467 innodb to enfore the minimum innodb_buffer_pool_size in SET (resize) the same as startup ---echo # - -let $wait_timeout = 180; -let $wait_condition = - SELECT SUBSTR(variable_value, 1, 30) = 'Completed resizing buffer pool' - FROM information_schema.global_status - WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; - ---disable_cursor_protocol -SELECT @@innodb_buffer_pool_size INTO @innodb_buffer_pool_size_orig; -SELECT CEILING((256 + 64) * @@innodb_page_size / 1048576) * 1048576 INTO @min_pool_size; ---enable_cursor_protocol ---error ER_WRONG_VALUE_FOR_VAR -EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size -1); - -SHOW WARNINGS; - -EXECUTE IMMEDIATE 'SET GLOBAL innodb_buffer_pool_size = ?' USING (@min_pool_size); - ---source include/wait_condition.inc - -SET GLOBAL innodb_buffer_pool_size = @innodb_buffer_pool_size_orig; - --echo # --echo # MDEV-27882 Innodb - recognise MySQL-8.0 innodb flags and give a specific error message --echo # diff --git a/mysql-test/suite/innodb/t/update_time-master.opt b/mysql-test/suite/innodb/t/update_time-master.opt deleted file mode 100644 index f0fd647546d..00000000000 --- a/mysql-test/suite/innodb/t/update_time-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb-buffer-pool-size=5M diff --git a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_size_basic.result b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_size_basic.result index e5dd6820420..6e4dad90127 100644 --- a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_size_basic.result +++ b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_size_basic.result @@ -1,16 +1,17 @@ SET @start_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size; -'#---------------------BS_STVARS_022_01----------------------#' -SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size); -COUNT(@@GLOBAL.innodb_buffer_pool_size) -1 -1 Expected '#---------------------BS_STVARS_022_02----------------------#' -SET @@GLOBAL.innodb_buffer_pool_size=10485760; -Expected succeeded -SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size); -COUNT(@@GLOBAL.innodb_buffer_pool_size) +SELECT @@GLOBAL.innodb_buffer_pool_size_max; +@@GLOBAL.innodb_buffer_pool_size_max +8388608 +SELECT @@GLOBAL.innodb_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size_max; +@@GLOBAL.innodb_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size_max +1 +SET GLOBAL innodb_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size_max + 1048576; +Warnings: +Warning 1292 Truncated incorrect innodb_buffer_pool_size value: '9437184' +SELECT @@GLOBAL.innodb_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size_max; +@@GLOBAL.innodb_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size_max 1 -1 Expected '#---------------------BS_STVARS_022_03----------------------#' SELECT @@GLOBAL.innodb_buffer_pool_size = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES @@ -18,10 +19,6 @@ WHERE VARIABLE_NAME='innodb_buffer_pool_size'; @@GLOBAL.innodb_buffer_pool_size = VARIABLE_VALUE 1 1 Expected -SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size); -COUNT(@@GLOBAL.innodb_buffer_pool_size) -1 -1 Expected SELECT COUNT(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME='innodb_buffer_pool_size'; @@ -50,4 +47,7 @@ COUNT(@@GLOBAL.innodb_buffer_pool_size) 1 Expected SELECT innodb_buffer_pool_size = @@SESSION.innodb_buffer_pool_size; ERROR 42S22: Unknown column 'innodb_buffer_pool_size' in 'SELECT' -# restart +SET GLOBAL innodb_buffer_pool_size = @start_buffer_pool_size; +SELECT @@innodb_buffer_pool_size = @start_buffer_pool_size; +@@innodb_buffer_pool_size = @start_buffer_pool_size +1 diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff index 185abfd6f14..1aa3de321c0 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff @@ -24,7 +24,7 @@ VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED - VARIABLE_COMMENT Size of a single memory chunk for resizing buffer pool. Online buffer pool resizing happens at this granularity. 0 means autosize this variable based on buffer pool size. + VARIABLE_COMMENT Deprecated parameter with no effect NUMERIC_MIN_VALUE 0 -NUMERIC_MAX_VALUE 18446744073709551615 +NUMERIC_MAX_VALUE 4294967295 @@ -40,7 +40,35 @@ VARIABLE_COMMENT Dump only the hottest N% of each buffer pool, defaults to 25 NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 100 -@@ -215,7 +215,7 @@ +@@ -203,10 +203,10 @@ + SESSION_VALUE NULL + DEFAULT_VALUE 134217728 + VARIABLE_SCOPE GLOBAL +-VARIABLE_TYPE BIGINT UNSIGNED ++VARIABLE_TYPE INT UNSIGNED + VARIABLE_COMMENT The size of the memory buffer InnoDB uses to cache data and indexes of its tables. + NUMERIC_MIN_VALUE 2097152 +-NUMERIC_MAX_VALUE 18446744073701163008 ++NUMERIC_MAX_VALUE 4292870144 + NUMERIC_BLOCK_SIZE 1048576 + ENUM_VALUE_LIST NULL + READ_ONLY NO +@@ -215,11 +215,11 @@ + SESSION_VALUE NULL + DEFAULT_VALUE 0 + VARIABLE_SCOPE GLOBAL +-VARIABLE_TYPE BIGINT UNSIGNED ++VARIABLE_TYPE INT UNSIGNED + VARIABLE_COMMENT Maximum innodb_buffer_pool_size + NUMERIC_MIN_VALUE 0 +-NUMERIC_MAX_VALUE 18446744073701163008 +-NUMERIC_BLOCK_SIZE 8388608 ++NUMERIC_MAX_VALUE 4292870144 ++NUMERIC_BLOCK_SIZE 2097152 + ENUM_VALUE_LIST NULL + READ_ONLY YES + COMMAND_LINE_ARGUMENT REQUIRED +@@ -227,7 +227,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -49,7 +77,7 @@ VARIABLE_COMMENT A number between [0, 100] that tells how oftern buffer pool dump status in percentages should be printed. E.g. 10 means that buffer pool dump status is printed when every 10% of number of buffer pool pages are dumped. Default is 0 (only start and end status is printed). NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 100 -@@ -335,7 +335,7 @@ +@@ -347,7 +347,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 5 VARIABLE_SCOPE GLOBAL @@ -58,7 +86,7 @@ VARIABLE_COMMENT If the compression failure rate of a table is greater than this number more padding is added to the pages to reduce the failures. A value of zero implies no padding NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 100 -@@ -359,7 +359,7 @@ +@@ -371,7 +371,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 50 VARIABLE_SCOPE GLOBAL @@ -67,7 +95,7 @@ VARIABLE_COMMENT Percentage of empty space on a data page that can be reserved to make the page compressible. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 75 -@@ -647,7 +647,7 @@ +@@ -659,7 +659,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 600 VARIABLE_SCOPE GLOBAL @@ -76,7 +104,7 @@ VARIABLE_COMMENT Maximum number of seconds that semaphore times out in InnoDB. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -695,7 +695,7 @@ +@@ -707,7 +707,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 30 VARIABLE_SCOPE GLOBAL @@ -85,7 +113,7 @@ VARIABLE_COMMENT Number of iterations over which the background flushing is averaged. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1000 -@@ -719,7 +719,7 @@ +@@ -731,7 +731,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1 VARIABLE_SCOPE GLOBAL @@ -94,7 +122,7 @@ VARIABLE_COMMENT Controls the durability/speed trade-off for commits. Set to 0 (write and flush redo log to disk only once per second), 1 (flush to disk at each commit), 2 (write to log at commit but flush to disk only once per second) or 3 (flush to disk at prepare and at commit, slower and usually redundant). 1 and 3 guarantees that after a crash, committed transactions will not be lost and will be consistent with the binlog and other transactional engines. 2 can get inconsistent and lose transactions if there is a power failure or kernel crash but not if mysqld crashes. 0 has no guarantees in case of crash. 0 and 2 can be faster than 1 or 3. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 3 -@@ -743,7 +743,7 @@ +@@ -755,7 +755,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1 VARIABLE_SCOPE GLOBAL @@ -103,7 +131,7 @@ VARIABLE_COMMENT Set to 0 (don't flush neighbors from buffer pool), 1 (flush contiguous neighbors from buffer pool) or 2 (flush neighbors from buffer pool), when flushing a block NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 2 -@@ -779,7 +779,7 @@ +@@ -791,7 +791,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -112,7 +140,7 @@ VARIABLE_COMMENT Helps to save your data in case the disk image of the database becomes corrupt. Value 5 can return bogus data, and 6 can permanently corrupt data. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 6 -@@ -803,10 +803,10 @@ +@@ -815,10 +815,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 8000000 VARIABLE_SCOPE GLOBAL @@ -125,7 +153,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -839,7 +839,7 @@ +@@ -851,7 +851,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 84 VARIABLE_SCOPE GLOBAL @@ -134,7 +162,7 @@ VARIABLE_COMMENT InnoDB Fulltext search maximum token size in characters NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 84 -@@ -851,7 +851,7 @@ +@@ -863,7 +863,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 3 VARIABLE_SCOPE GLOBAL @@ -143,7 +171,7 @@ VARIABLE_COMMENT InnoDB Fulltext search minimum token size in characters NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16 -@@ -863,7 +863,7 @@ +@@ -875,7 +875,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 2000 VARIABLE_SCOPE GLOBAL @@ -152,7 +180,7 @@ VARIABLE_COMMENT InnoDB Fulltext search number of words to optimize for each optimize table call NUMERIC_MIN_VALUE 1000 NUMERIC_MAX_VALUE 10000 -@@ -875,10 +875,10 @@ +@@ -887,10 +887,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 2000000000 VARIABLE_SCOPE GLOBAL @@ -165,7 +193,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -899,7 +899,7 @@ +@@ -911,7 +911,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 2 VARIABLE_SCOPE GLOBAL @@ -174,7 +202,7 @@ VARIABLE_COMMENT InnoDB Fulltext search parallel sort degree, will round up to nearest power of 2 number NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 16 -@@ -911,10 +911,10 @@ +@@ -923,10 +923,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 640000000 VARIABLE_SCOPE GLOBAL @@ -187,7 +215,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -959,7 +959,7 @@ +@@ -971,7 +971,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 200 VARIABLE_SCOPE GLOBAL @@ -196,7 +224,7 @@ VARIABLE_COMMENT Number of IOPs the server can do. Tunes the background IO rate NUMERIC_MIN_VALUE 100 NUMERIC_MAX_VALUE 4294967295 -@@ -971,7 +971,7 @@ +@@ -983,7 +983,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 4294967295 VARIABLE_SCOPE GLOBAL @@ -205,7 +233,7 @@ VARIABLE_COMMENT Limit to which innodb_io_capacity can be inflated. NUMERIC_MIN_VALUE 100 NUMERIC_MAX_VALUE 4294967295 -@@ -1091,10 +1091,10 @@ +@@ -1103,10 +1103,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 32 VARIABLE_SCOPE GLOBAL @@ -218,7 +246,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1103,10 +1103,10 @@ +@@ -1115,10 +1115,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 1536 VARIABLE_SCOPE GLOBAL @@ -231,7 +259,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1139,10 +1139,10 @@ +@@ -1151,10 +1151,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -244,7 +272,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1151,7 +1151,7 @@ +@@ -1163,7 +1163,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -253,7 +281,7 @@ VARIABLE_COMMENT Maximum delay of user threads in micro-seconds NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 10000000 -@@ -1283,10 +1283,10 @@ +@@ -1295,10 +1295,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -266,7 +294,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY YES -@@ -1307,7 +1307,7 @@ +@@ -1319,7 +1319,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 16384 VARIABLE_SCOPE GLOBAL @@ -275,7 +303,7 @@ VARIABLE_COMMENT Page size to use for all InnoDB tablespaces. NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 65536 -@@ -1343,7 +1343,7 @@ +@@ -1355,7 +1355,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 127 VARIABLE_SCOPE GLOBAL @@ -284,7 +312,7 @@ VARIABLE_COMMENT Number of UNDO log pages to purge in one batch from the history list. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 5000 -@@ -1355,7 +1355,7 @@ +@@ -1367,7 +1367,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 128 VARIABLE_SCOPE GLOBAL @@ -293,7 +321,7 @@ VARIABLE_COMMENT Deprecated parameter with no effect NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 128 -@@ -1391,7 +1391,7 @@ +@@ -1403,7 +1403,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 56 VARIABLE_SCOPE GLOBAL @@ -302,7 +330,7 @@ VARIABLE_COMMENT Number of pages that must be accessed sequentially for InnoDB to trigger a readahead. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 64 -@@ -1475,7 +1475,7 @@ +@@ -1487,7 +1487,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1048576 VARIABLE_SCOPE GLOBAL @@ -311,7 +339,7 @@ VARIABLE_COMMENT Memory buffer size for index creation NUMERIC_MIN_VALUE 65536 NUMERIC_MAX_VALUE 67108864 -@@ -1643,10 +1643,10 @@ +@@ -1655,10 +1655,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 30 VARIABLE_SCOPE GLOBAL diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 0f84e3e17ba..1fddbe3fc1e 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -5,6 +5,7 @@ variable_name not in ( 'innodb_evict_tables_on_commit_debug', # one may want to override this 'innodb_use_native_aio', # default value depends on OS 'innodb_log_file_buffering', # only available on Linux and Windows +'innodb_buffer_pool_size_auto_min', # only available on Linux for now 'innodb_buffer_pool_load_pages_abort') # debug build only, and is only for testing order by variable_name; VARIABLE_NAME INNODB_ADAPTIVE_FLUSHING @@ -96,7 +97,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED -VARIABLE_COMMENT Size of a single memory chunk for resizing buffer pool. Online buffer pool resizing happens at this granularity. 0 means autosize this variable based on buffer pool size. +VARIABLE_COMMENT Deprecated parameter with no effect NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 18446744073709551615 NUMERIC_BLOCK_SIZE 1048576 @@ -206,11 +207,23 @@ VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The size of the memory buffer InnoDB uses to cache data and indexes of its tables. NUMERIC_MIN_VALUE 2097152 -NUMERIC_MAX_VALUE 9223372036854775807 +NUMERIC_MAX_VALUE 18446744073701163008 NUMERIC_BLOCK_SIZE 1048576 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME INNODB_BUFFER_POOL_SIZE_MAX +SESSION_VALUE NULL +DEFAULT_VALUE 0 +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_COMMENT Maximum innodb_buffer_pool_size +NUMERIC_MIN_VALUE 0 +NUMERIC_MAX_VALUE 18446744073701163008 +NUMERIC_BLOCK_SIZE 8388608 +ENUM_VALUE_LIST NULL +READ_ONLY YES +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_BUF_DUMP_STATUS_FREQUENCY SESSION_VALUE NULL DEFAULT_VALUE 0 diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic-master.opt b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic-master.opt deleted file mode 100644 index aa536bf0070..00000000000 --- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic-master.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb-buffer-pool-chunk-size=2M diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.opt b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.opt new file mode 100644 index 00000000000..373ccf8732e --- /dev/null +++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.opt @@ -0,0 +1 @@ +--innodb-buffer-pool-size-max=8m diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test index dada2a9a455..1807ffaada1 100644 --- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test +++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test @@ -24,35 +24,19 @@ --source include/have_innodb.inc -let $wait_condition = - SELECT SUBSTR(variable_value, 1, 30) = 'Completed resizing buffer pool' - FROM information_schema.global_status - WHERE LOWER(variable_name) = 'innodb_buffer_pool_resize_status'; - SET @start_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size; ---echo '#---------------------BS_STVARS_022_01----------------------#' -#################################################################### -# Displaying default value # -#################################################################### -SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size); ---echo 1 Expected - - --echo '#---------------------BS_STVARS_022_02----------------------#' #################################################################### # Check if Value can set # #################################################################### -SET @@GLOBAL.innodb_buffer_pool_size=10485760; ---echo Expected succeeded ---source include/wait_condition.inc - -SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size); ---echo 1 Expected - - - +--enable_warnings +SELECT @@GLOBAL.innodb_buffer_pool_size_max; +SELECT @@GLOBAL.innodb_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size_max; +SET GLOBAL innodb_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size_max + 1048576; +SELECT @@GLOBAL.innodb_buffer_pool_size = @@GLOBAL.innodb_buffer_pool_size_max; +--disable_warnings --echo '#---------------------BS_STVARS_022_03----------------------#' ################################################################# @@ -66,9 +50,6 @@ WHERE VARIABLE_NAME='innodb_buffer_pool_size'; --enable_warnings --echo 1 Expected -SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size); ---echo 1 Expected - --disable_warnings SELECT COUNT(VARIABLE_VALUE) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES @@ -76,8 +57,6 @@ WHERE VARIABLE_NAME='innodb_buffer_pool_size'; --enable_warnings --echo 1 Expected - - --echo '#---------------------BS_STVARS_022_04----------------------#' ################################################################################ # Check if accessing variable with and without GLOBAL point to same variable # @@ -111,4 +90,6 @@ SELECT innodb_buffer_pool_size = @@SESSION.innodb_buffer_pool_size; # Restore the original buffer pool size. ---source include/restart_mysqld.inc +SET GLOBAL innodb_buffer_pool_size = @start_buffer_pool_size; + +SELECT @@innodb_buffer_pool_size = @start_buffer_pool_size; diff --git a/mysql-test/suite/sys_vars/t/sysvars_innodb.test b/mysql-test/suite/sys_vars/t/sysvars_innodb.test index 2680e442da4..7c4345cce25 100644 --- a/mysql-test/suite/sys_vars/t/sysvars_innodb.test +++ b/mysql-test/suite/sys_vars/t/sysvars_innodb.test @@ -12,5 +12,6 @@ select VARIABLE_NAME, SESSION_VALUE, DEFAULT_VALUE, VARIABLE_SCOPE, VARIABLE_TYP 'innodb_evict_tables_on_commit_debug', # one may want to override this 'innodb_use_native_aio', # default value depends on OS 'innodb_log_file_buffering', # only available on Linux and Windows + 'innodb_buffer_pool_size_auto_min', # only available on Linux for now 'innodb_buffer_pool_load_pages_abort') # debug build only, and is only for testing order by variable_name; diff --git a/mysys/CMakeLists.txt b/mysys/CMakeLists.txt index 5ab44931de3..ceae31f07eb 100644 --- a/mysys/CMakeLists.txt +++ b/mysys/CMakeLists.txt @@ -46,7 +46,8 @@ SET(MYSYS_SOURCES array.c charset-def.c charset.c my_default.c my_uuid.c wqueue.c waiting_threads.c ma_dyncol.c ../sql-common/my_time.c my_rdtsc.c psi_noop.c my_atomic_writes.c my_cpu.c my_likely.c my_largepage.c - file_logger.c my_dlerror.c crc32/crc32c.cc) + file_logger.c my_dlerror.c crc32/crc32c.cc + my_virtual_mem.c) IF (WIN32) SET (MYSYS_SOURCES ${MYSYS_SOURCES} diff --git a/mysys/my_largepage.c b/mysys/my_largepage.c index 71527a9bc27..240c8e84fc7 100644 --- a/mysys/my_largepage.c +++ b/mysys/my_largepage.c @@ -35,17 +35,11 @@ extern int memcntl(caddr_t, size_t, int, caddr_t, int, int); #endif /* __sun__ ... */ #endif /* HAVE_SOLARIS_LARGE_PAGES */ -#if defined(_WIN32) -static size_t my_large_page_size; -#define HAVE_LARGE_PAGES -#elif defined(HAVE_MMAP) -#define HAVE_LARGE_PAGES -#endif -#ifdef HAVE_LARGE_PAGES -static my_bool my_use_large_pages= 0; -#else -#define my_use_large_pages 0 +my_bool my_use_large_pages; + +#ifdef _WIN32 +static size_t my_large_page_size; #endif #if defined(HAVE_GETPAGESIZES) || defined(__linux__) @@ -172,7 +166,7 @@ static void my_get_large_page_sizes(size_t sizes[]) @retval a large page size that is valid on this system or 0 if no large page size possible. */ -#if defined(HAVE_MMAP) && !defined(_WIN32) +#ifndef _WIN32 static size_t my_next_large_page_size(size_t sz, int *start) { DBUG_ENTER("my_next_large_page_size"); @@ -188,11 +182,12 @@ static size_t my_next_large_page_size(size_t sz, int *start) } DBUG_RETURN(0); } -#endif /* defined(MMAP) || !defined(_WIN32) */ +#endif -int my_init_large_pages(my_bool super_large_pages) +int my_init_large_pages(void) { + my_use_large_pages= 1; #ifdef _WIN32 if (!my_obtain_privilege(SE_LOCK_MEMORY_NAME)) { @@ -200,19 +195,15 @@ int my_init_large_pages(my_bool super_large_pages) "Lock Pages in memory access rights required for use with" " large-pages, see https://mariadb.com/kb/en/library/" "mariadb-memory-allocation/#huge-pages", MYF(MY_WME)); + my_use_large_pages= 0; } my_large_page_size= GetLargePageMinimum(); #endif - my_use_large_pages= 1; my_get_large_page_sizes(my_large_page_sizes); -#ifndef HAVE_LARGE_PAGES - my_printf_error(EE_OUTOFMEMORY, "No large page support on this platform", - MYF(MY_WME)); -#endif - #ifdef HAVE_SOLARIS_LARGE_PAGES + extern my_bool opt_super_large_pages; /* tell the kernel that we want to use 4/256MB page for heap storage and also for the stack. We use 4 MByte as default and if the @@ -222,9 +213,15 @@ int my_init_large_pages(my_bool super_large_pages) measured in a number of GBytes. We use as big pages as possible which isn't bigger than the above desired page sizes. + + Note: This refers to some implementations of the SPARC ISA, + where the supported page sizes are + 8KiB, 64KiB, 512KiB, 4MiB, 32MiB, 256MiB, 2GiB, and 16GiB. + On implementations of the AMD64 ISA, the available page sizes + should be 4KiB, 2MiB, and 1GiB. */ int nelem= 0; - size_t max_desired_page_size= (super_large_pages ? 256 : 4) * 1024 * 1024; + size_t max_desired_page_size= opt_super_large_pages ? 256 << 20 : 4 << 20; size_t max_page_size= my_next_large_page_size(max_desired_page_size, &nelem); if (max_page_size > 0) @@ -426,6 +423,118 @@ uchar *my_large_malloc(size_t *size, myf my_flags) DBUG_RETURN(ptr); } +#ifdef _WIN32 +/** + Special large pages allocator, with possibility to commit to allocating + more memory later. + Every implementation returns a zero filled buffer here. +*/ +char *my_large_virtual_alloc(size_t *size) +{ + char *ptr; + DBUG_ENTER("my_large_virtual_alloc"); + + if (my_use_large_pages) + { + size_t s= *size; + s= MY_ALIGN(s, (size_t) my_large_page_size); + ptr= VirtualAlloc(NULL, s, MEM_COMMIT | MEM_RESERVE | MEM_LARGE_PAGES, + PAGE_READWRITE); + if (ptr) + { + *size= s; + DBUG_RETURN(ptr); + } + } + + DBUG_RETURN(VirtualAlloc(NULL, *size, MEM_RESERVE, PAGE_READWRITE)); +} +#elif defined HAVE_MMAP +/** + Special large pages allocator, with possibility to commit to allocating + more memory later. + Every implementation returns a zero filled buffer here. +*/ +char *my_large_mmap(size_t *size, int prot) +{ + char *ptr; + DBUG_ENTER("my_large_virtual_alloc"); + + if (my_use_large_pages) + { + size_t large_page_size; + int page_i= 0; + prot= PROT_READ | PROT_WRITE; + + while ((large_page_size= my_next_large_page_size(*size, &page_i)) != 0) + { + int mapflag= MAP_PRIVATE | +# ifdef MAP_POPULATE + MAP_POPULATE | +# endif +# if defined MAP_HUGETLB /* linux 2.6.32 */ + MAP_HUGETLB | +# if defined MAP_HUGE_SHIFT /* Linux-3.8+ */ + my_bit_log2_size_t(large_page_size) << MAP_HUGE_SHIFT | +# else +# warning "No explicit large page (HUGETLB pages) support in Linux < 3.8" +# endif +# elif defined MAP_ALIGNED + MAP_ALIGNED(my_bit_log2_size_t(large_page_size)) | +# if defined MAP_ALIGNED_SUPER + MAP_ALIGNED_SUPER | +# endif +# endif + OS_MAP_ANON; + + size_t aligned_size= MY_ALIGN(*size, (size_t) large_page_size); + ptr= mmap(NULL, aligned_size, prot, mapflag, -1, 0); + if (ptr == (void*) -1) + { + ptr= NULL; + /* try next smaller memory size */ + if (errno == ENOMEM) + continue; + + /* other errors are more serious */ + break; + } + else /* success */ + { + /* + we do need to record the adjustment so that munmap gets called with + the right size. This is only the case for HUGETLB pages. + */ + *size= aligned_size; + DBUG_RETURN(ptr); + } + } + } + + ptr= mmap(NULL, *size, prot, +# ifdef MAP_NORESERVE + MAP_NORESERVE | +# endif + MAP_PRIVATE | OS_MAP_ANON, -1, 0); + if (ptr == MAP_FAILED) + { + my_error(EE_OUTOFMEMORY, MYF(ME_BELL + ME_ERROR_LOG), size); + ptr= NULL; + } + + DBUG_RETURN(ptr); +} + +/** + Special large pages allocator, with possibility to commit to allocating + more memory later. + Every implementation returns a zero filled buffer here. +*/ +char *my_large_virtual_alloc(size_t *size) +{ + return my_large_mmap(size, PROT_READ | PROT_WRITE); +} +#endif /** General large pages deallocator. @@ -482,7 +591,7 @@ void my_large_free(void *ptr, size_t size) #endif /* memory_sanitizer */ #else my_free_lock(ptr); -#endif /* HAVE_MMMAP */ +#endif /* HAVE_MMAP */ DBUG_VOID_RETURN; } diff --git a/mysys/my_virtual_mem.c b/mysys/my_virtual_mem.c new file mode 100644 index 00000000000..47e3a29788a --- /dev/null +++ b/mysys/my_virtual_mem.c @@ -0,0 +1,207 @@ +/* Copyright (c) 2025, MariaDB + + 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 + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ + +#include +#include +#include +#include +#ifdef _AIX +# include +#endif + +/* + Functionality for handling virtual memory + + - reserve range, + - commit memory (within reserved range) + - decommit previously commited memory + - release range + + Not every OS has a "reserve" functionality, i.e it is not always + possible to reserve memory larger than swap or RAM for example. + + We try to respect use_large_pages setting, on Windows and Linux +*/ +#ifndef _WIN32 +char *my_large_mmap(size_t *size, int prot); +#endif + +char *my_virtual_mem_reserve(size_t *size) +{ +#ifdef _WIN32 + DWORD flags= my_use_large_pages + ? MEM_LARGE_PAGES | MEM_RESERVE | MEM_COMMIT + : MEM_RESERVE; + char *ptr= VirtualAlloc(NULL, *size, flags, PAGE_READWRITE); + if (!ptr && (flags & MEM_LARGE_PAGES)) + { + /* Try without large pages */ + ptr= VirtualAlloc(NULL, *size, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); + if (!ptr) + my_error(EE_OUTOFMEMORY, MYF(ME_BELL + ME_ERROR_LOG), *size); + } + return ptr; +#else + return my_large_mmap(size, PROT_NONE); +#endif +} + +#if defined _WIN32 && !defined DBUG_OFF +static my_bool is_memory_committed(char *ptr, size_t size) +{ + MEMORY_BASIC_INFORMATION mbi; + if (VirtualQuery(ptr, &mbi, sizeof mbi) == 0) + DBUG_ASSERT(0); + return !!(mbi.State & MEM_COMMIT); +} +#endif + +char *my_virtual_mem_commit(char *ptr, size_t size) +{ + DBUG_ASSERT(ptr); +#ifdef _WIN32 + if (my_use_large_pages) + { + DBUG_ASSERT(is_memory_committed(ptr, size)); + } + else + { + void *p= VirtualAlloc(ptr, size, MEM_COMMIT, PAGE_READWRITE); + DBUG_ASSERT(p == ptr); + if (!p) + { + my_error(EE_OUTOFMEMORY, MYF(ME_BELL + ME_ERROR_LOG), size); + return NULL; + } + } +#else + if (my_use_large_pages) + /* my_large_mmap() already created a read/write mapping. */; + else + { +# ifdef _AIX + /* + MAP_FIXED does not not work on IBM AIX in the way does works elsewhere. + Apparently, it is not possible to mmap(2) a range that is already in use, + at least not by default. + + mprotect(2) is the fallback, it can't communicate out-of-memory + conditions, but it looks like overcommitting is not possible on + AIX anyway. + */ + if (mprotect(ptr, size, PROT_READ | PROT_WRITE)) + { + my_error(EE_OUTOFMEMORY, MYF(ME_BELL + ME_ERROR_LOG), size); + return NULL; + } +# else + void *p= 0; + const int flags= +# ifdef MAP_POPULATE + MAP_POPULATE | +# endif + MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED; + p= mmap(ptr, size, PROT_READ | PROT_WRITE, flags, -1, 0); + if (p == MAP_FAILED) + { + my_error(EE_OUTOFMEMORY, MYF(ME_BELL + ME_ERROR_LOG), size); + return NULL; + } + DBUG_ASSERT(p == ptr); +# if defined MADV_FREE_REUSABLE && defined MADV_FREE_REUSE /* Apple macOS */ + madvise(ptr, size, MADV_FREE_REUSE); /* cancel MADV_FREE_REUSABLE */ +# endif +# endif + } +#endif + update_malloc_size(size, 0); + return ptr; +} + +void my_virtual_mem_decommit(char *ptr, size_t size) +{ +#ifdef _WIN32 + DBUG_ASSERT(is_memory_committed(ptr, size)); +# ifndef HAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT +# error "VirtualFree(MEM_DECOMMIT) will not allow subsequent reads!" +# endif + if (!my_use_large_pages) + { + if (!VirtualFree(ptr, size, MEM_DECOMMIT)) + { + my_error(EE_BADMEMORYRELEASE, MYF(ME_ERROR_LOG_ONLY), ptr, size, + GetLastError()); + DBUG_ASSERT(0); + } + } +#else + const int prot= +# ifndef HAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT + /* + In InnoDB, buf_pool_t::page_guess() may deference pointers to + this, assuming that either the original contents or zeroed + contents is available. + */ + PROT_READ +# else + /* We will explicitly mark the memory unaccessible. */ + PROT_NONE +# endif + ; +# ifdef _AIX + disclaim(ptr, size, DISCLAIM_ZEROMEM); +# elif defined __linux__ || defined __osf__ + madvise(ptr, size, MADV_DONTNEED); /* OSF/1, Linux mimicing AIX disclaim() */ +# elif defined MADV_FREE_REUSABLE && defined MADV_FREE_REUSE + /* Mac OS X 10.9; undocumented in Apple macOS */ + madvise(ptr, size, MADV_FREE_REUSABLE); /* macOS mimicing AIX disclaim() */ +# elif defined MADV_PURGE /* Illumos */ + madvise(ptr, size, MADV_PURGE); /* Illumos mimicing AIX disclaim() */ +# elif defined MADV_FREE + /* FreeBSD, NetBSD, OpenBSD, Dragonfly BSD, OpenSolaris, Apple macOS */ + madvise(ptr, size, MADV_FREE); /* allow lazy zeroing out */ +# elif defined MADV_DONTNEED +# warning "It is unclear if madvise(MADV_DONTNEED) works as intended" + madvise(ptr, size, MADV_DONTNEED); +# else +# warning "Do not know how to decommit memory" +# endif + if (mprotect(ptr, size, prot)) + { + my_error(EE_BADMEMORYRELEASE, MYF(ME_ERROR_LOG_ONLY), ptr, size, errno); + DBUG_ASSERT(0); + } +#endif + update_malloc_size(-(longlong) size, 0); +} + +void my_virtual_mem_release(char *ptr, size_t size) +{ +#ifdef _WIN32 + DBUG_ASSERT(my_use_large_pages || !is_memory_committed(ptr, size)); + if (!VirtualFree(ptr, 0, MEM_RELEASE)) + { + my_error(EE_BADMEMORYRELEASE, MYF(ME_ERROR_LOG_ONLY), ptr, size, + GetLastError()); + DBUG_ASSERT(0); + } +#else + if (munmap(ptr, size)) + { + my_error(EE_BADMEMORYRELEASE, MYF(ME_ERROR_LOG_ONLY), ptr, size, errno); + DBUG_ASSERT(0); + } +#endif +} diff --git a/sql/mysql_install_db.cc b/sql/mysql_install_db.cc index e424141b151..61fa17596aa 100644 --- a/sql/mysql_install_db.cc +++ b/sql/mysql_install_db.cc @@ -336,7 +336,7 @@ static char *init_bootstrap_command_line(char *cmdline, size_t size) " --bootstrap" " --datadir=." " --tmpdir=." - " --loose-innodb-buffer-pool-size=20M" + " --loose-innodb-buffer-pool-size=21M" "\"" , mysqld_path, opt_verbose_bootstrap ? "--console" : ""); return cmdline; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 901e19fcb6a..51e0b4a3c8c 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -420,7 +420,9 @@ my_bool opt_require_secure_transport= 0; char* opt_secure_file_priv; my_bool lower_case_file_system= 0; my_bool opt_large_pages= 0; +#ifdef HAVE_SOLARIS_LARGE_PAGES my_bool opt_super_large_pages= 0; +#endif my_bool opt_myisam_use_mmap= 0; uint opt_large_page_size= 0; #if defined(ENABLED_DEBUG_SYNC) @@ -4118,7 +4120,7 @@ static int init_common_variables() if (opt_large_pages) { DBUG_PRINT("info", ("Large page set")); - if (my_init_large_pages(opt_super_large_pages)) + if (my_init_large_pages()) { return 1; } @@ -7872,7 +7874,9 @@ static int mysql_init_variables(void) bzero((char*) &global_status_var, offsetof(STATUS_VAR, last_cleared_system_status_var)); opt_large_pages= 0; +#ifdef HAVE_SOLARIS_LARGE_PAGES opt_super_large_pages= 0; +#endif #if defined(ENABLED_DEBUG_SYNC) opt_debug_sync_timeout= 0; #endif /* defined(ENABLED_DEBUG_SYNC) */ diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc index 1d66560363b..75256526a32 100644 --- a/storage/innobase/btr/btr0sea.cc +++ b/storage/innobase/btr/btr0sea.cc @@ -195,7 +195,7 @@ static void btr_search_disable_ref_count(dict_table_t *table) } /** Lazily free detached metadata when removing the last reference. */ -ATTRIBUTE_COLD static void btr_search_lazy_free(dict_index_t *index) +ATTRIBUTE_COLD void btr_search_lazy_free(dict_index_t *index) { ut_ad(index->freed()); dict_table_t *table= index->table; @@ -219,8 +219,7 @@ ATTRIBUTE_COLD static void btr_search_lazy_free(dict_index_t *index) table->autoinc_mutex.wr_unlock(); } -/** Disable the adaptive hash search system and empty the index. */ -void btr_search_disable() +ATTRIBUTE_COLD bool btr_search_disable() { dict_table_t* table; @@ -231,7 +230,7 @@ void btr_search_disable() if (!btr_search_enabled) { dict_sys.unfreeze(); btr_search_x_unlock_all(); - return; + return false; } btr_search_enabled = false; @@ -259,23 +258,25 @@ void btr_search_disable() btr_search_sys.clear(); btr_search_x_unlock_all(); + + return true; } /** Enable the adaptive hash search system. @param resize whether buf_pool_t::resize() is the caller */ -void btr_search_enable(bool resize) +ATTRIBUTE_COLD void btr_search_enable(bool resize) { if (!resize) { mysql_mutex_lock(&buf_pool.mutex); - bool changed = srv_buf_pool_old_size != srv_buf_pool_size; + const auto is_shrinking = buf_pool.is_shrinking(); mysql_mutex_unlock(&buf_pool.mutex); - if (changed) { + if (is_shrinking) { return; } } btr_search_x_lock_all(); - ulint hash_size = buf_pool_get_curr_size() / sizeof(void *) / 64; + ulint hash_size = buf_pool.curr_size() / sizeof(void *) / 64; if (btr_search_sys.parts[0].heap) { ut_ad(btr_search_enabled); @@ -939,88 +940,6 @@ btr_search_failure(btr_search_t* info, btr_cur_t* cursor) info->last_hash_succ = FALSE; } -/** Clear the adaptive hash index on all pages in the buffer pool. */ -inline void buf_pool_t::clear_hash_index() noexcept -{ - ut_ad(!resizing); - ut_ad(!btr_search_enabled); - - std::set garbage; - - for (chunk_t *chunk= chunks + n_chunks; chunk-- != chunks; ) - { - for (buf_block_t *block= chunk->blocks, * const end= block + chunk->size; - block != end; block++) - { - dict_index_t *index= block->index; - assert_block_ahi_valid(block); - - /* We can clear block->index and block->n_pointers when - holding all AHI latches exclusively; see the comments in buf0buf.h */ - - if (!index) - { -# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG - ut_a(!block->n_pointers); -# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ - continue; - } - - ut_d(const auto s= block->page.state()); - /* Another thread may have set the state to - REMOVE_HASH in buf_LRU_block_remove_hashed(). - - The state change in buf_pool_t::realloc() is not observable - here, because in that case we would have !block->index. - - In the end, the entire adaptive hash index will be removed. */ - ut_ad(s >= buf_page_t::UNFIXED || s == buf_page_t::REMOVE_HASH); -# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG - block->n_pointers= 0; -# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ - if (index->freed()) - garbage.insert(index); - block->index= nullptr; - } - } - - for (dict_index_t *index : garbage) - btr_search_lazy_free(index); -} - -/** Get a buffer block from an adaptive hash index pointer. -This function does not return if the block is not identified. -@param ptr pointer to within a page frame -@return pointer to block, never NULL */ -inline buf_block_t* buf_pool_t::block_from_ahi(const byte *ptr) const noexcept -{ - chunk_t::map *chunk_map = chunk_t::map_ref; - ut_ad(chunk_t::map_ref == chunk_t::map_reg); - ut_ad(!resizing); - - chunk_t::map::const_iterator it= chunk_map->upper_bound(ptr); - ut_a(it != chunk_map->begin()); - - chunk_t *chunk= it == chunk_map->end() - ? chunk_map->rbegin()->second - : (--it)->second; - - const size_t offs= size_t(ptr - chunk->blocks->page.frame) >> - srv_page_size_shift; - ut_a(offs < chunk->size); - - buf_block_t *block= &chunk->blocks[offs]; - /* buf_pool_t::chunk_t::init() invokes buf_block_init() so that - block[n].frame == block->page.frame + n * srv_page_size. Check it. */ - ut_ad(block->page.frame == page_align(ptr)); - /* Read the state of the block without holding hash_lock. - A state transition to REMOVE_HASH is possible during - this execution. */ - ut_ad(block->page.state() >= buf_page_t::REMOVE_HASH); - - return block; -} - /** Tries to guess the right search position based on the hash search info of the index. Note that if mode is PAGE_CUR_LE, which is used in inserts, and the function returns TRUE, then cursor->up_match and cursor->low_match @@ -1103,7 +1022,8 @@ fail: return false; } - buf_block_t* block = buf_pool.block_from_ahi(rec); + buf_block_t* block = buf_pool.block_from(rec); + ut_ad(block->page.frame == page_align(rec)); buf_pool_t::hash_chain& chain = buf_pool.page_hash.cell_get( block->page.id().fold()); @@ -2196,7 +2116,7 @@ func_exit: for (; node != NULL; node = node->next) { const buf_block_t* block - = buf_pool.block_from_ahi((byte*) node->data); + = buf_pool.block_from(node->data); index_id_t page_index_id; if (UNIV_LIKELY(block->page.in_file())) { diff --git a/storage/innobase/buf/buf0buddy.cc b/storage/innobase/buf/buf0buddy.cc index 2c6b652d18f..12620ec8a2a 100644 --- a/storage/innobase/buf/buf0buddy.cc +++ b/storage/innobase/buf/buf0buddy.cc @@ -162,6 +162,20 @@ buf_buddy_get( } #ifdef UNIV_DEBUG +const buf_block_t *buf_pool_t::contains_zip(const void *data, size_t shift) + const noexcept +{ + const size_t d= size_t(data) >> shift; + + for (size_t i= 0; i < n_blocks; i++) + { + const buf_block_t *block= get_nth_page(i); + if (size_t(block->page.zip.data) >> shift == d) + return block; + } + return nullptr; +} + /** Validate a given zip_free list. */ struct CheckZipFree { CheckZipFree(ulint i) : m_i(i) {} @@ -257,13 +271,10 @@ buf_buddy_is_free( /** Add a block to the head of the appropriate buddy free list. @param[in,out] buf block to be freed @param[in] i index of buf_pool.zip_free[] */ -UNIV_INLINE -void -buf_buddy_add_to_free(buf_buddy_free_t* buf, ulint i) +static void buf_buddy_add_to_free(buf_buddy_free_t *buf, ulint i) { mysql_mutex_assert_owner(&buf_pool.mutex); ut_ad(buf_pool.zip_free[i].start != buf); - buf_buddy_stamp_free(buf, i); UT_LIST_ADD_FIRST(buf_pool.zip_free[i], buf); ut_d(buf_buddy_list_validate(i)); @@ -272,9 +283,7 @@ buf_buddy_add_to_free(buf_buddy_free_t* buf, ulint i) /** Remove a block from the appropriate buddy free list. @param[in,out] buf block to be freed @param[in] i index of buf_pool.zip_free[] */ -UNIV_INLINE -void -buf_buddy_remove_from_free(buf_buddy_free_t* buf, ulint i) +static void buf_buddy_remove_from_free(buf_buddy_free_t *buf, ulint i) { mysql_mutex_assert_owner(&buf_pool.mutex); ut_ad(buf_buddy_check_free(buf, i)); @@ -298,13 +307,10 @@ static buf_buddy_free_t* buf_buddy_alloc_zip(ulint i) buf = UT_LIST_GET_FIRST(buf_pool.zip_free[i]); - if (buf_pool.is_shrinking() - && UT_LIST_GET_LEN(buf_pool.withdraw) - < buf_pool.withdraw_target) { - + if (size_t size = buf_pool.shrinking_size()) { while (buf != NULL && buf_pool.will_be_withdrawn( - reinterpret_cast(buf))) { + reinterpret_cast(buf), size)) { /* This should be withdrawn, not to be allocated */ buf = UT_LIST_GET_NEXT(list, buf); } @@ -312,6 +318,7 @@ static buf_buddy_free_t* buf_buddy_alloc_zip(ulint i) if (buf) { buf_buddy_remove_from_free(buf, i); + ut_ad(!buf_pool.contains_zip(buf, BUF_BUDDY_LOW_SHIFT + i)); } else if (i + 1 < BUF_BUDDY_SIZES) { /* Attempt to split. */ buf = buf_buddy_alloc_zip(i + 1); @@ -321,7 +328,6 @@ static buf_buddy_free_t* buf_buddy_alloc_zip(ulint i) reinterpret_cast( reinterpret_cast(buf) + (BUF_BUDDY_LOW << i)); - ut_ad(!buf_pool.contains_zip(buddy)); buf_buddy_add_to_free(buddy, i); } } @@ -340,74 +346,52 @@ static buf_buddy_free_t* buf_buddy_alloc_zip(ulint i) return(buf); } +#ifdef UNIV_DEBUG +/** number of blocks allocated to the buddy system */ +static size_t buf_buddy_n_frames; +#endif + /** Deallocate a buffer frame of srv_page_size. @param buf buffer frame to deallocate */ static void buf_buddy_block_free(void *buf) noexcept { mysql_mutex_assert_owner(&buf_pool.mutex); - ut_a(!ut_align_offset(buf, srv_page_size)); - - const ulint fold= BUF_POOL_ZIP_FOLD_PTR(buf); - buf_page_t **prev= buf_pool.zip_hash.cell_get(fold)-> - search(&buf_page_t::hash, [buf](const buf_page_t *b) - { - ut_ad(b->in_zip_hash); - ut_ad(b->state() == buf_page_t::MEMORY); - return b->frame == buf; - }); - - buf_page_t *bpage= *prev; - ut_a(bpage); - ut_a(bpage->frame == buf); - ut_d(bpage->in_zip_hash= false); - *prev= bpage->hash; - bpage->hash= nullptr; - + buf_block_t *block= buf_pool.block_from(buf); + ut_ad(block->page.state() == buf_page_t::MEMORY); + ut_ad(block->page.frame == buf); + ut_ad(!buf_pool.contains_zip(buf, srv_page_size_shift)); ut_d(memset(buf, 0, srv_page_size)); MEM_UNDEFINED(buf, srv_page_size); - - buf_LRU_block_free_non_file_page(reinterpret_cast(bpage)); - ut_ad(buf_pool.buddy_n_frames > 0); - ut_d(buf_pool.buddy_n_frames--); + buf_LRU_block_free_non_file_page(block); + ut_ad(buf_buddy_n_frames > 0); + ut_d(buf_buddy_n_frames--); } /** Allocate a buffer block to the buddy allocator. @param block buffer block to register */ static void buf_buddy_block_register(buf_block_t *block) noexcept { - const ulint fold= BUF_POOL_ZIP_FOLD(block); + ut_ad(buf_pool.is_uncompressed_current(block)); ut_ad(block->page.state() == buf_page_t::MEMORY); - - ut_a(block->page.frame); - ut_a(!ut_align_offset(block->page.frame, srv_page_size)); - - ut_ad(!block->page.in_zip_hash); - ut_d(block->page.in_zip_hash= true); - buf_pool.zip_hash.cell_get(fold)->append(block->page, &buf_page_t::hash); - ut_d(buf_pool.buddy_n_frames++); + ut_d(buf_buddy_n_frames++); } /** Allocate a block from a bigger object. @param[in] buf a block that is free to use @param[in] i index of buf_pool.zip_free[] -@param[in] j size of buf as an index of buf_pool.zip_free[] @return allocated block */ -static -void* -buf_buddy_alloc_from(void* buf, ulint i, ulint j) +static void *buf_buddy_alloc_from(void *buf, ulint i) { - ulint offs = BUF_BUDDY_LOW << j; - ut_ad(j <= BUF_BUDDY_SIZES); ut_ad(i >= buf_buddy_get_slot(UNIV_ZIP_SIZE_MIN)); - ut_ad(j >= i); - ut_ad(!ut_align_offset(buf, offs)); + ut_ad(i <= BUF_BUDDY_SIZES); + ut_ad(!ut_align_offset(buf, srv_page_size)); + ut_ad(!buf_pool.contains_zip(buf, srv_page_size)); /* Add the unused parts of the block to the free lists. */ - while (j > i) { + for (ulint j = BUF_BUDDY_SIZES, offs = srv_page_size; j-- > i; ) { buf_buddy_free_t* zip_buf; offs >>= 1; - j--; zip_buf = reinterpret_cast( reinterpret_cast(buf) + offs); @@ -422,7 +406,7 @@ buf_buddy_alloc_from(void* buf, ulint i, ulint j) @param i index of buf_pool.zip_free[] or BUF_BUDDY_SIZES @param lru assigned to true if buf_pool.mutex was temporarily released @return allocated block, never NULL */ -byte *buf_buddy_alloc_low(ulint i, bool *lru) +byte *buf_buddy_alloc_low(ulint i, bool *lru) noexcept { buf_block_t* block; @@ -439,7 +423,7 @@ byte *buf_buddy_alloc_low(ulint i, bool *lru) } /* Try allocating from the buf_pool.free list. */ - block = buf_LRU_get_free_only(); + block = buf_pool.allocate(); if (block) { goto alloc_big; @@ -455,21 +439,21 @@ alloc_big: buf_buddy_block_register(block); block = reinterpret_cast( - buf_buddy_alloc_from(block->page.frame, i, BUF_BUDDY_SIZES)); + buf_buddy_alloc_from(block->page.frame, i)); func_exit: buf_pool.buddy_stat[i].used++; return reinterpret_cast(block); } -/** Try to relocate a block. The caller must hold zip_free_mutex, and this -function will release and lock it again. +/** Try to relocate a block. @param[in] src block to relocate @param[in] dst free block to relocated to @param[in] i index of buf_pool.zip_free[] @param[in] force true if we must relocated always @return true if relocated */ -static bool buf_buddy_relocate(void* src, void* dst, ulint i, bool force) +static bool buf_buddy_relocate(void *src, void *dst, ulint i, bool force) + noexcept { buf_page_t* bpage; const ulint size = BUF_BUDDY_LOW << i; @@ -575,7 +559,7 @@ static bool buf_buddy_relocate(void* src, void* dst, ulint i, bool force) @param[in] buf block to be freed, must not be pointed to by the buffer pool @param[in] i index of buf_pool.zip_free[], or BUF_BUDDY_SIZES */ -void buf_buddy_free_low(void* buf, ulint i) +void buf_buddy_free_low(void* buf, ulint i) noexcept { buf_buddy_free_t* buddy; @@ -595,13 +579,12 @@ recombine: ut_ad(i < BUF_BUDDY_SIZES); ut_ad(buf == ut_align_down(buf, BUF_BUDDY_LOW << i)); - ut_ad(!buf_pool.contains_zip(buf)); + ut_ad(!buf_pool.contains_zip(buf, BUF_BUDDY_LOW_SHIFT + i)); /* Do not recombine blocks if there are few free blocks. We may waste up to 15360*max_len bytes to free blocks (1024 + 2048 + 4096 + 8192 = 15360) */ - if (UT_LIST_GET_LEN(buf_pool.zip_free[i]) < 16 - && !buf_pool.is_shrinking()) { + if (UT_LIST_GET_LEN(buf_pool.zip_free[i]) < 16) { goto func_exit; } @@ -615,10 +598,9 @@ recombine: /* The buddy is free: recombine */ buf_buddy_remove_from_free(buddy, i); buddy_is_free: - ut_ad(!buf_pool.contains_zip(buddy)); i++; buf = ut_align_down(buf, BUF_BUDDY_LOW << i); - + ut_ad(!buf_pool.contains_zip(buf, BUF_BUDDY_LOW_SHIFT + i)); goto recombine; case BUF_BUDDY_STATE_USED: @@ -655,107 +637,125 @@ func_exit: buf_buddy_add_to_free(reinterpret_cast(buf), i); } -/** Try to reallocate a block. -@param[in] buf buf_pool block to be reallocated -@param[in] size block size, up to srv_page_size -@return whether the reallocation succeeded */ -bool -buf_buddy_realloc(void* buf, ulint size) +/** Reallocate a ROW_FORMAT=COMPRESSED page frame during buf_pool_t::resize(). +@param bpage page descriptor covering a ROW_FORMAT=COMPRESSED page +@param block uncompressed block for storage +@return block +@retval nullptr if the block was consumed */ +ATTRIBUTE_COLD +buf_block_t *buf_buddy_shrink(buf_page_t *bpage, buf_block_t *block) noexcept { - buf_block_t* block = NULL; - ulint i = buf_buddy_get_slot(size); + ut_ad(bpage->zip.data); - mysql_mutex_assert_owner(&buf_pool.mutex); - ut_ad(i <= BUF_BUDDY_SIZES); - ut_ad(i >= buf_buddy_get_slot(UNIV_ZIP_SIZE_MIN)); + void *dst= nullptr; + ulint size= page_zip_get_size(&bpage->zip); + ulint i= buf_buddy_get_slot(size); - if (i < BUF_BUDDY_SIZES) { - /* Try to allocate from the buddy system. */ - block = reinterpret_cast(buf_buddy_alloc_zip(i)); - } + ut_ad(buf_pool.will_be_withdrawn(bpage->zip.data, size)); + ut_ad(bpage->can_relocate()); + ut_ad(i <= BUF_BUDDY_SIZES); + ut_ad(i >= buf_buddy_get_slot(UNIV_ZIP_SIZE_MIN)); - if (block == NULL) { - /* Try allocating from the buf_pool.free list. */ - block = buf_LRU_get_free_only(); + if (UNIV_LIKELY(i < BUF_BUDDY_SIZES)) + dst= buf_buddy_alloc_zip(i); - if (block == NULL) { - return(false); /* free_list was not enough */ - } + if (!dst) + { + buf_buddy_block_register(block); + dst= buf_buddy_alloc_from(block->page.frame, i); + ut_ad(dst); + block= nullptr; + } - buf_buddy_block_register(block); + void *src= bpage->zip.data; + memcpy_aligned(dst, src, size); + bpage->zip.data= static_cast(dst); + buf_pool.buddy_stat[i].relocated++; - block = reinterpret_cast( - buf_buddy_alloc_from( - block->page.frame, i, BUF_BUDDY_SIZES)); - } + for (;;) + { + MEM_UNDEFINED(src, BUF_BUDDY_LOW << i); + ut_ad(i < BUF_BUDDY_SIZES); + /* Try to combine adjacent blocks. */ + buf_buddy_free_t *buddy= reinterpret_cast + (buf_buddy_get(static_cast(src), BUF_BUDDY_LOW << i)); - buf_pool.buddy_stat[i].used++; + if (buf_buddy_is_free(buddy, i) != BUF_BUDDY_STATE_FREE) + { + ut_ad(!buf_pool.contains_zip(src, BUF_BUDDY_LOW_SHIFT + i)); + buf_buddy_add_to_free(static_cast(src), i); + break; + } - /* Try to relocate the buddy of buf to the free block. */ - if (buf_buddy_relocate(buf, block, i, true)) { - /* succeeded */ - buf_buddy_free_low(buf, i); - } else { - /* failed */ - buf_buddy_free_low(block, i); - } + /* The buddy is free: recombine */ + buf_buddy_remove_from_free(buddy, i); + i++; + src= ut_align_down(src, BUF_BUDDY_LOW << i); + if (i == BUF_BUDDY_SIZES) + { + buf_buddy_block_free(src); + break; + } + } - return(true); /* free_list was enough */ + return block; } -/** Combine all pairs of free buddies. */ -void buf_buddy_condense_free() +/** Combine all pairs of free buddies. +@param size the target innodb_buffer_pool_size */ +ATTRIBUTE_COLD void buf_buddy_condense_free(size_t size) noexcept { - mysql_mutex_assert_owner(&buf_pool.mutex); - ut_ad(buf_pool.is_shrinking()); + ut_ad(size); + ut_ad(size == buf_pool.shrinking_size()); - for (ulint i = 0; i < UT_ARR_SIZE(buf_pool.zip_free); ++i) { - buf_buddy_free_t* buf = - UT_LIST_GET_FIRST(buf_pool.zip_free[i]); + for (ulint i= 0; i < array_elements(buf_pool.zip_free); i++) + { + buf_buddy_free_t *buf= UT_LIST_GET_FIRST(buf_pool.zip_free[i]); - /* seek to withdraw target */ - while (buf != NULL - && !buf_pool.will_be_withdrawn( - reinterpret_cast(buf))) { - buf = UT_LIST_GET_NEXT(list, buf); - } + /* seek to withdraw target */ + while (buf && + !buf_pool.will_be_withdrawn(reinterpret_cast(buf), size)) + buf= UT_LIST_GET_NEXT(list, buf); - while (buf != NULL) { - buf_buddy_free_t* next = - UT_LIST_GET_NEXT(list, buf); + for (buf_buddy_free_t *next= buf; buf; buf= next) + { + buf_buddy_free_t *buddy= reinterpret_cast + (buf_buddy_get(reinterpret_cast(buf), BUF_BUDDY_LOW << i)); - buf_buddy_free_t* buddy = - reinterpret_cast( - buf_buddy_get( - reinterpret_cast(buf), - BUF_BUDDY_LOW << i)); + /* seek to the next withdraw target */ + do + { + while ((next= UT_LIST_GET_NEXT(list, next)) && + !buf_pool.will_be_withdrawn(reinterpret_cast(next), + size)) {} + } + while (buddy == next); - /* seek to the next withdraw target */ - while (true) { - while (next != NULL - && !buf_pool.will_be_withdrawn( - reinterpret_cast(next))) { - next = UT_LIST_GET_NEXT(list, next); - } + if (buf_buddy_is_free(buddy, i) != BUF_BUDDY_STATE_FREE) + continue; - if (buddy != next) { - break; - } + buf_buddy_remove_from_free(buf, i); + ulint j= i; + recombine: + buf_buddy_remove_from_free(buddy, j); + j++; + buf= static_cast + (ut_align_down(buf, BUF_BUDDY_LOW << j)); + MEM_UNDEFINED(buf, BUF_BUDDY_LOW << j); - next = UT_LIST_GET_NEXT(list, next); - } + if (j == BUF_BUDDY_SIZES) + { + buf_buddy_block_free(buf); + continue; + } - if (buf_buddy_is_free(buddy, i) - == BUF_BUDDY_STATE_FREE) { - /* Both buf and buddy are free. - Try to combine them. */ - buf_buddy_remove_from_free(buf, i); - buf_pool.buddy_stat[i].used++; + buddy= reinterpret_cast + (buf_buddy_get(reinterpret_cast(buf), BUF_BUDDY_LOW << j)); + if (buf_buddy_is_free(buddy, j) == BUF_BUDDY_STATE_FREE) + goto recombine; - buf_buddy_free_low(buf, i); - } - - buf = next; - } - } + ut_ad(!buf_pool.contains_zip(buf, BUF_BUDDY_LOW_SHIFT + j)); + buf_buddy_add_to_free(buf, j); + } + } } diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 20222631434..27c7f2f584e 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -47,8 +47,6 @@ Created 11/5/1995 Heikki Tuuri #include "lock0lock.h" #include "btr0sea.h" #include "ibuf0ibuf.h" -#include "trx0undo.h" -#include "trx0purge.h" #include "log0log.h" #include "dict0stats_bg.h" #include "srv0srv.h" @@ -64,6 +62,7 @@ Created 11/5/1995 Heikki Tuuri #include #include #include "log.h" +#include "my_virtual_mem.h" using st_::span; @@ -277,6 +276,56 @@ the read requests for the whole area. */ #ifndef UNIV_INNOCHECKSUM +/** Compute the number of page frames needed for buf_block_t, +per innodb_buffer_pool_extent_size. +@param ps innodb_page_size +@return number of buf_block_t frames per extent */ +static constexpr uint8_t first_page(size_t ps) +{ + return uint8_t(innodb_buffer_pool_extent_size / ps - + innodb_buffer_pool_extent_size / (ps + sizeof(buf_block_t))); +} + +/** Compute the number of bytes needed for buf_block_t, +per innodb_buffer_pool_extent_size. +@param ps innodb_page_size +@return number of buf_block_t frames per extent */ +static constexpr size_t first_frame(size_t ps) +{ + return first_page(ps) * ps; +} + +/** Compute the number of pages per innodb_buffer_pool_extent_size. +@param ps innodb_page_size +@return number of buf_block_t frames per extent */ +static constexpr uint16_t pages(size_t ps) +{ + return uint16_t(innodb_buffer_pool_extent_size / ps - first_page(ps)); +} + +/** The byte offset of the first page frame in a buffer pool extent +of innodb_buffer_pool_extent_size bytes */ +static constexpr size_t first_frame_in_extent[]= +{ + first_frame(4096), first_frame(8192), first_frame(16384), + first_frame(32768), first_frame(65536) +}; + +/** The position offset of the first page frame in a buffer pool extent +of innodb_buffer_pool_extent_size bytes */ +static constexpr uint8_t first_page_in_extent[]= +{ + first_page(4096), first_page(8192), first_page(16384), + first_page(32768), first_page(65536) +}; + +/** Number of pages per buffer pool extent +of innodb_buffer_pool_extent_size bytes */ +static constexpr size_t pages_in_extent[]= +{ + pages(4096), pages(8192), pages(16384), pages(32768), pages(65536) +}; + # ifdef SUX_LOCK_GENERIC void page_hash_latch::read_lock_wait() noexcept { @@ -326,8 +375,6 @@ const byte *field_ref_zero; /** The InnoDB buffer pool */ buf_pool_t buf_pool; -buf_pool_t::chunk_t::map *buf_pool_t::chunk_t::map_reg; -buf_pool_t::chunk_t::map *buf_pool_t::chunk_t::map_ref; #ifdef UNIV_DEBUG /** This is used to insert validation operations in execution @@ -797,6 +844,11 @@ public: bool setup() { + m_num_fds= 0; + + if (my_use_large_pages) + return false; + static_assert(array_elements(m_fds) == (array_elements(m_triggers) + 1), "insufficient fds"); std::string memcgroup{"/sys/fs/cgroup"}; @@ -809,7 +861,6 @@ public: cgroup.erase(0, 3); // Remove "0::" memcgroup+= cgroup + "/memory.pressure"; - m_num_fds= 0; for (auto trig= std::begin(m_triggers); trig!= std::end(m_triggers); ++trig) { if ((m_fds[m_num_fds].fd= @@ -958,1163 +1009,17 @@ void mem_pressure::pressure_routine(mem_pressure *m) } /** Initialize mem pressure. */ -ATTRIBUTE_COLD void buf_mem_pressure_detect_init() +ATTRIBUTE_COLD static void buf_mem_pressure_detect_init() noexcept { mem_pressure_obj.setup(); } -ATTRIBUTE_COLD void buf_mem_pressure_shutdown() +ATTRIBUTE_COLD void buf_mem_pressure_shutdown() noexcept { mem_pressure_obj.join(); } -#endif /* __linux__ */ -#if defined(DBUG_OFF) && defined(HAVE_MADVISE) && defined(MADV_DODUMP) -/** Enable buffers to be dumped to core files - -A convience function, not called anyhwere directly however -it is left available for gdb or any debugger to call -in the event that you want all of the memory to be dumped -to a core file. - -Returns number of errors found in madvise calls. */ -MY_ATTRIBUTE((used)) -int -buf_madvise_do_dump() -{ - int ret= 0; - - /* mirrors allocation in log_t::create() */ - if (log_sys.buf) { - ret += madvise(log_sys.buf, log_sys.buf_size, MADV_DODUMP); - ret += madvise(log_sys.flush_buf, log_sys.buf_size, - MADV_DODUMP); - } - - mysql_mutex_lock(&buf_pool.mutex); - auto chunk = buf_pool.chunks; - - for (ulint n = buf_pool.n_chunks; n--; chunk++) { - ret+= madvise(chunk->mem, chunk->mem_size(), MADV_DODUMP); - } - - mysql_mutex_unlock(&buf_pool.mutex); - return ret; -} -#endif - -#ifndef UNIV_DEBUG -static inline byte hex_to_ascii(byte hex_digit) -{ - const int offset= hex_digit <= 9 ? '0' : 'a' - 10; - return byte(hex_digit + offset); -} -#endif - -/** Dump a page to stderr. -@param[in] read_buf database page -@param[in] zip_size compressed page size, or 0 */ -ATTRIBUTE_COLD -void buf_page_print(const byte *read_buf, ulint zip_size) noexcept -{ -#ifndef UNIV_DEBUG - const size_t size = zip_size ? zip_size : srv_page_size; - const byte * const end= read_buf + size; - sql_print_information("InnoDB: Page dump (%zu bytes):", size); - - do - { - byte row[64]; - - for (byte *r= row; r != &row[64]; r+= 2, read_buf++) - { - r[0]= hex_to_ascii(byte(*read_buf >> 4)); - r[1]= hex_to_ascii(*read_buf & 15); - } - - sql_print_information("InnoDB: %.*s", 64, row); - } - while (read_buf != end); - - sql_print_information("InnoDB: End of page dump"); -#endif -} - -/** Initialize a buffer page descriptor. -@param[in,out] block buffer page descriptor -@param[in] frame buffer page frame */ -static -void -buf_block_init(buf_block_t* block, byte* frame) -{ - /* This function should only be executed at database startup or by - buf_pool.resize(). Either way, adaptive hash index must not exist. */ - assert_block_ahi_empty_on_init(block); - - block->page.frame = frame; - - MEM_MAKE_DEFINED(&block->modify_clock, sizeof block->modify_clock); - ut_ad(!block->modify_clock); - MEM_MAKE_DEFINED(&block->page.lock, sizeof block->page.lock); - block->page.lock.init(); - block->page.init(buf_page_t::NOT_USED, page_id_t(~0ULL)); -#ifdef BTR_CUR_HASH_ADAPT - MEM_MAKE_DEFINED(&block->index, sizeof block->index); - ut_ad(!block->index); -#endif /* BTR_CUR_HASH_ADAPT */ - ut_d(block->in_unzip_LRU_list = false); - ut_d(block->in_withdraw_list = false); - - page_zip_des_init(&block->page.zip); - - MEM_MAKE_DEFINED(&block->page.hash, sizeof block->page.hash); - ut_ad(!block->page.hash); -} - -/** Allocate a chunk of buffer frames. -@param bytes requested size -@return whether the allocation succeeded */ -inline bool buf_pool_t::chunk_t::create(size_t bytes) noexcept -{ - DBUG_EXECUTE_IF("ib_buf_chunk_init_fails", return false;); - /* Round down to a multiple of page size, although it already should be. */ - bytes= ut_2pow_round(bytes, srv_page_size); - - mem= buf_pool.allocator.allocate_large_dontdump(bytes, &mem_pfx); - - if (UNIV_UNLIKELY(!mem)) - return false; - - MEM_UNDEFINED(mem, mem_size()); - -#ifdef HAVE_LIBNUMA - if (srv_numa_interleave) - { - struct bitmask *numa_mems_allowed= numa_get_mems_allowed(); - MEM_MAKE_DEFINED(numa_mems_allowed, sizeof *numa_mems_allowed); - if (mbind(mem, mem_size(), MPOL_INTERLEAVE, - numa_mems_allowed->maskp, numa_mems_allowed->size, - MPOL_MF_MOVE)) - { - ib::warn() << "Failed to set NUMA memory policy of" - " buffer pool page frames to MPOL_INTERLEAVE" - " (error: " << strerror(errno) << ")."; - } - numa_bitmask_free(numa_mems_allowed); - } -#endif /* HAVE_LIBNUMA */ - - - /* Allocate the block descriptors from - the start of the memory block. */ - blocks= reinterpret_cast(mem); - - /* Align a pointer to the first frame. Note that when - opt_large_page_size is smaller than srv_page_size, - (with max srv_page_size at 64k don't think any hardware - makes this true), - we may allocate one fewer block than requested. When - it is bigger, we may allocate more blocks than requested. */ - static_assert(sizeof(byte*) == sizeof(ulint), "pointer size"); - - byte *frame= reinterpret_cast((reinterpret_cast(mem) + - srv_page_size - 1) & - ~ulint{srv_page_size - 1}); - size= (mem_pfx.m_size >> srv_page_size_shift) - (frame != mem); - - /* Subtract the space needed for block descriptors. */ - { - ulint s= size; - - while (frame < reinterpret_cast(blocks + s)) - { - frame+= srv_page_size; - s--; - } - - size= s; - } - - /* Init block structs and assign frames for them. Then we assign the - frames to the first blocks (we already mapped the memory above). */ - - buf_block_t *block= blocks; - - for (auto i= size; i--; ) { - buf_block_init(block, frame); - MEM_UNDEFINED(block->page.frame, srv_page_size); - /* Add the block to the free list */ - UT_LIST_ADD_LAST(buf_pool.free, &block->page); - - ut_d(block->page.in_free_list = TRUE); - block++; - frame+= srv_page_size; - } - - reg(); - - return true; -} - -#ifdef UNIV_DEBUG -/** Check that all file pages in the buffer chunk are in a replaceable state. -@return address of a non-free block -@retval nullptr if all freed */ -inline const buf_block_t *buf_pool_t::chunk_t::not_freed() const noexcept -{ - buf_block_t *block= blocks; - for (auto i= size; i--; block++) - { - if (block->page.in_file()) - { - /* The uncompressed buffer pool should never - contain ROW_FORMAT=COMPRESSED block descriptors. */ - ut_ad(block->page.frame); - const lsn_t lsn= block->page.oldest_modification(); - - if (srv_read_only_mode) - { - /* The page cleaner is disabled in read-only mode. No pages - can be dirtied, so all of them must be clean. */ - ut_ad(lsn == 0 || lsn == recv_sys.lsn || - srv_force_recovery == SRV_FORCE_NO_LOG_REDO); - break; - } - - if (fsp_is_system_temporary(block->page.id().space())) - { - ut_ad(lsn == 0 || lsn == 2); - break; - } - - if (lsn > 1 || !block->page.can_relocate()) - return block; - - break; - } - } - - return nullptr; -} -#endif /* UNIV_DEBUG */ - -/** Create the hash table. -@param n the lower bound of n_cells */ -void buf_pool_t::page_hash_table::create(ulint n) noexcept -{ - n_cells= ut_find_prime(n); - const size_t size= MY_ALIGN(pad(n_cells) * sizeof *array, - CPU_LEVEL1_DCACHE_LINESIZE); - void *v= aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE); - memset_aligned(v, 0, size); - array= static_cast(v); -} - -/** Create the buffer pool. -@return whether the creation failed */ -bool buf_pool_t::create() -{ - ut_ad(this == &buf_pool); - ut_ad(srv_buf_pool_size % srv_buf_pool_chunk_unit == 0); - ut_ad(!is_initialised()); - ut_ad(srv_buf_pool_size > 0); - ut_ad(!resizing); - ut_ad(!chunks_old); - /* mariabackup loads tablespaces, and it requires field_ref_zero to be - allocated before innodb initialization */ - ut_ad(srv_operation >= SRV_OPERATION_RESTORE || !field_ref_zero); - - NUMA_MEMPOLICY_INTERLEAVE_IN_SCOPE; - - if (!field_ref_zero) { - if (auto b= aligned_malloc(UNIV_PAGE_SIZE_MAX, 4096)) - field_ref_zero= static_cast - (memset_aligned<4096>(b, 0, UNIV_PAGE_SIZE_MAX)); - else - return true; - } - - chunk_t::map_reg= UT_NEW_NOKEY(chunk_t::map()); - - new(&allocator) ut_allocator(mem_key_buf_buf_pool); - - n_chunks= srv_buf_pool_size / srv_buf_pool_chunk_unit; - const size_t chunk_size= srv_buf_pool_chunk_unit; - - chunks= static_cast(ut_zalloc_nokey(n_chunks * sizeof *chunks)); - UT_LIST_INIT(free, &buf_page_t::list); - curr_size= 0; - auto chunk= chunks; - - do - { - if (!chunk->create(chunk_size)) - { - while (--chunk >= chunks) - { - buf_block_t* block= chunk->blocks; - - for (auto i= chunk->size; i--; block++) - block->page.lock.free(); - - allocator.deallocate_large_dodump(chunk->mem, &chunk->mem_pfx); - } - ut_free(chunks); - chunks= nullptr; - UT_DELETE(chunk_t::map_reg); - chunk_t::map_reg= nullptr; - aligned_free(const_cast(field_ref_zero)); - field_ref_zero= nullptr; - ut_ad(!is_initialised()); - return true; - } - - curr_size+= chunk->size; - } - while (++chunk < chunks + n_chunks); - - ut_ad(is_initialised()); -#if defined(__aarch64__) - mysql_mutex_init(buf_pool_mutex_key, &mutex, MY_MUTEX_INIT_FAST); -#else - mysql_mutex_init(buf_pool_mutex_key, &mutex, nullptr); -#endif - - UT_LIST_INIT(LRU, &buf_page_t::LRU); - UT_LIST_INIT(withdraw, &buf_page_t::list); - withdraw_target= 0; - UT_LIST_INIT(flush_list, &buf_page_t::list); - UT_LIST_INIT(unzip_LRU, &buf_block_t::unzip_LRU); - - for (size_t i= 0; i < UT_ARR_SIZE(zip_free); ++i) - UT_LIST_INIT(zip_free[i], &buf_buddy_free_t::list); - ulint s= curr_size; - s/= BUF_READ_AHEAD_PORTION; - read_ahead_area= s >= READ_AHEAD_PAGES - ? READ_AHEAD_PAGES - : my_round_up_to_next_power(static_cast(s)); - curr_pool_size= srv_buf_pool_size; - - n_chunks_new= n_chunks; - - page_hash.create(2 * curr_size); - zip_hash.create(2 * curr_size); - last_printout_time= time(NULL); - - mysql_mutex_init(flush_list_mutex_key, &flush_list_mutex, - MY_MUTEX_INIT_FAST); - - pthread_cond_init(&done_flush_LRU, nullptr); - pthread_cond_init(&done_flush_list, nullptr); - pthread_cond_init(&do_flush_list, nullptr); - pthread_cond_init(&done_free, nullptr); - - try_LRU_scan= true; - - ut_d(flush_hp.m_mutex= &flush_list_mutex;); - ut_d(lru_hp.m_mutex= &mutex); - ut_d(lru_scan_itr.m_mutex= &mutex); - - io_buf.create((srv_n_read_io_threads + srv_n_write_io_threads) * - OS_AIO_N_PENDING_IOS_PER_THREAD); - - /* FIXME: remove some of these variables */ - srv_buf_pool_curr_size= curr_pool_size; - srv_buf_pool_old_size= srv_buf_pool_size; - srv_buf_pool_base_size= srv_buf_pool_size; - - last_activity_count= srv_get_activity_count(); - - chunk_t::map_ref= chunk_t::map_reg; - buf_LRU_old_ratio_update(100 * 3 / 8, false); - btr_search_sys_create(); - -#ifdef __linux__ - if (srv_operation == SRV_OPERATION_NORMAL) - buf_mem_pressure_detect_init(); -#endif - ut_ad(is_initialised()); - return false; -} - -/** Clean up after successful create() */ -void buf_pool_t::close() noexcept -{ - ut_ad(this == &buf_pool); - if (!is_initialised()) - return; - - mysql_mutex_destroy(&mutex); - mysql_mutex_destroy(&flush_list_mutex); - - for (buf_page_t *bpage= UT_LIST_GET_LAST(LRU), *prev_bpage= nullptr; bpage; - bpage= prev_bpage) - { - prev_bpage= UT_LIST_GET_PREV(LRU, bpage); - ut_ad(bpage->in_file()); - ut_ad(bpage->in_LRU_list); - /* The buffer pool must be clean during normal shutdown. - Only on aborted startup (with recovery) or with innodb_fast_shutdown=2 - we may discard changes. */ - ut_d(const lsn_t oldest= bpage->oldest_modification();) - ut_ad(fsp_is_system_temporary(bpage->id().space()) - ? (oldest == 0 || oldest == 2) - : oldest <= 1 || srv_is_being_started || srv_fast_shutdown == 2); - - if (UNIV_UNLIKELY(!bpage->frame)) - { - bpage->lock.free(); - ut_free(bpage); - } - } - - for (auto chunk= chunks + n_chunks; --chunk >= chunks; ) - { - buf_block_t *block= chunk->blocks; - - for (auto i= chunk->size; i--; block++) - block->page.lock.free(); - - allocator.deallocate_large_dodump(chunk->mem, &chunk->mem_pfx); - } - - pthread_cond_destroy(&done_flush_LRU); - pthread_cond_destroy(&done_flush_list); - pthread_cond_destroy(&do_flush_list); - pthread_cond_destroy(&done_free); - - ut_free(chunks); - chunks= nullptr; - page_hash.free(); - zip_hash.free(); - - io_buf.close(); - UT_DELETE(chunk_t::map_reg); - chunk_t::map_reg= chunk_t::map_ref= nullptr; - aligned_free(const_cast(field_ref_zero)); - field_ref_zero= nullptr; -} - -/** Try to reallocate a control block. -@param block control block to reallocate -@return whether the reallocation succeeded */ -inline bool buf_pool_t::realloc(buf_block_t *block) noexcept -{ - buf_block_t* new_block; - - mysql_mutex_assert_owner(&mutex); - ut_ad(block->page.in_file()); - ut_ad(block->page.frame); - - new_block = buf_LRU_get_free_only(); - - if (new_block == NULL) { - mysql_mutex_lock(&buf_pool.flush_list_mutex); - page_cleaner_wakeup(); - mysql_mutex_unlock(&buf_pool.flush_list_mutex); - return(false); /* free list was not enough */ - } - - const page_id_t id{block->page.id()}; - hash_chain& chain = page_hash.cell_get(id.fold()); - page_hash_latch& hash_lock = page_hash.lock_get(chain); - /* It does not make sense to use transactional_lock_guard - here, because copying innodb_page_size (4096 to 65536) bytes - as well as other changes would likely make the memory - transaction too large. */ - hash_lock.lock(); - - if (block->page.can_relocate()) { - memcpy_aligned( - new_block->page.frame, block->page.frame, - srv_page_size); - mysql_mutex_lock(&buf_pool.flush_list_mutex); - const auto frame = new_block->page.frame; - new_block->page.lock.free(); - new (&new_block->page) buf_page_t(block->page); - new_block->page.frame = frame; - - /* relocate LRU list */ - if (buf_page_t* prev_b = buf_pool.LRU_remove(&block->page)) { - UT_LIST_INSERT_AFTER(LRU, prev_b, &new_block->page); - } else { - UT_LIST_ADD_FIRST(LRU, &new_block->page); - } - - if (LRU_old == &block->page) { - LRU_old = &new_block->page; - } - - ut_ad(new_block->page.in_LRU_list); - - /* relocate unzip_LRU list */ - if (block->page.zip.data != NULL) { - ut_ad(block->in_unzip_LRU_list); - ut_d(new_block->in_unzip_LRU_list = true); - - buf_block_t* prev_block = UT_LIST_GET_PREV(unzip_LRU, block); - UT_LIST_REMOVE(unzip_LRU, block); - - ut_d(block->in_unzip_LRU_list = false); - block->page.zip.data = NULL; - page_zip_set_size(&block->page.zip, 0); - - if (prev_block != NULL) { - UT_LIST_INSERT_AFTER(unzip_LRU, prev_block, new_block); - } else { - UT_LIST_ADD_FIRST(unzip_LRU, new_block); - } - } else { - ut_ad(!block->in_unzip_LRU_list); - ut_d(new_block->in_unzip_LRU_list = false); - } - - /* relocate page_hash */ - hash_chain& chain = page_hash.cell_get(id.fold()); - ut_ad(&block->page == page_hash.get(id, chain)); - buf_pool.page_hash.replace(chain, &block->page, - &new_block->page); - buf_block_modify_clock_inc(block); - static_assert(FIL_PAGE_OFFSET % 4 == 0, "alignment"); - memset_aligned<4>(block->page.frame - + FIL_PAGE_OFFSET, 0xff, 4); - static_assert(FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID % 4 == 2, - "not perfect alignment"); - memset_aligned<2>(block->page.frame - + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, 0xff, 4); - MEM_UNDEFINED(block->page.frame, srv_page_size); - block->page.set_state(buf_page_t::REMOVE_HASH); - if (!fsp_is_system_temporary(id.space())) { - buf_flush_relocate_on_flush_list(&block->page, - &new_block->page); - } - mysql_mutex_unlock(&buf_pool.flush_list_mutex); - block->page.set_corrupt_id(); - - /* set other flags of buf_block_t */ - -#ifdef BTR_CUR_HASH_ADAPT - /* This code should only be executed by resize(), - while the adaptive hash index is disabled. */ - assert_block_ahi_empty(block); - assert_block_ahi_empty_on_init(new_block); - ut_ad(!block->index); - new_block->index = NULL; - new_block->n_hash_helps = 0; - new_block->n_fields = 1; - new_block->left_side = TRUE; -#endif /* BTR_CUR_HASH_ADAPT */ - ut_d(block->page.set_state(buf_page_t::MEMORY)); - /* free block */ - new_block = block; - } - - hash_lock.unlock(); - buf_LRU_block_free_non_file_page(new_block); - return(true); /* free_list was enough */ -} - -void buf_pool_t::io_buf_t::create(ulint n_slots) noexcept -{ - this->n_slots= n_slots; - slots= static_cast - (ut_malloc_nokey(n_slots * sizeof *slots)); - memset((void*) slots, 0, n_slots * sizeof *slots); -} - -void buf_pool_t::io_buf_t::close() noexcept -{ - for (buf_tmp_buffer_t *s= slots, *e= slots + n_slots; s != e; s++) - { - aligned_free(s->crypt_buf); - aligned_free(s->comp_buf); - } - ut_free(slots); - slots= nullptr; - n_slots= 0; -} - -buf_tmp_buffer_t *buf_pool_t::io_buf_t::reserve(bool wait_for_reads) noexcept -{ - for (;;) - { - for (buf_tmp_buffer_t *s= slots, *e= slots + n_slots; s != e; s++) - if (s->acquire()) - return s; - buf_dblwr.flush_buffered_writes(); - os_aio_wait_until_no_pending_writes(true); - if (!wait_for_reads) - continue; - for (buf_tmp_buffer_t *s= slots, *e= slots + n_slots; s != e; s++) - if (s->acquire()) - return s; - os_aio_wait_until_no_pending_reads(true); - } -} - -/** Sets the global variable that feeds MySQL's innodb_buffer_pool_resize_status -to the specified string. The format and the following parameters are the -same as the ones used for printf(3). -@param[in] fmt format -@param[in] ... extra parameters according to fmt */ -static -void -buf_resize_status( - const char* fmt, - ...) -{ - va_list ap; - - va_start(ap, fmt); - - vsnprintf( - export_vars.innodb_buffer_pool_resize_status, - sizeof(export_vars.innodb_buffer_pool_resize_status), - fmt, ap); - - va_end(ap); - - ib::info() << export_vars.innodb_buffer_pool_resize_status; -} - -/** Withdraw blocks from the buffer pool until meeting withdraw_target. -@return whether retry is needed */ -inline bool buf_pool_t::withdraw_blocks() noexcept -{ - buf_block_t* block; - ulint loop_count = 0; - - ib::info() << "Start to withdraw the last " - << withdraw_target << " blocks."; - - while (UT_LIST_GET_LEN(withdraw) < withdraw_target) { - - /* try to withdraw from free_list */ - ulint count1 = 0; - - mysql_mutex_lock(&mutex); - buf_buddy_condense_free(); - block = reinterpret_cast( - UT_LIST_GET_FIRST(free)); - while (block != NULL - && UT_LIST_GET_LEN(withdraw) < withdraw_target) { - ut_ad(block->page.in_free_list); - ut_ad(!block->page.oldest_modification()); - ut_ad(!block->page.in_LRU_list); - ut_a(!block->page.in_file()); - - buf_block_t* next_block; - next_block = reinterpret_cast( - UT_LIST_GET_NEXT( - list, &block->page)); - - if (will_be_withdrawn(block->page)) { - /* This should be withdrawn */ - UT_LIST_REMOVE(free, &block->page); - UT_LIST_ADD_LAST(withdraw, &block->page); - ut_d(block->in_withdraw_list = true); - count1++; - } - - block = next_block; - } - - /* reserve free_list length */ - if (UT_LIST_GET_LEN(withdraw) < withdraw_target) { - try_LRU_scan = false; - mysql_mutex_unlock(&mutex); - mysql_mutex_lock(&flush_list_mutex); - page_cleaner_wakeup(true); - my_cond_wait(&done_flush_list, - &flush_list_mutex.m_mutex); - mysql_mutex_unlock(&flush_list_mutex); - mysql_mutex_lock(&mutex); - } - - /* relocate blocks/buddies in withdrawn area */ - ulint count2 = 0; - - buf_pool_mutex_exit_forbid(); - for (buf_page_t* bpage = UT_LIST_GET_FIRST(LRU), *next_bpage; - bpage; bpage = next_bpage) { - ut_ad(bpage->in_file()); - next_bpage = UT_LIST_GET_NEXT(LRU, bpage); - if (UNIV_LIKELY_NULL(bpage->zip.data) - && will_be_withdrawn(bpage->zip.data) - && bpage->can_relocate()) { - if (!buf_buddy_realloc( - bpage->zip.data, - page_zip_get_size(&bpage->zip))) { - /* failed to allocate block */ - break; - } - count2++; - if (bpage->frame) { - goto realloc_frame; - } - } - - if (bpage->frame && will_be_withdrawn(*bpage) - && bpage->can_relocate()) { -realloc_frame: - if (!realloc(reinterpret_cast( - bpage))) { - /* failed to allocate block */ - break; - } - count2++; - } - } - buf_pool_mutex_exit_allow(); - mysql_mutex_unlock(&mutex); - - buf_resize_status( - "Withdrawing blocks. (" ULINTPF "/" ULINTPF ").", - UT_LIST_GET_LEN(withdraw), - withdraw_target); - - ib::info() << "Withdrew " - << count1 << " blocks from free list." - << " Tried to relocate " << count2 << " blocks (" - << UT_LIST_GET_LEN(withdraw) << "/" - << withdraw_target << ")."; - - if (++loop_count >= 10) { - /* give up for now. - retried after user threads paused. */ - - ib::info() << "will retry to withdraw later"; - - /* need retry later */ - return(true); - } - } - - /* confirm withdrawn enough */ - for (const chunk_t* chunk = chunks + n_chunks_new, - * const echunk = chunks + n_chunks; chunk != echunk; chunk++) { - block = chunk->blocks; - for (ulint j = chunk->size; j--; block++) { - ut_a(block->page.state() == buf_page_t::NOT_USED); - ut_ad(block->in_withdraw_list); - } - } - - ib::info() << "Withdrawn target: " << UT_LIST_GET_LEN(withdraw) - << " blocks."; - - return(false); -} - - - -inline void buf_pool_t::page_hash_table::write_lock_all() noexcept -{ - for (auto n= pad(n_cells) & ~ELEMENTS_PER_LATCH;; n-= ELEMENTS_PER_LATCH + 1) - { - reinterpret_cast(array[n]).lock(); - if (!n) - break; - } -} - - -inline void buf_pool_t::page_hash_table::write_unlock_all() noexcept -{ - for (auto n= pad(n_cells) & ~ELEMENTS_PER_LATCH;; n-= ELEMENTS_PER_LATCH + 1) - { - reinterpret_cast(array[n]).unlock(); - if (!n) - break; - } -} - - -namespace -{ - -struct find_interesting_trx -{ - void operator()(const trx_t &trx) - { - if (!trx.is_started()) - return; - if (trx.mysql_thd == nullptr) - return; - if (withdraw_started <= trx.start_time_micro) - return; - - if (!found) - { - sql_print_warning("InnoDB: The following trx might hold " - "the blocks in buffer pool to " - "be withdrawn. Buffer pool " - "resizing can complete only " - "after all the transactions " - "below release the blocks."); - found= true; - } - - lock_trx_print_wait_and_mvcc_state(stderr, &trx, current_time); - } - - bool &found; - /** microsecond_interval_timer() */ - const ulonglong withdraw_started; - const my_hrtime_t current_time; -}; - -} // namespace - -/** Resize from srv_buf_pool_old_size to srv_buf_pool_size. */ -inline void buf_pool_t::resize() -{ - ut_ad(this == &buf_pool); - ut_ad(srv_shutdown_state < SRV_SHUTDOWN_CLEANUP); - - bool warning = false; - - NUMA_MEMPOLICY_INTERLEAVE_IN_SCOPE; - - ut_ad(!resize_in_progress()); - ut_ad(srv_buf_pool_chunk_unit > 0); - - ulint new_instance_size = srv_buf_pool_size >> srv_page_size_shift; - std::ostringstream str_old_size, str_new_size, str_chunk_size; - str_old_size << ib::bytes_iec{srv_buf_pool_old_size}; - str_new_size << ib::bytes_iec{srv_buf_pool_size}; - str_chunk_size << ib::bytes_iec{srv_buf_pool_chunk_unit}; - - buf_resize_status("Resizing buffer pool from %s to %s (unit = %s).", - str_old_size.str().c_str(), - str_new_size.str().c_str(), - str_chunk_size.str().c_str()); - -#ifdef BTR_CUR_HASH_ADAPT - /* disable AHI if needed */ - buf_resize_status("Disabling adaptive hash index."); - - btr_search_s_lock_all(); - const bool btr_search_disabled = btr_search_enabled; - btr_search_s_unlock_all(); - - btr_search_disable(); - - if (btr_search_disabled) { - ib::info() << "disabled adaptive hash index."; - } -#endif /* BTR_CUR_HASH_ADAPT */ - - mysql_mutex_lock(&mutex); - ut_ad(n_chunks_new == n_chunks); - ut_ad(UT_LIST_GET_LEN(withdraw) == 0); - - n_chunks_new = (new_instance_size << srv_page_size_shift) - / srv_buf_pool_chunk_unit; - curr_size = n_chunks_new * chunks->size; - mysql_mutex_unlock(&mutex); - - if (is_shrinking()) { - /* set withdraw target */ - size_t w = 0; - - for (const chunk_t* chunk = chunks + n_chunks_new, - * const echunk = chunks + n_chunks; - chunk != echunk; chunk++) - w += chunk->size; - - ut_ad(withdraw_target == 0); - withdraw_target = w; - } - - buf_resize_status("Withdrawing blocks to be shrunken."); - - ulonglong withdraw_started = microsecond_interval_timer(); - ulonglong message_interval = 60ULL * 1000 * 1000; - ulint retry_interval = 1; - -withdraw_retry: - /* wait for the number of blocks fit to the new size (if needed)*/ - bool should_retry_withdraw = is_shrinking() - && withdraw_blocks(); - - if (srv_shutdown_state != SRV_SHUTDOWN_NONE) { - /* abort to resize for shutdown. */ - return; - } - - /* abort buffer pool load */ - buf_load_abort(); - - const ulonglong current_time = microsecond_interval_timer(); - - if (should_retry_withdraw - && current_time - withdraw_started >= message_interval) { - - if (message_interval > 900000000) { - message_interval = 1800000000; - } else { - message_interval *= 2; - } - - bool found= false; - find_interesting_trx f - {found, withdraw_started, my_hrtime_coarse()}; - withdraw_started = current_time; - - /* This is going to exceed the maximum size of a - memory transaction. */ - LockMutexGuard g{SRW_LOCK_CALL}; - trx_sys.trx_list.for_each(f); - } - - if (should_retry_withdraw) { - ib::info() << "Will retry to withdraw " << retry_interval - << " seconds later."; - std::this_thread::sleep_for( - std::chrono::seconds(retry_interval)); - - if (retry_interval > 5) { - retry_interval = 10; - } else { - retry_interval *= 2; - } - - goto withdraw_retry; - } - - buf_resize_status("Latching entire buffer pool."); - -#ifndef DBUG_OFF - { - bool should_wait = true; - - while (should_wait) { - should_wait = false; - DBUG_EXECUTE_IF( - "ib_buf_pool_resize_wait_before_resize", - should_wait = true; - std::this_thread::sleep_for( - std::chrono::milliseconds(10));); - } - } -#endif /* !DBUG_OFF */ - - if (srv_shutdown_state != SRV_SHUTDOWN_NONE) { - return; - } - - /* Indicate critical path */ - resizing.store(true, std::memory_order_relaxed); - - mysql_mutex_lock(&mutex); - page_hash.write_lock_all(); - - chunk_t::map_reg = UT_NEW_NOKEY(chunk_t::map()); - - /* add/delete chunks */ - - buf_resize_status("Resizing buffer pool from " - ULINTPF " chunks to " ULINTPF " chunks.", - n_chunks, n_chunks_new); - - if (is_shrinking()) { - /* delete chunks */ - chunk_t* chunk = chunks + n_chunks_new; - const chunk_t* const echunk = chunks + n_chunks; - - ulint sum_freed = 0; - - while (chunk < echunk) { - /* buf_LRU_block_free_non_file_page() invokes - MEM_NOACCESS() on any buf_pool.free blocks. - We must cancel the effect of that. In - MemorySanitizer, MEM_NOACCESS() is no-op, so - we must not do anything special for it here. */ -#ifdef HAVE_valgrind -# if !__has_feature(memory_sanitizer) - MEM_MAKE_DEFINED(chunk->mem, chunk->mem_size()); -# endif -#else - MEM_MAKE_ADDRESSABLE(chunk->mem, chunk->size); -#endif - - buf_block_t* block = chunk->blocks; - - for (ulint j = chunk->size; j--; block++) { - block->page.lock.free(); - } - - allocator.deallocate_large_dodump( - chunk->mem, &chunk->mem_pfx); - sum_freed += chunk->size; - ++chunk; - } - - /* discard withdraw list */ - UT_LIST_INIT(withdraw, &buf_page_t::list); - withdraw_target = 0; - - ib::info() << n_chunks - n_chunks_new - << " Chunks (" << sum_freed - << " blocks) were freed."; - - n_chunks = n_chunks_new; - } - - { - /* reallocate chunks */ - const size_t new_chunks_size - = n_chunks_new * sizeof(chunk_t); - - chunk_t* new_chunks = static_cast( - ut_zalloc_nokey_nofatal(new_chunks_size)); - - DBUG_EXECUTE_IF("buf_pool_resize_chunk_null", - ut_free(new_chunks); new_chunks= nullptr; ); - - if (!new_chunks) { - ib::error() << "failed to allocate" - " the chunk array."; - n_chunks_new = n_chunks; - warning = true; - chunks_old = NULL; - goto calc_buf_pool_size; - } - - ulint n_chunks_copy = ut_min(n_chunks_new, n_chunks); - - memcpy(new_chunks, chunks, - n_chunks_copy * sizeof *new_chunks); - - for (ulint j = 0; j < n_chunks_copy; j++) { - new_chunks[j].reg(); - } - - chunks_old = chunks; - chunks = new_chunks; - } - - if (n_chunks_new > n_chunks) { - /* add chunks */ - ulint sum_added = 0; - ulint n = n_chunks; - const size_t unit = srv_buf_pool_chunk_unit; - - for (chunk_t* chunk = chunks + n_chunks, - * const echunk = chunks + n_chunks_new; - chunk != echunk; chunk++) { - if (!chunk->create(unit)) { - ib::error() << "failed to allocate" - " memory for buffer pool chunk"; - - warning = true; - n_chunks_new = n_chunks; - break; - } - - sum_added += chunk->size; - ++n; - } - - ib::info() << n_chunks_new - n_chunks - << " chunks (" << sum_added - << " blocks) were added."; - - n_chunks = n; - } -calc_buf_pool_size: - /* recalc curr_size */ - ulint new_size = 0; - - { - chunk_t* chunk = chunks; - const chunk_t* const echunk = chunk + n_chunks; - do { - new_size += chunk->size; - } while (++chunk != echunk); - } - - curr_size = new_size; - n_chunks_new = n_chunks; - - if (chunks_old) { - ut_free(chunks_old); - chunks_old = NULL; - } - - chunk_t::map* chunk_map_old = chunk_t::map_ref; - chunk_t::map_ref = chunk_t::map_reg; - - /* set size */ - ut_ad(UT_LIST_GET_LEN(withdraw) == 0); - ulint s= curr_size; - s/= BUF_READ_AHEAD_PORTION; - read_ahead_area= s >= READ_AHEAD_PAGES - ? READ_AHEAD_PAGES - : my_round_up_to_next_power(static_cast(s)); - curr_pool_size= n_chunks * srv_buf_pool_chunk_unit; - srv_buf_pool_curr_size= curr_pool_size;/* FIXME: remove*/ - extern ulonglong innobase_buffer_pool_size; - innobase_buffer_pool_size= buf_pool_size_align(srv_buf_pool_curr_size); - - const bool new_size_too_diff - = srv_buf_pool_base_size > srv_buf_pool_size * 2 - || srv_buf_pool_base_size * 2 < srv_buf_pool_size; - - mysql_mutex_unlock(&mutex); - page_hash.write_unlock_all(); - - UT_DELETE(chunk_map_old); - - resizing.store(false, std::memory_order_relaxed); - - /* Normalize other components, if the new size is too different */ - if (!warning && new_size_too_diff) { - srv_buf_pool_base_size = srv_buf_pool_size; - - buf_resize_status("Resizing other hash tables."); - - srv_lock_table_size = 5 - * (srv_buf_pool_size >> srv_page_size_shift); - lock_sys.resize(srv_lock_table_size); - dict_sys.resize(); - - ib::info() << "Resized hash tables: lock_sys," -#ifdef BTR_CUR_HASH_ADAPT - " adaptive hash index," -#endif /* BTR_CUR_HASH_ADAPT */ - " and dictionary."; - } - - /* normalize ibuf.max_size */ - ibuf_max_size_update(srv_change_buffer_max_size); - - if (srv_buf_pool_old_size != srv_buf_pool_size) { - - buf_resize_status("Completed resizing buffer pool from %zu to %zu bytes." - ,srv_buf_pool_old_size, srv_buf_pool_size); - srv_buf_pool_old_size = srv_buf_pool_size; - } - -#ifdef BTR_CUR_HASH_ADAPT - /* enable AHI if needed */ - if (btr_search_disabled) { - btr_search_enable(true); - ib::info() << "Re-enabled adaptive hash index."; - } -#endif /* BTR_CUR_HASH_ADAPT */ - - if (warning) - buf_resize_status("Resizing buffer pool failed"); - - ut_d(validate()); - - return; -} - -#ifdef __linux__ -inline void buf_pool_t::garbage_collect() +inline void buf_pool_t::garbage_collect() noexcept { mysql_mutex_lock(&mutex); size_t freed= 0; @@ -2205,67 +1110,993 @@ rescan: freed); return; } -#endif /* __linux__ */ +#endif -/** Thread pool task invoked by innodb_buffer_pool_size changes. */ -static void buf_resize_callback(void *) +#if defined(DBUG_OFF) && defined(HAVE_MADVISE) && defined(MADV_DODUMP) +/** Enable buffers to be dumped to core files. + +A convenience function, not called anyhwere directly however +it is left available for gdb or any debugger to call +in the event that you want all of the memory to be dumped +to a core file. + +@return number of errors found in madvise() calls */ +MY_ATTRIBUTE((used)) +int buf_pool_t::madvise_do_dump() noexcept { - DBUG_ENTER("buf_resize_callback"); - ut_ad(srv_shutdown_state < SRV_SHUTDOWN_CLEANUP); - mysql_mutex_lock(&buf_pool.mutex); - const auto size= srv_buf_pool_size; - const bool work= srv_buf_pool_old_size != size; - mysql_mutex_unlock(&buf_pool.mutex); + int ret= 0; - if (work) - buf_pool.resize(); + /* mirrors allocation in log_t::create() */ + if (log_sys.buf) { + ret += madvise(log_sys.buf, log_sys.buf_size, MADV_DODUMP); + ret += madvise(log_sys.flush_buf, log_sys.buf_size, + MADV_DODUMP); + } + + ret+= madvise(buf_pool.memory, buf_pool.size_in_bytes, MADV_DODUMP); + return ret; +} +#endif + +#ifndef UNIV_DEBUG +static inline byte hex_to_ascii(byte hex_digit) noexcept +{ + const int offset= hex_digit <= 9 ? '0' : 'a' - 10; + return byte(hex_digit + offset); +} +#endif + +/** Dump a page to stderr. +@param[in] read_buf database page +@param[in] zip_size compressed page size, or 0 */ +ATTRIBUTE_COLD +void buf_page_print(const byte *read_buf, ulint zip_size) noexcept +{ +#ifndef UNIV_DEBUG + const size_t size = zip_size ? zip_size : srv_page_size; + const byte * const end= read_buf + size; + sql_print_information("InnoDB: Page dump (%zu bytes):", size); + + do + { + byte row[64]; + + for (byte *r= row; r != &row[64]; r+= 2, read_buf++) + { + r[0]= hex_to_ascii(byte(*read_buf >> 4)); + r[1]= hex_to_ascii(*read_buf & 15); + } + + sql_print_information("InnoDB: %.*s", 64, row); + } + while (read_buf != end); + + sql_print_information("InnoDB: End of page dump"); +#endif +} + +IF_DBUG(,inline) byte *buf_block_t::frame_address() const noexcept +{ + static_assert(ut_is_2pow(innodb_buffer_pool_extent_size), ""); + + byte *frame_= reinterpret_cast + ((reinterpret_cast(this) & ~(innodb_buffer_pool_extent_size - 1)) | + first_frame_in_extent[srv_page_size_shift - UNIV_PAGE_SIZE_SHIFT_MIN]); + ut_ad(reinterpret_cast(this) + sizeof(*this) <= frame_); + frame_+= + (((reinterpret_cast(this) & (innodb_buffer_pool_extent_size - 1)) / + sizeof(*this)) << srv_page_size_shift); + return frame_; +} + +buf_block_t *buf_pool_t::block_from(const void *ptr) noexcept +{ + static_assert(ut_is_2pow(innodb_buffer_pool_extent_size), ""); + ut_ad(static_cast(ptr) >= buf_pool.memory); + + byte *first_block= reinterpret_cast + (reinterpret_cast(ptr) & ~(innodb_buffer_pool_extent_size - 1)); + const size_t first_frame= + first_frame_in_extent[srv_page_size_shift - UNIV_PAGE_SIZE_SHIFT_MIN]; + + ut_ad(static_cast(ptr) >= first_block + first_frame); + return reinterpret_cast(first_block) + + (((size_t(ptr) & (innodb_buffer_pool_extent_size - 1)) - first_frame) >> + srv_page_size_shift); +} + +/** Determine the address of the first invalid block descriptor +@param n_blocks buf_pool.n_blocks +@return offset of the first invalid buf_block_t, relative to buf_pool.memory */ +static size_t block_descriptors_in_bytes(size_t n_blocks) noexcept +{ + const size_t ssize= srv_page_size_shift - UNIV_PAGE_SIZE_SHIFT_MIN; + const size_t extent_size= pages_in_extent[ssize]; + return n_blocks / extent_size * innodb_buffer_pool_extent_size + + (n_blocks % extent_size) * sizeof(buf_block_t); +} + +buf_block_t *buf_pool_t::get_nth_page(size_t pos) const noexcept +{ + mysql_mutex_assert_owner(&mutex); + ut_ad(pos < n_blocks); + return reinterpret_cast + (memory + block_descriptors_in_bytes(pos)); +} + +buf_block_t *buf_pool_t::allocate() noexcept +{ + mysql_mutex_assert_owner(&mutex); + + while (buf_page_t *b= UT_LIST_GET_FIRST(free)) + { + ut_ad(b->in_free_list); + ut_d(b->in_free_list = FALSE); + ut_ad(!b->oldest_modification()); + ut_ad(!b->in_LRU_list); + ut_a(!b->in_file()); + UT_LIST_REMOVE(free, b); + + if (UNIV_LIKELY(!n_blocks_to_withdraw) || !withdraw(*b)) + { + /* No adaptive hash index entries may point to a free block. */ + assert_block_ahi_empty(reinterpret_cast(b)); + b->set_state(buf_page_t::MEMORY); + b->set_os_used(); + return reinterpret_cast(b); + } + } + + return nullptr; +} + +/** Create the hash table. +@param n the lower bound of n_cells */ +void buf_pool_t::page_hash_table::create(ulint n) noexcept +{ + n_cells= ut_find_prime(n); + const size_t size= MY_ALIGN(pad(n_cells) * sizeof *array, + CPU_LEVEL1_DCACHE_LINESIZE); + void *v= aligned_malloc(size, CPU_LEVEL1_DCACHE_LINESIZE); + memset_aligned(v, 0, size); + array= static_cast(v); +} + +size_t buf_pool_t::get_n_blocks(size_t size_in_bytes) noexcept +{ + const size_t ssize= srv_page_size_shift - UNIV_PAGE_SIZE_SHIFT_MIN; + size_t n_blocks_alloc= size_in_bytes / innodb_buffer_pool_extent_size * + pages_in_extent[ssize]; + + if (const size_t incomplete_extent_pages= + (size_in_bytes & (innodb_buffer_pool_extent_size - 1)) >> + srv_page_size_shift) + { + ssize_t d= incomplete_extent_pages - first_page_in_extent[ssize]; + ut_ad(d > 0); + n_blocks_alloc+= d; + } + + return n_blocks_alloc; +} + +size_t buf_pool_t::blocks_in_bytes(size_t n_blocks) noexcept +{ + const size_t shift{srv_page_size_shift}; + const size_t ssize{shift - UNIV_PAGE_SIZE_SHIFT_MIN}; + const size_t extent_size= pages_in_extent[ssize]; + size_t size_in_bytes= n_blocks / extent_size * + innodb_buffer_pool_extent_size; + if (size_t remainder= n_blocks % extent_size) + size_in_bytes+= (remainder + first_page_in_extent[ssize]) << shift; + ut_ad(get_n_blocks(size_in_bytes) == n_blocks); + return size_in_bytes; +} + +/** Create the buffer pool. +@return whether the creation failed */ +bool buf_pool_t::create() noexcept +{ + ut_ad(this == &buf_pool); + ut_ad(!is_initialised()); + ut_ad(size_in_bytes_requested > 0); + ut_ad(!(size_in_bytes_max & (innodb_buffer_pool_extent_size - 1))); + ut_ad(!(size_in_bytes_requested & ((1U << 20) - 1))); + ut_ad(size_in_bytes_requested <= size_in_bytes_max); + /* mariabackup loads tablespaces, and it requires field_ref_zero to be + allocated before innodb initialization */ + ut_ad(srv_operation >= SRV_OPERATION_RESTORE || !field_ref_zero); + + if (!field_ref_zero) + { + if (auto b= aligned_malloc(UNIV_PAGE_SIZE_MAX, 4096)) + { + field_ref_zero= static_cast + (memset_aligned<4096>(b, 0, UNIV_PAGE_SIZE_MAX)); + goto init; + } + + oom: + ut_ad(!is_initialised()); + sql_print_error("InnoDB: Cannot map innodb_buffer_pool_size_max=%zum", + size_in_bytes_max >> 20); + return true; + } + + init: + DBUG_EXECUTE_IF("ib_buf_chunk_init_fails", goto oom;); + size_t size= size_in_bytes_max; + sql_print_information("InnoDB: innodb_buffer_pool_size_max=%zum," + " innodb_buffer_pool_size=%zum", + size >> 20, size_in_bytes_requested >> 20); + + retry: + { + NUMA_MEMPOLICY_INTERLEAVE_IN_SCOPE; + memory_unaligned= my_virtual_mem_reserve(&size); + } + + if (!memory_unaligned) + goto oom; + + const size_t alignment_waste= + ((~size_t(memory_unaligned) & (innodb_buffer_pool_extent_size - 1)) + 1) & + (innodb_buffer_pool_extent_size - 1); + + if (size < size_in_bytes_max + alignment_waste) + { + my_virtual_mem_release(memory_unaligned, size); + size+= 1 + + (~size_t(memory_unaligned) & (innodb_buffer_pool_extent_size - 1)); + goto retry; + } + + MEM_UNDEFINED(memory_unaligned, size); + ut_dontdump(memory_unaligned, size, true); + memory= memory_unaligned + alignment_waste; + size_unaligned= size; + size-= alignment_waste; + size&= ~(innodb_buffer_pool_extent_size - 1); + + const size_t actual_size= size_in_bytes_requested; + ut_ad(actual_size <= size); + + size_in_bytes= actual_size; + os_total_large_mem_allocated+= actual_size; + +#ifdef UNIV_PFS_MEMORY + PSI_MEMORY_CALL(memory_alloc)(mem_key_buf_buf_pool, actual_size, &owner); +#endif + if (!my_virtual_mem_commit(memory, actual_size)) + { + my_virtual_mem_release(memory_unaligned, size_unaligned); + memory= nullptr; + memory_unaligned= nullptr; + goto oom; + } + +#ifdef HAVE_LIBNUMA + if (srv_numa_interleave) + { + struct bitmask *numa_mems_allowed= numa_get_mems_allowed(); + MEM_MAKE_DEFINED(numa_mems_allowed, sizeof *numa_mems_allowed); + if (mbind(memory_unaligned, size_unaligned, MPOL_INTERLEAVE, + numa_mems_allowed->maskp, numa_mems_allowed->size, + MPOL_MF_MOVE)) + sql_print_warning("InnoDB: Failed to set NUMA memory policy of" + " buffer pool page frames to MPOL_INTERLEAVE" + " (error: %s).", strerror(errno)); + numa_bitmask_free(numa_mems_allowed); + } +#endif /* HAVE_LIBNUMA */ + + n_blocks= get_n_blocks(actual_size); + n_blocks_to_withdraw= 0; + UT_LIST_INIT(free, &buf_page_t::list); + const size_t ssize= srv_page_size_shift - UNIV_PAGE_SIZE_SHIFT_MIN; + + for (char *extent= memory, + *end= memory + block_descriptors_in_bytes(n_blocks); + extent < end; extent+= innodb_buffer_pool_extent_size) + { + buf_block_t *block= reinterpret_cast(extent); + const buf_block_t *extent_end= block + pages_in_extent[ssize]; + if (reinterpret_cast(extent_end) > end) + extent_end= reinterpret_cast(end); + MEM_MAKE_DEFINED(block, (extent_end - block) * sizeof *block); + for (byte *frame= reinterpret_cast(extent) + + first_frame_in_extent[ssize]; + block < extent_end; block++, frame+= srv_page_size) + { + ut_ad(!memcmp(block, field_ref_zero, sizeof *block)); + block->page.frame= frame; + block->page.lock.init(); + UT_LIST_ADD_LAST(free, &block->page); + ut_d(block->page.in_free_list= true); + } + } + +#if defined(__aarch64__) + mysql_mutex_init(buf_pool_mutex_key, &mutex, MY_MUTEX_INIT_FAST); +#else + mysql_mutex_init(buf_pool_mutex_key, &mutex, nullptr); +#endif + + UT_LIST_INIT(withdrawn, &buf_page_t::list); + UT_LIST_INIT(LRU, &buf_page_t::LRU); + UT_LIST_INIT(flush_list, &buf_page_t::list); + UT_LIST_INIT(unzip_LRU, &buf_block_t::unzip_LRU); + + for (size_t i= 0; i < UT_ARR_SIZE(zip_free); ++i) + UT_LIST_INIT(zip_free[i], &buf_buddy_free_t::list); + ulint s= n_blocks; + s/= BUF_READ_AHEAD_PORTION; + read_ahead_area= s >= READ_AHEAD_PAGES + ? READ_AHEAD_PAGES + : my_round_up_to_next_power(static_cast(s)); + + page_hash.create(2 * n_blocks); + last_printout_time= time(nullptr); + + mysql_mutex_init(flush_list_mutex_key, &flush_list_mutex, + MY_MUTEX_INIT_FAST); + + pthread_cond_init(&done_flush_LRU, nullptr); + pthread_cond_init(&done_flush_list, nullptr); + pthread_cond_init(&do_flush_list, nullptr); + pthread_cond_init(&done_free, nullptr); + + try_LRU_scan= true; + + ut_d(flush_hp.m_mutex= &flush_list_mutex;); + ut_d(lru_hp.m_mutex= &mutex); + ut_d(lru_scan_itr.m_mutex= &mutex); + + io_buf.create((srv_n_read_io_threads + srv_n_write_io_threads) * + OS_AIO_N_PENDING_IOS_PER_THREAD); + + last_activity_count= srv_get_activity_count(); + + buf_LRU_old_ratio_update(100 * 3 / 8, false); + btr_search_sys_create(); + +#ifdef __linux__ + if (srv_operation == SRV_OPERATION_NORMAL) + buf_mem_pressure_detect_init(); +#endif + ut_ad(is_initialised()); + sql_print_information("InnoDB: Completed initialization of buffer pool"); + return false; +} + +/** Clean up after successful create() */ +void buf_pool_t::close() noexcept +{ + ut_ad(this == &buf_pool); + if (!is_initialised()) + return; + + mysql_mutex_destroy(&mutex); + mysql_mutex_destroy(&flush_list_mutex); + + for (buf_page_t *bpage= UT_LIST_GET_LAST(LRU), *prev_bpage= nullptr; bpage; + bpage= prev_bpage) + { + prev_bpage= UT_LIST_GET_PREV(LRU, bpage); + ut_ad(bpage->in_file()); + ut_ad(bpage->in_LRU_list); + /* The buffer pool must be clean during normal shutdown. + Only on aborted startup (with recovery) or with innodb_fast_shutdown=2 + we may discard changes. */ + ut_d(const lsn_t oldest= bpage->oldest_modification();) + ut_ad(fsp_is_system_temporary(bpage->id().space()) + ? (oldest == 0 || oldest == 2) + : oldest <= 1 || srv_is_being_started || srv_fast_shutdown == 2); + + if (UNIV_UNLIKELY(!bpage->frame)) + { + bpage->lock.free(); + ut_free(bpage); + } + } + + { + const size_t size{size_in_bytes}; + + for (char *extent= memory, + *end= memory + block_descriptors_in_bytes(n_blocks); + extent < end; extent+= innodb_buffer_pool_extent_size) + for (buf_block_t *block= reinterpret_cast(extent), + *extent_end= block + + pages_in_extent[srv_page_size_shift - UNIV_PAGE_SIZE_SHIFT_MIN]; + block < extent_end && reinterpret_cast(block) < end; block++) + { + MEM_MAKE_DEFINED(&block->page.lock, sizeof &block->page.lock); + block->page.lock.free(); + } + + ut_dodump(memory_unaligned, size_unaligned); +#ifdef UNIV_PFS_MEMORY + PSI_MEMORY_CALL(memory_free)(mem_key_buf_buf_pool, size, owner); + owner= nullptr; +#endif + os_total_large_mem_allocated-= size; + my_virtual_mem_decommit(memory, size); + my_virtual_mem_release(memory_unaligned, size_unaligned); + memory= nullptr; + memory_unaligned= nullptr; + } + + pthread_cond_destroy(&done_flush_LRU); + pthread_cond_destroy(&done_flush_list); + pthread_cond_destroy(&do_flush_list); + pthread_cond_destroy(&done_free); + + page_hash.free(); + + io_buf.close(); + aligned_free(const_cast(field_ref_zero)); + field_ref_zero= nullptr; +} + +void buf_pool_t::io_buf_t::create(ulint n_slots) noexcept +{ + this->n_slots= n_slots; + slots= static_cast + (ut_malloc_nokey(n_slots * sizeof *slots)); + memset((void*) slots, 0, n_slots * sizeof *slots); +} + +void buf_pool_t::io_buf_t::close() noexcept +{ + for (buf_tmp_buffer_t *s= slots, *e= slots + n_slots; s != e; s++) + { + aligned_free(s->crypt_buf); + aligned_free(s->comp_buf); + } + ut_free(slots); + slots= nullptr; + n_slots= 0; +} + +buf_tmp_buffer_t *buf_pool_t::io_buf_t::reserve(bool wait_for_reads) noexcept +{ + for (;;) + { + for (buf_tmp_buffer_t *s= slots, *e= slots + n_slots; s != e; s++) + if (s->acquire()) + return s; + buf_dblwr.flush_buffered_writes(); + os_aio_wait_until_no_pending_writes(true); + if (!wait_for_reads) + continue; + for (buf_tmp_buffer_t *s= slots, *e= slots + n_slots; s != e; s++) + if (s->acquire()) + return s; + os_aio_wait_until_no_pending_reads(true); + } +} + +ATTRIBUTE_COLD bool buf_pool_t::withdraw(buf_page_t &bpage) noexcept +{ + mysql_mutex_assert_owner(&mutex); + ut_ad(n_blocks_to_withdraw); + ut_ad(first_to_withdraw); + ut_ad(!bpage.zip.data); + if (&bpage < first_to_withdraw) + return false; + n_blocks_to_withdraw--; + bpage.lock.free(); + UT_LIST_ADD_LAST(withdrawn, &bpage); + return true; +} + +ATTRIBUTE_COLD buf_pool_t::shrink_status buf_pool_t::shrink(size_t size) + noexcept +{ + mysql_mutex_assert_owner(&mutex); + buf_load_abort(); + + if (!n_blocks_to_withdraw) + { + withdraw_done: + first_to_withdraw= nullptr; + while (buf_page_t *b= UT_LIST_GET_FIRST(withdrawn)) + { + UT_LIST_REMOVE(withdrawn, b); + /* satisfy the check in lazy_allocate() */ + ut_d(memset((void*) b, 0, sizeof(buf_block_t))); + } + return SHRINK_DONE; + } + + buf_buddy_condense_free(size); + + for (buf_page_t *b= UT_LIST_GET_FIRST(free), *next; b; b= next) + { + ut_ad(b->in_free_list); + ut_ad(!b->in_LRU_list); + ut_ad(!b->zip.data); + ut_ad(!b->oldest_modification()); + ut_a(b->state() == buf_page_t::NOT_USED); + + next= UT_LIST_GET_NEXT(list, b); + + if (b >= first_to_withdraw) + { + UT_LIST_REMOVE(free, b); + b->lock.free(); + UT_LIST_ADD_LAST(withdrawn, b); + if (!--n_blocks_to_withdraw) + goto withdraw_done; + } + } + + buf_block_t *block= allocate(); + size_t scanned= 0; + for (buf_page_t *b= lru_scan_itr.start(), *prev; block && b; b= prev) + { + ut_ad(b->in_LRU_list); + ut_a(b->in_file()); + + prev= UT_LIST_GET_PREV(LRU, b); + + if (!b->can_relocate()) + { + next: + if (++scanned & 31) + continue; + /* Avoid starvation by periodically releasing buf_pool.mutex. */ + lru_scan_itr.set(prev); + mysql_mutex_unlock(&mutex); + mysql_mutex_lock(&mutex); + prev= lru_scan_itr.get(); + continue; + } + + const page_id_t id{b->id()}; + hash_chain &chain= page_hash.cell_get(id.fold()); + page_hash_latch &hash_lock= page_hash.lock_get(chain); + hash_lock.lock(); + + { + /* relocate flush_list and b->page.zip */ + bool have_flush_list_mutex= false; + + switch (b->oldest_modification()) { + case 2: + ut_ad(fsp_is_system_temporary(id.space())); + /* fall through */ + case 0: + break; + default: + mysql_mutex_lock(&flush_list_mutex); + switch (ut_d(lsn_t om=) b->oldest_modification()) { + case 1: + delete_from_flush_list(b); + /* fall through */ + case 0: + mysql_mutex_unlock(&flush_list_mutex); + break; + default: + ut_ad(om != 2); + have_flush_list_mutex= true; + } + } + + if (!b->can_relocate()) + { + next_quick: + if (have_flush_list_mutex) + mysql_mutex_unlock(&flush_list_mutex); + hash_lock.unlock(); + continue; + } + + if (UNIV_LIKELY_NULL(b->zip.data) && + will_be_withdrawn(b->zip.data, size)) + { + block= buf_buddy_shrink(b, block); + ut_ad(mach_read_from_4(b->zip.data + FIL_PAGE_OFFSET) == id.page_no()); + if (UNIV_UNLIKELY(!n_blocks_to_withdraw)) + { + if (have_flush_list_mutex) + mysql_mutex_unlock(&flush_list_mutex); + hash_lock.unlock(); + if (block) + buf_LRU_block_free_non_file_page(block); + goto withdraw_done; + } + if (!block && !(block= allocate())) + goto next_quick; + } + + if (!b->frame || b < first_to_withdraw) + goto next_quick; + + ut_ad(is_uncompressed_current(b)); + + byte *const frame= block->page.frame; + memcpy_aligned<4096>(frame, b->frame, srv_page_size); + b->lock.free(); + block->page.lock.free(); + new(&block->page) buf_page_t(*b); + block->page.frame= frame; + + if (have_flush_list_mutex) + { + buf_flush_relocate_on_flush_list(b, &block->page); + mysql_mutex_unlock(&flush_list_mutex); + } + } + + /* relocate LRU list */ + if (buf_page_t *prev_b= LRU_remove(b)) + UT_LIST_INSERT_AFTER(LRU, prev_b, &block->page); + else + UT_LIST_ADD_FIRST(LRU, &block->page); + + if (LRU_old == b) + LRU_old= &block->page; + + ut_ad(block->page.in_LRU_list); + + /* relocate page_hash */ + ut_ad(b == page_hash.get(id, chain)); + page_hash.replace(chain, b, &block->page); + + if (b->zip.data) + { + ut_ad(mach_read_from_4(b->zip.data + FIL_PAGE_OFFSET) == id.page_no()); + b->zip.data= nullptr; + /* relocate unzip_LRU list */ + buf_block_t *old_block= reinterpret_cast(b); + ut_ad(old_block->in_unzip_LRU_list); + ut_d(old_block->in_unzip_LRU_list= false); + ut_d(block->in_unzip_LRU_list= true); + + buf_block_t *prev= UT_LIST_GET_PREV(unzip_LRU, old_block); + UT_LIST_REMOVE(unzip_LRU, old_block); + + if (prev) + UT_LIST_INSERT_AFTER(unzip_LRU, prev, block); + else + UT_LIST_ADD_FIRST(unzip_LRU, block); + } + + buf_block_modify_clock_inc(block); + +#ifdef BTR_CUR_HASH_ADAPT + assert_block_ahi_empty_on_init(block); + block->index= nullptr; + block->n_hash_helps= 0; + block->n_fields= 1; + block->left_side= true; +#endif /* BTR_CUR_HASH_ADAPT */ + hash_lock.unlock(); + + ut_d(b->in_LRU_list= false); + + b->set_state(buf_page_t::NOT_USED); + UT_LIST_ADD_LAST(withdrawn, b); + if (!--n_blocks_to_withdraw) + goto withdraw_done; + + block= allocate(); + goto next; + } + + mysql_mutex_lock(&flush_list_mutex); + + if (LRU_warned && !UT_LIST_GET_FIRST(free)) + { + LRU_warned_clear(); + mysql_mutex_unlock(&flush_list_mutex); + return SHRINK_ABORT; + } + + try_LRU_scan= false; + mysql_mutex_unlock(&mutex); + page_cleaner_wakeup(true); + my_cond_wait(&done_flush_list, &flush_list_mutex.m_mutex); + mysql_mutex_unlock(&flush_list_mutex); + mysql_mutex_lock(&mutex); + + if (!n_blocks_to_withdraw) + goto withdraw_done; + + return SHRINK_IN_PROGRESS; +} + +inline void buf_pool_t::shrunk(size_t size, size_t reduced) noexcept +{ + ut_ad(size + reduced == size_in_bytes); + size_in_bytes_requested= size; + size_in_bytes= size; +# ifndef HAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT + /* Only page_guess() may read this memory, which after + my_virtual_mem_decommit() may be zeroed out or preserve its original + contents. Try to catch any unintended reads outside page_guess(). */ + MEM_UNDEFINED(memory + size, size_in_bytes_max - size); +# else + for (size_t n= page_hash.pad(page_hash.n_cells), i= 0; i < n; + i+= page_hash.ELEMENTS_PER_LATCH + 1) + { + auto &latch= reinterpret_cast(page_hash.array[i]); + latch.lock(); + /* We already shrunk size_in_bytes. The exclusive lock here + ensures that any page_guess() will detect an out-of-bounds + guess before we invoke my_virtual_mem_decommit() below. */ + latch.unlock(); + } +# endif + my_virtual_mem_decommit(memory + size, reduced); +#ifdef UNIV_PFS_MEMORY + PSI_MEMORY_CALL(memory_free)(mem_key_buf_buf_pool, reduced, owner); +#endif +} + +ATTRIBUTE_COLD void buf_pool_t::resize(size_t size, THD *thd) noexcept +{ + ut_ad(this == &buf_pool); + mysql_mutex_assert_owner(&LOCK_global_system_variables); + ut_ad(size <= size_in_bytes_max); + if (my_use_large_pages) + { + my_error(ER_VARIABLE_IS_READONLY, MYF(0), "InnoDB", + "innodb_buffer_pool_size", "large_pages=0"); + return; + } + + size_t n_blocks_new= get_n_blocks(size); + + mysql_mutex_lock(&mutex); + + const size_t old_size= size_in_bytes; + if (first_to_withdraw || old_size != size_in_bytes_requested) + { + mysql_mutex_unlock(&mutex); + my_printf_error(ER_WRONG_USAGE, + "innodb_buffer_pool_size change is already in progress", + MYF(0)); + return; + } + + ut_ad(UT_LIST_GET_LEN(withdrawn) == 0); + ut_ad(n_blocks_to_withdraw == 0); +#ifdef __linux__ + DBUG_EXECUTE_IF("trigger_garbage_collection", + mem_pressure_obj.trigger_collection();); +#endif + + if (size == old_size) + { + mysql_mutex_unlock(&mutex); + DBUG_EXECUTE_IF("trigger_garbage_collection", + std::this_thread::sleep_for(std::chrono::milliseconds(50)); + garbage_collect();); + return; + } + +#ifdef BTR_CUR_HASH_ADAPT + bool ahi_disabled= false; +#endif + + const bool significant_change= + n_blocks_new > n_blocks * 2 || n_blocks > n_blocks_new * 2; + const ssize_t n_blocks_removed= n_blocks - n_blocks_new; + + if (n_blocks_removed <= 0) + { + if (!my_virtual_mem_commit(memory + old_size, size - old_size)) + { + mysql_mutex_unlock(&mutex); + sql_print_error("InnoDB: Cannot commit innodb_buffer_pool_size=%zum;" + " retaining innodb_buffer_pool_size=%zum", + size >> 20, old_size >> 20); + my_error(ER_OUT_OF_RESOURCES, MYF(0)); + return; + } + + size_in_bytes_requested= size; + size_in_bytes= size; + + { + const size_t ssize= srv_page_size_shift - UNIV_PAGE_SIZE_SHIFT_MIN; + const size_t pages= pages_in_extent[ssize]; + const size_t first_extent= n_blocks / pages; + + char *extent= memory + first_extent * innodb_buffer_pool_extent_size; + + buf_block_t *block= reinterpret_cast(extent); + if (const size_t first_blocks= n_blocks % pages) + { + /* Extend the last (partial) extent until its end */ + const buf_block_t *extent_end= block + + (first_extent == (n_blocks_new / pages) + ? (n_blocks_new % pages) + : pages); + block+= first_blocks; + memset((void*) block, 0, (extent_end - block) * sizeof *block); + + for (byte *frame= reinterpret_cast(extent) + + first_frame_in_extent[ssize] + + (first_blocks << srv_page_size_shift); block < extent_end; + block++, frame+= srv_page_size) + { + block->page.frame= frame; + block->page.lock.init(); + UT_LIST_ADD_LAST(free, &block->page); + ut_d(block->page.in_free_list= true); + } + extent+= innodb_buffer_pool_extent_size; + } + + /* Fill in further extents; @see buf_pool_t::create() */ + for (const char *const end_new= memory + + block_descriptors_in_bytes(n_blocks_new); + extent < end_new; extent+= innodb_buffer_pool_extent_size) + { + block= reinterpret_cast(extent); + const buf_block_t *extent_end= block + pages; + if (reinterpret_cast(extent_end) > end_new) + extent_end= reinterpret_cast(end_new); + + memset((void*) block, 0, (extent_end - block) * sizeof *block); + for (byte *frame= reinterpret_cast(extent) + + first_frame_in_extent[ssize]; + block < extent_end; block++, frame+= srv_page_size) + { + block->page.frame= frame; + block->page.lock.init(); + UT_LIST_ADD_LAST(free, &block->page); + ut_d(block->page.in_free_list= true); + } + } + } + + mysql_mutex_unlock(&LOCK_global_system_variables); + resized: + ut_ad(UT_LIST_GET_LEN(withdrawn) == 0); + ut_ad(n_blocks_to_withdraw == 0); + ut_ad(!first_to_withdraw); + const size_t old_blocks{n_blocks}; + n_blocks= n_blocks_new; + + size_t s= n_blocks_new / BUF_READ_AHEAD_PORTION; + read_ahead_area= s >= READ_AHEAD_PAGES + ? READ_AHEAD_PAGES + : my_round_up_to_next_power(uint32(s)); + + if (ssize_t d= size - old_size) + { + os_total_large_mem_allocated+= d; + if (d > 0) + { + /* Already committed memory earlier */ + ut_ad(n_blocks_removed <= 0); +#ifdef UNIV_PFS_MEMORY + PSI_MEMORY_CALL(memory_alloc)(mem_key_buf_buf_pool, d, &owner); +#endif + } + else + shrunk(size, size_t(-d)); + } + + mysql_mutex_unlock(&mutex); + + if (significant_change) + { + sql_print_information("InnoDB: Resizing hash tables"); + srv_lock_table_size= 5 * n_blocks_new; + lock_sys.resize(srv_lock_table_size); + dict_sys.resize(); + } + + ibuf_max_size_update(srv_change_buffer_max_size); +#ifdef BTR_CUR_HASH_ADAPT + if (ahi_disabled) + btr_search_enable(true); +#endif + mysql_mutex_lock(&LOCK_global_system_variables); + bool resized= n_blocks_removed < 0; + if (n_blocks_removed > 0) + { + mysql_mutex_lock(&mutex); + resized= size_in_bytes == old_size; + if (resized) + { + size_in_bytes_requested= size; + size_in_bytes= size; + } + mysql_mutex_unlock(&mutex); + } + + if (resized) + sql_print_information("InnoDB: innodb_buffer_pool_size=%zum (%zu pages)" + " resized from %zum (%zu pages)", + size >> 20, n_blocks_new, old_size >> 20, + old_blocks); + } else { - std::ostringstream sout; - sout << "Size did not change: old size = new size = " << size; - buf_resize_status(sout.str().c_str()); + size_t to_withdraw= size_t(n_blocks_removed); + n_blocks_to_withdraw= to_withdraw; + first_to_withdraw= &get_nth_page(n_blocks_new)->page; + size_in_bytes_requested= size; + mysql_mutex_unlock(&LOCK_global_system_variables); + + mysql_mutex_unlock(&mutex); + DEBUG_SYNC_C("buf_pool_shrink_before_wakeup"); + mysql_mutex_lock(&flush_list_mutex); + page_cleaner_wakeup(true); + my_cond_wait(&done_flush_list, &flush_list_mutex.m_mutex); + mysql_mutex_unlock(&flush_list_mutex); +#ifdef BTR_CUR_HASH_ADAPT + ahi_disabled= btr_search_disable(); +#endif /* BTR_CUR_HASH_ADAPT */ + mysql_mutex_lock(&mutex); + + time_t last_message= 0; + + do + { + time_t now= time(nullptr); + if (now - last_message > 15) + { + if (last_message != 0 && to_withdraw == n_blocks_to_withdraw) + break; + to_withdraw= n_blocks_to_withdraw; + last_message= now; + sql_print_information("InnoDB: Trying to shrink" + " innodb_buffer_pool_size=%zum (%zu pages)" + " from %zum (%zu pages, to withdraw %zu)", + size >> 20, n_blocks_new, + old_size >> 20, n_blocks, to_withdraw); + } + shrink_status s{shrink(size)}; + if (s == SHRINK_DONE) + goto resized; + if (s != SHRINK_IN_PROGRESS) + break; + } + while (!thd_kill_level(thd)); + + ut_ad(size_in_bytes > size_in_bytes_requested); + n_blocks_to_withdraw= 0; + first_to_withdraw= nullptr; + size_in_bytes_requested= size_in_bytes; + + while (buf_page_t *b= UT_LIST_GET_FIRST(withdrawn)) + { + UT_LIST_REMOVE(withdrawn, b); + UT_LIST_ADD_LAST(free, b); + ut_d(b->in_free_list= true); + ut_ad(b->state() == buf_page_t::NOT_USED); + b->lock.init(); + } + + mysql_mutex_unlock(&mutex); + my_printf_error(ER_WRONG_USAGE, "innodb_buffer_pool_size change aborted", + MYF(ME_ERROR_LOG)); + mysql_mutex_lock(&LOCK_global_system_variables); } - DBUG_VOID_RETURN; + + ut_d(validate()); } -/* Ensure that task does not run in parallel, by setting max_concurrency to 1 for the thread group */ -static tpool::task_group single_threaded_group(1); -static tpool::waitable_task buf_resize_task(buf_resize_callback, - nullptr, &single_threaded_group); - -void buf_resize_start() -{ -#if !defined(DBUG_OFF) && defined(__linux__) - DBUG_EXECUTE_IF("trigger_garbage_collection", - { - mem_pressure_obj.trigger_collection(); - } - ); -#endif - - srv_thread_pool->submit_task(&buf_resize_task); -} - -void buf_resize_shutdown() -{ -#ifdef __linux__ - buf_mem_pressure_shutdown(); -#endif - buf_resize_task.wait(); -} - - /** Relocate a ROW_FORMAT=COMPRESSED block in the LRU list and buf_pool.page_hash. The caller must relocate bpage->list. @param bpage ROW_FORMAT=COMPRESSED only block @param dpage destination control block */ -static void buf_relocate(buf_page_t *bpage, buf_page_t *dpage) +static void buf_relocate(buf_page_t *bpage, buf_page_t *dpage) noexcept { const page_id_t id{bpage->id()}; buf_pool_t::hash_chain &chain= buf_pool.page_hash.cell_get(id.fold()); ut_ad(!bpage->frame); mysql_mutex_assert_owner(&buf_pool.mutex); + ut_ad(mach_read_from_4(bpage->zip.data + FIL_PAGE_OFFSET) == id.page_no()); ut_ad(buf_pool.page_hash.lock_get(chain).is_write_locked()); ut_ad(bpage == buf_pool.page_hash.get(id, chain)); ut_ad(!buf_pool.watch_is_sentinel(*bpage)); @@ -2274,6 +2105,7 @@ static void buf_relocate(buf_page_t *bpage, buf_page_t *dpage) ut_ad(state <= buf_page_t::READ_FIX); ut_ad(bpage->lock.is_write_locked()); const auto frame= dpage->frame; + ut_ad(frame == reinterpret_cast(dpage)->frame_address()); dpage->lock.free(); new (dpage) buf_page_t(*bpage); @@ -2345,7 +2177,6 @@ got_block: ut_ad(w->access_time == 0); ut_ad(!w->oldest_modification()); ut_ad(!w->zip.data); - ut_ad(!w->in_zip_hash); static_assert(buf_page_t::NOT_USED == 0, "efficiency"); if (ut_d(auto s=) w->state()) { @@ -2625,6 +2456,8 @@ bool buf_zip_decompress(buf_block_t *block, bool check) noexcept ut_ad(block->zip_size()); ut_a(block->page.id().space() != 0); + ut_ad(mach_read_from_4(frame + FIL_PAGE_OFFSET) + == block->page.id().page_no()); if (UNIV_UNLIKELY(check && !page_zip_verify_checksum(frame, size))) { @@ -2863,7 +2696,6 @@ buf_block_t *buf_pool_t::page_fix(const page_id_t id, if (b && !watch_is_sentinel(*b)) { uint32_t state= b->fix() + 1; - ut_ad(!b->in_zip_hash); hash_lock.unlock_shared(); if (UNIV_UNLIKELY(state < buf_page_t::UNFIXED)) @@ -2893,7 +2725,8 @@ buf_block_t *buf_pool_t::page_fix(const page_id_t id, return reinterpret_cast(-1); } - if (UNIV_LIKELY(b->frame != nullptr)); + if (UNIV_LIKELY(b->frame != nullptr)) + ut_ad(b->frame==reinterpret_cast(b)->frame_address()); else if (state < buf_page_t::READ_FIX) goto unzip; else @@ -2959,6 +2792,49 @@ buf_block_t *buf_pool_t::page_fix(const page_id_t id, } } +TRANSACTIONAL_TARGET +uint32_t buf_pool_t::page_guess(buf_block_t *b, page_hash_latch &latch, + const page_id_t id) noexcept +{ + transactional_shared_lock_guard g{latch}; +#ifndef HAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT + /* shrunk() and my_virtual_mem_decommit() could retain the original + contents of the virtual memory range or zero it out immediately or + with a delay. Any zeroing out may lead to a false positive for + b->page.id() == id but never for b->page.state(). At the time of + the shrunk() call, shrink() and buf_LRU_block_free_non_file_page() + should guarantee that b->page.state() is equal to + buf_page_t::NOT_USED (0) for all to-be-freed blocks. */ +#else + /* shrunk() made the memory inaccessible. */ + if (UNIV_UNLIKELY(reinterpret_cast(b) >= memory + size_in_bytes)) + return 0; +#endif + const page_id_t block_id{b->page.id()}; +#ifndef HAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT + /* shrunk() may have invoked MEM_UNDEFINED() on this memory to be able + to catch any unintended access elsewhere in our code. */ + MEM_MAKE_DEFINED(&block_id, sizeof block_id); +#endif + + if (id == block_id) + { + uint32_t state= b->page.state(); +#ifndef HAVE_UNACCESSIBLE_AFTER_MEM_DECOMMIT + /* shrunk() may have invoked MEM_UNDEFINED() on this memory to be able + to catch any unintended access elsewhere in our code. */ + MEM_MAKE_DEFINED(&state, sizeof state); +#endif + /* Ignore guesses that point to read-fixed blocks. We can only + avoid a race condition by looking up the block via page_hash. */ + if ((state >= buf_page_t::FREED && state < buf_page_t::READ_FIX) || + state >= buf_page_t::WRITE_FIX) + return b->page.fix(); + ut_ad(b->page.frame); + } + return 0; +} + /** Low level function used to get access to a database page. @param[in] page_id page id @param[in] zip_size ROW_FORMAT=COMPRESSED page size, or 0 @@ -3023,22 +2899,9 @@ loop: buf_block_t* block = guess; uint32_t state; - if (block) { - transactional_shared_lock_guard g{hash_lock}; - if (buf_pool.is_uncompressed(block) - && page_id == block->page.id()) { - ut_ad(!block->page.in_zip_hash); - state = block->page.state(); - /* Ignore guesses that point to read-fixed blocks. - We can only avoid a race condition by - looking up the block via buf_pool.page_hash. */ - if ((state >= buf_page_t::FREED - && state < buf_page_t::READ_FIX) - || state >= buf_page_t::WRITE_FIX) { - state = block->page.fix(); - goto got_block; - } - } + if (block + && (state = buf_pool.page_guess(block, hash_lock, page_id))) { + goto got_block; } guess = nullptr; @@ -3108,7 +2971,6 @@ loop: goto loop; got_block: - ut_ad(!block->page.in_zip_hash); state++; got_block_fixed: ut_ad(state > buf_page_t::FREED); @@ -3313,6 +3175,7 @@ wait_for_unzip: btr_search_drop_page_hash_index(block, true); #endif /* BTR_CUR_HASH_ADAPT */ + ut_ad(block->page.frame == block->frame_address()); ut_ad(page_id_t(page_get_space_id(block->page.frame), page_get_page_no(block->page.frame)) == page_id); return block; @@ -3418,21 +3281,19 @@ buf_page_get_gen( return block; } -TRANSACTIONAL_TARGET buf_block_t *buf_page_optimistic_fix(buf_block_t *block, page_id_t id) noexcept { buf_pool_t::hash_chain &chain= buf_pool.page_hash.cell_get(id.fold()); - transactional_shared_lock_guard g - {buf_pool.page_hash.lock_get(chain)}; - if (UNIV_UNLIKELY(!buf_pool.is_uncompressed(block) || - id != block->page.id() || !block->page.frame)) - return nullptr; - const auto state= block->page.state(); - if (UNIV_UNLIKELY(state < buf_page_t::UNFIXED || - state >= buf_page_t::READ_FIX)) - return nullptr; - block->page.fix(); - return block; + page_hash_latch &hash_lock= buf_pool.page_hash.lock_get(chain); + if (uint32_t state= buf_pool.page_guess(block, hash_lock, id)) + { + if (UNIV_LIKELY(state >= buf_page_t::UNFIXED)) + return block; + else + /* Refuse access to pages that are marked as freed in the data file. */ + block->page.unfix(); + } + return nullptr; } buf_block_t *buf_page_optimistic_get(buf_block_t *block, @@ -3547,6 +3408,7 @@ void buf_block_t::initialise(const page_id_t page_id, ulint zip_size, { ut_ad(!page.in_file()); buf_block_init_low(this); + page.lock.init(); page.init(fix, page_id); page.set_os_used(); page_zip_set_size(&page.zip, zip_size); @@ -3635,6 +3497,7 @@ retry: { mysql_mutex_unlock(&buf_pool.mutex); buf_block_t *block= reinterpret_cast(bpage); + ut_ad(bpage->frame == block->frame_address()); mtr->memo_push(block, MTR_MEMO_PAGE_X_FIX); #ifdef BTR_CUR_HASH_ADAPT drop_hash_entry= block->index; @@ -3670,7 +3533,8 @@ retry: else { mysql_mutex_unlock(&buf_pool.mutex); - ut_ad(bpage->frame); + ut_ad(bpage->frame == + reinterpret_cast(bpage)->frame_address()); #ifdef BTR_CUR_HASH_ADAPT ut_ad(!reinterpret_cast(bpage)->index); #endif @@ -4127,6 +3991,61 @@ success_page: return DB_SUCCESS; } +#ifdef BTR_CUR_HASH_ADAPT +/** Clear the adaptive hash index on all pages in the buffer pool. */ +ATTRIBUTE_COLD void buf_pool_t::clear_hash_index() noexcept +{ + std::set garbage; + + mysql_mutex_lock(&mutex); + ut_ad(!btr_search_enabled); + + for (char *extent= memory, + *end= memory + block_descriptors_in_bytes(n_blocks); + extent < end; extent+= innodb_buffer_pool_extent_size) + for (buf_block_t *block= reinterpret_cast(extent), + *extent_end= block + + pages_in_extent[srv_page_size_shift - UNIV_PAGE_SIZE_SHIFT_MIN]; + block < extent_end && reinterpret_cast(block) < end; block++) + { + dict_index_t *index= block->index; + assert_block_ahi_valid(block); + + /* We can clear block->index and block->n_pointers when + holding all AHI latches exclusively; see the comments in buf0buf.h */ + + if (!index) + { +# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG + ut_a(!block->n_pointers); +# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ + continue; + } + + ut_d(const auto s= block->page.state()); + /* Another thread may have set the state to + REMOVE_HASH in buf_LRU_block_remove_hashed(). + + The state change in buf_pool_t::resize() is not observable + here, because in that case we would have !block->index. + + In the end, the entire adaptive hash index will be removed. */ + ut_ad(s >= buf_page_t::UNFIXED || s == buf_page_t::REMOVE_HASH); +# if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG + block->n_pointers= 0; +# endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */ + if (index->freed()) + garbage.insert(index); + block->index= nullptr; + } + + mysql_mutex_unlock(&mutex); + + for (dict_index_t *index : garbage) + btr_search_lazy_free(index); +} +#endif /* BTR_CUR_HASH_ADAPT */ + #ifdef UNIV_DEBUG /** Check that all blocks are in a replaceable state. @return address of a non-free block @@ -4134,10 +4053,44 @@ success_page: void buf_pool_t::assert_all_freed() noexcept { mysql_mutex_lock(&mutex); - const chunk_t *chunk= chunks; - for (auto i= n_chunks; i--; chunk++) - if (const buf_block_t* block= chunk->not_freed()) - ib::fatal() << "Page " << block->page.id() << " still fixed or dirty"; + + for (char *extent= memory, + *end= memory + block_descriptors_in_bytes(n_blocks); + extent < end; extent+= innodb_buffer_pool_extent_size) + for (buf_block_t *block= reinterpret_cast(extent), + *extent_end= block + + pages_in_extent[srv_page_size_shift - UNIV_PAGE_SIZE_SHIFT_MIN]; + block < extent_end && reinterpret_cast(block) < end; block++) + { + if (!block->page.in_file()) + continue; + switch (const lsn_t lsn= block->page.oldest_modification()) { + case 0: + case 1: + break; + + case 2: + ut_ad(fsp_is_system_temporary(block->page.id().space())); + break; + + default: + if (srv_read_only_mode) + { + /* The page cleaner is disabled in read-only mode. No pages + can be dirtied, so all of them must be clean. */ + ut_ad(lsn == recv_sys.lsn || + srv_force_recovery == SRV_FORCE_NO_LOG_REDO); + break; + } + + goto fixed_or_dirty; + } + + if (!block->page.can_relocate()) + fixed_or_dirty: + ib::fatal() << "Page " << block->page.id() << " still fixed or dirty"; + } + mysql_mutex_unlock(&mutex); } #endif /* UNIV_DEBUG */ @@ -4187,40 +4140,35 @@ void buf_pool_t::validate() noexcept mysql_mutex_lock(&mutex); - chunk_t* chunk = chunks; - /* Check the uncompressed blocks. */ - for (auto i = n_chunks; i--; chunk++) { - buf_block_t* block = chunk->blocks; + for (ulint i = 0; i < n_blocks; i++) { + const buf_block_t* block = get_nth_page(i); + ut_ad(block->page.frame == block->frame_address()); - for (auto j = chunk->size; j--; block++) { - ut_ad(block->page.frame); - switch (const auto f = block->page.state()) { - case buf_page_t::NOT_USED: - n_free++; + switch (const auto f = block->page.state()) { + case buf_page_t::NOT_USED: + ut_ad(!block->page.in_LRU_list); + n_free++; + break; + case buf_page_t::MEMORY: + case buf_page_t::REMOVE_HASH: + /* do nothing */ + break; + default: + if (f >= buf_page_t::READ_FIX + && f < buf_page_t::WRITE_FIX) { + /* A read-fixed block is not + necessarily in the page_hash yet. */ break; - - case buf_page_t::MEMORY: - case buf_page_t::REMOVE_HASH: - /* do nothing */ - break; - - default: - if (f >= buf_page_t::READ_FIX - && f < buf_page_t::WRITE_FIX) { - /* A read-fixed block is not - necessarily in the page_hash yet. */ - break; - } - ut_ad(f >= buf_page_t::FREED); - const page_id_t id{block->page.id()}; - ut_ad(page_hash.get( - id, - page_hash.cell_get(id.fold())) - == &block->page); - n_lru++; } + ut_ad(f >= buf_page_t::FREED); + const page_id_t id{block->page.id()}; + ut_ad(page_hash.get( + id, + page_hash.cell_get(id.fold())) + == &block->page); + n_lru++; } } @@ -4245,24 +4193,11 @@ void buf_pool_t::validate() noexcept ut_ad(UT_LIST_GET_LEN(flush_list) == n_flushing); mysql_mutex_unlock(&flush_list_mutex); - - if (n_chunks_new == n_chunks - && n_lru + n_free > curr_size + n_zip) { - - ib::fatal() << "n_LRU " << n_lru << ", n_free " << n_free - << ", pool " << curr_size - << " zip " << n_zip << ". Aborting..."; - } - + ut_ad(n_lru + n_free <= n_blocks + n_zip); ut_ad(UT_LIST_GET_LEN(LRU) >= n_lru); - - if (n_chunks_new == n_chunks - && UT_LIST_GET_LEN(free) != n_free) { - - ib::fatal() << "Free list len " - << UT_LIST_GET_LEN(free) - << ", free blocks " << n_free << ". Aborting..."; - } + ut_ad(UT_LIST_GET_LEN(free) <= n_free); + ut_ad(size_in_bytes != size_in_bytes_requested + || UT_LIST_GET_LEN(free) == n_free); mysql_mutex_unlock(&mutex); @@ -4277,26 +4212,23 @@ void buf_pool_t::print() noexcept { index_id_t* index_ids; ulint* counts; - ulint size; ulint i; - ulint j; index_id_t id; ulint n_found; - chunk_t* chunk; dict_index_t* index; - size = curr_size; + mysql_mutex_lock(&mutex); index_ids = static_cast( - ut_malloc_nokey(size * sizeof *index_ids)); + ut_malloc_nokey(n_blocks * sizeof *index_ids)); - counts = static_cast(ut_malloc_nokey(sizeof(ulint) * size)); + counts = static_cast( + ut_malloc_nokey(sizeof(ulint) * n_blocks)); - mysql_mutex_lock(&mutex); mysql_mutex_lock(&flush_list_mutex); ib::info() - << "[buffer pool: size=" << curr_size + << "[buffer pool: size=" << n_blocks << ", database pages=" << UT_LIST_GET_LEN(LRU) << ", free pages=" << UT_LIST_GET_LEN(free) << ", modified database pages=" @@ -4316,38 +4248,28 @@ void buf_pool_t::print() noexcept n_found = 0; - chunk = chunks; + for (size_t i = 0; i < n_blocks; i++) { + buf_block_t* block = get_nth_page(i); + const buf_frame_t* frame = block->page.frame; + ut_ad(frame == block->frame_address()); - for (i = n_chunks; i--; chunk++) { - buf_block_t* block = chunk->blocks; - ulint n_blocks = chunk->size; + if (fil_page_index_page_check(frame)) { - for (; n_blocks--; block++) { - const buf_frame_t* frame = block->page.frame; + id = btr_page_get_index_id(frame); - if (fil_page_index_page_check(frame)) { - - id = btr_page_get_index_id(frame); - - /* Look for the id in the index_ids array */ - j = 0; - - while (j < n_found) { - - if (index_ids[j] == id) { - counts[j]++; - - break; - } - j++; - } - - if (j == n_found) { - n_found++; - index_ids[j] = id; - counts[j] = 1; + /* Look for the id in the index_ids array */ + for (ulint j = 0; j < n_found; j++) { + if (index_ids[j] == id) { + counts[j]++; + goto found; } } + + index_ids[n_found] = id; + counts[n_found] = 1; + n_found++; +found: + continue; } } @@ -4381,138 +4303,78 @@ ulint buf_get_latched_pages_number() noexcept { ulint fixed_pages_number= 0; - mysql_mutex_lock(&buf_pool.mutex); + mysql_mutex_assert_owner(&buf_pool.mutex); for (buf_page_t *b= UT_LIST_GET_FIRST(buf_pool.LRU); b; b= UT_LIST_GET_NEXT(LRU, b)) if (b->state() > buf_page_t::UNFIXED) fixed_pages_number++; - mysql_mutex_unlock(&buf_pool.mutex); - return fixed_pages_number; } #endif /* UNIV_DEBUG */ -/** Collect buffer pool metadata. -@param[out] pool_info buffer pool metadata */ -void buf_stats_get_pool_info(buf_pool_info_t *pool_info) noexcept +void buf_pool_t::get_info(buf_pool_info_t *pool_info) noexcept { - time_t current_time; - double time_elapsed; + mysql_mutex_lock(&mutex); + pool_info->pool_size= curr_size(); + pool_info->lru_len= UT_LIST_GET_LEN(LRU); + pool_info->old_lru_len= LRU_old_len; + pool_info->free_list_len= UT_LIST_GET_LEN(free); - mysql_mutex_lock(&buf_pool.mutex); + mysql_mutex_lock(&flush_list_mutex); + pool_info->flush_list_len= UT_LIST_GET_LEN(flush_list); + pool_info->n_pend_unzip= UT_LIST_GET_LEN(unzip_LRU); + pool_info->n_pend_reads= os_aio_pending_reads_approx(); + pool_info->n_pending_flush_lru= n_flush(); + pool_info->n_pending_flush_list= os_aio_pending_writes(); + mysql_mutex_unlock(&flush_list_mutex); - pool_info->pool_size = buf_pool.curr_size; + double elapsed= 0.001 + difftime(time(nullptr), last_printout_time); - pool_info->lru_len = UT_LIST_GET_LEN(buf_pool.LRU); - - pool_info->old_lru_len = buf_pool.LRU_old_len; - - pool_info->free_list_len = UT_LIST_GET_LEN(buf_pool.free); - - mysql_mutex_lock(&buf_pool.flush_list_mutex); - pool_info->flush_list_len = UT_LIST_GET_LEN(buf_pool.flush_list); - - pool_info->n_pend_unzip = UT_LIST_GET_LEN(buf_pool.unzip_LRU); - - pool_info->n_pend_reads = os_aio_pending_reads_approx(); - - pool_info->n_pending_flush_lru = buf_pool.n_flush(); - - pool_info->n_pending_flush_list = os_aio_pending_writes(); - mysql_mutex_unlock(&buf_pool.flush_list_mutex); - - current_time = time(NULL); - time_elapsed = 0.001 + difftime(current_time, - buf_pool.last_printout_time); - - pool_info->n_pages_made_young = buf_pool.stat.n_pages_made_young; - - pool_info->n_pages_not_made_young = - buf_pool.stat.n_pages_not_made_young; - - pool_info->n_pages_read = buf_pool.stat.n_pages_read; - - pool_info->n_pages_created = buf_pool.stat.n_pages_created; - - pool_info->n_pages_written = buf_pool.stat.n_pages_written; - - pool_info->n_page_gets = buf_pool.stat.n_page_gets; - - pool_info->n_ra_pages_read_rnd = buf_pool.stat.n_ra_pages_read_rnd; - pool_info->n_ra_pages_read = buf_pool.stat.n_ra_pages_read; - - pool_info->n_ra_pages_evicted = buf_pool.stat.n_ra_pages_evicted; - - pool_info->page_made_young_rate = - static_cast(buf_pool.stat.n_pages_made_young - - buf_pool.old_stat.n_pages_made_young) - / time_elapsed; - - pool_info->page_not_made_young_rate = - static_cast(buf_pool.stat.n_pages_not_made_young - - buf_pool.old_stat.n_pages_not_made_young) - / time_elapsed; - - pool_info->pages_read_rate = - static_cast(buf_pool.stat.n_pages_read - - buf_pool.old_stat.n_pages_read) - / time_elapsed; - - pool_info->pages_created_rate = - static_cast(buf_pool.stat.n_pages_created - - buf_pool.old_stat.n_pages_created) - / time_elapsed; - - pool_info->pages_written_rate = - static_cast(buf_pool.stat.n_pages_written - - buf_pool.old_stat.n_pages_written) - / time_elapsed; - - pool_info->n_page_get_delta = buf_pool.stat.n_page_gets - - buf_pool.old_stat.n_page_gets; - - if (pool_info->n_page_get_delta) { - pool_info->page_read_delta = buf_pool.stat.n_pages_read - - buf_pool.old_stat.n_pages_read; - - pool_info->young_making_delta = - buf_pool.stat.n_pages_made_young - - buf_pool.old_stat.n_pages_made_young; - - pool_info->not_young_making_delta = - buf_pool.stat.n_pages_not_made_young - - buf_pool.old_stat.n_pages_not_made_young; - } - pool_info->pages_readahead_rnd_rate = - static_cast(buf_pool.stat.n_ra_pages_read_rnd - - buf_pool.old_stat.n_ra_pages_read_rnd) - / time_elapsed; - - - pool_info->pages_readahead_rate = - static_cast(buf_pool.stat.n_ra_pages_read - - buf_pool.old_stat.n_ra_pages_read) - / time_elapsed; - - pool_info->pages_evicted_rate = - static_cast(buf_pool.stat.n_ra_pages_evicted - - buf_pool.old_stat.n_ra_pages_evicted) - / time_elapsed; - - pool_info->unzip_lru_len = UT_LIST_GET_LEN(buf_pool.unzip_LRU); - - pool_info->io_sum = buf_LRU_stat_sum.io; - - pool_info->io_cur = buf_LRU_stat_cur.io; - - pool_info->unzip_sum = buf_LRU_stat_sum.unzip; - - pool_info->unzip_cur = buf_LRU_stat_cur.unzip; - - buf_refresh_io_stats(); - mysql_mutex_unlock(&buf_pool.mutex); + pool_info->n_pages_made_young= stat.n_pages_made_young; + pool_info->page_made_young_rate= + double(stat.n_pages_made_young - old_stat.n_pages_made_young) / + elapsed; + pool_info->n_pages_not_made_young= stat.n_pages_not_made_young; + pool_info->page_not_made_young_rate= + double(stat.n_pages_not_made_young - old_stat.n_pages_not_made_young) / + elapsed; + pool_info->n_pages_read= stat.n_pages_read; + pool_info->pages_read_rate= + double(stat.n_pages_read - old_stat.n_pages_read) / elapsed; + pool_info->n_pages_created= stat.n_pages_created; + pool_info->pages_created_rate= + double(stat.n_pages_created - old_stat.n_pages_created) / elapsed; + pool_info->n_pages_written= stat.n_pages_written; + pool_info->pages_written_rate= + double(stat.n_pages_written - old_stat.n_pages_written) / elapsed; + pool_info->n_page_gets= stat.n_page_gets; + pool_info->n_page_get_delta= stat.n_page_gets - old_stat.n_page_gets; + if (pool_info->n_page_get_delta) + { + pool_info->page_read_delta= stat.n_pages_read - old_stat.n_pages_read; + pool_info->young_making_delta= + stat.n_pages_made_young - old_stat.n_pages_made_young; + pool_info->not_young_making_delta= + stat.n_pages_not_made_young - old_stat.n_pages_not_made_young; + } + pool_info->n_ra_pages_read_rnd= stat.n_ra_pages_read_rnd; + pool_info->pages_readahead_rnd_rate= + double(stat.n_ra_pages_read_rnd - old_stat.n_ra_pages_read_rnd) / elapsed; + pool_info->n_ra_pages_read= stat.n_ra_pages_read; + pool_info->pages_readahead_rate= + double(stat.n_ra_pages_read - old_stat.n_ra_pages_read) / elapsed; + pool_info->n_ra_pages_evicted= stat.n_ra_pages_evicted; + pool_info->pages_evicted_rate= + double(stat.n_ra_pages_evicted - old_stat.n_ra_pages_evicted) / elapsed; + pool_info->unzip_lru_len= UT_LIST_GET_LEN(unzip_LRU); + pool_info->io_sum= buf_LRU_stat_sum.io; + pool_info->io_cur= buf_LRU_stat_cur.io; + pool_info->unzip_sum= buf_LRU_stat_sum.unzip; + pool_info->unzip_cur= buf_LRU_stat_cur.unzip; + buf_refresh_io_stats(); + mysql_mutex_unlock(&mutex); } /*********************************************************************//** @@ -4620,7 +4482,7 @@ buf_print_io( { buf_pool_info_t pool_info; - buf_stats_get_pool_info(&pool_info); + buf_pool.get_info(&pool_info); buf_print_io_instance(&pool_info, file); } diff --git a/storage/innobase/buf/buf0dump.cc b/storage/innobase/buf/buf0dump.cc index fa239e7d5cc..ff46074e8d0 100644 --- a/storage/innobase/buf/buf0dump.cc +++ b/storage/innobase/buf/buf0dump.cc @@ -58,7 +58,7 @@ take after being waked up. */ static volatile bool buf_dump_should_start; static volatile bool buf_load_should_start; -static bool buf_load_abort_flag; +static Atomic_relaxed buf_load_abort_flag; /** Start the buffer pool dump/load task and instructs it to start a dump. */ void buf_dump_start() @@ -295,7 +295,7 @@ buf_dump( /* limit the number of total pages dumped to X% of the total number of pages */ - t_pages = buf_pool.curr_size * srv_buf_pool_dump_pct / 100; + t_pages = buf_pool.curr_size() * srv_buf_pool_dump_pct / 100; if (n_pages > t_pages) { buf_dump_status(STATUS_INFO, "Restricted to " ULINTPF @@ -477,10 +477,10 @@ buf_load() return; } - /* If dump is larger than the buffer pool(s), then we ignore the + /* If the dump is larger than the buffer pool, then we ignore the extra trailing. This could happen if a dump is made, then buffer pool is shrunk and then load is attempted. */ - dump_n = std::min(dump_n, buf_pool.get_n_pages()); + dump_n = std::min(dump_n, buf_pool.curr_size()); if (dump_n != 0) { dump = static_cast(ut_malloc_nokey( diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 1a3368c9f94..c019786867b 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -281,6 +281,8 @@ void buf_page_t::write_complete(bool persistent, bool error, uint32_t state) { ut_ad(!persistent == fsp_is_system_temporary(id().space())); ut_ad(state >= WRITE_FIX); + ut_ad(!frame || + frame == reinterpret_cast(this)->frame_address()); if (UNIV_LIKELY(!error)) { @@ -795,6 +797,7 @@ bool buf_page_t::flush(fil_space_t *space) noexcept size_t orig_size; #endif buf_tmp_buffer_t *slot= nullptr; + byte *page= frame; if (UNIV_UNLIKELY(!frame)) /* ROW_FORMAT=COMPRESSED */ { @@ -810,7 +813,6 @@ bool buf_page_t::flush(fil_space_t *space) noexcept } else { - byte *page= frame; size= block->physical_size(); #if defined HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE || defined _WIN32 orig_size= size; @@ -891,7 +893,7 @@ static page_id_t buf_flush_check_neighbors(const fil_space_t &space, : space.physical_size() == 1024 ? 3 : 0)); /* When flushed, dirty blocks are searched in neighborhoods of this size, and flushed along with the original page. */ - const ulint s= buf_pool.curr_size / 16; + const ulint s= buf_pool.curr_size() / 16; const uint32_t read_ahead= buf_pool.read_ahead_area; const uint32_t buf_flush_area= read_ahead > s ? static_cast(s) : read_ahead; @@ -1211,16 +1213,15 @@ static void buf_flush_discard_page(buf_page_t *bpage) noexcept /** Flush dirty blocks from the end buf_pool.LRU, and move clean blocks to buf_pool.free. -@param max maximum number of blocks to flush -@param n counts of flushed and evicted pages */ -static void buf_flush_LRU_list_batch(ulint max, flush_counters_t *n) noexcept +@param max maximum number of blocks to flush +@param n counts of flushed and evicted pages +@param to_withdraw buf_pool.to_withdraw() */ +static void buf_flush_LRU_list_batch(ulint max, flush_counters_t *n, + size_t to_withdraw) noexcept { - ulint scanned= 0; + size_t scanned= 0; mysql_mutex_assert_owner(&buf_pool.mutex); - ulint free_limit{buf_pool.LRU_scan_depth}; - if (buf_pool.withdraw_target && buf_pool.is_shrinking()) - free_limit+= buf_pool.withdraw_target - UT_LIST_GET_LEN(buf_pool.withdraw); - + size_t free_limit{buf_pool.LRU_scan_depth + to_withdraw}; const auto neighbors= UT_LIST_GET_LEN(buf_pool.LRU) < BUF_LRU_OLD_MIN_LEN ? 0 : buf_pool.flush_neighbors; fil_space_t *space= nullptr; @@ -1237,8 +1238,8 @@ static void buf_flush_LRU_list_batch(ulint max, flush_counters_t *n) noexcept pages. To avoid such hang, we adjust the LRU limit lower than the limit for data objects as checked in buf_LRU_check_size_of_non_data_objects() i.e. one page less than 5% of BP. */ - size_t pool_limit= buf_pool.curr_size / 20 - 1; - auto buf_lru_min_len= std::min(pool_limit, BUF_LRU_MIN_LEN); + const size_t buf_lru_min_len= + std::min((buf_pool.usable_size()) / 20 - 1, size_t{BUF_LRU_MIN_LEN}); for (buf_page_t *bpage= UT_LIST_GET_LAST(buf_pool.LRU); bpage && @@ -1372,11 +1373,12 @@ Whether LRU or unzip_LRU is used depends on the state of the system. @param n counts of flushed and evicted pages */ static void buf_do_LRU_batch(ulint max, flush_counters_t *n) noexcept { - if (buf_LRU_evict_from_unzip_LRU()) + const size_t to_withdraw= buf_pool.to_withdraw(); + if (!to_withdraw && buf_LRU_evict_from_unzip_LRU()) buf_free_from_unzip_LRU_list_batch(); n->evicted= 0; n->flushed= 0; - buf_flush_LRU_list_batch(max, n); + buf_flush_LRU_list_batch(max, n, to_withdraw); mysql_mutex_assert_owner(&buf_pool.mutex); buf_lru_freed_page_count+= n->evicted; @@ -2422,6 +2424,13 @@ func_exit: goto func_exit; } +TPOOL_SUPPRESS_TSAN +bool buf_pool_t::running_out() const noexcept +{ + return !recv_recovery_is_on() && + UT_LIST_GET_LEN(free) + UT_LIST_GET_LEN(LRU) < n_blocks / 4; +} + TPOOL_SUPPRESS_TSAN bool buf_pool_t::need_LRU_eviction() const noexcept { @@ -2481,7 +2490,7 @@ static void buf_flush_page_cleaner() noexcept (!UT_LIST_GET_LEN(buf_pool.flush_list) || srv_max_dirty_pages_pct_lwm == 0.0)) { - buf_pool.LRU_warned.clear(std::memory_order_release); + buf_pool.LRU_warned_clear(); /* We are idle; wait for buf_pool.page_cleaner_wakeup() */ my_cond_wait(&buf_pool.do_flush_list, &buf_pool.flush_list_mutex.m_mutex); @@ -2556,6 +2565,7 @@ static void buf_flush_page_cleaner() noexcept buf_pool.n_flush_inc(); mysql_mutex_unlock(&buf_pool.flush_list_mutex); n= srv_max_io_capacity; + os_aio_wait_until_no_pending_writes(false); mysql_mutex_lock(&buf_pool.mutex); LRU_flush: n= buf_flush_LRU(n); @@ -2659,7 +2669,10 @@ static void buf_flush_page_cleaner() noexcept !buf_pool.need_LRU_eviction()) goto check_oldest_and_set_idle; else + { mysql_mutex_lock(&buf_pool.mutex); + os_aio_wait_until_no_pending_writes(false); + } n= srv_max_io_capacity; n= n >= n_flushed ? n - n_flushed : 0; @@ -2700,11 +2713,14 @@ ATTRIBUTE_COLD void buf_pool_t::LRU_warn() noexcept { mysql_mutex_assert_owner(&mutex); try_LRU_scan= false; - if (!LRU_warned.test_and_set(std::memory_order_acquire)) + if (!LRU_warned) + { + LRU_warned= true; sql_print_warning("InnoDB: Could not free any blocks in the buffer pool!" " %zu blocks are in use and %zu free." " Consider increasing innodb_buffer_pool_size.", UT_LIST_GET_LEN(LRU), UT_LIST_GET_LEN(free)); + } } /** Initialize page_cleaner. */ diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index b3315dabc67..1f5d6eab259 100644 --- a/storage/innobase/buf/buf0lru.cc +++ b/storage/innobase/buf/buf0lru.cc @@ -38,6 +38,7 @@ Created 11/5/1995 Heikki Tuuri #include "srv0srv.h" #include "srv0mon.h" #include "my_cpu.h" +#include "log.h" /** The number of blocks from the LRU_old pointer onward, including the block pointed to, must be buf_pool.LRU_old_ratio/BUF_LRU_OLD_RATIO_DIV @@ -133,7 +134,7 @@ static inline void incr_LRU_size_in_bytes(const buf_page_t* bpage) buf_pool.stat.LRU_bytes += bpage->physical_size(); - ut_ad(buf_pool.stat.LRU_bytes <= buf_pool.curr_pool_size); + ut_ad(buf_pool.stat.LRU_bytes <= buf_pool.curr_pool_size()); } /** @return whether the unzip_LRU list should be used for evicting a victim @@ -259,89 +260,52 @@ static bool buf_LRU_free_from_common_LRU_list(ulint limit) return(freed); } -/** @return a buffer block from the buf_pool.free list -@retval NULL if the free list is empty */ -buf_block_t* buf_LRU_get_free_only() -{ - buf_block_t* block; - - mysql_mutex_assert_owner(&buf_pool.mutex); - - block = reinterpret_cast( - UT_LIST_GET_FIRST(buf_pool.free)); - - while (block != NULL) { - ut_ad(block->page.in_free_list); - ut_d(block->page.in_free_list = FALSE); - ut_ad(!block->page.oldest_modification()); - ut_ad(!block->page.in_LRU_list); - ut_a(!block->page.in_file()); - UT_LIST_REMOVE(buf_pool.free, &block->page); - - if (!buf_pool.is_shrinking() - || UT_LIST_GET_LEN(buf_pool.withdraw) - >= buf_pool.withdraw_target - || !buf_pool.will_be_withdrawn(block->page)) { - /* No adaptive hash index entries may point to - a free block. */ - assert_block_ahi_empty(block); - - block->page.set_state(buf_page_t::MEMORY); - block->page.set_os_used(); - break; - } - - /* This should be withdrawn */ - UT_LIST_ADD_LAST(buf_pool.withdraw, &block->page); - ut_d(block->in_withdraw_list = true); - - block = reinterpret_cast( - UT_LIST_GET_FIRST(buf_pool.free)); - } - - return(block); -} - /******************************************************************//** Checks how much of buf_pool is occupied by non-data objects like AHI, lock heaps etc. Depending on the size of non-data objects this function will either assert or issue a warning and switch on the status monitor. */ -static void buf_LRU_check_size_of_non_data_objects() +static void buf_LRU_check_size_of_non_data_objects() noexcept { mysql_mutex_assert_owner(&buf_pool.mutex); - if (recv_recovery_is_on() || buf_pool.n_chunks_new != buf_pool.n_chunks) + if (recv_recovery_is_on()) return; - const auto s= UT_LIST_GET_LEN(buf_pool.free) + UT_LIST_GET_LEN(buf_pool.LRU); + const size_t curr_size{buf_pool.usable_size()}; - if (s < buf_pool.curr_size / 20) - ib::fatal() << "Over 95 percent of the buffer pool is" - " occupied by lock heaps" + auto s= UT_LIST_GET_LEN(buf_pool.free) + UT_LIST_GET_LEN(buf_pool.LRU); + + if (s < curr_size / 20) + { + sql_print_error("[FATAL] InnoDB: Over 95 percent of the buffer pool is" + " occupied by lock heaps" #ifdef BTR_CUR_HASH_ADAPT - " or the adaptive hash index" + " or the adaptive hash index" #endif /* BTR_CUR_HASH_ADAPT */ - "! Check that your transactions do not set too many" - " row locks, or review if innodb_buffer_pool_size=" - << (buf_pool.curr_size >> (20U - srv_page_size_shift)) - << "M could be bigger."; + "! Check that your transactions do not set too many" + " row locks, or review if innodb_buffer_pool_size=%zuM" + " could be bigger", + curr_size >> (20 - srv_page_size_shift)); + abort(); + } - if (s < buf_pool.curr_size / 3) + if (s < curr_size / 3) { if (!buf_lru_switched_on_innodb_mon && srv_monitor_timer) { /* Over 67 % of the buffer pool is occupied by lock heaps or the adaptive hash index. This may be a memory leak! */ - ib::warn() << "Over 67 percent of the buffer pool is" - " occupied by lock heaps" + sql_print_warning("InnoDB: Over 67 percent of the buffer pool is" + " occupied by lock heaps" #ifdef BTR_CUR_HASH_ADAPT - " or the adaptive hash index" + " or the adaptive hash index" #endif /* BTR_CUR_HASH_ADAPT */ - "! Check that your transactions do not set too many row locks." - " innodb_buffer_pool_size=" - << (buf_pool.curr_size >> (20U - srv_page_size_shift)) - << "M. Starting the InnoDB Monitor to print diagnostics."; + "! Check that your transactions do not set too many" + " row locks. innodb_buffer_pool_size=%zuM." + " Starting the InnoDB Monitor to print diagnostics.", + curr_size >> (20 - srv_page_size_shift)); + buf_lru_switched_on_innodb_mon= true; srv_print_innodb_monitor= TRUE; srv_monitor_timer_schedule_now(); @@ -389,15 +353,15 @@ buf_block_t *buf_LRU_get_free_block(bool have_mutex) retry: /* If there is a block in the free list, take it */ - block= buf_LRU_get_free_only(); + block= buf_pool.allocate(); if (block) { got_block: const ulint LRU_size= UT_LIST_GET_LEN(buf_pool.LRU); const ulint available= UT_LIST_GET_LEN(buf_pool.free); - const ulint scan_depth= buf_pool.LRU_scan_depth / 2; - ut_ad(LRU_size <= BUF_LRU_MIN_LEN || - available >= scan_depth || buf_pool.need_LRU_eviction()); + const size_t scan_depth{buf_pool.LRU_scan_depth / 2}; + ut_ad(LRU_size <= BUF_LRU_MIN_LEN || available >= scan_depth || + buf_pool.is_shrinking() || buf_pool.need_LRU_eviction()); ut_d(bool signalled = false); @@ -446,7 +410,7 @@ got_block: waited= true; - while (!(block= buf_LRU_get_free_only())) + while (!(block= buf_pool.allocate())) { buf_pool.stat.LRU_waits++; @@ -811,10 +775,10 @@ bool buf_LRU_free_page(buf_page_t *bpage, bool zip) if (zip || !bpage->zip.data || !bpage->frame) { break; } + mysql_mutex_lock(&buf_pool.flush_list_mutex); relocate_compressed: b = static_cast(ut_zalloc_nokey(sizeof *b)); ut_a(b); - mysql_mutex_lock(&buf_pool.flush_list_mutex); new (b) buf_page_t(*bpage); b->frame = nullptr; { @@ -833,7 +797,12 @@ func_exit: hash_lock.unlock(); return(false); } - goto relocate_compressed; + mysql_mutex_lock(&buf_pool.flush_list_mutex); + if (bpage->can_relocate()) { + goto relocate_compressed; + } + mysql_mutex_unlock(&buf_pool.flush_list_mutex); + goto func_exit; } mysql_mutex_assert_owner(&buf_pool.mutex); @@ -872,7 +841,6 @@ func_exit: /* The fields of bpage were copied to b before buf_LRU_block_remove_hashed() was invoked. */ - ut_ad(!b->in_zip_hash); ut_ad(b->in_LRU_list); ut_ad(b->in_page_hash); ut_d(b->in_page_hash = false); @@ -988,24 +956,12 @@ buf_LRU_block_free_non_file_page( if (data != NULL) { block->page.zip.data = NULL; - buf_pool_mutex_exit_forbid(); - ut_ad(block->zip_size()); - buf_buddy_free(data, block->zip_size()); - - buf_pool_mutex_exit_allow(); page_zip_set_size(&block->page.zip, 0); } - if (buf_pool.is_shrinking() - && UT_LIST_GET_LEN(buf_pool.withdraw) < buf_pool.withdraw_target - && buf_pool.will_be_withdrawn(block->page)) { - /* This should be withdrawn */ - UT_LIST_ADD_LAST( - buf_pool.withdraw, - &block->page); - ut_d(block->in_withdraw_list = true); + if (buf_pool.to_withdraw() && buf_pool.withdraw(block->page)) { } else { UT_LIST_ADD_FIRST(buf_pool.free, &block->page); ut_d(block->page.in_free_list = true); @@ -1106,7 +1062,6 @@ static bool buf_LRU_block_remove_hashed(buf_page_t *bpage, const page_id_t id, MEM_CHECK_ADDRESSABLE(bpage->zip.data, bpage->zip_size()); } - ut_ad(!bpage->in_zip_hash); buf_pool.page_hash.remove(chain, bpage); page_hash_latch& hash_lock = buf_pool.page_hash.lock_get(chain); @@ -1118,11 +1073,7 @@ static bool buf_LRU_block_remove_hashed(buf_page_t *bpage, const page_id_t id, ut_ad(!bpage->oldest_modification()); hash_lock.unlock(); - buf_pool_mutex_exit_forbid(); - buf_buddy_free(bpage->zip.data, bpage->zip_size()); - - buf_pool_mutex_exit_allow(); bpage->lock.free(); ut_free(bpage); return false; @@ -1151,12 +1102,7 @@ static bool buf_LRU_block_remove_hashed(buf_page_t *bpage, const page_id_t id, ut_ad(!bpage->in_free_list); ut_ad(!bpage->oldest_modification()); ut_ad(!bpage->in_LRU_list); - buf_pool_mutex_exit_forbid(); - buf_buddy_free(data, bpage->zip_size()); - - buf_pool_mutex_exit_allow(); - page_zip_set_size(&bpage->zip, 0); } @@ -1327,7 +1273,7 @@ void buf_LRU_validate() ut_ad(!bpage->frame || reinterpret_cast(bpage) ->in_unzip_LRU_list - == bpage->belongs_to_unzip_LRU()); + == !!bpage->zip.data); if (bpage->is_old()) { const buf_page_t* prev diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc index 09c30504f52..bddd0739ce3 100644 --- a/storage/innobase/buf/buf0rea.cc +++ b/storage/innobase/buf/buf0rea.cc @@ -44,7 +44,7 @@ Created 11/5/1995 Heikki Tuuri #include "log.h" #include "mariadb_stats.h" -/** If there are buf_pool.curr_size per the number below pending reads, then +/** If there are buf_pool.curr_size() per the number below pending reads, then read-ahead is not done: this is to prevent flooding the buffer pool with i/o-fixed buffer blocks */ #define BUF_READ_AHEAD_PEND_LIMIT 2 @@ -63,7 +63,6 @@ inline uint32_t buf_pool_t::watch_remove(buf_page_t *w, ut_ad(xtest() || page_hash.lock_get(chain).is_write_locked()); ut_ad(w >= &watch[0]); ut_ad(w < &watch[array_elements(watch)]); - ut_ad(!w->in_zip_hash); ut_ad(!w->zip.data); uint32_t s{w->state()}; @@ -372,7 +371,7 @@ ulint buf_read_ahead_random(const page_id_t page_id, bool ibuf) noexcept return 0; if (os_aio_pending_reads_approx() > - buf_pool.curr_size / BUF_READ_AHEAD_PEND_LIMIT) + buf_pool.curr_size() / BUF_READ_AHEAD_PEND_LIMIT) return 0; fil_space_t* space= fil_space_t::get(page_id.space()); @@ -525,7 +524,7 @@ ulint buf_read_ahead_linear(const page_id_t page_id, bool ibuf) noexcept return 0; if (os_aio_pending_reads_approx() > - buf_pool.curr_size / BUF_READ_AHEAD_PEND_LIMIT) + buf_pool.curr_size() / BUF_READ_AHEAD_PEND_LIMIT) return 0; const uint32_t buf_read_ahead_area= buf_pool.read_ahead_area; diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index 26177c701ad..9236e7e005d 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -930,7 +930,7 @@ void dict_sys_t::create() noexcept UT_LIST_INIT(table_LRU, &dict_table_t::table_LRU); UT_LIST_INIT(table_non_LRU, &dict_table_t::table_LRU); - const ulint hash_size = buf_pool_get_curr_size() + const ulint hash_size = buf_pool.curr_size() / (DICT_POOL_PER_TABLE_HASH * UNIV_WORD_SIZE); table_hash.create(hash_size); @@ -4393,7 +4393,7 @@ void dict_sys_t::resize() noexcept table_id_hash.free(); temp_id_hash.free(); - const ulint hash_size = buf_pool_get_curr_size() + const ulint hash_size = buf_pool.curr_size() / (DICT_POOL_PER_TABLE_HASH * UNIV_WORD_SIZE); table_hash.create(hash_size); table_id_hash.create(hash_size); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index b407ed3e4d4..58e40e41bdc 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -45,6 +45,7 @@ this program; if not, write to the Free Software Foundation, Inc., #include #include #include +#include #include #include #include @@ -169,13 +170,9 @@ static const long AUTOINC_OLD_STYLE_LOCKING = 0; static const long AUTOINC_NEW_STYLE_LOCKING = 1; static const long AUTOINC_NO_LOCKING = 2; -static constexpr size_t buf_pool_chunk_min_size= 1U << 20; - static ulong innobase_open_files; static long innobase_autoinc_lock_mode; -ulonglong innobase_buffer_pool_size; - /** Percentage of the buffer pool to reserve for 'old' blocks. Connected to buf_LRU_old_ratio. */ static uint innobase_old_blocks_pct; @@ -3678,53 +3675,25 @@ static int innodb_init_abort() DBUG_RETURN(1); } -/** Return the minimum buffer pool size based on page size */ -static inline ulint min_buffer_pool_size() +static void innodb_buffer_pool_size_update(THD* thd,st_mysql_sys_var*,void*, + const void *save) noexcept { - ulint s= (BUF_LRU_MIN_LEN + BUF_LRU_MIN_LEN / 4) * srv_page_size; - /* buf_pool_chunk_size minimum is 1M, so round up to a multiple */ - ulint alignment= 1U << 20; - return UT_CALC_ALIGN(s, alignment); + buf_pool.resize(*static_cast(save), thd); } -/** Validate the requested buffer pool size. Also, reserve the necessary -memory needed for buffer pool resize. -@param[in] thd thread handle -@param[in] var pointer to system variable -@param[out] save immediate result for update function -@param[in] value incoming string -@return 0 on success, 1 on failure. -*/ -static -int -innodb_buffer_pool_size_validate( - THD* thd, - struct st_mysql_sys_var* var, - void* save, - struct st_mysql_value* value); - -/** Update the system variable innodb_buffer_pool_size using the "saved" -value. This function is registered as a callback with MySQL. -@param[in] thd thread handle -@param[in] var pointer to system variable -@param[out] var_ptr where the formal string goes -@param[in] save immediate result from check function */ -static -void -innodb_buffer_pool_size_update( - THD* thd, - struct st_mysql_sys_var* var, - void* var_ptr, - const void* save); - -static MYSQL_SYSVAR_ULONGLONG(buffer_pool_size, innobase_buffer_pool_size, +static MYSQL_SYSVAR_SIZE_T(buffer_pool_size, buf_pool.size_in_bytes_requested, PLUGIN_VAR_RQCMDARG, - "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.", - innodb_buffer_pool_size_validate, - innodb_buffer_pool_size_update, - 128ULL << 20, - 2ULL << 20, - LLONG_MAX, 1024*1024L); + "The size of the memory buffer InnoDB uses to cache data" + " and indexes of its tables.", + nullptr, innodb_buffer_pool_size_update, 128U << 20, 2U << 20, + size_t(-ssize_t(innodb_buffer_pool_extent_size)), 1U << 20); + +static MYSQL_SYSVAR_SIZE_T(buffer_pool_size_max, buf_pool.size_in_bytes_max, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, + "Maximum innodb_buffer_pool_size", + nullptr, nullptr, 0, 0, + size_t(-ssize_t(innodb_buffer_pool_extent_size)), + innodb_buffer_pool_extent_size); static MYSQL_SYSVAR_UINT(log_write_ahead_size, log_sys.write_size, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, @@ -3776,29 +3745,6 @@ static ulonglong innodb_prepare_commit_versioned(THD* thd, ulonglong *trx_id) return 0; } -/** Initialize and normalize innodb_buffer_pool_{chunk_,}size. */ -static void innodb_buffer_pool_size_init() -{ - if (srv_buf_pool_chunk_unit > srv_buf_pool_size) - { - /* Size unit of buffer pool is larger than srv_buf_pool_size. - adjust srv_buf_pool_chunk_unit for srv_buf_pool_size. */ - srv_buf_pool_chunk_unit = srv_buf_pool_size; - } - else if (srv_buf_pool_chunk_unit == 0) - { - srv_buf_pool_chunk_unit = srv_buf_pool_size / 64; - my_large_page_truncate(&srv_buf_pool_chunk_unit); - } - - if (srv_buf_pool_chunk_unit < buf_pool_chunk_min_size) - srv_buf_pool_chunk_unit = buf_pool_chunk_min_size; - - srv_buf_pool_size = buf_pool_size_align(srv_buf_pool_size); - innobase_buffer_pool_size = srv_buf_pool_size; -} - - static bool compression_algorithm_is_not_loaded(ulong compression_algorithm, myf flags) { @@ -3824,323 +3770,299 @@ compression_algorithm_is_not_loaded(ulong compression_algorithm, myf flags) @retval HA_ERR_INITIALIZATION when some parameters are out of range */ static int innodb_init_params() { - DBUG_ENTER("innodb_init_params"); + DBUG_ENTER("innodb_init_params"); - ulong num_pll_degree; + srv_page_size_shift= innodb_page_size_validate(srv_page_size); + if (!srv_page_size_shift) + { + sql_print_error("InnoDB: Invalid page size=%lu.\n", srv_page_size); + DBUG_RETURN(HA_ERR_INITIALIZATION); + } - /* Check that values don't overflow on 32-bit systems. */ - if (sizeof(ulint) == 4) { - if (innobase_buffer_pool_size > UINT_MAX32) { - sql_print_error( - "innodb_buffer_pool_size can't be over 4GB" - " on 32-bit systems"); - DBUG_RETURN(HA_ERR_OUT_OF_MEM); - } - } + size_t &min= MYSQL_SYSVAR_NAME(buffer_pool_size).min_val; + min= ut_calc_align + (buf_pool.blocks_in_bytes(BUF_LRU_MIN_LEN + BUF_LRU_MIN_LEN / 4), + 1U << 20); + size_t innodb_buffer_pool_size= buf_pool.size_in_bytes_requested; - /* The buffer pool needs to be able to accommodate enough many - pages, even for larger pages */ - MYSQL_SYSVAR_NAME(buffer_pool_size).min_val= min_buffer_pool_size(); + /* With large pages, buffer pool can't grow or shrink. */ + if (!buf_pool.size_in_bytes_max || my_use_large_pages || + innodb_buffer_pool_size > buf_pool.size_in_bytes_max) + buf_pool.size_in_bytes_max= ut_calc_align(innodb_buffer_pool_size, + innodb_buffer_pool_extent_size); - if (innobase_buffer_pool_size < MYSQL_SYSVAR_NAME(buffer_pool_size).min_val) { - ib::error() << "innodb_page_size=" - << srv_page_size << " requires " - << "innodb_buffer_pool_size >= " - << (MYSQL_SYSVAR_NAME(buffer_pool_size).min_val >> 20) - << "MiB current " << (innobase_buffer_pool_size >> 20) - << "MiB"; - DBUG_RETURN(HA_ERR_INITIALIZATION); - } + MYSQL_SYSVAR_NAME(buffer_pool_size).max_val= buf_pool.size_in_bytes_max; - if (!ut_is_2pow(log_sys.write_size)) { - sql_print_error("InnoDB: innodb_log_write_ahead_size=%u" - " is not a power of two", - log_sys.write_size); - DBUG_RETURN(HA_ERR_INITIALIZATION); - } + if (innodb_buffer_pool_size < min) + { + sql_print_error("InnoDB: innodb_page_size=%lu requires " + "innodb_buffer_pool_size >= %zu MiB current %zu MiB", + srv_page_size, min >> 20, innodb_buffer_pool_size >> 20); + DBUG_RETURN(HA_ERR_INITIALIZATION); + } - if (compression_algorithm_is_not_loaded(innodb_compression_algorithm, ME_ERROR_LOG)) - DBUG_RETURN(HA_ERR_INITIALIZATION); + if (!ut_is_2pow(log_sys.write_size)) + { + sql_print_error("InnoDB: innodb_log_write_ahead_size=%u" + " is not a power of two", + log_sys.write_size); + DBUG_RETURN(HA_ERR_INITIALIZATION); + } - if ((srv_encrypt_tables || srv_encrypt_log - || innodb_encrypt_temporary_tables) - && !encryption_key_id_exists(FIL_DEFAULT_ENCRYPTION_KEY)) { - sql_print_error("InnoDB: cannot enable encryption, " - "encryption plugin is not available"); - DBUG_RETURN(HA_ERR_INITIALIZATION); - } + if (compression_algorithm_is_not_loaded(innodb_compression_algorithm, ME_ERROR_LOG)) + DBUG_RETURN(HA_ERR_INITIALIZATION); + + if ((srv_encrypt_tables || srv_encrypt_log || + innodb_encrypt_temporary_tables) && + !encryption_key_id_exists(FIL_DEFAULT_ENCRYPTION_KEY)) + { + sql_print_error("InnoDB: cannot enable encryption, " + "encryption plugin is not available"); + DBUG_RETURN(HA_ERR_INITIALIZATION); + } #ifdef _WIN32 - if (!is_filename_allowed(srv_buf_dump_filename, - strlen(srv_buf_dump_filename), FALSE)) { - sql_print_error("InnoDB: innodb_buffer_pool_filename" - " cannot have colon (:) in the file name."); - DBUG_RETURN(HA_ERR_INITIALIZATION); - } + if (!is_filename_allowed(srv_buf_dump_filename, + strlen(srv_buf_dump_filename), false)) + { + sql_print_error("InnoDB: innodb_buffer_pool_filename" + " cannot have colon (:) in the file name."); + DBUG_RETURN(HA_ERR_INITIALIZATION); + } #endif - /* First calculate the default path for innodb_data_home_dir etc., - in case the user has not given any value. + /* First calculate the default path for innodb_data_home_dir etc., + in case the user has not given any value. - Note that when using the embedded server, the datadirectory is not - necessarily the current directory of this program. */ + Note that when using the embedded server, the datadirectory is not + necessarily the current directory of this program. */ - fil_path_to_mysql_datadir = + fil_path_to_mysql_datadir = #ifndef HAVE_REPLICATION - mysqld_embedded ? mysql_real_data_home : + mysqld_embedded ? mysql_real_data_home : #endif - "./"; + "./"; - /* Set InnoDB initialization parameters according to the values - read from MySQL .cnf file */ + /* Set InnoDB initialization parameters according to the values + read from MySQL .cnf file */ - /* The default dir for data files is the datadir of MySQL */ + /* The default dir for data files is the datadir of MySQL */ - srv_data_home = innobase_data_home_dir - ? innobase_data_home_dir - : const_cast(fil_path_to_mysql_datadir); + srv_data_home= innobase_data_home_dir + ? innobase_data_home_dir + : const_cast(fil_path_to_mysql_datadir); #ifdef WITH_WSREP - /* If we use the wsrep API, then we need to tell the server - the path to the data files (for passing it to the SST scripts): */ - wsrep_set_data_home_dir(srv_data_home); + /* If we use the wsrep API, then we need to tell the server + the path to the data files (for passing it to the SST scripts): */ + wsrep_set_data_home_dir(srv_data_home); #endif /* WITH_WSREP */ - /*--------------- Shared tablespaces -------------------------*/ + /*--------------- Shared tablespaces -------------------------*/ - /* Check that the value of system variable innodb_page_size was - set correctly. Its value was put into srv_page_size. If valid, - return the associated srv_page_size_shift. */ - srv_page_size_shift = innodb_page_size_validate(srv_page_size); - if (!srv_page_size_shift) { - sql_print_error("InnoDB: Invalid page size=%lu.\n", - srv_page_size); - DBUG_RETURN(HA_ERR_INITIALIZATION); - } + /* Check that the value of system variable innodb_page_size was + set correctly. Its value was put into srv_page_size. If valid, + return the associated srv_page_size_shift. */ - srv_sys_space.set_space_id(TRX_SYS_SPACE); + srv_sys_space.set_space_id(TRX_SYS_SPACE); + /* Temporary tablespace is in full crc32 format. */ + srv_tmp_space.set_flags(FSP_FLAGS_FCRC32_MASK_MARKER | + FSP_FLAGS_FCRC32_PAGE_SSIZE()); - switch (srv_checksum_algorithm) { - case SRV_CHECKSUM_ALGORITHM_FULL_CRC32: - case SRV_CHECKSUM_ALGORITHM_STRICT_FULL_CRC32: - srv_sys_space.set_flags(FSP_FLAGS_FCRC32_MASK_MARKER - | FSP_FLAGS_FCRC32_PAGE_SSIZE()); - break; - default: - srv_sys_space.set_flags(FSP_FLAGS_PAGE_SSIZE()); - } + switch (srv_checksum_algorithm) { + case SRV_CHECKSUM_ALGORITHM_FULL_CRC32: + case SRV_CHECKSUM_ALGORITHM_STRICT_FULL_CRC32: + srv_sys_space.set_flags(srv_tmp_space.flags()); + break; + default: + srv_sys_space.set_flags(FSP_FLAGS_PAGE_SSIZE()); + } - srv_sys_space.set_path(srv_data_home); + srv_sys_space.set_path(srv_data_home); - /* Supports raw devices */ - if (!srv_sys_space.parse_params(innobase_data_file_path, true)) { - ib::error() << "Unable to parse innodb_data_file_path=" - << innobase_data_file_path; - DBUG_RETURN(HA_ERR_INITIALIZATION); - } + if (!srv_sys_space.parse_params(innobase_data_file_path, true)) + { + sql_print_error("InnoDB: Unable to parse innodb_data_file_path=%s", + innobase_data_file_path); + DBUG_RETURN(HA_ERR_INITIALIZATION); + } - srv_tmp_space.set_path(srv_data_home); + srv_tmp_space.set_path(srv_data_home); - /* Temporary tablespace is in full crc32 format. */ - srv_tmp_space.set_flags(FSP_FLAGS_FCRC32_MASK_MARKER - | FSP_FLAGS_FCRC32_PAGE_SSIZE()); + if (!srv_tmp_space.parse_params(innobase_temp_data_file_path, false)) + { + sql_print_error("InnoDB: Unable to parse innodb_temp_data_file_path=%s", + innobase_temp_data_file_path); + DBUG_RETURN(HA_ERR_INITIALIZATION); + } - if (!srv_tmp_space.parse_params(innobase_temp_data_file_path, false)) { - ib::error() << "Unable to parse innodb_temp_data_file_path=" - << innobase_temp_data_file_path; - DBUG_RETURN(HA_ERR_INITIALIZATION); - } + /* Perform all sanity check before we take action of deleting files*/ + if (srv_sys_space.intersection(&srv_tmp_space)) + { + sql_print_error("innodb_temporary and innodb_system" + " file names seem to be the same."); + DBUG_RETURN(HA_ERR_INITIALIZATION); + } - /* Perform all sanity check before we take action of deleting files*/ - if (srv_sys_space.intersection(&srv_tmp_space)) { - sql_print_error("innodb_temporary and innodb_system" - " file names seem to be the same."); - DBUG_RETURN(HA_ERR_INITIALIZATION); - } + srv_sys_space.normalize_size(); + srv_tmp_space.normalize_size(); - srv_sys_space.normalize_size(); - srv_tmp_space.normalize_size(); + /* ------------ UNDO tablespaces files ---------------------*/ + if (!srv_undo_dir) + srv_undo_dir= const_cast(fil_path_to_mysql_datadir); - /* ------------ UNDO tablespaces files ---------------------*/ - if (!srv_undo_dir) { - srv_undo_dir = const_cast(fil_path_to_mysql_datadir); - } + if (strchr(srv_undo_dir, ';')) + { + sql_print_error("syntax error in innodb_undo_directory"); + DBUG_RETURN(HA_ERR_INITIALIZATION); + } - if (strchr(srv_undo_dir, ';')) { - sql_print_error("syntax error in innodb_undo_directory"); - DBUG_RETURN(HA_ERR_INITIALIZATION); - } + if (!srv_log_group_home_dir) + srv_log_group_home_dir= const_cast(fil_path_to_mysql_datadir); - /* -------------- All log files ---------------------------*/ + if (strchr(srv_log_group_home_dir, ';')) + { + sql_print_error("syntax error in innodb_log_group_home_dir"); + DBUG_RETURN(HA_ERR_INITIALIZATION); + } - /* The default dir for log files is the datadir of MySQL */ + DBUG_ASSERT(innodb_change_buffering <= IBUF_USE_ALL); - if (!srv_log_group_home_dir) { - srv_log_group_home_dir - = const_cast(fil_path_to_mysql_datadir); - } + /* Check that interdependent parameters have sane values. */ + if (srv_max_buf_pool_modified_pct < srv_max_dirty_pages_pct_lwm) + { + sql_print_warning("InnoDB: innodb_max_dirty_pages_pct_lwm" + " cannot be set higher than" + " innodb_max_dirty_pages_pct.\n" + "InnoDB: Setting" + " innodb_max_dirty_pages_pct_lwm to %lf\n", + srv_max_buf_pool_modified_pct); + srv_max_dirty_pages_pct_lwm = srv_max_buf_pool_modified_pct; + } - if (strchr(srv_log_group_home_dir, ';')) { - sql_print_error("syntax error in innodb_log_group_home_dir"); - DBUG_RETURN(HA_ERR_INITIALIZATION); - } + if (srv_max_io_capacity == SRV_MAX_IO_CAPACITY_DUMMY_DEFAULT) + { + if (srv_io_capacity >= SRV_MAX_IO_CAPACITY_LIMIT / 2) + /* Avoid overflow. */ + srv_max_io_capacity= SRV_MAX_IO_CAPACITY_LIMIT; + else + /* The user has not set the value. We should set it based on + innodb_io_capacity. */ + srv_max_io_capacity= std::max(2 * srv_io_capacity, 2000UL); + } + else if (srv_max_io_capacity < srv_io_capacity) + { + sql_print_warning("InnoDB: innodb_io_capacity cannot be set higher than" + " innodb_io_capacity_max." + "Setting innodb_io_capacity=%lu", srv_max_io_capacity); + srv_io_capacity= srv_max_io_capacity; + } - DBUG_ASSERT(innodb_change_buffering <= IBUF_USE_ALL); + if (UNIV_PAGE_SIZE_DEF != srv_page_size) + { + sql_print_information("InnoDB: innodb_page_size=%lu", srv_page_size); + srv_max_undo_log_size= + std::max(srv_max_undo_log_size, + ulonglong(SRV_UNDO_TABLESPACE_SIZE_IN_PAGES) << + srv_page_size_shift); + } - /* Check that interdependent parameters have sane values. */ - if (srv_max_buf_pool_modified_pct < srv_max_dirty_pages_pct_lwm) { - sql_print_warning("InnoDB: innodb_max_dirty_pages_pct_lwm" - " cannot be set higher than" - " innodb_max_dirty_pages_pct.\n" - "InnoDB: Setting" - " innodb_max_dirty_pages_pct_lwm to %lf\n", - srv_max_buf_pool_modified_pct); + if (innobase_open_files < 10) + innobase_open_files= (srv_file_per_table && tc_size > 300 && + tc_size < open_files_limit) + ? tc_size + : 300; - srv_max_dirty_pages_pct_lwm = srv_max_buf_pool_modified_pct; - } + if (innobase_open_files > open_files_limit) + { + sql_print_warning("InnoDB: innodb_open_files %lu" + " should not be greater than the open_files_limit %lu", + innobase_open_files, open_files_limit); + if (innobase_open_files > tc_size) + innobase_open_files= tc_size; + } - if (srv_max_io_capacity == SRV_MAX_IO_CAPACITY_DUMMY_DEFAULT) { + const size_t min_open_files_limit= srv_undo_tablespaces + + srv_sys_space.m_files.size() + srv_tmp_space.m_files.size() + 1; + if (min_open_files_limit > innobase_open_files) + { + sql_print_warning("InnoDB: innodb_open_files=%lu is not greater " + "than the number of system tablespace files, " + "temporary tablespace files, " + "innodb_undo_tablespaces=%lu; adjusting " + "to innodb_open_files=%zu", + innobase_open_files, srv_undo_tablespaces, + min_open_files_limit); + innobase_open_files= ulong(min_open_files_limit); + } - if (srv_io_capacity >= SRV_MAX_IO_CAPACITY_LIMIT / 2) { - /* Avoid overflow. */ - srv_max_io_capacity = SRV_MAX_IO_CAPACITY_LIMIT; - } else { - /* The user has not set the value. We should - set it based on innodb_io_capacity. */ - srv_max_io_capacity = - ut_max(2 * srv_io_capacity, 2000UL); - } + srv_max_n_open_files= innobase_open_files; + srv_innodb_status = (ibool) innobase_create_status_file; - } else if (srv_max_io_capacity < srv_io_capacity) { - sql_print_warning("InnoDB: innodb_io_capacity" - " cannot be set higher than" - " innodb_io_capacity_max." - "Setting innodb_io_capacity=%lu", - srv_max_io_capacity); + srv_print_verbose_log= !mysqld_embedded; - srv_io_capacity = srv_max_io_capacity; - } + if (!ut_is_2pow(fts_sort_pll_degree)) + { + ulong n; + for (n= 1; n < fts_sort_pll_degree; n<<= 1) {} + fts_sort_pll_degree= n; + } - if (UNIV_PAGE_SIZE_DEF != srv_page_size) { - ib::info() << "innodb_page_size=" << srv_page_size; - - srv_max_undo_log_size = std::max( - srv_max_undo_log_size, - ulonglong(SRV_UNDO_TABLESPACE_SIZE_IN_PAGES) - << srv_page_size_shift); - } - - srv_buf_pool_size = ulint(innobase_buffer_pool_size); - - if (innobase_open_files < 10) { - innobase_open_files = 300; - if (srv_file_per_table && tc_size > 300 && tc_size < open_files_limit) { - innobase_open_files = tc_size; - } - } - - if (innobase_open_files > open_files_limit) { - ib::warn() << "innodb_open_files " << innobase_open_files - << " should not be greater" - << " than the open_files_limit " << open_files_limit; - if (innobase_open_files > tc_size) { - innobase_open_files = tc_size; - } - } - - ulint min_open_files_limit = srv_undo_tablespaces - + srv_sys_space.m_files.size() - + srv_tmp_space.m_files.size() + 1; - if (min_open_files_limit > innobase_open_files) { - sql_print_warning( - "InnoDB: innodb_open_files=%lu is not greater " - "than the number of system tablespace files, " - "temporary tablespace files, " - "innodb_undo_tablespaces=%u; adjusting " - "to innodb_open_files=%zu", - innobase_open_files, srv_undo_tablespaces, - min_open_files_limit); - innobase_open_files = (ulong) min_open_files_limit; - } - - srv_max_n_open_files = innobase_open_files; - srv_innodb_status = (ibool) innobase_create_status_file; - - srv_print_verbose_log = mysqld_embedded ? 0 : 1; - - /* Round up fts_sort_pll_degree to nearest power of 2 number */ - for (num_pll_degree = 1; - num_pll_degree < fts_sort_pll_degree; - num_pll_degree <<= 1) { - - /* No op */ - } - - fts_sort_pll_degree = num_pll_degree; - - /* Store the default charset-collation number of this MySQL - installation */ - - data_mysql_default_charset_coll = (ulint) default_charset_info->number; + /* Store the default charset-collation number of this installation */ + data_mysql_default_charset_coll = (ulint) default_charset_info->number; #if !defined _WIN32 && defined O_DIRECT - if (srv_use_atomic_writes && my_may_have_atomic_write) { - /* - Force O_DIRECT on Unixes (on Windows writes are always - unbuffered) - */ - switch (srv_file_flush_method) { - case SRV_O_DIRECT: - case SRV_O_DIRECT_NO_FSYNC: - break; - default: - srv_file_flush_method = SRV_O_DIRECT; - fprintf(stderr, "InnoDB: using O_DIRECT due to atomic writes.\n"); - } - } + if (srv_use_atomic_writes && my_may_have_atomic_write) + { + /* Force O_DIRECT on Unixes (on Windows writes are always unbuffered) */ + switch (srv_file_flush_method) { + case SRV_O_DIRECT: + case SRV_O_DIRECT_NO_FSYNC: + break; + default: + srv_file_flush_method= SRV_O_DIRECT; + fprintf(stderr, "InnoDB: using O_DIRECT due to atomic writes.\n"); + } + } #endif #if defined __linux__ || defined _WIN32 - if (srv_flush_log_at_trx_commit == 2) { - /* Do not disable the file system cache if - innodb_flush_log_at_trx_commit=2. */ - log_sys.log_buffered = true; - } + if (srv_flush_log_at_trx_commit == 2) + /* Do not disable the file system cache if + innodb_flush_log_at_trx_commit=2. */ + log_sys.log_buffered= true; #endif #if !defined LINUX_NATIVE_AIO && !defined HAVE_URING && !defined _WIN32 - /* Currently native AIO is supported only on windows and linux - and that also when the support is compiled in. In all other - cases, we ignore the setting of innodb_use_native_aio. */ - srv_use_native_aio = FALSE; + /* Currently native AIO is supported only on windows and linux + and that also when the support is compiled in. In all other + cases, we ignore the setting of innodb_use_native_aio. */ + srv_use_native_aio= FALSE; #endif #ifdef HAVE_URING - if (srv_use_native_aio && io_uring_may_be_unsafe) { - sql_print_warning("innodb_use_native_aio may cause " - "hangs with this kernel %s; see " - "https://jira.mariadb.org/browse/MDEV-26674", - io_uring_may_be_unsafe); - } + if (srv_use_native_aio && io_uring_may_be_unsafe) + sql_print_warning("innodb_use_native_aio may cause " + "hangs with this kernel %s; see " + "https://jira.mariadb.org/browse/MDEV-26674", + io_uring_may_be_unsafe); #endif #ifdef _WIN32 - switch (srv_file_flush_method) { - case SRV_ALL_O_DIRECT_FSYNC + 1 /* "async_unbuffered"="unbuffered" */: - srv_file_flush_method = SRV_ALL_O_DIRECT_FSYNC; - break; - case SRV_ALL_O_DIRECT_FSYNC + 2 /* "normal"="fsync" */: - srv_file_flush_method = SRV_FSYNC; - break; - default: - ut_ad(srv_file_flush_method <= SRV_ALL_O_DIRECT_FSYNC); - } + switch (srv_file_flush_method) { + case SRV_ALL_O_DIRECT_FSYNC + 1 /* "async_unbuffered"="unbuffered" */: + srv_file_flush_method= SRV_ALL_O_DIRECT_FSYNC; + break; + case SRV_ALL_O_DIRECT_FSYNC + 2 /* "normal"="fsync" */: + srv_file_flush_method= SRV_FSYNC; + break; + default: + ut_ad(srv_file_flush_method <= SRV_ALL_O_DIRECT_FSYNC); + } #else - ut_ad(srv_file_flush_method <= SRV_O_DIRECT_NO_FSYNC); + ut_ad(srv_file_flush_method <= SRV_O_DIRECT_NO_FSYNC); #endif - innodb_buffer_pool_size_init(); - - srv_lock_table_size = 5 * (srv_buf_pool_size >> srv_page_size_shift); - DBUG_RETURN(0); + srv_lock_table_size = 5 * buf_pool.curr_size(); + DBUG_RETURN(0); } /** Initialize the InnoDB storage engine plugin. @@ -17614,22 +17536,6 @@ innodb_stopword_table_validate( return(ret); } -extern void buf_resize_start(); - -/** Update the system variable innodb_buffer_pool_size using the "saved" -value. This function is registered as a callback with MySQL. -@param[in] save immediate result from check function */ -static -void -innodb_buffer_pool_size_update(THD*,st_mysql_sys_var*,void*, const void* save) -{ - snprintf(export_vars.innodb_buffer_pool_resize_status, - sizeof(export_vars.innodb_buffer_pool_resize_status), - "Buffer pool resize requested"); - - buf_resize_start(); -} - /** The latest assigned innodb_ft_aux_table name */ static char* innodb_ft_aux_table; @@ -19295,11 +19201,12 @@ static MYSQL_SYSVAR_UINT(autoextend_increment, "Data file autoextend increment in megabytes", NULL, NULL, 64, 1, 1000, 0); -static MYSQL_SYSVAR_SIZE_T(buffer_pool_chunk_size, srv_buf_pool_chunk_unit, - PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, - "Size of a single memory chunk" - " for resizing buffer pool. Online buffer pool resizing happens at this" - " granularity. 0 means autosize this variable based on buffer pool size.", +static size_t innodb_buffer_pool_chunk_size; + +static MYSQL_SYSVAR_SIZE_T(buffer_pool_chunk_size, + innodb_buffer_pool_chunk_size, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY | PLUGIN_VAR_DEPRECATED, + "Deprecated parameter with no effect", NULL, NULL, 0, 0, SIZE_T_MAX, 1024 * 1024); @@ -20026,6 +19933,7 @@ static MYSQL_SYSVAR_BOOL(encrypt_temporary_tables, innodb_encrypt_temporary_tabl static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(autoextend_increment), MYSQL_SYSVAR(buffer_pool_size), + MYSQL_SYSVAR(buffer_pool_size_max), MYSQL_SYSVAR(buffer_pool_chunk_size), MYSQL_SYSVAR(buffer_pool_filename), MYSQL_SYSVAR(buffer_pool_dump_now), @@ -21130,90 +21038,6 @@ innobase_convert_to_system_charset( cs2, to, static_cast(len), errors))); } -/** Validate the requested buffer pool size. Also, reserve the necessary -memory needed for buffer pool resize. -@param[in] thd thread handle -@param[out] save immediate result for update function -@param[in] value incoming string -@return 0 on success, 1 on failure. -*/ -static -int -innodb_buffer_pool_size_validate( - THD* thd, - st_mysql_sys_var*, - void* save, - struct st_mysql_value* value) -{ - longlong intbuf; - - value->val_int(value, &intbuf); - - if (static_cast(intbuf) < MYSQL_SYSVAR_NAME(buffer_pool_size).min_val) { - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - ER_WRONG_ARGUMENTS, - "innodb_buffer_pool_size must be at least" - " %lld for innodb_page_size=%lu", - MYSQL_SYSVAR_NAME(buffer_pool_size).min_val, - srv_page_size); - return(1); - } - - if (!srv_was_started) { - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - ER_WRONG_ARGUMENTS, - "Cannot update innodb_buffer_pool_size," - " because InnoDB is not started."); - return(1); - } - - mysql_mutex_lock(&buf_pool.mutex); - - if (srv_buf_pool_old_size != srv_buf_pool_size) { - mysql_mutex_unlock(&buf_pool.mutex); - my_printf_error(ER_WRONG_ARGUMENTS, - "Another buffer pool resize is already in progress.", MYF(0)); - return(1); - } - - ulint requested_buf_pool_size = buf_pool_size_align(ulint(intbuf)); - - *static_cast(save) = requested_buf_pool_size; - - if (srv_buf_pool_size == ulint(intbuf)) { - mysql_mutex_unlock(&buf_pool.mutex); - /* nothing to do */ - return(0); - } - - if (srv_buf_pool_size == requested_buf_pool_size) { - mysql_mutex_unlock(&buf_pool.mutex); - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - ER_WRONG_ARGUMENTS, - "innodb_buffer_pool_size must be at least" - " innodb_buffer_pool_chunk_size=%zu", - srv_buf_pool_chunk_unit); - /* nothing to do */ - return(0); - } - - srv_buf_pool_size = requested_buf_pool_size; - mysql_mutex_unlock(&buf_pool.mutex); - - if (intbuf != static_cast(requested_buf_pool_size)) { - char buf[64]; - int len = 64; - value->val_str(value, buf, &len); - push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, - ER_TRUNCATED_WRONG_VALUE, - "Truncated incorrect %-.32s value: '%-.128s'", - mysql_sysvar_buffer_pool_size.name, - value->val_str(value, buf, &len)); - } - - return(0); -} - /*************************************************************//** Check for a valid value of innobase_compression_algorithm. @return 0 for valid innodb_compression_algorithm. */ @@ -21509,19 +21333,3 @@ void ins_node_t::vers_update_end(row_prebuilt_t *prebuilt, bool history_row) if (UNIV_LIKELY_NULL(local_heap)) mem_heap_free(local_heap); } - -/** Calculate aligned buffer pool size based on srv_buf_pool_chunk_unit, -if needed. -@param[in] size size in bytes -@return aligned size */ -ulint buf_pool_size_align(ulint size) noexcept -{ - const size_t m = srv_buf_pool_chunk_unit; - size = ut_max(size, (size_t) MYSQL_SYSVAR_NAME(buffer_pool_size).min_val); - - if (size % m == 0) { - return(size); - } else { - return (size / m + 1) * m; - } -} diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 0554a229e5e..96f848de033 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -3388,7 +3388,7 @@ static int i_s_innodb_stats_fill(THD *thd, TABLE_LIST * tables, Item *) DBUG_RETURN(0); } - buf_stats_get_pool_info(&info); + buf_pool.get_info(&info); table = tables->table; @@ -3937,87 +3937,37 @@ and fetch information to information schema tables: INNODB_BUFFER_PAGE. @return 0 on success, 1 on failure */ static int i_s_innodb_buffer_page_fill(THD *thd, TABLE_LIST *tables, Item *) { - int status = 0; - mem_heap_t* heap; + DBUG_ENTER("i_s_innodb_buffer_page_fill"); + RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name.str); - DBUG_ENTER("i_s_innodb_buffer_page_fill"); + /* deny access to user without PROCESS privilege */ + if (check_global_access(thd, PROCESS_ACL)) + DBUG_RETURN(0); - RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name.str); + int status; + buf_page_info_t *b= + static_cast(my_malloc(PSI_INSTRUMENT_ME, + MAX_BUF_INFO_CACHED * sizeof *b, + MYF(MY_WME))); + if (!b) + DBUG_RETURN(1); + for (size_t j= 0;;) + { + memset((void*) b, 0, MAX_BUF_INFO_CACHED * sizeof *b); + mysql_mutex_lock(&buf_pool.mutex); + const size_t N= buf_pool.curr_size(); + const size_t n= std::min(N, MAX_BUF_INFO_CACHED); + for (size_t i= 0; i < n && j < N; i++, j++) + i_s_innodb_buffer_page_get_info(&buf_pool.get_nth_page(j)->page, j, + &b[i]); - /* deny access to user without PROCESS privilege */ - if (check_global_access(thd, PROCESS_ACL)) { - DBUG_RETURN(0); - } - - heap = mem_heap_create(10000); - - for (ulint n = 0; - n < ut_min(buf_pool.n_chunks, buf_pool.n_chunks_new); n++) { - const buf_block_t* block; - ulint n_blocks; - buf_page_info_t* info_buffer; - ulint num_page; - ulint mem_size; - ulint chunk_size; - ulint num_to_process = 0; - ulint block_id = 0; - - /* Get buffer block of the nth chunk */ - block = buf_pool.chunks[n].blocks; - chunk_size = buf_pool.chunks[n].size; - num_page = 0; - - while (chunk_size > 0) { - /* we cache maximum MAX_BUF_INFO_CACHED number of - buffer page info */ - num_to_process = ut_min(chunk_size, - (ulint)MAX_BUF_INFO_CACHED); - - mem_size = num_to_process * sizeof(buf_page_info_t); - - /* For each chunk, we'll pre-allocate information - structures to cache the page information read from - the buffer pool. Doing so before obtain any mutex */ - info_buffer = (buf_page_info_t*) mem_heap_zalloc( - heap, mem_size); - - /* Obtain appropriate mutexes. Since this is diagnostic - buffer pool info printout, we are not required to - preserve the overall consistency, so we can - release mutex periodically */ - mysql_mutex_lock(&buf_pool.mutex); - - /* GO through each block in the chunk */ - for (n_blocks = num_to_process; n_blocks--; block++) { - i_s_innodb_buffer_page_get_info( - &block->page, block_id, - info_buffer + num_page); - block_id++; - num_page++; - } - - mysql_mutex_unlock(&buf_pool.mutex); - - /* Fill in information schema table with information - just collected from the buffer chunk scan */ - status = i_s_innodb_buffer_page_fill( - thd, tables, info_buffer, - num_page); - - /* If something goes wrong, break and return */ - if (status) { - break; - } - - mem_heap_empty(heap); - chunk_size -= num_to_process; - num_page = 0; - } - } - - mem_heap_free(heap); - - DBUG_RETURN(status); + mysql_mutex_unlock(&buf_pool.mutex); + status= i_s_innodb_buffer_page_fill(thd, tables, b, n); + if (status || j >= N) + break; + } + my_free(b); + DBUG_RETURN(status); } /*******************************************************************//** diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index b594b86d1ea..07c8a13a72c 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -500,9 +500,7 @@ ibuf_max_size_update( { if (UNIV_UNLIKELY(!ibuf.index)) return; ulint new_size = std::min( - (buf_pool_get_curr_size() >> srv_page_size_shift) * new_val - / 100, uint32_t(~0U)); - + buf_pool.curr_size() * new_val / 100, uint32_t(~0U)); mysql_mutex_lock(&ibuf_mutex); ibuf.max_size = uint32_t(new_size); mysql_mutex_unlock(&ibuf_mutex); @@ -2056,8 +2054,7 @@ corruption: } } - limit = ut_min(IBUF_MAX_N_PAGES_MERGED, - buf_pool_get_curr_size() / 4); + limit = std::min(IBUF_MAX_N_PAGES_MERGED, buf_pool.curr_size() / 4); first_page_no = ibuf_rec_get_page_no(mtr, rec); first_space_id = ibuf_rec_get_space(mtr, rec); diff --git a/storage/innobase/include/btr0sea.h b/storage/innobase/include/btr0sea.h index b75cad10180..6d084e8c651 100644 --- a/storage/innobase/include/btr0sea.h +++ b/storage/innobase/include/btr0sea.h @@ -39,12 +39,16 @@ extern mysql_pfs_key_t btr_search_latch_key; #define btr_search_sys_create() btr_search_sys.create() #define btr_search_sys_free() btr_search_sys.free() -/** Disable the adaptive hash search system and empty the index. */ -void btr_search_disable(); +/** Lazily free detached metadata when removing the last reference. */ +ATTRIBUTE_COLD void btr_search_lazy_free(dict_index_t *index); + +/** Disable the adaptive hash search system and empty the index. +@return whether the adaptive hash index was enabled */ +ATTRIBUTE_COLD bool btr_search_disable(); /** Enable the adaptive hash search system. @param resize whether buf_pool_t::resize() is the caller */ -void btr_search_enable(bool resize= false); +ATTRIBUTE_COLD void btr_search_enable(bool resize= false); /*********************************************************************//** Updates the search info. */ diff --git a/storage/innobase/include/buf0buddy.h b/storage/innobase/include/buf0buddy.h index bb9994203d6..9ac26c7d4be 100644 --- a/storage/innobase/include/buf0buddy.h +++ b/storage/innobase/include/buf0buddy.h @@ -24,17 +24,13 @@ Binary buddy allocator for compressed pages Created December 2006 by Marko Makela *******************************************************/ -#ifndef buf0buddy_h -#define buf0buddy_h - +#pragma once #include "buf0types.h" /** @param[in] block size in bytes @return index of buf_pool.zip_free[], or BUF_BUDDY_SIZES */ -inline -ulint -buf_buddy_get_slot(ulint size) +inline ulint buf_buddy_get_slot(ulint size) noexcept { ulint i; ulint s; @@ -53,13 +49,13 @@ buf_buddy_get_slot(ulint size) @param i index of buf_pool.zip_free[] or BUF_BUDDY_SIZES @param lru assigned to true if buf_pool.mutex was temporarily released @return allocated block, never NULL */ -byte *buf_buddy_alloc_low(ulint i, bool *lru) MY_ATTRIBUTE((malloc)); +byte *buf_buddy_alloc_low(ulint i, bool *lru) noexcept MY_ATTRIBUTE((malloc)); /** Allocate a ROW_FORMAT=COMPRESSED block. @param size compressed page size in bytes @param lru assigned to true if buf_pool.mutex was temporarily released @return allocated block, never NULL */ -inline byte *buf_buddy_alloc(ulint size, bool *lru= nullptr) +inline byte *buf_buddy_alloc(ulint size, bool *lru= nullptr) noexcept { return buf_buddy_alloc_low(buf_buddy_get_slot(size), lru); } @@ -68,24 +64,26 @@ inline byte *buf_buddy_alloc(ulint size, bool *lru= nullptr) @param[in] buf block to be freed, must not be pointed to by the buffer pool @param[in] i index of buf_pool.zip_free[], or BUF_BUDDY_SIZES */ -void buf_buddy_free_low(void* buf, ulint i); +void buf_buddy_free_low(void* buf, ulint i) noexcept; /** Deallocate a block. @param[in] buf block to be freed, must not be pointed to by the buffer pool @param[in] size block size in bytes */ -inline void buf_buddy_free(void* buf, ulint size) +inline void buf_buddy_free(void* buf, ulint size) noexcept { - buf_buddy_free_low(buf, buf_buddy_get_slot(size)); + buf_buddy_free_low(buf, buf_buddy_get_slot(size)); } -/** Try to reallocate a block. -@param[in] buf block to be reallocated, must be pointed -to by the buffer pool -@param[in] size block size, up to srv_page_size -@retval false if failed because of no free blocks. */ -bool buf_buddy_realloc(void* buf, ulint size); +ATTRIBUTE_COLD MY_ATTRIBUTE((nonnull, warn_unused_result)) +/** Reallocate a ROW_FORMAT=COMPRESSED page frame during buf_pool_t::resize(). +@param bpage page descriptor covering a ROW_FORMAT=COMPRESSED page +@param block uncompressed block for storage +@return block +@retval nullptr if the block was consumed */ +ATTRIBUTE_COLD +buf_block_t *buf_buddy_shrink(buf_page_t *bpage, buf_block_t *block) noexcept; -/** Combine all pairs of free buddies. */ -void buf_buddy_condense_free(); -#endif /* buf0buddy_h */ +/** Combine all pairs of free buddies. +@param size the target innodb_buffer_pool_size */ +ATTRIBUTE_COLD void buf_buddy_condense_free(size_t size) noexcept; diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index bb3846038e2..0a3f04c9844 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -35,13 +35,16 @@ Created 11/5/1995 Heikki Tuuri #include "assume_aligned.h" #include "buf0types.h" #ifndef UNIV_INNOCHECKSUM -#include "ut0byte.h" #include "page0types.h" #include "log0log.h" #include "srv0srv.h" #include "transactional_lock_guard.h" #include +/** The allocation granularity of innodb_buffer_pool_size */ +constexpr size_t innodb_buffer_pool_extent_size= + sizeof(size_t) < 8 ? 2 << 20 : 8 << 20; + /** @name Modes for buf_page_get_gen */ /* @{ */ #define BUF_GET 10 /*!< get always */ @@ -71,7 +74,7 @@ struct buf_pool_info_t ulint pool_size; /*!< Buffer Pool size in pages */ ulint lru_len; /*!< Length of buf_pool.LRU */ ulint old_lru_len; /*!< buf_pool.LRU_old_len */ - ulint free_list_len; /*!< Length of buf_pool.free list */ + ulint free_list_len; /*!< free + lazy_allocate_size() */ ulint flush_list_len; /*!< Length of buf_pool.flush_list */ ulint n_pend_unzip; /*!< buf_pool.n_pend_unzip, pages pending decompress */ @@ -142,10 +145,8 @@ operator<<( const page_id_t page_id); #ifndef UNIV_INNOCHECKSUM -# define buf_pool_get_curr_size() srv_buf_pool_curr_size # define buf_block_free(block) buf_pool.free_block(block) - -#define buf_page_get(ID, SIZE, LA, MTR) \ +# define buf_page_get(ID, SIZE, LA, MTR) \ buf_page_get_gen(ID, SIZE, LA, NULL, BUF_GET, MTR) /** Try to buffer-fix a page. @@ -395,9 +396,6 @@ void buf_print_io( /*=========*/ FILE* file); /*!< in: file where to print */ -/** Collect buffer pool metadata. -@param[out] pool_info buffer pool metadata */ -void buf_stats_get_pool_info(buf_pool_info_t *pool_info) noexcept; /** Refresh the statistics used to print per-second averages. */ void buf_refresh_io_stats() noexcept; @@ -427,12 +425,6 @@ counter value in MONITOR_MODULE_BUF_PAGE. ATTRIBUTE_COLD void buf_page_monitor(const buf_page_t &bpage, bool read) noexcept; -/** Calculate aligned buffer pool size based on srv_buf_pool_chunk_unit, -if needed. -@param[in] size size in bytes -@return aligned size */ -ulint buf_pool_size_align(ulint size) noexcept; - /** Verify that post encryption checksum match with the calculated checksum. This function should be called only if tablespace contains crypt data metadata. @param page page frame @@ -549,7 +541,7 @@ public: /** buf_pool.LRU status mask in state() */ static constexpr uint32_t LRU_MASK= 7U << 29; - /** lock covering the contents of frame */ + /** lock covering the contents of frame() */ block_lock lock; /** pointer to aligned, uncompressed page frame of innodb_page_size */ byte *frame; @@ -559,8 +551,6 @@ public: !frame && !zip.data means an active buf_pool.watch */ page_zip_des_t zip; #ifdef UNIV_DEBUG - /** whether this->list is in buf_pool.zip_hash; protected by buf_pool.mutex */ - bool in_zip_hash; /** whether this->LRU is in buf_pool.LRU (in_file()); protected by buf_pool.mutex */ bool in_LRU_list; @@ -574,7 +564,7 @@ public: /** list member in one of the lists of buf_pool; protected by buf_pool.mutex or buf_pool.flush_list_mutex - state() == NOT_USED: buf_pool.free or buf_pool.withdraw + state() == NOT_USED: buf_pool.free in_file() && oldest_modification(): buf_pool.flush_list (protected by buf_pool.flush_list_mutex) @@ -615,7 +605,7 @@ public: lock() /* not copied */, frame(b.frame), zip(b.zip), #ifdef UNIV_DEBUG - in_zip_hash(b.in_zip_hash), in_LRU_list(b.in_LRU_list), + in_LRU_list(b.in_LRU_list), in_page_hash(b.in_page_hash), in_free_list(b.in_free_list), #endif /* UNIV_DEBUG */ list(b.list), LRU(b.LRU), old(b.old), freed_page_clock(b.freed_page_clock), @@ -632,7 +622,6 @@ public: id_= id; zip.fix= state; oldest_modification_= 0; - ut_d(in_zip_hash= false); ut_d(in_free_list= false); ut_d(in_LRU_list= false); ut_d(in_page_hash= false); @@ -891,10 +880,6 @@ struct buf_block_t{ buf_pool.page_hash can point to buf_page_t or buf_block_t */ #ifdef UNIV_DEBUG - /** whether page.list is in buf_pool.withdraw - ((state() == NOT_USED)) and the buffer pool is being shrunk; - protected by buf_pool.mutex */ - bool in_withdraw_list; /** whether unzip_LRU is in buf_pool.unzip_LRU (in_file() && frame && zip.data); protected by buf_pool.mutex */ @@ -1022,15 +1007,10 @@ struct buf_block_t{ @param state initial state() */ void initialise(const page_id_t page_id, ulint zip_size, uint32_t state) noexcept; -}; -/**********************************************************************//** -Compute the hash fold value for blocks in buf_pool.zip_hash. */ -/* @{ */ -#define BUF_POOL_ZIP_FOLD_PTR(ptr) (ulint(ptr) >> srv_page_size_shift) -#define BUF_POOL_ZIP_FOLD(b) BUF_POOL_ZIP_FOLD_PTR((b)->page.frame) -#define BUF_POOL_ZIP_FOLD_BPAGE(b) BUF_POOL_ZIP_FOLD((buf_block_t*) (b)) -/* @} */ + /** Calculate the page frame address */ + IF_DBUG(,inline) byte *frame_address() const noexcept; +}; /** A "Hazard Pointer" class used to iterate over buf_pool.LRU or buf_pool.flush_list. A hazard pointer is a buf_page_t pointer @@ -1198,59 +1178,62 @@ struct buf_buddy_stat_t { /** The buffer pool */ class buf_pool_t { - /** A chunk of buffers */ - struct chunk_t - { - /** number of elements in blocks[] */ - size_t size; - /** memory allocated for the page frames */ - unsigned char *mem; - /** descriptor of mem */ - ut_new_pfx_t mem_pfx; - /** array of buffer control blocks */ - buf_block_t *blocks; + /** arrays of buf_block_t followed by page frames; + aliged to and repeating every innodb_buffer_pool_extent_size; + each extent comprises pages_in_extent[] blocks */ + alignas(CPU_LEVEL1_DCACHE_LINESIZE) char *memory; + /** the allocation of the above memory, possibly including some + alignment loss at the beginning */ + char *memory_unaligned; + /** the virtual address range size of memory_unaligned */ + size_t size_unaligned; +#ifdef UNIV_PFS_MEMORY + /** the "owner thread" of the buffer pool allocation */ + PSI_thread *owner; +#endif + /** initialized number of block descriptors */ + size_t n_blocks; + /** number of blocks that need to be freed in shrink() */ + size_t n_blocks_to_withdraw; + /** first block to withdraw in shrink() */ + const buf_page_t *first_to_withdraw; - /** Map of first page frame address to chunks[] */ - using map= std::map, - ut_allocator>>; - /** Chunk map that may be under construction by buf_resize_thread() */ - static map *map_reg; - /** Current chunk map for lookup only */ - static map *map_ref; + /** amount of memory allocated to the buffer pool and descriptors; + protected by mutex */ + Atomic_relaxed size_in_bytes; - /** @return the memory size bytes. */ - size_t mem_size() const noexcept { return mem_pfx.m_size; } - - /** Register the chunk */ - void reg() noexcept - { map_reg->emplace(map::value_type(blocks->page.frame, this)); } - - /** Allocate a chunk of buffer frames. - @param bytes requested size - @return whether the allocation succeeded */ - inline bool create(size_t bytes) noexcept; - -#ifdef UNIV_DEBUG - /** Find a block that points to a ROW_FORMAT=COMPRESSED page - @param data pointer to the start of a ROW_FORMAT=COMPRESSED page frame - @return the block - @retval nullptr if not found */ - const buf_block_t *contains_zip(const void *data) const noexcept - { - const buf_block_t *block= blocks; - for (auto i= size; i--; block++) - if (block->page.zip.data == data) - return block; - return nullptr; - } - - /** Check that all blocks are in a replaceable state. - @return address of a non-free block - @retval nullptr if all freed */ - inline const buf_block_t *not_freed() const noexcept; -#endif /* UNIV_DEBUG */ - }; public: + /** The requested innodb_buffer_pool_size */ + size_t size_in_bytes_requested; + /** The maximum allowed innodb_buffer_pool_size */ + size_t size_in_bytes_max; + + /** @return the current size of the buffer pool, in bytes */ + size_t curr_pool_size() const noexcept { return size_in_bytes; } + + /** @return the current size of the buffer pool, in pages */ + TPOOL_SUPPRESS_TSAN size_t curr_size() const noexcept { return n_blocks; } + /** @return the maximum usable size of the buffer pool, in pages */ + TPOOL_SUPPRESS_TSAN size_t usable_size() const noexcept + { return n_blocks - n_blocks_to_withdraw - UT_LIST_GET_LEN(withdrawn); } + + /** Determine the used size of the buffer pool in bytes. + @param n_blocks size of the buffer pool in blocks + @return the size needed for n_blocks in bytes, for innodb_page_size */ + static size_t blocks_in_bytes(size_t n_blocks) noexcept; + +#if defined(DBUG_OFF) && defined(HAVE_MADVISE) && defined(MADV_DODUMP) + /** Enable buffers to be dumped to core files. + + A convenience function, not called anyhwere directly however + it is left available for gdb or any debugger to call + in the event that you want all of the memory to be dumped + to a core file. + + @return number of errors found in madvise() calls */ + static int madvise_do_dump() noexcept; +#endif + /** Hash cell chain in page_hash_table */ struct hash_chain { @@ -1258,106 +1241,58 @@ public: buf_page_t *first; }; private: - /** Withdraw blocks from the buffer pool until meeting withdraw_target. - @return whether retry is needed */ - inline bool withdraw_blocks() noexcept; + /** Determine the number of blocks in a buffer pool of a particular size. + @param size_in_bytes innodb_buffer_pool_size in bytes + @return number of buffer pool pages */ + static size_t get_n_blocks(size_t size_in_bytes) noexcept; - /** Determine if a pointer belongs to a buf_block_t. It can be a pointer to - the buf_block_t itself or a member of it. - @param ptr a pointer that will not be dereferenced - @return whether the ptr belongs to a buf_block_t struct */ - bool is_block_field(const void *ptr) const noexcept - { - const chunk_t *chunk= chunks; - const chunk_t *const echunk= chunk + ut_min(n_chunks, n_chunks_new); + /** The outcome of shrink() */ + enum shrink_status{SHRINK_DONE= -1, SHRINK_IN_PROGRESS= 0, SHRINK_ABORT}; - /* TODO: protect chunks with a mutex (the older pointer will - currently remain during resize()) */ - for (; chunk < echunk; chunk++) - if (ptr >= reinterpret_cast(chunk->blocks) && - ptr < reinterpret_cast(chunk->blocks + chunk->size)) - return true; - return false; - } + /** Attempt to shrink the buffer pool. + @param size requested innodb_buffer_pool_size in bytes + @retval whether the shrinking was completed */ + ATTRIBUTE_COLD shrink_status shrink(size_t size) noexcept; - /** Try to reallocate a control block. - @param block control block to reallocate - @return whether the reallocation succeeded */ - inline bool realloc(buf_block_t *block) noexcept; + /** Finish shrinking the buffer pool. + @param size the new innodb_buffer_pool_size in bytes + @param reduced how much the innodb_buffer_pool_size was reduced */ + inline void shrunk(size_t size, size_t reduced) noexcept; public: - bool is_initialised() const noexcept { return chunks != nullptr; } + bool is_initialised() const noexcept { return memory != nullptr; } /** Create the buffer pool. @return whether the creation failed */ - bool create(); + bool create() noexcept; /** Clean up after successful create() */ void close() noexcept; - /** Resize from srv_buf_pool_old_size to srv_buf_pool_size. */ - inline void resize(); + /** Resize the buffer pool. + @param size requested innodb_buffer_pool_size in bytes + @param thd current connnection */ + ATTRIBUTE_COLD void resize(size_t size, THD *thd) noexcept; -#ifdef __linux__ /** Collect garbage (release pages from the LRU list) */ - inline void garbage_collect(); -#endif + inline void garbage_collect() noexcept; - /** @return whether resize() is in progress */ - bool resize_in_progress() const noexcept - { - return UNIV_UNLIKELY(resizing.load(std::memory_order_relaxed)); - } - - /** @return the current size in blocks */ - size_t get_n_pages() const noexcept - { - ut_ad(is_initialised()); - size_t size= 0; - for (auto j= ut_min(n_chunks_new, n_chunks); j--; ) - size+= chunks[j].size; - return size; - } - - /** Determine whether a frame is intended to be withdrawn during resize(). + /** Determine whether a frame needs to be withdrawn during resize(). @param ptr pointer within a buf_page_t::frame + @param size size_in_bytes_requested @return whether the frame will be withdrawn */ - bool will_be_withdrawn(const byte *ptr) const noexcept + bool will_be_withdrawn(const byte *ptr, size_t size) const noexcept { - ut_ad(n_chunks_new < n_chunks); -#ifdef SAFE_MUTEX - if (resize_in_progress()) - mysql_mutex_assert_owner(&mutex); -#endif /* SAFE_MUTEX */ - - for (const chunk_t *chunk= chunks + n_chunks_new, - * const echunk= chunks + n_chunks; - chunk != echunk; chunk++) - if (ptr >= chunk->blocks->page.frame && - ptr < (chunk->blocks + chunk->size - 1)->page.frame + srv_page_size) - return true; - return false; + const char *p= reinterpret_cast(ptr); + ut_ad(p >= memory); + ut_ad(p < memory + size_in_bytes_max); + return p >= memory + size; } - /** Determine whether a block is intended to be withdrawn during resize(). + /** Withdraw a block if needed in case resize() is shrinking. @param bpage buffer pool block - @return whether the frame will be withdrawn */ - bool will_be_withdrawn(const buf_page_t &bpage) const noexcept - { - ut_ad(n_chunks_new < n_chunks); -#ifdef SAFE_MUTEX - if (resize_in_progress()) - mysql_mutex_assert_owner(&mutex); -#endif /* SAFE_MUTEX */ - - for (const chunk_t *chunk= chunks + n_chunks_new, - * const echunk= chunks + n_chunks; - chunk != echunk; chunk++) - if (&bpage >= &chunk->blocks->page && - &bpage < &chunk->blocks[chunk->size].page) - return true; - return false; - } + @return whether the block was withdrawn */ + ATTRIBUTE_COLD bool withdraw(buf_page_t &bpage) noexcept; /** Release and evict a corrupted page. @param bpage x-latched page that was found corrupted @@ -1371,31 +1306,18 @@ public: #ifdef UNIV_DEBUG /** Find a block that points to a ROW_FORMAT=COMPRESSED page @param data pointer to the start of a ROW_FORMAT=COMPRESSED page frame + @param shift number of least significant address bits to ignore @return the block @retval nullptr if not found */ - const buf_block_t *contains_zip(const void *data) const noexcept - { - mysql_mutex_assert_owner(&mutex); - for (const chunk_t *chunk= chunks, * const end= chunks + n_chunks; - chunk != end; chunk++) - if (const buf_block_t *block= chunk->contains_zip(data)) - return block; - return nullptr; - } - + const buf_block_t *contains_zip(const void *data, size_t shift= 0) + const noexcept; /** Assert that all buffer pool pages are in a replaceable state */ void assert_all_freed() noexcept; #endif /* UNIV_DEBUG */ #ifdef BTR_CUR_HASH_ADAPT /** Clear the adaptive hash index on all pages in the buffer pool. */ - inline void clear_hash_index() noexcept; - - /** Get a buffer block from an adaptive hash index pointer. - This function does not return if the block is not identified. - @param ptr pointer to within a page frame - @return pointer to block, never NULL */ - inline buf_block_t *block_from_ahi(const byte *ptr) const noexcept; + void clear_hash_index() noexcept; #endif /* BTR_CUR_HASH_ADAPT */ /** @@ -1418,13 +1340,27 @@ public: return empty_lsn; } - /** Determine if a buffer block was created by chunk_t::create(). - @param block block descriptor (not dereferenced) - @return whether block has been created by chunk_t::create() */ - bool is_uncompressed(const buf_block_t *block) const noexcept + /** Look up the block descriptor for a page frame address. + @param ptr address within a valid page frame + @return the corresponding block descriptor */ + static buf_block_t *block_from(const void *ptr) noexcept; + + /** Access a block while holding the buffer pool mutex. + @param pos position between 0 and get_n_pages() + @return the block descriptor */ + buf_block_t *get_nth_page(size_t pos) const noexcept; + +#ifdef UNIV_DEBUG + /** Determine if an object is within the curr_pool_size() + and associated with an uncompressed page. + @param ptr memory object (not dereferenced) + @return whether the object is valid in the current buffer pool */ + bool is_uncompressed_current(const void *ptr) const noexcept { - return is_block_field(reinterpret_cast(block)); + const ptrdiff_t d= static_cast(ptr) - memory; + return d >= 0 && size_t(d) < curr_pool_size(); } +#endif public: /** page_fix() mode of operation */ @@ -1456,6 +1392,16 @@ public: buf_block_t *page_fix(const page_id_t id) noexcept { return page_fix(id, nullptr, FIX_WAIT_READ); } + /** Validate a block descriptor. + @param b block descriptor that may be invalid after shrink() + @param latch page_hash latch for id + @param id page identifier + @return b->page.fix() if b->page.id() == id + @retval 0 if b is invalid */ + TRANSACTIONAL_TARGET + uint32_t page_guess(buf_block_t *b, page_hash_latch &latch, + const page_id_t id) noexcept; + /** Decompress a page and relocate the block descriptor @param b buffer-fixed compressed-only ROW_FORMAT=COMPRESSED page @param chain hash table chain for b->id().fold() @@ -1477,7 +1423,6 @@ public: buf_page_t *bpage= page_hash.get(page_id, chain); if (bpage >= &watch[0] && bpage < &watch[UT_ARR_SIZE(watch)]) { - ut_ad(!bpage->in_zip_hash); ut_ad(!bpage->zip.data); if (!allow_watch) bpage= nullptr; @@ -1498,7 +1443,6 @@ public: ut_ad(bpage.in_file()); if (&bpage < &watch[0] || &bpage >= &watch[array_elements(watch)]) return false; - ut_ad(!bpage.in_zip_hash); ut_ad(!bpage.zip.data); return true; } @@ -1539,23 +1483,30 @@ public: inline uint32_t watch_remove(buf_page_t *w, hash_chain &chain) noexcept; /** @return whether less than 1/4 of the buffer pool is available */ - TPOOL_SUPPRESS_TSAN - bool running_out() const noexcept - { - return !recv_recovery_is_on() && - UT_LIST_GET_LEN(free) + UT_LIST_GET_LEN(LRU) < - (n_chunks_new * chunks->size) / 4; - } + bool running_out() const noexcept; /** @return whether the buffer pool is running low */ bool need_LRU_eviction() const noexcept; - /** @return whether the buffer pool is shrinking */ - inline bool is_shrinking() const noexcept + /** @return number of blocks resize() needs to evict from the buffer pool */ + size_t is_shrinking() const noexcept { - return n_chunks_new < n_chunks; + mysql_mutex_assert_owner(&mutex); + return n_blocks_to_withdraw + UT_LIST_GET_LEN(withdrawn); } + /** @return number of blocks in resize() waiting to be withdrawn */ + size_t to_withdraw() const noexcept + { + mysql_mutex_assert_owner(&mutex); + return n_blocks_to_withdraw; + } + + /** @return the shrinking size of the buffer pool, in bytes + @retval 0 if resize() is not shrinking the buffer pool */ + size_t shrinking_size() const noexcept + { return is_shrinking() ? size_in_bytes_requested : 0; } + #ifdef UNIV_DEBUG /** Validate the buffer pool. */ void validate() noexcept; @@ -1572,7 +1523,6 @@ public: mysql_mutex_assert_owner(&mutex); ut_ad(bpage->in_LRU_list); ut_ad(bpage->in_page_hash); - ut_ad(!bpage->in_zip_hash); ut_ad(bpage->in_file()); lru_hp.adjust(bpage); lru_scan_itr.adjust(bpage); @@ -1592,26 +1542,8 @@ public: /** @name General fields */ /* @{ */ - ulint curr_pool_size; /*!< Current pool size in bytes */ ulint LRU_old_ratio; /*!< Reserve this much of the buffer pool for "old" blocks */ -#ifdef UNIV_DEBUG - ulint buddy_n_frames; /*!< Number of frames allocated from - the buffer pool to the buddy system */ - ulint mutex_exit_forbidden; /*!< Forbid release mutex */ -#endif - ut_allocator allocator; /*!< Allocator used for - allocating memory for the the "chunks" - member. */ - ulint n_chunks; /*!< number of buffer pool chunks */ - ulint n_chunks_new; /*!< new number of buffer pool chunks. - both n_chunks{,new} are protected under - mutex */ - chunk_t* chunks; /*!< buffer pool chunks */ - chunk_t* chunks_old; /*!< old buffer pool chunks to be freed - after resizing buffer pool */ - /** current pool size in pages */ - Atomic_counter curr_size; /** read-ahead request size in pages */ Atomic_counter read_ahead_area; @@ -1723,12 +1655,6 @@ public: /** Look up a page in a hash bucket chain. */ inline buf_page_t *get(const page_id_t id, const hash_chain &chain) const noexcept; - - /** Exclusively aqcuire all latches */ - inline void write_lock_all() noexcept; - - /** Release all latches */ - inline void write_unlock_all() noexcept; }; /** Buffer pool mutex */ @@ -1745,9 +1671,6 @@ public: indexed by page_id_t. Protected by both mutex and page_hash.lock_get(). */ page_hash_table page_hash; - /** map of block->frame to buf_block_t blocks that belong - to buf_buddy_alloc(); protected by buf_pool.mutex */ - hash_table_t zip_hash; /** number of pending unzip() */ Atomic_counter n_pend_unzip; @@ -1878,30 +1801,29 @@ public: Set whenever the free list grows, along with a broadcast of done_free. Protected by buf_pool.mutex. */ Atomic_relaxed try_LRU_scan; - /** Whether we have warned to be running out of buffer pool */ - std::atomic_flag LRU_warned; /* @} */ /** @name LRU replacement algorithm fields */ /* @{ */ - UT_LIST_BASE_NODE_T(buf_page_t) free; - /*!< base node of the free - block list */ +private: + /** Whether we have warned to be running out of buffer pool; + only modified by buf_flush_page_cleaner(): + set while holding mutex, cleared while holding flush_list_mutex */ + Atomic_relaxed LRU_warned; + + /** withdrawn blocks during resize() */ + UT_LIST_BASE_NODE_T(buf_page_t) withdrawn; + +public: + /** list of blocks available for allocate() */ + UT_LIST_BASE_NODE_T(buf_page_t) free; + /** broadcast each time when the free list grows or try_LRU_scan is set; protected by mutex */ pthread_cond_t done_free; - UT_LIST_BASE_NODE_T(buf_page_t) withdraw; - /*!< base node of the withdraw - block list. It is only used during - shrinking buffer pool size, not to - reuse the blocks will be removed */ - - ulint withdraw_target;/*!< target length of withdraw - block list, when withdrawing */ - /** "hazard pointer" used during scan of LRU while doing LRU list batch. Protected by buf_pool_t::mutex. */ LRUHp lru_hp; @@ -1942,10 +1864,22 @@ public: /** Sentinels to detect if pages are read into the buffer pool while a delete-buffering operation is pending. Protected by mutex. */ buf_page_t watch[innodb_purge_threads_MAX + 1]; + + /** Clear LRU_warned */ + void LRU_warned_clear() noexcept + { + mysql_mutex_assert_owner(&flush_list_mutex); + LRU_warned= false; + } + /** Reserve a buffer. */ buf_tmp_buffer_t *io_buf_reserve(bool wait_for_reads) noexcept { return io_buf.reserve(wait_for_reads); } + /** Try to allocate a block. + @return a buffer block + @retval nullptr if no blocks are available */ + buf_block_t *allocate() noexcept; /** Remove a block from flush_list. @param bpage buffer pool page */ void delete_from_flush_list(buf_page_t *bpage) noexcept; @@ -1968,6 +1902,10 @@ public: /** Issue a warning that we could not free up buffer pool pages. */ ATTRIBUTE_COLD void LRU_warn() noexcept; + /** Collect buffer pool metadata. + @param pool_info buffer pool metadata */ + void get_info(buf_pool_info_t *pool_info) noexcept; + private: /** Temporary memory for page_compressed and encrypted I/O */ struct io_buf_t @@ -1984,9 +1922,6 @@ private: /** Reserve a buffer */ buf_tmp_buffer_t *reserve(bool wait_for_reads) noexcept; } io_buf; - - /** whether resize() is in the critical path */ - std::atomic resizing; }; /** The InnoDB buffer pool */ @@ -2135,24 +2070,6 @@ inline void buf_page_t::set_old(bool old) noexcept this->old= old; } -#ifdef UNIV_DEBUG -/** Forbid the release of the buffer pool mutex. */ -# define buf_pool_mutex_exit_forbid() do { \ - mysql_mutex_assert_owner(&buf_pool.mutex); \ - buf_pool.mutex_exit_forbidden++; \ -} while (0) -/** Allow the release of the buffer pool mutex. */ -# define buf_pool_mutex_exit_allow() do { \ - mysql_mutex_assert_owner(&buf_pool.mutex); \ - ut_ad(buf_pool.mutex_exit_forbidden--); \ -} while (0) -#else -/** Forbid the release of the buffer pool mutex. */ -# define buf_pool_mutex_exit_forbid() ((void) 0) -/** Allow the release of the buffer pool mutex. */ -# define buf_pool_mutex_exit_allow() ((void) 0) -#endif - /********************************************************************** Let us list the consistency conditions for different control block states. diff --git a/storage/innobase/include/buf0buf.inl b/storage/innobase/include/buf0buf.inl index 8103ac2f7ef..c90eee27b62 100644 --- a/storage/innobase/include/buf0buf.inl +++ b/storage/innobase/include/buf0buf.inl @@ -37,7 +37,7 @@ inline bool buf_page_peek_if_young(const buf_page_t *bpage) /* FIXME: bpage->freed_page_clock is 31 bits */ return((buf_pool.freed_page_clock & ((1UL << 31) - 1)) < (bpage->freed_page_clock - + (buf_pool.curr_size + + (buf_pool.curr_size() * (BUF_LRU_OLD_RATIO_DIV - buf_pool.LRU_old_ratio) / (BUF_LRU_OLD_RATIO_DIV * 4)))); } diff --git a/storage/innobase/include/buf0lru.h b/storage/innobase/include/buf0lru.h index ac4f36066a4..29f41adde1c 100644 --- a/storage/innobase/include/buf0lru.h +++ b/storage/innobase/include/buf0lru.h @@ -55,10 +55,6 @@ bool buf_LRU_free_page(buf_page_t *bpage, bool zip) @return true if found and freed */ bool buf_LRU_scan_and_free_block(ulint limit= ULINT_UNDEFINED); -/** @return a buffer block from the buf_pool.free list -@retval NULL if the free list is empty */ -buf_block_t* buf_LRU_get_free_only(); - /** Get a block from the buf_pool.free list. If the list is empty, blocks will be moved from the end of buf_pool.LRU to buf_pool.free. diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index bf3778a33c5..a233a691541 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -223,17 +223,6 @@ extern uint srv_flush_log_at_timeout; extern my_bool srv_adaptive_flushing; extern my_bool srv_flush_sync; -/** Requested size in bytes */ -extern ulint srv_buf_pool_size; -/** Requested buffer pool chunk size */ -extern size_t srv_buf_pool_chunk_unit; -/** Scan depth for LRU flush batch i.e.: number of blocks scanned*/ -/** Previously requested size */ -extern ulint srv_buf_pool_old_size; -/** Current size as scaling factor for the other components */ -extern ulint srv_buf_pool_base_size; -/** Current size in bytes */ -extern ulint srv_buf_pool_curr_size; /** Dump this % of each buffer pool during BP dump */ extern ulong srv_buf_pool_dump_pct; #ifdef UNIV_DEBUG @@ -596,7 +585,7 @@ struct export_var_t{ #endif /* BTR_CUR_HASH_ADAPT */ char innodb_buffer_pool_dump_status[OS_FILE_MAX_PATH + 128];/*!< Buf pool dump status */ char innodb_buffer_pool_load_status[OS_FILE_MAX_PATH + 128];/*!< Buf pool load status */ - char innodb_buffer_pool_resize_status[512];/*!< Buf pool resize status */ + char innodb_buffer_pool_resize_status[65];/*!< Buf pool resize status */ my_bool innodb_buffer_pool_load_incomplete;/*!< Buf pool load incomplete */ ulint innodb_buffer_pool_pages_total; /*!< Buffer pool size */ ulint innodb_buffer_pool_bytes_data; /*!< File bytes used */ diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 77225b1c809..268871cc5af 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -1330,7 +1330,11 @@ void log_free_check() } } -extern void buf_resize_shutdown(); +#ifdef __linux__ +extern void buf_mem_pressure_shutdown() noexcept; +#else +inline void buf_mem_pressure_shutdown() noexcept {} +#endif /** Make a checkpoint at the latest lsn on shutdown. */ ATTRIBUTE_COLD void logs_empty_and_mark_files_at_shutdown() @@ -1348,8 +1352,7 @@ ATTRIBUTE_COLD void logs_empty_and_mark_files_at_shutdown() srv_master_timer.reset(); } - /* Wait for the end of the buffer resize task.*/ - buf_resize_shutdown(); + buf_mem_pressure_shutdown(); dict_stats_shutdown(); btr_defragment_shutdown(); diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 3c7b63bdfed..d238d46d23d 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -1481,34 +1481,18 @@ inline void recv_sys_t::free(const void *data) ut_ad(!ut_align_offset(data, ALIGNMENT)); mysql_mutex_assert_owner(&mutex); - /* MDEV-14481 FIXME: To prevent race condition with buf_pool.resize(), - we must acquire and hold the buffer pool mutex here. */ - ut_ad(!buf_pool.resize_in_progress()); - - auto *chunk= buf_pool.chunks; - for (auto i= buf_pool.n_chunks; i--; chunk++) + buf_block_t *block= buf_pool.block_from(data); + ut_ad(block->page.frame == page_align(data)); + ut_ad(block->page.state() == buf_page_t::MEMORY); + ut_ad(uint16_t(block->page.free_offset - 1) < srv_page_size); + ut_ad(block->page.used_records); + if (!--block->page.used_records) { - if (data < chunk->blocks->page.frame) - continue; - const size_t offs= (reinterpret_cast(data) - - chunk->blocks->page.frame) >> srv_page_size_shift; - if (offs >= chunk->size) - continue; - buf_block_t *block= &chunk->blocks[offs]; - ut_ad(block->page.frame == page_align(data)); - ut_ad(block->page.state() == buf_page_t::MEMORY); - ut_ad(uint16_t(block->page.free_offset - 1) < srv_page_size); - ut_ad(block->page.used_records); - if (!--block->page.used_records) - { - block->page.hash= nullptr; - UT_LIST_REMOVE(blocks, block); - MEM_MAKE_ADDRESSABLE(block->page.frame, srv_page_size); - buf_block_free(block); - } - return; + block->page.hash= nullptr; + UT_LIST_REMOVE(blocks, block); + MEM_MAKE_ADDRESSABLE(block->page.frame, srv_page_size); + buf_block_free(block); } - ut_ad(0); } @@ -2060,9 +2044,9 @@ ATTRIBUTE_COLD void recv_sys_t::wait_for_pool(size_t pages) mysql_mutex_lock(&mutex); garbage_collect(); mysql_mutex_lock(&buf_pool.mutex); - bool need_more= UT_LIST_GET_LEN(buf_pool.free) < pages; + const size_t available= UT_LIST_GET_LEN(buf_pool.free); mysql_mutex_unlock(&buf_pool.mutex); - if (need_more) + if (available < pages) buf_flush_sync_batch(lsn); } diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index ab3d1a2f76a..bb632bd66b7 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -169,7 +169,7 @@ inline void buf_pool_t::insert_into_flush_list(buf_page_t *prev, else flush_list_bytes+= block->physical_size(); - ut_ad(flush_list_bytes <= curr_pool_size); + ut_ad(flush_list_bytes <= size_in_bytes); if (prev) UT_LIST_INSERT_AFTER(flush_list, prev, &block->page); diff --git a/storage/innobase/srv/srv0mon.cc b/storage/innobase/srv/srv0mon.cc index 62229842ab7..a9bc310753b 100644 --- a/storage/innobase/srv/srv0mon.cc +++ b/storage/innobase/srv/srv0mon.cc @@ -1366,12 +1366,13 @@ srv_mon_process_existing_counter( /* innodb_buffer_pool_pages_total */ case MONITOR_OVLD_BUF_POOL_PAGE_TOTAL: - value = buf_pool.get_n_pages(); + case MONITOR_OVLD_BUFFER_POOL_SIZE: + value = buf_pool.curr_size(); break; /* innodb_buffer_pool_pages_misc */ case MONITOR_OVLD_BUF_POOL_PAGE_MISC: - value = buf_pool.get_n_pages() + value = buf_pool.curr_size() - UT_LIST_GET_LEN(buf_pool.LRU) - UT_LIST_GET_LEN(buf_pool.free); break; @@ -1490,10 +1491,6 @@ srv_mon_process_existing_counter( value = srv_page_size; break; - case MONITOR_OVLD_BUFFER_POOL_SIZE: - value = srv_buf_pool_size; - break; - /* innodb_row_lock_current_waits */ case MONITOR_OVLD_ROW_LOCK_CURRENT_WAIT: // dirty read without lock_sys.wait_mutex diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index f73a95d5226..3dbe680a340 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -178,16 +178,6 @@ srv_printf_innodb_monitor() will request mutex acquisition with mysql_mutex_lock(), which will wait until it gets the mutex. */ #define MUTEX_NOWAIT(mutex_skipped) ((mutex_skipped) < MAX_MUTEX_NOWAIT) -/** copy of innodb_buffer_pool_size */ -ulint srv_buf_pool_size; -/** Requested buffer pool chunk size */ -size_t srv_buf_pool_chunk_unit; -/** Previously requested size */ -ulint srv_buf_pool_old_size; -/** Current size as scaling factor for the other components */ -ulint srv_buf_pool_base_size; -/** Current size in bytes */ -ulint srv_buf_pool_curr_size; /** Dump this % of each buffer pool during BP dump */ ulong srv_buf_pool_dump_pct; /** Abort load after this amount of pages */ @@ -901,6 +891,7 @@ srv_export_innodb_status(void) export_vars.innodb_buffer_pool_read_requests = buf_pool.stat.n_page_gets; + mysql_mutex_lock(&buf_pool.mutex); export_vars.innodb_buffer_pool_bytes_data = buf_pool.stat.LRU_bytes + (UT_LIST_GET_LEN(buf_pool.unzip_LRU) @@ -910,12 +901,21 @@ srv_export_innodb_status(void) export_vars.innodb_buffer_pool_pages_latched = buf_get_latched_pages_number(); #endif /* UNIV_DEBUG */ - export_vars.innodb_buffer_pool_pages_total = buf_pool.get_n_pages(); + export_vars.innodb_buffer_pool_pages_total = buf_pool.curr_size(); export_vars.innodb_buffer_pool_pages_misc = - buf_pool.get_n_pages() + export_vars.innodb_buffer_pool_pages_total - UT_LIST_GET_LEN(buf_pool.LRU) - UT_LIST_GET_LEN(buf_pool.free); + if (size_t shrinking = buf_pool.is_shrinking()) { + snprintf(export_vars.innodb_buffer_pool_resize_status, + sizeof export_vars.innodb_buffer_pool_resize_status, + "Withdrawing blocks. (%zu/%zu).", + buf_pool.to_withdraw(), shrinking); + } else { + export_vars.innodb_buffer_pool_resize_status[0] = '\0'; + } + mysql_mutex_unlock(&buf_pool.mutex); export_vars.innodb_max_trx_id = trx_sys.get_max_trx_id(); export_vars.innodb_history_list_length = trx_sys.history_size_approx(); diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index e32ed6e4710..dc2ad75848f 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -1288,31 +1288,10 @@ dberr_t srv_start(bool create_new_db) fil_system.create(srv_file_per_table ? 50000 : 5000); - ib::info() << "Initializing buffer pool, total size = " - << ib::bytes_iec{srv_buf_pool_size} - << ", chunk size = " << ib::bytes_iec{srv_buf_pool_chunk_unit}; - if (buf_pool.create()) { - ib::error() << "Cannot allocate memory for the buffer pool"; - return(srv_init_abort(DB_ERROR)); } - ib::info() << "Completed initialization of buffer pool"; - -#ifdef UNIV_DEBUG - /* We have observed deadlocks with a 5MB buffer pool but - the actual lower limit could very well be a little higher. */ - - if (srv_buf_pool_size <= 5 * 1024 * 1024) { - - ib::info() << "Small buffer pool size (" - << ib::bytes_iec{srv_buf_pool_size} - << "), the flst_validate() debug function can cause a" - << " deadlock if the buffer pool fills up."; - } -#endif /* UNIV_DEBUG */ - log_sys.create(); recv_sys.create(); lock_sys.create(srv_lock_table_size); diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index d6feb820a62..0b9b5e3951c 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -1237,9 +1237,6 @@ static purge_sys_t::iterator trx_purge_attach_undo_recs(THD *thd, static_cast(thd_mdl_context(thd)); ut_ad(mdl_context); - const size_t max_pages= - std::min(buf_pool.curr_size * 3 / 4, size_t{srv_purge_batch_size}); - while (UNIV_LIKELY(srv_undo_sources) || !srv_fast_shutdown) { /* Track the max {trx_id, undo_no} for truncating the @@ -1289,7 +1286,9 @@ static purge_sys_t::iterator trx_purge_attach_undo_recs(THD *thd, ut_ad(!table_node->in_progress); } - if (purge_sys.n_pages_handled() >= max_pages) + const size_t size{purge_sys.n_pages_handled()}; + if (size >= size_t{srv_purge_batch_size} || + size >= buf_pool.usable_size() * 3 / 4) break; } From ba81009f635ccf0760476315ed3a934b60fee4a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 26 Mar 2025 17:05:48 +0200 Subject: [PATCH 089/134] MDEV-34863 RAM Usage Changed Significantly Between 10.11 Releases innodb_buffer_pool_size_auto_min: A minimum innodb_buffer_pool_size that a Linux memory pressure event can lead to shrinking the buffer pool to. On a memory pressure event, we will attempt to shrink innodb_buffer_pool_size halfway between its current value and innodb_buffer_pool_size_auto_min. If innodb_buffer_pool_size_auto_min is specified as 0 or not specified on startup, its default value will be adjusted to innodb_buffer_pool_size_max, that is, memory pressure events will be disregarded by default. buf_pool_t::garbage_collect(): For up to 15 seconds, attempt to shrink the buffer pool in response to a memory pressure event. Reviewed by: Debarun Banerjee --- .../suite/innodb/r/mem_pressure,32bit.rdiff | 11 ++ mysql-test/suite/innodb/r/mem_pressure.result | 33 ++-- .../innodb/t/innodb_buffer_pool_resize.opt | 2 +- mysql-test/suite/innodb/t/mem_pressure.opt | 1 + mysql-test/suite/innodb/t/mem_pressure.test | 35 ++-- .../sys_vars/r/sysvars_innodb,32bit.rdiff | 71 +++++--- .../suite/sys_vars/r/sysvars_innodb.result | 13 +- .../suite/sys_vars/t/sysvars_innodb.test | 1 - storage/innobase/buf/buf0buf.cc | 167 +++++++++--------- storage/innobase/handler/ha_innodb.cc | 29 +++ storage/innobase/include/buf0buf.h | 4 + 11 files changed, 228 insertions(+), 139 deletions(-) create mode 100644 mysql-test/suite/innodb/r/mem_pressure,32bit.rdiff diff --git a/mysql-test/suite/innodb/r/mem_pressure,32bit.rdiff b/mysql-test/suite/innodb/r/mem_pressure,32bit.rdiff new file mode 100644 index 00000000000..37809768945 --- /dev/null +++ b/mysql-test/suite/innodb/r/mem_pressure,32bit.rdiff @@ -0,0 +1,11 @@ +--- mem_pressure.result ++++ mem_pressure,32bit.result +@@ -11,7 +11,7 @@ + @@GLOBAL.innodb_buffer_pool_size_auto_min, + @@GLOBAL.innodb_buffer_pool_size_max; + @@GLOBAL.innodb_buffer_pool_size @@GLOBAL.innodb_buffer_pool_size_auto_min @@GLOBAL.innodb_buffer_pool_size_max +-17825792 16777216 25165824 ++17825792 16777216 18874368 + CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; + SET GLOBAL innodb_limit_optimistic_insert_debug=2; + SET STATEMENT unique_checks=0, foreign_key_checks=0 FOR diff --git a/mysql-test/suite/innodb/r/mem_pressure.result b/mysql-test/suite/innodb/r/mem_pressure.result index 62f04d58d6b..c20adbeb406 100644 --- a/mysql-test/suite/innodb/r/mem_pressure.result +++ b/mysql-test/suite/innodb/r/mem_pressure.result @@ -4,23 +4,34 @@ set @save_dbug=@@debug_dbug; set @save_limit=@@GLOBAL.innodb_limit_optimistic_insert_debug; set GLOBAL innodb_max_purge_lag_wait=0; +SET @innodb_buffer_pool_size= @@GLOBAL.innodb_buffer_pool_size; +SET @innodb_buffer_pool_size_min= @@GLOBAL.innodb_buffer_pool_size_auto_min; +SELECT +@@GLOBAL.innodb_buffer_pool_size, +@@GLOBAL.innodb_buffer_pool_size_auto_min, +@@GLOBAL.innodb_buffer_pool_size_max; +@@GLOBAL.innodb_buffer_pool_size @@GLOBAL.innodb_buffer_pool_size_auto_min @@GLOBAL.innodb_buffer_pool_size_max +17825792 16777216 25165824 CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; SET GLOBAL innodb_limit_optimistic_insert_debug=2; SET STATEMENT unique_checks=0, foreign_key_checks=0 FOR INSERT INTO t1 SELECT * FROM seq_1_to_1000; SET GLOBAL innodb_limit_optimistic_insert_debug=@save_limit; DROP TABLE t1; -SELECT CAST(VARIABLE_VALUE AS INTEGER) INTO @dirty_prev -FROM INFORMATION_SCHEMA.GLOBAL_STATUS -WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty'; -set debug_dbug="d,trigger_garbage_collection"; -SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size; -FOUND 1 /[Mm]emory pressure.*/ in mysqld.1.err -SELECT CAST(VARIABLE_VALUE AS INTEGER) < @dirty_prev AS LESS_DIRTY_IS_GOOD -FROM INFORMATION_SCHEMA.GLOBAL_STATUS -WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty'; -LESS_DIRTY_IS_GOOD +SET STATEMENT debug_dbug="d,trigger_garbage_collection" FOR +SET GLOBAL innodb_buffer_pool_size=@innodb_buffer_pool_size; +FOUND 1 /Memory pressure event disregarded.*/ in mysqld.1.err +SET STATEMENT debug_dbug="d,trigger_garbage_collection" FOR +SET GLOBAL innodb_buffer_pool_size_auto_min= +CAST(@innodb_buffer_pool_size/2 AS UNSIGNED), +innodb_buffer_pool_size=@innodb_buffer_pool_size; +Warnings: +Warning 1292 Truncated incorrect innodb_buffer_pool_size_auto_min value: '8912896' +select @@global.innodb_buffer_pool_size < @innodb_buffer_pool_size; +@@global.innodb_buffer_pool_size < @innodb_buffer_pool_size 1 -FOUND 1 /InnoDB: Memory pressure event freed.*/ in mysqld.1.err +FOUND 1 /InnoDB: Memory pressure event shrunk.*/ in mysqld.1.err set debug_dbug=@save_dbug; +SET GLOBAL innodb_buffer_pool_size= @innodb_buffer_pool_size; +SET GLOBAL innodb_buffer_pool_size_auto_min=@innodb_buffer_pool_size_min; # End of 10.11 tests diff --git a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.opt b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.opt index 19074aa9024..eaf7b653020 100644 --- a/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.opt +++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_resize.opt @@ -1,3 +1,3 @@ --innodb-buffer-pool-size=8M ---innodb-buffer-pool-size-max=24M +--innodb-buffer-pool-size-max=25M --innodb-page-size=4k diff --git a/mysql-test/suite/innodb/t/mem_pressure.opt b/mysql-test/suite/innodb/t/mem_pressure.opt index 8c6cf8729eb..ea4105f2390 100644 --- a/mysql-test/suite/innodb/t/mem_pressure.opt +++ b/mysql-test/suite/innodb/t/mem_pressure.opt @@ -1,2 +1,3 @@ +--loose-innodb-buffer-pool-size-auto-min=17m --innodb-buffer-pool-size-max=17m --innodb-buffer-pool-size=17m diff --git a/mysql-test/suite/innodb/t/mem_pressure.test b/mysql-test/suite/innodb/t/mem_pressure.test index 578d6d44841..5e32a9de2ec 100644 --- a/mysql-test/suite/innodb/t/mem_pressure.test +++ b/mysql-test/suite/innodb/t/mem_pressure.test @@ -2,6 +2,7 @@ --source include/not_embedded.inc --source include/have_innodb.inc --source include/have_sequence.inc +--source include/word_size.inc --echo # --echo # MDEV-24670 avoid OOM by linux kernel co-operative memory management @@ -14,6 +15,13 @@ set @save_limit=@@GLOBAL.innodb_limit_optimistic_insert_debug; # This is not an actual parameter, so there is no need to restore it. set GLOBAL innodb_max_purge_lag_wait=0; +SET @innodb_buffer_pool_size= @@GLOBAL.innodb_buffer_pool_size; +SET @innodb_buffer_pool_size_min= @@GLOBAL.innodb_buffer_pool_size_auto_min; +SELECT +@@GLOBAL.innodb_buffer_pool_size, +@@GLOBAL.innodb_buffer_pool_size_auto_min, +@@GLOBAL.innodb_buffer_pool_size_max; + CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; SET GLOBAL innodb_limit_optimistic_insert_debug=2; SET STATEMENT unique_checks=0, foreign_key_checks=0 FOR @@ -23,32 +31,31 @@ SET GLOBAL innodb_limit_optimistic_insert_debug=@save_limit; DROP TABLE t1; ---disable_cursor_protocol -SELECT CAST(VARIABLE_VALUE AS INTEGER) INTO @dirty_prev -FROM INFORMATION_SCHEMA.GLOBAL_STATUS -WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty'; ---enable_cursor_protocol - -set debug_dbug="d,trigger_garbage_collection"; -SET GLOBAL innodb_buffer_pool_size=@@innodb_buffer_pool_size; +SET STATEMENT debug_dbug="d,trigger_garbage_collection" FOR +SET GLOBAL innodb_buffer_pool_size=@innodb_buffer_pool_size; let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; -# either a fail or the pressure event -let SEARCH_PATTERN= [Mm]emory pressure.*; +let SEARCH_PATTERN= Memory pressure event disregarded.*; +let SEARCH_WAIT= FOUND; --source include/search_pattern_in_file.inc +SET STATEMENT debug_dbug="d,trigger_garbage_collection" FOR +SET GLOBAL innodb_buffer_pool_size_auto_min= +CAST(@innodb_buffer_pool_size/2 AS UNSIGNED), +innodb_buffer_pool_size=@innodb_buffer_pool_size; + # The garbage collection happens asynchronously after trigger, in a background # thread. So wait for it to happen to avoid sporadic failure. let $wait_condition= - SELECT CAST(VARIABLE_VALUE AS INTEGER) < @dirty_prev AS LESS_DIRTY_IS_GOOD - FROM INFORMATION_SCHEMA.GLOBAL_STATUS - WHERE VARIABLE_NAME='Innodb_buffer_pool_pages_dirty'; + select @@global.innodb_buffer_pool_size < @innodb_buffer_pool_size; --source include/wait_condition.inc eval $wait_condition; -let SEARCH_PATTERN= InnoDB: Memory pressure event freed.*; +let SEARCH_PATTERN= InnoDB: Memory pressure event shrunk.*; let SEARCH_WAIT= FOUND; --source include/search_pattern_in_file.inc set debug_dbug=@save_dbug; +SET GLOBAL innodb_buffer_pool_size= @innodb_buffer_pool_size; +SET GLOBAL innodb_buffer_pool_size_auto_min=@innodb_buffer_pool_size_min; --echo # End of 10.11 tests diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff index 1aa3de321c0..ddf9ea941f0 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit.rdiff @@ -58,6 +58,21 @@ DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL -VARIABLE_TYPE BIGINT UNSIGNED ++VARIABLE_TYPE INT UNSIGNED + VARIABLE_COMMENT Minimum innodb_buffer_pool_size for dynamic shrinking on memory pressure + NUMERIC_MIN_VALUE 0 +-NUMERIC_MAX_VALUE 18446744073701163008 +-NUMERIC_BLOCK_SIZE 8388608 ++NUMERIC_MAX_VALUE 4292870144 ++NUMERIC_BLOCK_SIZE 2097152 + ENUM_VALUE_LIST NULL + READ_ONLY NO + COMMAND_LINE_ARGUMENT REQUIRED +@@ -227,11 +227,11 @@ + SESSION_VALUE NULL + DEFAULT_VALUE 0 + VARIABLE_SCOPE GLOBAL +-VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_TYPE INT UNSIGNED VARIABLE_COMMENT Maximum innodb_buffer_pool_size NUMERIC_MIN_VALUE 0 @@ -68,7 +83,7 @@ ENUM_VALUE_LIST NULL READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED -@@ -227,7 +227,7 @@ +@@ -239,7 +239,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -77,7 +92,7 @@ VARIABLE_COMMENT A number between [0, 100] that tells how oftern buffer pool dump status in percentages should be printed. E.g. 10 means that buffer pool dump status is printed when every 10% of number of buffer pool pages are dumped. Default is 0 (only start and end status is printed). NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 100 -@@ -347,7 +347,7 @@ +@@ -359,7 +359,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 5 VARIABLE_SCOPE GLOBAL @@ -86,7 +101,7 @@ VARIABLE_COMMENT If the compression failure rate of a table is greater than this number more padding is added to the pages to reduce the failures. A value of zero implies no padding NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 100 -@@ -371,7 +371,7 @@ +@@ -383,7 +383,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 50 VARIABLE_SCOPE GLOBAL @@ -95,7 +110,7 @@ VARIABLE_COMMENT Percentage of empty space on a data page that can be reserved to make the page compressible. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 75 -@@ -659,7 +659,7 @@ +@@ -671,7 +671,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 600 VARIABLE_SCOPE GLOBAL @@ -104,7 +119,7 @@ VARIABLE_COMMENT Maximum number of seconds that semaphore times out in InnoDB. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 4294967295 -@@ -707,7 +707,7 @@ +@@ -719,7 +719,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 30 VARIABLE_SCOPE GLOBAL @@ -113,7 +128,7 @@ VARIABLE_COMMENT Number of iterations over which the background flushing is averaged. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 1000 -@@ -731,7 +731,7 @@ +@@ -743,7 +743,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1 VARIABLE_SCOPE GLOBAL @@ -122,7 +137,7 @@ VARIABLE_COMMENT Controls the durability/speed trade-off for commits. Set to 0 (write and flush redo log to disk only once per second), 1 (flush to disk at each commit), 2 (write to log at commit but flush to disk only once per second) or 3 (flush to disk at prepare and at commit, slower and usually redundant). 1 and 3 guarantees that after a crash, committed transactions will not be lost and will be consistent with the binlog and other transactional engines. 2 can get inconsistent and lose transactions if there is a power failure or kernel crash but not if mysqld crashes. 0 has no guarantees in case of crash. 0 and 2 can be faster than 1 or 3. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 3 -@@ -755,7 +755,7 @@ +@@ -767,7 +767,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1 VARIABLE_SCOPE GLOBAL @@ -131,7 +146,7 @@ VARIABLE_COMMENT Set to 0 (don't flush neighbors from buffer pool), 1 (flush contiguous neighbors from buffer pool) or 2 (flush neighbors from buffer pool), when flushing a block NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 2 -@@ -791,7 +791,7 @@ +@@ -803,7 +803,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -140,7 +155,7 @@ VARIABLE_COMMENT Helps to save your data in case the disk image of the database becomes corrupt. Value 5 can return bogus data, and 6 can permanently corrupt data. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 6 -@@ -815,10 +815,10 @@ +@@ -827,10 +827,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 8000000 VARIABLE_SCOPE GLOBAL @@ -153,7 +168,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -851,7 +851,7 @@ +@@ -863,7 +863,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 84 VARIABLE_SCOPE GLOBAL @@ -162,7 +177,7 @@ VARIABLE_COMMENT InnoDB Fulltext search maximum token size in characters NUMERIC_MIN_VALUE 10 NUMERIC_MAX_VALUE 84 -@@ -863,7 +863,7 @@ +@@ -875,7 +875,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 3 VARIABLE_SCOPE GLOBAL @@ -171,7 +186,7 @@ VARIABLE_COMMENT InnoDB Fulltext search minimum token size in characters NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 16 -@@ -875,7 +875,7 @@ +@@ -887,7 +887,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 2000 VARIABLE_SCOPE GLOBAL @@ -180,7 +195,7 @@ VARIABLE_COMMENT InnoDB Fulltext search number of words to optimize for each optimize table call NUMERIC_MIN_VALUE 1000 NUMERIC_MAX_VALUE 10000 -@@ -887,10 +887,10 @@ +@@ -899,10 +899,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 2000000000 VARIABLE_SCOPE GLOBAL @@ -193,7 +208,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -911,7 +911,7 @@ +@@ -923,7 +923,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 2 VARIABLE_SCOPE GLOBAL @@ -202,7 +217,7 @@ VARIABLE_COMMENT InnoDB Fulltext search parallel sort degree, will round up to nearest power of 2 number NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 16 -@@ -923,10 +923,10 @@ +@@ -935,10 +935,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 640000000 VARIABLE_SCOPE GLOBAL @@ -215,7 +230,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -971,7 +971,7 @@ +@@ -983,7 +983,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 200 VARIABLE_SCOPE GLOBAL @@ -224,7 +239,7 @@ VARIABLE_COMMENT Number of IOPs the server can do. Tunes the background IO rate NUMERIC_MIN_VALUE 100 NUMERIC_MAX_VALUE 4294967295 -@@ -983,7 +983,7 @@ +@@ -995,7 +995,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 4294967295 VARIABLE_SCOPE GLOBAL @@ -233,7 +248,7 @@ VARIABLE_COMMENT Limit to which innodb_io_capacity can be inflated. NUMERIC_MIN_VALUE 100 NUMERIC_MAX_VALUE 4294967295 -@@ -1103,10 +1103,10 @@ +@@ -1115,10 +1115,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 32 VARIABLE_SCOPE GLOBAL @@ -246,7 +261,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1115,10 +1115,10 @@ +@@ -1127,10 +1127,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 1536 VARIABLE_SCOPE GLOBAL @@ -259,7 +274,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1151,10 +1151,10 @@ +@@ -1163,10 +1163,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -272,7 +287,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY NO -@@ -1163,7 +1163,7 @@ +@@ -1175,7 +1175,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -281,7 +296,7 @@ VARIABLE_COMMENT Maximum delay of user threads in micro-seconds NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 10000000 -@@ -1295,10 +1295,10 @@ +@@ -1307,10 +1307,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL @@ -294,7 +309,7 @@ NUMERIC_BLOCK_SIZE 0 ENUM_VALUE_LIST NULL READ_ONLY YES -@@ -1319,7 +1319,7 @@ +@@ -1331,7 +1331,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 16384 VARIABLE_SCOPE GLOBAL @@ -303,7 +318,7 @@ VARIABLE_COMMENT Page size to use for all InnoDB tablespaces. NUMERIC_MIN_VALUE 4096 NUMERIC_MAX_VALUE 65536 -@@ -1355,7 +1355,7 @@ +@@ -1367,7 +1367,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 127 VARIABLE_SCOPE GLOBAL @@ -312,7 +327,7 @@ VARIABLE_COMMENT Number of UNDO log pages to purge in one batch from the history list. NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 5000 -@@ -1367,7 +1367,7 @@ +@@ -1379,7 +1379,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 128 VARIABLE_SCOPE GLOBAL @@ -321,7 +336,7 @@ VARIABLE_COMMENT Deprecated parameter with no effect NUMERIC_MIN_VALUE 1 NUMERIC_MAX_VALUE 128 -@@ -1403,7 +1403,7 @@ +@@ -1415,7 +1415,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 56 VARIABLE_SCOPE GLOBAL @@ -330,7 +345,7 @@ VARIABLE_COMMENT Number of pages that must be accessed sequentially for InnoDB to trigger a readahead. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 64 -@@ -1487,7 +1487,7 @@ +@@ -1499,7 +1499,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 1048576 VARIABLE_SCOPE GLOBAL @@ -339,7 +354,7 @@ VARIABLE_COMMENT Memory buffer size for index creation NUMERIC_MIN_VALUE 65536 NUMERIC_MAX_VALUE 67108864 -@@ -1655,10 +1655,10 @@ +@@ -1667,10 +1667,10 @@ SESSION_VALUE NULL DEFAULT_VALUE 30 VARIABLE_SCOPE GLOBAL diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 1fddbe3fc1e..565a4fbf22c 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -5,7 +5,6 @@ variable_name not in ( 'innodb_evict_tables_on_commit_debug', # one may want to override this 'innodb_use_native_aio', # default value depends on OS 'innodb_log_file_buffering', # only available on Linux and Windows -'innodb_buffer_pool_size_auto_min', # only available on Linux for now 'innodb_buffer_pool_load_pages_abort') # debug build only, and is only for testing order by variable_name; VARIABLE_NAME INNODB_ADAPTIVE_FLUSHING @@ -212,6 +211,18 @@ NUMERIC_BLOCK_SIZE 1048576 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED +VARIABLE_NAME INNODB_BUFFER_POOL_SIZE_AUTO_MIN +SESSION_VALUE NULL +DEFAULT_VALUE 0 +VARIABLE_SCOPE GLOBAL +VARIABLE_TYPE BIGINT UNSIGNED +VARIABLE_COMMENT Minimum innodb_buffer_pool_size for dynamic shrinking on memory pressure +NUMERIC_MIN_VALUE 0 +NUMERIC_MAX_VALUE 18446744073701163008 +NUMERIC_BLOCK_SIZE 8388608 +ENUM_VALUE_LIST NULL +READ_ONLY NO +COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_BUFFER_POOL_SIZE_MAX SESSION_VALUE NULL DEFAULT_VALUE 0 diff --git a/mysql-test/suite/sys_vars/t/sysvars_innodb.test b/mysql-test/suite/sys_vars/t/sysvars_innodb.test index 7c4345cce25..2680e442da4 100644 --- a/mysql-test/suite/sys_vars/t/sysvars_innodb.test +++ b/mysql-test/suite/sys_vars/t/sysvars_innodb.test @@ -12,6 +12,5 @@ select VARIABLE_NAME, SESSION_VALUE, DEFAULT_VALUE, VARIABLE_SCOPE, VARIABLE_TYP 'innodb_evict_tables_on_commit_debug', # one may want to override this 'innodb_use_native_aio', # default value depends on OS 'innodb_log_file_buffering', # only available on Linux and Windows - 'innodb_buffer_pool_size_auto_min', # only available on Linux for now 'innodb_buffer_pool_load_pages_abort') # debug build only, and is only for testing order by variable_name; diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 27c7f2f584e..0ceaa47d8b2 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1018,97 +1018,98 @@ ATTRIBUTE_COLD void buf_mem_pressure_shutdown() noexcept { mem_pressure_obj.join(); } +#endif +#if defined __linux__ || !defined DBUG_OFF inline void buf_pool_t::garbage_collect() noexcept { mysql_mutex_lock(&mutex); - size_t freed= 0; - -#ifdef BTR_CUR_HASH_ADAPT - /* buf_LRU_free_page() will temporarily release and reacquire - buf_pool.mutex for invoking btr_search_drop_page_hash_index(). Thus, - we must protect ourselves with the hazard pointer. */ -rescan: -#else - lru_hp.set(nullptr); -#endif - for (buf_page_t *bpage= UT_LIST_GET_LAST(LRU), *prev; bpage; bpage= prev) + const size_t old_size{size_in_bytes}, min_size{size_in_bytes_auto_min}; + const size_t reduce_size= + std::max(innodb_buffer_pool_extent_size, + ut_calc_align((old_size - min_size) / 2, + innodb_buffer_pool_extent_size)); + if (old_size < min_size + reduce_size || + first_to_withdraw || old_size != size_in_bytes_requested) { - prev= UT_LIST_GET_PREV(LRU, bpage); -#ifdef BTR_CUR_HASH_ADAPT - lru_hp.set(prev); -#endif - auto state= bpage->state(); - ut_ad(state >= buf_page_t::FREED); - ut_ad(bpage->in_LRU_list); - - /* We try to free any pages that can be freed without writing out - anything. */ - switch (bpage->oldest_modification()) { - case 0: - try_to_evict: - if (buf_LRU_free_page(bpage, true)) - { - evicted: - freed++; -#ifdef BTR_CUR_HASH_ADAPT - bpage= prev; - prev= lru_hp.get(); - if (!prev && bpage) - goto rescan; -#endif - } - continue; - case 1: - break; - default: - if (state >= buf_page_t::UNFIXED) - continue; - } - - if (state < buf_page_t::READ_FIX && bpage->lock.u_lock_try(true)) - { - ut_ad(!bpage->is_io_fixed()); - lsn_t oldest_modification= bpage->oldest_modification(); - switch (oldest_modification) { - case 1: - mysql_mutex_lock(&flush_list_mutex); - oldest_modification= bpage->oldest_modification(); - if (oldest_modification) - { - ut_ad(oldest_modification == 1); - delete_from_flush_list(bpage); - } - mysql_mutex_unlock(&flush_list_mutex); - /* fall through */ - case 0: - bpage->lock.u_unlock(true); - goto try_to_evict; - default: - if (bpage->state() < buf_page_t::UNFIXED && - oldest_modification <= log_sys.get_flushed_lsn()) - { - release_freed_page(bpage); - goto evicted; - } - else - bpage->lock.u_unlock(true); - } - } + mysql_mutex_unlock(&mutex); + sql_print_information("InnoDB: Memory pressure event disregarded;" + " innodb_buffer_pool_size=%zum," + " innodb_buffer_pool_size_min=%zum", + old_size >> 20, min_size >> 20); + return; } -#if defined MADV_FREE - /* FIXME: Issue fewer calls for larger contiguous blocks of - memory. For now, we assume that this is acceptable, because this - code should be executed rarely. */ - for (buf_page_t *bpage= UT_LIST_GET_FIRST(free); bpage; - bpage= UT_LIST_GET_NEXT(list, bpage)) - madvise(bpage->frame, srv_page_size, MADV_FREE); -#endif + size_t size= old_size - reduce_size; + size_t n_blocks_new= get_n_blocks(size); + + ut_ad(UT_LIST_GET_LEN(withdrawn) == 0); + ut_ad(n_blocks_to_withdraw == 0); + + n_blocks_to_withdraw= n_blocks - n_blocks_new; + first_to_withdraw= &get_nth_page(n_blocks_new)->page; + + size_in_bytes_requested= size; mysql_mutex_unlock(&mutex); - sql_print_information("InnoDB: Memory pressure event freed %zu pages", - freed); - return; + mysql_mutex_lock(&flush_list_mutex); + page_cleaner_wakeup(true); + my_cond_wait(&done_flush_list, &flush_list_mutex.m_mutex); + mysql_mutex_unlock(&flush_list_mutex); +# ifdef BTR_CUR_HASH_ADAPT + bool ahi_disabled= btr_search_disable(); +# endif /* BTR_CUR_HASH_ADAPT */ + time_t start= time(nullptr); + mysql_mutex_lock(&mutex); + + do + { + if (shrink(size)) + { + const size_t old_blocks{n_blocks}; + n_blocks= n_blocks_new; + + size_t s= n_blocks_new / BUF_READ_AHEAD_PORTION; + read_ahead_area= s >= READ_AHEAD_PAGES + ? READ_AHEAD_PAGES + : my_round_up_to_next_power(uint32(s)); + + os_total_large_mem_allocated-= reduce_size; + shrunk(size, reduce_size); + ibuf_max_size_update(srv_change_buffer_max_size); +# ifdef BTR_CUR_HASH_ADAPT + if (ahi_disabled) + btr_search_enable(true); +# endif + mysql_mutex_unlock(&mutex); + sql_print_information("InnoDB: Memory pressure event shrunk" + " innodb_buffer_pool_size=%zum (%zu pages)" + " from %zum (%zu pages)", + size >> 20, n_blocks_new, old_size >> 20, + old_blocks); + ut_d(validate()); + return; + } + } + while (time(nullptr) - start < 15); + + ut_ad(size_in_bytes > size_in_bytes_requested); + n_blocks_to_withdraw= 0; + first_to_withdraw= nullptr; + size_in_bytes_requested= size_in_bytes; + + while (buf_page_t *b= UT_LIST_GET_FIRST(withdrawn)) + { + UT_LIST_REMOVE(withdrawn, b); + UT_LIST_ADD_LAST(free, b); + ut_d(b->in_free_list= true); + ut_ad(b->state() == buf_page_t::NOT_USED); + b->lock.init(); + } + + mysql_mutex_unlock(&mutex); + sql_print_information("InnoDB: Memory pressure event failed to shrink" + " innodb_buffer_pool_size=%zum", old_size); + ut_d(validate()); } #endif diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 58e40e41bdc..a38c01d2d50 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3688,6 +3688,25 @@ static MYSQL_SYSVAR_SIZE_T(buffer_pool_size, buf_pool.size_in_bytes_requested, nullptr, innodb_buffer_pool_size_update, 128U << 20, 2U << 20, size_t(-ssize_t(innodb_buffer_pool_extent_size)), 1U << 20); +#if defined __linux__ || !defined DBUG_OFF +static void innodb_buffer_pool_size_auto_min_update(THD*,st_mysql_sys_var*, + void*, const void *save) + noexcept +{ + mysql_mutex_lock(&buf_pool.mutex); + buf_pool.size_in_bytes_auto_min= *static_cast(save); + mysql_mutex_unlock(&buf_pool.mutex); +} + +static MYSQL_SYSVAR_SIZE_T(buffer_pool_size_auto_min, + buf_pool.size_in_bytes_auto_min, + PLUGIN_VAR_RQCMDARG, + "Minimum innodb_buffer_pool_size for dynamic shrinking on memory pressure", + nullptr, innodb_buffer_pool_size_auto_min_update, 0, 0, + size_t(-ssize_t(innodb_buffer_pool_extent_size)), + innodb_buffer_pool_extent_size); +#endif + static MYSQL_SYSVAR_SIZE_T(buffer_pool_size_max, buf_pool.size_in_bytes_max, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, "Maximum innodb_buffer_pool_size", @@ -3792,6 +3811,13 @@ static int innodb_init_params() innodb_buffer_pool_extent_size); MYSQL_SYSVAR_NAME(buffer_pool_size).max_val= buf_pool.size_in_bytes_max; +#if defined __linux__ || !defined DBUG_OFF + if (!buf_pool.size_in_bytes_auto_min || + buf_pool.size_in_bytes_auto_min > buf_pool.size_in_bytes_max) + buf_pool.size_in_bytes_auto_min= buf_pool.size_in_bytes_max; + MYSQL_SYSVAR_NAME(buffer_pool_size_auto_min).max_val= + buf_pool.size_in_bytes_max; +#endif if (innodb_buffer_pool_size < min) { @@ -19933,6 +19959,9 @@ static MYSQL_SYSVAR_BOOL(encrypt_temporary_tables, innodb_encrypt_temporary_tabl static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(autoextend_increment), MYSQL_SYSVAR(buffer_pool_size), +#if defined __linux__ || !defined DBUG_OFF + MYSQL_SYSVAR(buffer_pool_size_auto_min), +#endif MYSQL_SYSVAR(buffer_pool_size_max), MYSQL_SYSVAR(buffer_pool_chunk_size), MYSQL_SYSVAR(buffer_pool_filename), diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 0a3f04c9844..d88642de21c 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -1205,6 +1205,10 @@ class buf_pool_t public: /** The requested innodb_buffer_pool_size */ size_t size_in_bytes_requested; +#if defined __linux__ || !defined DBUG_OFF + /** The minimum allowed innodb_buffer_pool_size in garbage_collect() */ + size_t size_in_bytes_auto_min; +#endif /** The maximum allowed innodb_buffer_pool_size */ size_t size_in_bytes_max; From d68f5ea9f0a33b3cb3ad147b5057046dd2641e38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 27 Mar 2025 08:19:40 +0200 Subject: [PATCH 090/134] MDEV-35000 fixup: galera.MDEV-33136 TRUNCATE TABLE will no longer cause a reload of InnoDB statistics. RENAME TABLE will. --- mysql-test/suite/galera/r/MDEV-33136.result | 2 +- mysql-test/suite/galera/t/MDEV-33136.test | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/galera/r/MDEV-33136.result b/mysql-test/suite/galera/r/MDEV-33136.result index 36159fa05cd..fb9945235d6 100644 --- a/mysql-test/suite/galera/r/MDEV-33136.result +++ b/mysql-test/suite/galera/r/MDEV-33136.result @@ -4,7 +4,7 @@ connect node_1a,127.0.0.1,root,,test,$NODE_MYPORT_1; connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; connection node_1a; -TRUNCATE TABLE t1; +RENAME TABLE t1 TO tmp, tmp TO t1; SET SESSION wsrep_retry_autocommit = 0; SET DEBUG_SYNC = 'dict_stats_mdl_acquired SIGNAL may_toi WAIT_FOR bf_abort'; INSERT INTO t1 VALUES (1); diff --git a/mysql-test/suite/galera/t/MDEV-33136.test b/mysql-test/suite/galera/t/MDEV-33136.test index 12765ef6dfb..f7f5cdfed56 100644 --- a/mysql-test/suite/galera/t/MDEV-33136.test +++ b/mysql-test/suite/galera/t/MDEV-33136.test @@ -19,8 +19,8 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; --connection node_1a -TRUNCATE TABLE t1; -# TRUNCATE forces the next statement to re-read statistics from persistent storage, +RENAME TABLE t1 TO tmp, tmp TO t1; +# RENAME forces the next statement to re-read statistics from persistent storage, # which will acquire MDL locks on the statistics tables in InnoDB. SET SESSION wsrep_retry_autocommit = 0; SET DEBUG_SYNC = 'dict_stats_mdl_acquired SIGNAL may_toi WAIT_FOR bf_abort'; From 9a6540cb84efe8f5df4682fba25af0d45ca3a607 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 27 Mar 2025 08:54:00 +0200 Subject: [PATCH 091/134] MDEV-29445 fixup: galera_sst_mariabackup_use_memory The mariadb-backup --use-memory parameter will be trimmed to a multiple of 8 MiB, or 2 MiB on 32-bit systems. Also, let us remove a bogus message in mariadb-backup: Warning: option 'use-memory': signed value -1 adjusted to 8388608 --- extra/mariabackup/xtrabackup.cc | 5 +++-- .../suite/galera/r/galera_sst_mariabackup_use_memory.result | 2 +- .../suite/galera/t/galera_sst_mariabackup_use_memory.cnf | 2 +- .../suite/galera/t/galera_sst_mariabackup_use_memory.test | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 57ae9da3b6b..daed2c4b817 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -1413,8 +1413,9 @@ struct my_option xb_client_options[]= { "The value is used in place of innodb_buffer_pool_size. " "This option is only relevant when the --prepare option is specified.", (G_PTR *) &xtrabackup_use_memory, (G_PTR *) &xtrabackup_use_memory, 0, - GET_LL, REQUIRED_ARG, 96 << 20, innodb_buffer_pool_extent_size, - SIZE_T_MAX, 0, innodb_buffer_pool_extent_size, 0}, + GET_ULL, REQUIRED_ARG, 96 << 20, innodb_buffer_pool_extent_size, + size_t(-ssize_t(innodb_buffer_pool_extent_size)), + 0, innodb_buffer_pool_extent_size, 0}, {"throttle", OPT_XTRA_THROTTLE, "limit count of IO operations (pairs of read&write) per second to IOS " "values (for '--backup')", diff --git a/mysql-test/suite/galera/r/galera_sst_mariabackup_use_memory.result b/mysql-test/suite/galera/r/galera_sst_mariabackup_use_memory.result index 1d631198990..2f5763139b6 100644 --- a/mysql-test/suite/galera/r/galera_sst_mariabackup_use_memory.result +++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_use_memory.result @@ -8,6 +8,6 @@ connection node_1; Cleaning var directory ... connection node_2; Starting server ... -include/assert_grep.inc [mariabackup: Using 128974848 bytes for buffer pool \(set by --use-memory parameter\)] +include/assert_grep.inc [mariabackup: Using 134217728 bytes for buffer pool \(set by --use-memory parameter\)] disconnect node_2; disconnect node_1; diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.cnf index 05a647eb090..0504f610b80 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.cnf @@ -5,4 +5,4 @@ wsrep_sst_method=mariabackup wsrep_sst_auth="root:" [mariabackup] -use_memory=123m +use_memory=129m diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.test b/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.test index f6ba873976e..bbc689b03ed 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.test +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.test @@ -40,8 +40,8 @@ let $restart_noprint=2; --source include/wait_condition.inc # Confirm that IST did not take place ---let $assert_text = mariabackup: Using 128974848 bytes for buffer pool \(set by --use-memory parameter\) ---let $assert_select = mariabackup: Using 128974848 bytes for buffer pool \(set by --use-memory parameter\) +--let $assert_text = mariabackup: Using 134217728 bytes for buffer pool \(set by --use-memory parameter\) +--let $assert_select = mariabackup: Using 134217728 bytes for buffer pool \(set by --use-memory parameter\) --let $assert_count = 1 --let $assert_file = $MYSQLTEST_VARDIR/mysqld.2/data/mariabackup.prepare.log --let $assert_only_after = Starting InnoDB instance for recovery From 027d815546d45513ec597b490f2fa45b567802ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 27 Mar 2025 14:52:07 +0200 Subject: [PATCH 092/134] MDEV-29445 fixup: Make Valgrind fair again recv_sys_t::wait_for_pool(): Also wait for pending writes, so that previously written blocks can be evicted and reused. buf_flush_sync_for_checkpoint(): Wait for pending writes, in order to guarantee progress even if the scheduler is unfair. --- storage/innobase/buf/buf0flu.cc | 2 ++ storage/innobase/log/log0recv.cc | 1 + 2 files changed, 3 insertions(+) diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index c019786867b..b82fe796bb5 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -2195,6 +2195,8 @@ static void buf_flush_sync_for_checkpoint(lsn_t lsn) noexcept MONITOR_FLUSH_SYNC_PAGES, n_flushed); } + os_aio_wait_until_no_pending_writes(false); + switch (srv_file_flush_method) { case SRV_NOSYNC: case SRV_O_DIRECT_NO_FSYNC: diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index e15c1d24337..901e3ca3520 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -2041,6 +2041,7 @@ ATTRIBUTE_COLD void recv_sys_t::wait_for_pool(size_t pages) { mysql_mutex_unlock(&mutex); os_aio_wait_until_no_pending_reads(false); + os_aio_wait_until_no_pending_writes(false); mysql_mutex_lock(&mutex); garbage_collect(); mysql_mutex_lock(&buf_pool.mutex); From 992d85025cf7c60038587e469e5de5ca13fcc5d3 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 6 Mar 2025 10:03:04 +0100 Subject: [PATCH 093/134] cmake CMP0177 policy, no dot in the install destination path --- mysql-test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/CMakeLists.txt b/mysql-test/CMakeLists.txt index 7487e301df5..bb467b8ec22 100644 --- a/mysql-test/CMakeLists.txt +++ b/mysql-test/CMakeLists.txt @@ -14,7 +14,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA -INSTALL_MYSQL_TEST("." ".") +INSTALL_MYSQL_TEST("." "") IF(NOT ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) # Enable running mtr from build directory From 6aa860be27480db134a3c71065b9b47d15b72674 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 11 Mar 2025 11:22:00 +0100 Subject: [PATCH 094/134] MDEV-36268 mariadb-dump used wrong quoting character use ' not " and use quote_for_equal() --- client/mysqldump.c | 15 +++++++---- mysql-test/main/mysqldump-system.result | 6 ++--- mysql-test/main/mysqldump.result | 33 +++++++++++++++++++++++++ mysql-test/main/mysqldump.test | 9 +++++++ 4 files changed, 55 insertions(+), 8 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index 1cb41b66e30..e7264c07ad9 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -2098,7 +2098,7 @@ static char *quote_for_equal(const char *name, char *buff) *to++='\\'; } if (*name == '\'') - *to++= '\\'; + *to++= '\''; *to++= *name++; } to[0]= '\''; @@ -3612,7 +3612,7 @@ static void dump_trigger_old(FILE *sql_file, MYSQL_RES *show_triggers_rs, fprintf(sql_file, "DELIMITER ;;\n" - "/*!50003 SET SESSION SQL_MODE=\"%s\" */;;\n" + "/*!50003 SET SESSION SQL_MODE='%s' */;;\n" "/*!50003 CREATE */ ", (*show_trigger_row)[6]); @@ -4578,17 +4578,19 @@ static int dump_all_users_roles_and_grants() return 1; while ((row= mysql_fetch_row(tableres))) { + char buf[200]; if (opt_replace_into) /* Protection against removing the current import user */ /* MySQL-8.0 export capability */ fprintf(md_result_file, "DELIMITER |\n" - "/*M!100101 IF current_user()=\"%s\" THEN\n" + "/*M!100101 IF current_user()=%s THEN\n" " SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001," " MESSAGE_TEXT=\"Don't remove current user %s'\";\n" "END IF */|\n" "DELIMITER ;\n" - "/*!50701 DROP USER IF EXISTS %s */;\n", row[0], row[0], row[0]); + "/*!50701 DROP USER IF EXISTS %s */;\n", + quote_for_equal(row[0],buf), row[0], row[0]); if (dump_create_user(row[0])) result= 1; /* if roles exist, defer dumping grants until after roles created */ @@ -6698,6 +6700,7 @@ static my_bool get_view_structure(char *table, char* db) char *result_table, *opt_quoted_table; char table_buff[NAME_LEN*2+3]; char table_buff2[NAME_LEN*2+3]; + char temp_buff[NAME_LEN*2 + 3], temp_buff2[NAME_LEN*2 + 3]; char query[QUERY_LENGTH]; FILE *sql_file= md_result_file; DBUG_ENTER("get_view_structure"); @@ -6758,7 +6761,9 @@ static my_bool get_view_structure(char *table, char* db) "SELECT CHECK_OPTION, DEFINER, SECURITY_TYPE, " " CHARACTER_SET_CLIENT, COLLATION_CONNECTION " "FROM information_schema.views " - "WHERE table_name=\"%s\" AND table_schema=\"%s\"", table, db); + "WHERE table_name=%s AND table_schema=%s", + quote_for_equal(table, temp_buff2), + quote_for_equal(db, temp_buff)); if (mysql_query(mysql, query)) { diff --git a/mysql-test/main/mysqldump-system.result b/mysql-test/main/mysqldump-system.result index e011132b0f9..14cbc7eb5c0 100644 --- a/mysql-test/main/mysqldump-system.result +++ b/mysql-test/main/mysqldump-system.result @@ -176,21 +176,21 @@ UNLOCK TABLES; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; /*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; DELIMITER | -/*M!100101 IF current_user()="'mariadb.sys'@'localhost'" THEN +/*M!100101 IF current_user()='''mariadb.sys''@''localhost''' THEN SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'mariadb.sys'@'localhost''"; END IF */| DELIMITER ; /*!50701 DROP USER IF EXISTS 'mariadb.sys'@'localhost' */; CREATE /*M!100103 OR REPLACE */ USER `mariadb.sys`@`localhost` PASSWORD EXPIRE; DELIMITER | -/*M!100101 IF current_user()="'root'@'localhost'" THEN +/*M!100101 IF current_user()='''root''@''localhost''' THEN SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'root'@'localhost''"; END IF */| DELIMITER ; /*!50701 DROP USER IF EXISTS 'root'@'localhost' */; CREATE /*M!100103 OR REPLACE */ USER `root`@`localhost`; DELIMITER | -/*M!100101 IF current_user()="'USER'@'%'" THEN +/*M!100101 IF current_user()='''USER''@''%''' THEN SIGNAL SQLSTATE '45000' SET MYSQL_ERRNO=30001, MESSAGE_TEXT="Don't remove current user 'USER'@'%''"; END IF */| DELIMITER ; diff --git a/mysql-test/main/mysqldump.result b/mysql-test/main/mysqldump.result index 93e0f9ee89c..8e8e342d833 100644 --- a/mysql-test/main/mysqldump.result +++ b/mysql-test/main/mysqldump.result @@ -6590,4 +6590,37 @@ CREATE TABLE `t1` ( /*!40101 SET character_set_client = @saved_cs_client */; ERROR at line 9: Not allowed in the sandbox mode drop table t1; +# +# MDEV-36268 mariadb-dump used wrong quoting character +# +create table t1 (a int); +create view `v'1"2` as select * from t1 with check option; +/*M!999999\- enable the sandbox mode */ +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `t1` ( + `a` int(11) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci; +/*!40101 SET character_set_client = @saved_cs_client */; +SET @saved_cs_client = @@character_set_client; +SET character_set_client = utf8mb4; +/*!50001 CREATE VIEW `v'1"2` AS SELECT + 1 AS `a` */; +SET character_set_client = @saved_cs_client; +/*!50001 DROP VIEW IF EXISTS `v'1"2`*/; +/*!50001 SET @saved_cs_client = @@character_set_client */; +/*!50001 SET @saved_cs_results = @@character_set_results */; +/*!50001 SET @saved_col_connection = @@collation_connection */; +/*!50001 SET character_set_client = utf8 */; +/*!50001 SET character_set_results = utf8 */; +/*!50001 SET collation_connection = utf8_general_ci */; +/*!50001 CREATE ALGORITHM=UNDEFINED */ +/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */ +/*!50001 VIEW `v'1"2` AS select `t1`.`a` AS `a` from `t1` */ +/*!50002 WITH CASCADED CHECK OPTION */; +/*!50001 SET character_set_client = @saved_cs_client */; +/*!50001 SET character_set_results = @saved_cs_results */; +/*!50001 SET collation_connection = @saved_col_connection */; +drop view `v'1"2`; +drop table t1; # End of 10.5 tests diff --git a/mysql-test/main/mysqldump.test b/mysql-test/main/mysqldump.test index 00569a9db7a..58790c15fd2 100644 --- a/mysql-test/main/mysqldump.test +++ b/mysql-test/main/mysqldump.test @@ -3023,4 +3023,13 @@ EOF --remove_file $MYSQLTEST_VARDIR/tmp/mdev33727.sql drop table t1; +--echo # +--echo # MDEV-36268 mariadb-dump used wrong quoting character +--echo # +create table t1 (a int); +create view `v'1"2` as select * from t1 with check option; # "' +--exec $MYSQL_DUMP --compact test +drop view `v'1"2`; # "' +drop table t1; + --echo # End of 10.5 tests From 1cc138958e312e4b252691a97f9ee2eafec0de1f Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 16 Mar 2025 11:26:30 +0100 Subject: [PATCH 095/134] MDEV-35727 main.mysql-interactive fails in buildbot on debian fix failing main.mysql-interactive * increase socat EOF timeout from 0.5s to 10s * add an explicit exit to not wait 10s (or even 0.5s - the test now finishes in 0.15s) * enable it for libedit --- mysql-test/main/mysql-interactive.result | 4 +++- mysql-test/main/mysql-interactive.test | 11 ++--------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/mysql-test/main/mysql-interactive.result b/mysql-test/main/mysql-interactive.result index a18c018b932..cdb0931418a 100644 --- a/mysql-test/main/mysql-interactive.result +++ b/mysql-test/main/mysql-interactive.result @@ -4,6 +4,7 @@ delimiter $ select 1; $ +exit Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is X Server version: Y @@ -21,4 +22,5 @@ MariaDB [(none)]> select 1; +---+ 1 row in set -MariaDB [(none)]> \ No newline at end of file +MariaDB [(none)]> exit +Bye diff --git a/mysql-test/main/mysql-interactive.test b/mysql-test/main/mysql-interactive.test index 0051d8e58c6..e387f937226 100644 --- a/mysql-test/main/mysql-interactive.test +++ b/mysql-test/main/mysql-interactive.test @@ -6,23 +6,16 @@ source include/not_windows.inc; # this would need an instrumented ncurses library source include/not_msan.inc; -error 0,1; -exec $MYSQL -V|grep -q readline; -if ($sys_errno == 1) -{ - # strangely enough - skip does not work with libedit; -} - write_file $MYSQL_TMP_DIR/mysql_in; delimiter $ select 1; $ +exit EOF let TERM=dumb; replace_regex /id is \d+/id is X/ /Server version: .*/Server version: Y/ / \(\d+\.\d+ sec\)//; error 0,127; -exec socat EXEC:"$MYSQL",pty STDIO < $MYSQL_TMP_DIR/mysql_in; +exec socat -t10 EXEC:"$MYSQL",pty STDIO < $MYSQL_TMP_DIR/mysql_in; if ($sys_errno == 127) { remove_file $MYSQL_TMP_DIR/mysql_in; From bca07a6f88db9278d00eb460c8c1a79f05e867cd Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 21 Mar 2025 16:59:34 +0100 Subject: [PATCH 096/134] cleanup: mysql_upgrade.test make it strict, don't just ignore all the pesky numbers it shows, replace the current mariadb version with X.Y.Z, replace first two components of the current version with X.Y replace the first component (or first-1, if the second is 0) with X fix perl to write mysql_upgrade_info files in binary mode, otherwise mariadb-upgrade reads them incorrectly on Windows. --- mysql-test/main/mysql_upgrade.result | 23 ++++++++++++----------- mysql-test/main/mysql_upgrade.test | 25 +++++++++++++++++-------- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/mysql-test/main/mysql_upgrade.result b/mysql-test/main/mysql_upgrade.result index bc33cc75cfa..8c3d7354604 100644 --- a/mysql-test/main/mysql_upgrade.result +++ b/mysql-test/main/mysql_upgrade.result @@ -47,7 +47,8 @@ test Phase 7/7: Running 'FLUSH PRIVILEGES' OK Run it again - should say already completed -This installation of MariaDB is already upgraded to VERSION.There is no need to run mysql_upgrade again for VERSION. +This installation of MariaDB is already upgraded to X.Y.Z-MariaDB. +There is no need to run mysql_upgrade again for X.Y.Z-MariaDB. You can use --force if you still want to run mysql_upgrade Force should run it regardless of whether it has been run before Phase 1/7: Checking and upgrading mysql database @@ -776,11 +777,11 @@ FLUSH PRIVILEGES; # # MDEV-27279: mariadb_upgrade add --check-if-upgrade-is-needed # -This installation of MariaDB is already upgraded to MariaDB . -There is no need to run mysql_upgrade again for MariaDB . +This installation of MariaDB is already upgraded to X.Y.Z-MariaDB. +There is no need to run mysql_upgrade again for X.Y.Z-MariaDB. Looking for 'mariadb' as: mariadb -This installation of MariaDB is already upgraded to MariaDB . -There is no need to run mysql_upgrade again for MariaDB . +This installation of MariaDB is already upgraded to X.Y.Z-MariaDB. +There is no need to run mysql_upgrade again for X.Y.Z-MariaDB. # # MDEV-27279: mariadb_upgrade check-if-upgrade absence is do it # @@ -790,17 +791,17 @@ Empty or non existent ...mysql_upgrade_info. Assuming mysql_upgrade has to be ru # MDEV-27279: mariadb_upgrade check-if-upgrade with minor version change # Looking for 'mariadb' as: mariadb -This installation of MariaDB is already upgraded to MariaDB . -There is no need to run mysql_upgrade again for MariaDB . -This installation of MariaDB is already upgraded to MariaDB . -There is no need to run mysql_upgrade again for MariaDB . +This installation of MariaDB is already upgraded to X.Y.0-MariaDB. +There is no need to run mysql_upgrade again for X.Y.Z-MariaDB. +This installation of MariaDB is already upgraded to X.Y.0-MariaDB. +There is no need to run mysql_upgrade again for X.Y.Z-MariaDB. You can use --force if you still want to run mysql_upgrade # # MDEV-27279: mariadb_upgrade check-if-upgrade with major version change # -Major version upgrade detected from MariaDB to MariaDB . Check required! +Major version upgrade detected from X.0.99 to X.Y.Z-MariaDB. Check required! Looking for 'mysql' as: mysql -Major version upgrade detected from MariaDB to MariaDB . Check required! +Major version upgrade detected from X.0.99 to X.Y.Z-MariaDB. Check required! drop table mysql.global_priv; rename table mysql.global_priv_bak to mysql.global_priv; # End of 10.2 tests diff --git a/mysql-test/main/mysql_upgrade.test b/mysql-test/main/mysql_upgrade.test index 647106facf1..1a7b6ac85f3 100644 --- a/mysql-test/main/mysql_upgrade.test +++ b/mysql-test/main/mysql_upgrade.test @@ -4,6 +4,10 @@ -- source include/have_partition.inc -- source include/no_valgrind_without_big.inc +let majorminor=`select substring_index(version(), '.', 2)`; +# for major upgrade test, see below +let major=`select substring_index(version(), '.', 1) - (version() like '%.0.%')`; + set sql_mode=""; # @@ -18,7 +22,7 @@ let $MYSQLD_DATADIR= `select @@datadir`; file_exists $MYSQLD_DATADIR/mysql_upgrade_info; --echo Run it again - should say already completed ---replace_regex /upgraded to [^\n].*/upgraded to VERSION./ /again for [^\n]*/again for VERSION./ +--replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB --exec $MYSQL_UPGRADE 2>&1 # It should have created a file in the MySQL Servers datadir @@ -288,10 +292,11 @@ FLUSH PRIVILEGES; --error 1 --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --silent ---replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / +--replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB --error 1 --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed ---replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / /'mariadb.* as:[^\n]*/'mariadb' as: mariadb/ +--replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB +--replace_regex /'mariadb.* as:[^\n]*/'mariadb' as: mariadb/ --error 1 --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --verbose @@ -319,16 +324,18 @@ perl; my $file= $ENV{'DATADIR'} or die "MYSQLD_DATADIR not set"; $ver =~ s/^(\d*)\.(\d*).(\d*)(.*)/$1.$2.0$4/; open(FILE, ">$file/mysql_upgrade_info") or die "Failed to open $file"; + binmode FILE; print FILE "$ver\n"; close(FILE); EOF --error 1 --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --silent ---replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / /'mariadb.* as:[^\n]*/'mariadb' as: mariadb/ +--replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB $majorminor X.Y +--replace_regex /'mariadb.* as:[^\n]*/'mariadb' as: mariadb/ --error 1 --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --verbose ---replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / +--replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB $majorminor X.Y --exec $MYSQL_UPGRADE --remove_file $MYSQLD_DATADIR/mysql_upgrade_info @@ -343,16 +350,18 @@ let DATADIR= $MYSQLD_DATADIR; perl; my $ver= $ENV{'MYSQL_SERVER_VERSION'} or die "MYSQL_SERVER_VERSION not set"; my $file= $ENV{'DATADIR'} or die "MYSQLD_DATADIR not set"; - $ver =~ s/^(\d*)\.(\d*).(\d*)(.*)/$1.0.$3$4/; + $ver =~ s/^(\d*)\.(\d*).(\d*)(.*)/$1.0.99/; open(FILE, ">$file/mysql_upgrade_info") or die "Failed to open $file"; + binmode FILE; print FILE "$ver\n"; close(FILE); EOF --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --silent ---replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / +--replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB $major X --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed ---replace_regex /\d\d\.\d*\.\d*[^ .\n]*/MariaDB / /'mariadb.* as:[^\n]*/'mysql' as: mysql/ +--replace_result $MYSQL_SERVER_VERSION X.Y.Z-MariaDB $major X +--replace_regex /'mariadb.* as:[^\n]*/'mysql' as: mysql/ --exec $MYSQL_UPGRADE --check-if-upgrade-is-needed --verbose --remove_file $MYSQLD_DATADIR/mysql_upgrade_info drop table mysql.global_priv; From 04771ff6b1dae3ea1c35029744cfbbf2b6da4538 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 21 Mar 2025 17:52:43 +0100 Subject: [PATCH 097/134] MDEV-28209 New mysql_upgrade message on minor-only upgrades is confusing --- client/mysql_upgrade.c | 14 +++++++++----- mysql-test/main/mysql_upgrade.result | 10 +++++----- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index f81cff2797c..3afe24e2dd7 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -855,8 +855,7 @@ static int upgrade_already_done(int silent) s= strchr(version, '.'); s= strchr(s + 1, '.'); - if (strncmp(upgrade_from_version, version, - (size_t)(s - version + 1))) + if (strncmp(upgrade_from_version, version, (size_t)(s - version + 1))) { if (calc_server_version(upgrade_from_version) <= MYSQL_VERSION_ID) { @@ -870,9 +869,14 @@ static int upgrade_already_done(int silent) } if (!silent) { - verbose("This installation of MariaDB is already upgraded to %s.\n" - "There is no need to run mysql_upgrade again for %s.", - upgrade_from_version, version); + if (strcmp(upgrade_from_version, version)) + verbose("This installation of MariaDB is already upgraded to %s.\n" + "There is no need to run mysql_upgrade again for %s, because " + "they're both %.*s.", + upgrade_from_version, version, (int)(s - version), version); + else + verbose("This installation of MariaDB is already upgraded to %s.\n" + "There is no need to run mysql_upgrade again.", version); if (!opt_check_upgrade) verbose("You can use --force if you still want to run mysql_upgrade"); } diff --git a/mysql-test/main/mysql_upgrade.result b/mysql-test/main/mysql_upgrade.result index 8c3d7354604..33f1df35feb 100644 --- a/mysql-test/main/mysql_upgrade.result +++ b/mysql-test/main/mysql_upgrade.result @@ -48,7 +48,7 @@ Phase 7/7: Running 'FLUSH PRIVILEGES' OK Run it again - should say already completed This installation of MariaDB is already upgraded to X.Y.Z-MariaDB. -There is no need to run mysql_upgrade again for X.Y.Z-MariaDB. +There is no need to run mysql_upgrade again. You can use --force if you still want to run mysql_upgrade Force should run it regardless of whether it has been run before Phase 1/7: Checking and upgrading mysql database @@ -778,10 +778,10 @@ FLUSH PRIVILEGES; # MDEV-27279: mariadb_upgrade add --check-if-upgrade-is-needed # This installation of MariaDB is already upgraded to X.Y.Z-MariaDB. -There is no need to run mysql_upgrade again for X.Y.Z-MariaDB. +There is no need to run mysql_upgrade again. Looking for 'mariadb' as: mariadb This installation of MariaDB is already upgraded to X.Y.Z-MariaDB. -There is no need to run mysql_upgrade again for X.Y.Z-MariaDB. +There is no need to run mysql_upgrade again. # # MDEV-27279: mariadb_upgrade check-if-upgrade absence is do it # @@ -792,9 +792,9 @@ Empty or non existent ...mysql_upgrade_info. Assuming mysql_upgrade has to be ru # Looking for 'mariadb' as: mariadb This installation of MariaDB is already upgraded to X.Y.0-MariaDB. -There is no need to run mysql_upgrade again for X.Y.Z-MariaDB. +There is no need to run mysql_upgrade again for X.Y.Z-MariaDB, because they're both X.Y. This installation of MariaDB is already upgraded to X.Y.0-MariaDB. -There is no need to run mysql_upgrade again for X.Y.Z-MariaDB. +There is no need to run mysql_upgrade again for X.Y.Z-MariaDB, because they're both X.Y. You can use --force if you still want to run mysql_upgrade # # MDEV-27279: mariadb_upgrade check-if-upgrade with major version change From bc13c8e4ae3cf8335f569dc0cff11d655e136f86 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 26 Mar 2025 12:32:34 +0100 Subject: [PATCH 098/134] MDEV-36078 PCRE2 10.45 breaks main.func_regexp_pcre due to change in PCRE 10.45 is correct, update test results to match. allow builds with <10.45 too (for old distros) but remove the buggy test --- cmake/pcre.cmake | 4 ++-- mysql-test/main/func_regexp_pcre.result | 28 +------------------------ mysql-test/main/func_regexp_pcre.test | 2 +- 3 files changed, 4 insertions(+), 30 deletions(-) diff --git a/cmake/pcre.cmake b/cmake/pcre.cmake index db685c3572d..3d84fd145f6 100644 --- a/cmake/pcre.cmake +++ b/cmake/pcre.cmake @@ -54,8 +54,8 @@ MACRO(BUNDLE_PCRE2) ExternalProject_Add( pcre2 PREFIX "${dir}" - URL "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.44/pcre2-10.44.zip" - URL_MD5 dfab8313154b3377a6959c3b6377841e + URL "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.45/pcre2-10.45.zip" + URL_MD5 873da56c6469ec207ca5c5ae9688b83a INSTALL_COMMAND "" CMAKE_ARGS "-DCMAKE_WARN_DEPRECATED=FALSE" diff --git a/mysql-test/main/func_regexp_pcre.result b/mysql-test/main/func_regexp_pcre.result index 57490009be3..d9254008378 100644 --- a/mysql-test/main/func_regexp_pcre.result +++ b/mysql-test/main/func_regexp_pcre.result @@ -60,7 +60,7 @@ INSERT INTO t1 VALUES ('1'),('௨'); INSERT INTO t2 VALUES ('\\p{Cyrillic}'),('\\p{Greek}'),('\\p{Latin}'); INSERT INTO t2 VALUES ('\\p{Han}'),('\\p{Hangul}'); INSERT INTO t2 VALUES ('\\p{Sinhala}'), ('\\p{Tamil}'); -INSERT INTO t2 VALUES ('\\p{L}'),('\\p{Ll}'),('\\p{Lu}'),('\\p{L&}'); +INSERT INTO t2 VALUES ('\\p{L}'), /* buggy before v10.45 ('\\p{Ll}'),('\\p{Lu}'),*/ ('\\p{L&}'); INSERT INTO t2 VALUES ('[[:alpha:]]'),('[[:digit:]]'); SELECT class, ch, ch RLIKE class FROM t1, t2 ORDER BY class, BINARY ch; class ch ch RLIKE class @@ -168,32 +168,6 @@ class ch ch RLIKE class \p{Latin} ප 0 \p{Latin} 㐗 0 \p{Latin} 갷 0 -\p{Ll} 1 0 -\p{Ll} A 0 -\p{Ll} a 1 -\p{Ll} À 0 -\p{Ll} à 1 -\p{Ll} Σ 0 -\p{Ll} σ 1 -\p{Ll} Я 0 -\p{Ll} я 1 -\p{Ll} ௨ 0 -\p{Ll} ප 0 -\p{Ll} 㐗 0 -\p{Ll} 갷 0 -\p{Lu} 1 0 -\p{Lu} A 1 -\p{Lu} a 0 -\p{Lu} À 1 -\p{Lu} à 0 -\p{Lu} Σ 1 -\p{Lu} σ 0 -\p{Lu} Я 1 -\p{Lu} я 0 -\p{Lu} ௨ 0 -\p{Lu} ප 0 -\p{Lu} 㐗 0 -\p{Lu} 갷 0 \p{L} 1 0 \p{L} A 1 \p{L} a 1 diff --git a/mysql-test/main/func_regexp_pcre.test b/mysql-test/main/func_regexp_pcre.test index c194e9aefd0..88baee071d1 100644 --- a/mysql-test/main/func_regexp_pcre.test +++ b/mysql-test/main/func_regexp_pcre.test @@ -41,7 +41,7 @@ INSERT INTO t1 VALUES ('1'),('௨'); INSERT INTO t2 VALUES ('\\p{Cyrillic}'),('\\p{Greek}'),('\\p{Latin}'); INSERT INTO t2 VALUES ('\\p{Han}'),('\\p{Hangul}'); INSERT INTO t2 VALUES ('\\p{Sinhala}'), ('\\p{Tamil}'); -INSERT INTO t2 VALUES ('\\p{L}'),('\\p{Ll}'),('\\p{Lu}'),('\\p{L&}'); +INSERT INTO t2 VALUES ('\\p{L}'), /* buggy before v10.45 ('\\p{Ll}'),('\\p{Lu}'),*/ ('\\p{L&}'); INSERT INTO t2 VALUES ('[[:alpha:]]'),('[[:digit:]]'); SELECT class, ch, ch RLIKE class FROM t1, t2 ORDER BY class, BINARY ch; DROP TABLE t1, t2; From da20e4d8a57f0fd957edcaa50299173ccc8cac86 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Wed, 26 Mar 2025 22:44:42 +0100 Subject: [PATCH 099/134] Fix PCRE2 10.45 build on Windows as an external project PCRE2 10.45 sets cmake_minimum_required to version 3.15. With that, on MSVC, compile flags for choosing C runtime (/MT, /MD, etc.) are ignored. Instead, CMAKE_MSVC_RUNTIME_LIBRARY must be passed when building an external project for consistent linkage, if it creates a static library. --- cmake/os/Windows.cmake | 19 +++++++++++++++++++ cmake/pcre.cmake | 8 ++++++++ 2 files changed, 27 insertions(+) diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index 1a853349ae5..5edc214d613 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -129,6 +129,25 @@ IF(MSVC) MESSAGE(FATAL_ERROR "Invalid value ${MSVC_CRT_TYPE} for MSVC_CRT_TYPE, choose one of /MT,/MTd,/MD,/MDd ") ENDIF() + # CMake version 3.15 and later uses CMAKE_MSVC_RUNTIME_LIBRARY + # variable for our MSVC_CRT_TYPE. + # Set CMAKE_MSVC_RUNTIME_LIBRARY and pass to external projects + # it is important to keep the same CRT type when linking + # + # Translation rules MSVC_CRT_TYPE -> CMAKE_MSVC_RUNTIME_LIBRARY + # /MT -> MultiThreaded + # /MTd -> MultiThreadedDebug + # /MD -> MultiThreadedDLL + # /MDd -> MultiThreadedDebugDLL + + SET(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded) + IF(MSVC_CRT_TYPE MATCHES "d$") + STRING(APPEND CMAKE_MSVC_RUNTIME_LIBRARY Debug) + ENDIF() + IF(MSVC_CRT_TYPE MATCHES "D") + STRING(APPEND CMAKE_MSVC_RUNTIME_LIBRARY DLL) + ENDIF() + IF(MSVC_CRT_TYPE MATCHES "/MD") # Dynamic runtime (DLLs), need to install CRT libraries. SET(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT VCCRT) diff --git a/cmake/pcre.cmake b/cmake/pcre.cmake index 3d84fd145f6..c203444ee04 100644 --- a/cmake/pcre.cmake +++ b/cmake/pcre.cmake @@ -51,6 +51,13 @@ MACRO(BUNDLE_PCRE2) ENDIF() ENDFOREACH() + IF(CMAKE_MSVC_RUNTIME_LIBRARY) + SET(CMAKE_MSVC_RUNTIME_LIBRARY_ARG + "-DCMAKE_MSVC_RUNTIME_LIBRARY=${CMAKE_MSVC_RUNTIME_LIBRARY}") + ELSE() + SET(CMAKE_MSVC_RUNTIME_LIBRARY_ARG) + ENDIF() + ExternalProject_Add( pcre2 PREFIX "${dir}" @@ -69,6 +76,7 @@ MACRO(BUNDLE_PCRE2) "-DCMAKE_C_FLAGS_RELEASE=${pcre2_flags_RELEASE}" "-DCMAKE_C_FLAGS_MINSIZEREL=${pcre2_flags_MINSIZEREL}" "-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}" + ${CMAKE_MSVC_RUNTIME_LIBRARY_ARG} ${stdlibs} ${byproducts} ) From c61345169af1fdf61e994978e7c771db119259f9 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Fri, 28 Mar 2025 02:53:59 +0100 Subject: [PATCH 100/134] galera tests: synchronization after merge --- mysql-test/suite/galera/disabled.def | 1 - .../include/auto_increment_offset_save.inc | 1 - .../galera/include/galera_dump_sr_table.inc | 1 - .../include/galera_st_shutdown_slave.inc | 1 - .../include/galera_start_replication.inc | 4 +- .../galera/include/galera_wsrep_recover.inc | 4 +- mysql-test/suite/galera/r/MDEV-26266.result | 2 +- mysql-test/suite/galera/r/MDEV-34647.result | 1 - mysql-test/suite/galera/r/MW-284.result | 2 +- .../galera/r/galera_2primary_replica.result | 5 +- .../galera/r/galera_binlog_checksum.result | 1 + .../r/galera_circular_replication.result | 1 + .../suite/galera/r/galera_defaults.result | 3 + .../suite/galera/r/galera_gcs_fragment.result | 2 +- .../galera/r/galera_ist_mysqldump.result | 6 +- .../galera/r/galera_partitioned_tables.result | 2 +- .../galera/r/galera_restart_replica.result | 1 + .../suite/galera/r/galera_slave_replay.result | 4 +- .../suite/galera/r/galera_split_brain.result | 1 + mysql-test/suite/galera/r/galera_ssl.result | 3 + .../galera/r/galera_ssl_compression.result | 3 + .../suite/galera/r/galera_ssl_upgrade.result | 3 + .../r/galera_strict_require_innodb.result | 2 +- .../galera_strict_require_primary_key.result | 2 +- .../r/galera_var_replicate_myisam_on.result | 21 ++++-- mysql-test/suite/galera/r/galera_wan.result | 2 +- mysql-test/suite/galera/r/mdev-29775.result | 4 +- mysql-test/suite/galera/r/mdev-30653.result | 2 +- mysql-test/suite/galera/t/GCF-939.test | 2 + mysql-test/suite/galera/t/MDEV-26266.test | 3 +- mysql-test/suite/galera/t/MDEV-27001.opt | 2 +- mysql-test/suite/galera/t/MDEV-27001.test | 2 +- mysql-test/suite/galera/t/MDEV-28053.test | 1 + mysql-test/suite/galera/t/MDEV-33136.test | 1 + mysql-test/suite/galera/t/MDEV-34647.test | 1 - mysql-test/suite/galera/t/MDEV-6860.test | 2 +- mysql-test/suite/galera/t/MW-284.test | 7 +- mysql-test/suite/galera/t/MW-416.test | 10 +-- .../suite/galera/t/binlog_checksum.test | 1 + .../galera/t/galera_2primary_replica.test | 6 +- .../galera/t/galera_alter_engine_myisam.test | 2 +- .../galera/t/galera_as_slave_nonprim.test | 3 +- .../galera/t/galera_bf_abort_mariabackup.cnf | 4 +- .../galera/t/galera_binlog_checksum.test | 2 - .../galera/t/galera_circular_replication.test | 1 + .../suite/galera/t/galera_defaults.test | 4 +- .../galera/t/galera_disallow_local_gtid.test | 1 - .../suite/galera/t/galera_fk_truncate.cnf | 9 +++ .../suite/galera/t/galera_flush_local.test | 3 +- .../suite/galera/t/galera_gcache_recover.cnf | 4 +- .../suite/galera/t/galera_gcache_recover.test | 1 + .../t/galera_gcache_recover_full_gcache.cnf | 4 +- .../t/galera_gcache_recover_full_gcache.test | 1 + .../t/galera_gcache_recover_manytrx.cnf | 4 +- .../t/galera_gcache_recover_manytrx.test | 1 + .../galera/t/galera_gtid_slave_sst_rsync.test | 15 +++++ .../suite/galera/t/galera_ist_mysqldump.test | 4 +- .../galera/t/galera_kill_smallchanges.test | 1 + .../suite/galera/t/galera_many_rows.test | 1 + .../galera/t/galera_partitioned_tables.test | 2 +- .../t/galera_query_cache_invalidate.test | 2 +- .../galera/t/galera_restart_replica.test | 1 + .../suite/galera/t/galera_slave_replay.test | 3 +- .../suite/galera/t/galera_split_brain.test | 1 + mysql-test/suite/galera/t/galera_ssl.test | 4 ++ .../galera/t/galera_ssl_compression.test | 4 ++ .../suite/galera/t/galera_ssl_upgrade.test | 3 + .../suite/galera/t/galera_sst_mariabackup.cnf | 2 +- .../t/galera_strict_require_innodb.test | 4 +- .../t/galera_strict_require_primary_key.test | 4 +- .../suite/galera/t/galera_sync_wait_upto.test | 1 + .../suite/galera/t/galera_threadpool.test | 1 - .../t/galera_var_auto_inc_control_off.test | 2 + .../t/galera_var_replicate_aria_off.test | 1 - .../t/galera_var_replicate_aria_on.test | 1 - .../t/galera_var_replicate_myisam_on.test | 22 +++++-- .../suite/galera/t/galera_var_wsrep_mode.test | 6 -- .../galera/t/galera_vote_rejoin_ddl.test | 4 -- mysql-test/suite/galera/t/galera_wan.test | 2 +- .../suite/galera/t/galera_wsrep_mode.test | 1 - .../t/galera_wsrep_schema_detached.test | 1 + mysql-test/suite/galera/t/mdev-29775.test | 4 +- mysql-test/suite/galera/t/mdev-30653.test | 4 +- .../r/galera_garbd_backup.result | 1 - .../r/galera_vote_rejoin_mysqldump.result | 2 +- .../galera_3nodes/t/galera_allowlist.cnf | 6 +- .../t/galera_duplicate_primary_value.test | 1 + .../t/galera_dynamic_protocol.cnf | 6 +- .../t/galera_dynamic_protocol.test | 1 - .../galera_3nodes/t/galera_garbd_backup.test | 10 ++- .../galera_3nodes/t/galera_pc_bootstrap.test | 1 - .../t/galera_safe_to_bootstrap.test | 1 - .../t/galera_vote_rejoin_mysqldump.test | 2 +- .../galera_3nodes/t/galera_wsrep_schema.test | 1 + .../t/galera_wsrep_schema_init.test | 1 + .../galera_3nodes_sr/r/MDEV-26707.result | 10 +-- .../suite/galera_3nodes_sr/t/GCF-817.test | 1 + .../suite/galera_3nodes_sr/t/GCF-832.test | 1 + .../suite/galera_3nodes_sr/t/MDEV-26707.test | 8 +-- .../t/galera_sr_isolate_master.test | 1 + .../t/galera_sr_join_slave.test | 1 + .../t/galera_sr_kill_master.test | 1 + ...ra_sr_kill_slave_after_apply_rollback.test | 1 + ...a_sr_kill_slave_after_apply_rollback2.test | 1 + .../t/galera_sr_kill_slave_before_apply.test | 1 + .../t/galera_sr_threeway_split.test | 1 + mysql-test/suite/galera_sr/disabled.def | 2 - .../r/galera_sr_kill_all_norecovery.result | 1 + .../suite/galera_sr/r/galera_sr_myisam.result | 1 + .../t/galera_sr_kill_all_norecovery.test | 3 +- .../suite/galera_sr/t/galera_sr_myisam.test | 2 - .../galera_sr/t/galera_sr_shutdown_slave.test | 1 + mysql-test/suite/wsrep/README | 1 - .../wsrep/include/check_galera_version.inc | 1 - .../wsrep/r/wsrep-recover-v25,binlogon.rdiff | 2 +- sql/handler.cc | 15 +++-- sql/sp_head.cc | 2 +- sql/wsrep_mysqld.cc | 37 +++++------ sql/wsrep_server_service.cc | 1 + sql/wsrep_thd.h | 66 ++++++++++++------- 120 files changed, 276 insertions(+), 187 deletions(-) create mode 100644 mysql-test/suite/galera/t/galera_fk_truncate.cnf diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index a77d2fd8805..538d2d36759 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -15,4 +15,3 @@ galera_wan : MDEV-35940 Unallowed state transition: donor -> synced in galera_wa galera_vote_rejoin_ddl : MDEV-35940 Unallowed state transition: donor -> synced in galera_wan MW-329 : MDEV-35951 Complete freeze during MW-329 test galera_vote_rejoin_dml : MDEV-35964 Assertion `ist_seqno >= cc_seqno' failed in galera_vote_rejoin_dml -MDEV-26266 : MDEV-26266 diff --git a/mysql-test/suite/galera/include/auto_increment_offset_save.inc b/mysql-test/suite/galera/include/auto_increment_offset_save.inc index 216c689ec8c..a6ce62b5d8e 100644 --- a/mysql-test/suite/galera/include/auto_increment_offset_save.inc +++ b/mysql-test/suite/galera/include/auto_increment_offset_save.inc @@ -42,4 +42,3 @@ if ($node_4) --connection $node_4 let $auto_increment_offset_node_4 = `SELECT @@global.auto_increment_offset`; } - diff --git a/mysql-test/suite/galera/include/galera_dump_sr_table.inc b/mysql-test/suite/galera/include/galera_dump_sr_table.inc index 1e6ff5548d2..91dcf8be46f 100644 --- a/mysql-test/suite/galera/include/galera_dump_sr_table.inc +++ b/mysql-test/suite/galera/include/galera_dump_sr_table.inc @@ -25,4 +25,3 @@ while ($seqno <= $sr_max) --inc $seqno } - diff --git a/mysql-test/suite/galera/include/galera_st_shutdown_slave.inc b/mysql-test/suite/galera/include/galera_st_shutdown_slave.inc index 7492e9f3579..1f7371704e6 100644 --- a/mysql-test/suite/galera/include/galera_st_shutdown_slave.inc +++ b/mysql-test/suite/galera/include/galera_st_shutdown_slave.inc @@ -118,4 +118,3 @@ SELECT * from t1; SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; DROP TABLE t1; COMMIT; - diff --git a/mysql-test/suite/galera/include/galera_start_replication.inc b/mysql-test/suite/galera/include/galera_start_replication.inc index b9b201106d7..fd208742d86 100644 --- a/mysql-test/suite/galera/include/galera_start_replication.inc +++ b/mysql-test/suite/galera/include/galera_start_replication.inc @@ -41,9 +41,9 @@ perl; my $counter = 1000; #my $found = false - + while ($counter > 0) { - + open(FILE, "$logfile") or die("Unable to open $logfile : $!\n"); my $new_sync_count = () = grep(/Synchronized with group/g,); close(FILE); diff --git a/mysql-test/suite/galera/include/galera_wsrep_recover.inc b/mysql-test/suite/galera/include/galera_wsrep_recover.inc index efe803dcc9f..1f1427a68e6 100644 --- a/mysql-test/suite/galera/include/galera_wsrep_recover.inc +++ b/mysql-test/suite/galera/include/galera_wsrep_recover.inc @@ -9,14 +9,14 @@ if (!$wsrep_recover_additional) } --perl - use strict; + use strict; my $wsrep_start_position_str = "grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'"; my $wsrep_start_position = `grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`; chomp($wsrep_start_position); die if $wsrep_start_position eq ''; - open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/galera_wsrep_start_position.inc") or die; + open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/galera_wsrep_start_position.inc") or die; print FILE "--let \$galera_wsrep_start_position = $wsrep_start_position\n"; close FILE; EOF diff --git a/mysql-test/suite/galera/r/MDEV-26266.result b/mysql-test/suite/galera/r/MDEV-26266.result index 01171d4bb83..49efd893539 100644 --- a/mysql-test/suite/galera/r/MDEV-26266.result +++ b/mysql-test/suite/galera/r/MDEV-26266.result @@ -19,5 +19,5 @@ INSERT INTO t2 VALUES (3); INSERT INTO t2 VALUES (4); INSERT INTO t2 VALUES (5); CREATE VIEW v1 AS SELECT c1 FROM t1 WHERE c1 IN (SELECT a FROM t2) GROUP BY c1; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +DROP VIEW v1; DROP TABLE t1,t2; diff --git a/mysql-test/suite/galera/r/MDEV-34647.result b/mysql-test/suite/galera/r/MDEV-34647.result index 0333f14ece1..0bdab65d963 100644 --- a/mysql-test/suite/galera/r/MDEV-34647.result +++ b/mysql-test/suite/galera/r/MDEV-34647.result @@ -95,7 +95,6 @@ id val 4 d 5 d 6 d -set global wsrep_mode=default; connection node_1; drop table t1,t2,t3,t4,t5; set global wsrep_mode=default; diff --git a/mysql-test/suite/galera/r/MW-284.result b/mysql-test/suite/galera/r/MW-284.result index ba8b67e9c31..d03948fe28f 100644 --- a/mysql-test/suite/galera/r/MW-284.result +++ b/mysql-test/suite/galera/r/MW-284.result @@ -13,7 +13,7 @@ connection node_3; SELECT @@wsrep_on; @@wsrep_on 0 -call mtr.add_suppression("Error reading packet from server: WSREP has not yet prepared node for application use (server_errno=1047)"); +call mtr.add_suppression("Error reading packet from server: WSREP has not yet prepared node for application use \\(server_errno ?= ?1047\\)"); START SLAVE; include/wait_for_slave_param.inc [Slave_IO_Running] connection node_1; diff --git a/mysql-test/suite/galera/r/galera_2primary_replica.result b/mysql-test/suite/galera/r/galera_2primary_replica.result index 8bdbf5be962..9901caa9eb6 100644 --- a/mysql-test/suite/galera/r/galera_2primary_replica.result +++ b/mysql-test/suite/galera/r/galera_2primary_replica.result @@ -13,10 +13,13 @@ grant all on *.* to repl2@'%'; connect replica, 127.0.0.1, root, , test, $NODE_MYPORT_1; connection replica; connection node_2; +connection primary1; +connection primary2; connection replica; # Galera replica changing master to primary1 -SET @@default_master_connection='stream2'; +SET @@default_master_connection='stream1'; # Primary node changing master to primary2 +SET @@default_master_connection='stream2'; START ALL SLAVES; Warnings: Note 1937 SLAVE 'stream1' started diff --git a/mysql-test/suite/galera/r/galera_binlog_checksum.result b/mysql-test/suite/galera/r/galera_binlog_checksum.result index 3bd0bf42f96..7a56eaefe1d 100644 --- a/mysql-test/suite/galera/r/galera_binlog_checksum.result +++ b/mysql-test/suite/galera/r/galera_binlog_checksum.result @@ -27,4 +27,5 @@ i 1 connection node_1; DROP TABLE t1; +SET @@global.wsrep_mode=DEFAULT; # End of tests. diff --git a/mysql-test/suite/galera/r/galera_circular_replication.result b/mysql-test/suite/galera/r/galera_circular_replication.result index 72340977005..0094283d40b 100644 --- a/mysql-test/suite/galera/r/galera_circular_replication.result +++ b/mysql-test/suite/galera/r/galera_circular_replication.result @@ -12,6 +12,7 @@ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; connection replica1; connection node_2; connection primary2; +connection primary1; connection replica1; # Galera replica changing master to primary1 START SLAVE; diff --git a/mysql-test/suite/galera/r/galera_defaults.result b/mysql-test/suite/galera/r/galera_defaults.result index 84dd782999d..ebcae5827c8 100644 --- a/mysql-test/suite/galera/r/galera_defaults.result +++ b/mysql-test/suite/galera/r/galera_defaults.result @@ -1,6 +1,9 @@ connection node_2; connection node_1; # Correct Galera library found +SELECT COUNT(*) `expect 51` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%'; +expect 51 +51 SELECT VARIABLE_NAME, VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%' diff --git a/mysql-test/suite/galera/r/galera_gcs_fragment.result b/mysql-test/suite/galera/r/galera_gcs_fragment.result index bdd749047ee..cac35a78f1c 100644 --- a/mysql-test/suite/galera/r/galera_gcs_fragment.result +++ b/mysql-test/suite/galera/r/galera_gcs_fragment.result @@ -22,7 +22,7 @@ INSERT INTO t1 VALUES (2, "bbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa connection node_1a; SET GLOBAL wsrep_provider_options = 'signal=gcs_core_after_frag_send'; connection node_1; -ERROR HY000: Got error 6 "No such device or address" during COMMIT +ERROR HY000: Error while appending streaming replication fragment(provider status: Not connected to Primary Component) INSERT INTO t1 VALUES (3, "cccccaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); SELECT * FROM t1; f1 f2 diff --git a/mysql-test/suite/galera/r/galera_ist_mysqldump.result b/mysql-test/suite/galera/r/galera_ist_mysqldump.result index c3fd344c6cc..bcb6bce83df 100644 --- a/mysql-test/suite/galera/r/galera_ist_mysqldump.result +++ b/mysql-test/suite/galera/r/galera_ist_mysqldump.result @@ -1,5 +1,8 @@ connection node_2; connection node_1; +call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to "); +connection node_1; +connection node_2; Setting SST method to mysqldump ... call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to '127\\.0\\.0\\.1'"); call mtr.add_suppression("Failed to load slave replication state from table mysql\\.gtid_slave_pos"); @@ -9,9 +12,6 @@ GRANT ALL PRIVILEGES ON *.* TO 'sst'; SET GLOBAL wsrep_sst_auth = 'sst:'; connection node_2; SET GLOBAL wsrep_sst_method = 'mysqldump'; -call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to "); -connection node_1; -connection node_2; Performing State Transfer on a server that has been shut down cleanly and restarted connection node_1; CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; diff --git a/mysql-test/suite/galera/r/galera_partitioned_tables.result b/mysql-test/suite/galera/r/galera_partitioned_tables.result index 3f24cae1495..b68c1786ff7 100644 --- a/mysql-test/suite/galera/r/galera_partitioned_tables.result +++ b/mysql-test/suite/galera/r/galera_partitioned_tables.result @@ -1,6 +1,6 @@ connection node_2; connection node_1; -call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine partition for table.*"); +call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled\\. Storage engine partition for table"); # wsrep-mode= DEFAULT SET GLOBAL wsrep_mode = ""; SELECT @@wsrep_mode; diff --git a/mysql-test/suite/galera/r/galera_restart_replica.result b/mysql-test/suite/galera/r/galera_restart_replica.result index efc9a83a168..1691f9822a8 100644 --- a/mysql-test/suite/galera/r/galera_restart_replica.result +++ b/mysql-test/suite/galera/r/galera_restart_replica.result @@ -7,6 +7,7 @@ grant all on *.* to repl@'%'; ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; connection node_1; connection replica; +connection primary; connection replica; START SLAVE; connection primary; diff --git a/mysql-test/suite/galera/r/galera_slave_replay.result b/mysql-test/suite/galera/r/galera_slave_replay.result index 263e1a675d5..19b562d76d4 100644 --- a/mysql-test/suite/galera/r/galera_slave_replay.result +++ b/mysql-test/suite/galera/r/galera_slave_replay.result @@ -1,7 +1,7 @@ -connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; -connection node_2a; connection node_2; connection node_1; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2a; ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; connection node_3; diff --git a/mysql-test/suite/galera/r/galera_split_brain.result b/mysql-test/suite/galera/r/galera_split_brain.result index 374fb31afd1..b3b052b82ba 100644 --- a/mysql-test/suite/galera/r/galera_split_brain.result +++ b/mysql-test/suite/galera/r/galera_split_brain.result @@ -2,6 +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"); diff --git a/mysql-test/suite/galera/r/galera_ssl.result b/mysql-test/suite/galera/r/galera_ssl.result index ec3b717e3f3..b3f33112382 100644 --- a/mysql-test/suite/galera/r/galera_ssl.result +++ b/mysql-test/suite/galera/r/galera_ssl.result @@ -1,5 +1,8 @@ connection node_2; connection node_1; +SELECT COUNT(*) `expect 0` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE '%wsrep%'; +expect 0 +0 SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; VARIABLE_VALUE = 'Synced' 1 diff --git a/mysql-test/suite/galera/r/galera_ssl_compression.result b/mysql-test/suite/galera/r/galera_ssl_compression.result index 545f4babfe1..c5f7c65d303 100644 --- a/mysql-test/suite/galera/r/galera_ssl_compression.result +++ b/mysql-test/suite/galera/r/galera_ssl_compression.result @@ -1,5 +1,8 @@ connection node_2; connection node_1; +SELECT COUNT(*) `expect 0` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE '%wsrep%'; +expect 0 +0 SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; VARIABLE_VALUE = 'Synced' 1 diff --git a/mysql-test/suite/galera/r/galera_ssl_upgrade.result b/mysql-test/suite/galera/r/galera_ssl_upgrade.result index 9030850b67e..1b69d7b6980 100644 --- a/mysql-test/suite/galera/r/galera_ssl_upgrade.result +++ b/mysql-test/suite/galera/r/galera_ssl_upgrade.result @@ -1,5 +1,8 @@ connection node_2; connection node_1; +SELECT COUNT(*) `expect 0` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE '%wsrep%'; +expect 0 +0 connection node_1; connection node_2; connection node_1; diff --git a/mysql-test/suite/galera/r/galera_strict_require_innodb.result b/mysql-test/suite/galera/r/galera_strict_require_innodb.result index cc243cd3813..47adc5e9285 100644 --- a/mysql-test/suite/galera/r/galera_strict_require_innodb.result +++ b/mysql-test/suite/galera/r/galera_strict_require_innodb.result @@ -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\\. Storage engine "); 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; diff --git a/mysql-test/suite/galera/r/galera_strict_require_primary_key.result b/mysql-test/suite/galera/r/galera_strict_require_primary_key.result index 4a05f6405ed..ffdbb89170f 100644 --- a/mysql-test/suite/galera/r/galera_strict_require_primary_key.result +++ b/mysql-test/suite/galera/r/galera_strict_require_primary_key.result @@ -1,6 +1,6 @@ connection node_2; connection node_1; -call mtr.add_suppression("WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table .*"); +call mtr.add_suppression("WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled\\. Table "); CREATE TABLE t1(a int, b varchar(50)) ENGINE=INNODB; CREATE TABLE t2(a int, b varchar(50)) ENGINE=MYISAM; CREATE TABLE t3(a int, b varchar(50)) ENGINE=MEMORY; diff --git a/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result b/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result index d8463f6732f..20701aa1108 100644 --- a/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result +++ b/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result @@ -52,8 +52,8 @@ EXPECT_0 0 DROP TABLE t1; connection node_1; -CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM; -CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB; +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t2 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES (1); @@ -224,15 +224,26 @@ id b DROP TRIGGER tr1; DROP TRIGGER tr2; DROP TRIGGER tr3; -DROP TABLE t1,t2; +DROP TABLE t1, t2; +CREATE TABLE t1 (a INT, b INT, UNIQUE(a)) ENGINE=MyISAM; +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=1; +INSERT INTO t1 (a,b) VALUES (10,20); +connection node_2; +SELECT * from t1; +a b +1 20 +connection node_1; +DROP TABLE t1; # # MDEV-11152: wsrep_replicate_myisam: SELECT gets replicated using TO # connection node_1; -CREATE TABLE t1 (i INT) ENGINE=INNODB; +CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=INNODB; INSERT INTO t1 VALUES(1); SELECT * FROM t1; i 1 DROP TABLE t1; -connection node_1; +SET GLOBAL wsrep_mode = DEFAULT; +connection node_2; +SET GLOBAL wsrep_mode = DEFAULT; diff --git a/mysql-test/suite/galera/r/galera_wan.result b/mysql-test/suite/galera/r/galera_wan.result index 1fa36456c4d..af5314635e6 100644 --- a/mysql-test/suite/galera/r/galera_wan.result +++ b/mysql-test/suite/galera/r/galera_wan.result @@ -2,7 +2,7 @@ connection node_2; connection node_1; CALL mtr.add_suppression("WSREP: Stray state UUID msg: "); CALL mtr.add_suppression("WSREP: .*Sending JOIN failed: "); -CALL mtr.add_suppression("WSREP: .*sending install message failed: Socket is not connected"); +CALL mtr.add_suppression("WSREP: .*sending install message failed: (Transport endpoint|Socket) is not connected"); CALL mtr.add_suppression("WSREP: .*There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 4 diff --git a/mysql-test/suite/galera/r/mdev-29775.result b/mysql-test/suite/galera/r/mdev-29775.result index e5b55d6ad16..22ab8e50417 100644 --- a/mysql-test/suite/galera/r/mdev-29775.result +++ b/mysql-test/suite/galera/r/mdev-29775.result @@ -75,10 +75,10 @@ ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if ws SET GLOBAL wsrep_forced_binlog_format=DEFAULT; SET GLOBAL wsrep_mode=DEFAULT; SET GLOBAL wsrep_forced_binlog_format=MIXED; -SET GLOBAL wsrep_mode=REPLICATE_MYISAM; +SET GLOBAL wsrep_mode = REPLICATE_MYISAM; ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if wsrep_forced_binlog != [NONE|ROW] SET GLOBAL wsrep_forced_binlog_format=STATEMENT; -SET GLOBAL wsrep_mode=REPLICATE_MYISAM; +SET GLOBAL wsrep_mode = REPLICATE_MYISAM; ERROR HY000: wsrep_mode=[REPLICATE_MYISAM|REPLICATE_ARIA] can't be enabled if wsrep_forced_binlog != [NONE|ROW] SET GLOBAL wsrep_forced_binlog_format=DEFAULT; SET GLOBAL wsrep_mode=DEFAULT; diff --git a/mysql-test/suite/galera/r/mdev-30653.result b/mysql-test/suite/galera/r/mdev-30653.result index 43f525ceace..2a6099ae915 100644 --- a/mysql-test/suite/galera/r/mdev-30653.result +++ b/mysql-test/suite/galera/r/mdev-30653.result @@ -4,7 +4,7 @@ create table t1 (id serial, val int) engine=innodb; create table t2 (id serial, val int) engine=aria; insert into t1 values(1, 23); insert into t2 values(2, 42); -call mtr.add_suppression("WSREP: Replication of non-transactional engines is experimental. Storage engine Aria for table 'test'.'t2' is not supported in Galera"); +call mtr.add_suppression("WSREP: Replication of non-transactional engines is experimental\\. Storage engine Aria for table 'test'\\.'t2' is not supported in Galera"); begin; update t1 set val=24 where id=1; update t2 set val=41 where id=2; diff --git a/mysql-test/suite/galera/t/GCF-939.test b/mysql-test/suite/galera/t/GCF-939.test index a9b9077d5ef..c2fbfa8685e 100644 --- a/mysql-test/suite/galera/t/GCF-939.test +++ b/mysql-test/suite/galera/t/GCF-939.test @@ -3,6 +3,7 @@ # --source include/galera_cluster.inc +--source include/have_innodb.inc --exec rm -rf $MYSQLTEST_VARDIR/mysqld.2/data/GRA_*.log @@ -30,5 +31,6 @@ SELECT * FROM t1; DROP TABLE t1; CALL mtr.add_suppression("Ignoring error 'Unknown table 'test\\.t1'' on query"); + --connection node_2 CALL mtr.add_suppression("Error 'Unknown table 'test\\.t1'' on query"); diff --git a/mysql-test/suite/galera/t/MDEV-26266.test b/mysql-test/suite/galera/t/MDEV-26266.test index 8560cb3c7b6..f8ce83535f4 100644 --- a/mysql-test/suite/galera/t/MDEV-26266.test +++ b/mysql-test/suite/galera/t/MDEV-26266.test @@ -31,7 +31,6 @@ INSERT INTO t2 VALUES (2); INSERT INTO t2 VALUES (3); INSERT INTO t2 VALUES (4); INSERT INTO t2 VALUES (5); ---error ER_LOCK_DEADLOCK CREATE VIEW v1 AS SELECT c1 FROM t1 WHERE c1 IN (SELECT a FROM t2) GROUP BY c1; - +DROP VIEW v1; DROP TABLE t1,t2; diff --git a/mysql-test/suite/galera/t/MDEV-27001.opt b/mysql-test/suite/galera/t/MDEV-27001.opt index c62d74cb249..8b9f55f295e 100644 --- a/mysql-test/suite/galera/t/MDEV-27001.opt +++ b/mysql-test/suite/galera/t/MDEV-27001.opt @@ -1 +1 @@ ---partition=ON \ No newline at end of file +--partition=ON diff --git a/mysql-test/suite/galera/t/MDEV-27001.test b/mysql-test/suite/galera/t/MDEV-27001.test index fb5f57f53e5..095e2607911 100644 --- a/mysql-test/suite/galera/t/MDEV-27001.test +++ b/mysql-test/suite/galera/t/MDEV-27001.test @@ -4,4 +4,4 @@ CREATE TABLE t3 (c INT) PARTITION BY RANGE (c) (PARTITION p1 VALUES LESS THAN (1000)); CREATE TABLE tp2 (c INT); ALTER TABLE t3 CONVERT TABLE tp2 TO PARTITION p2 VALUES LESS THAN (2000); -DROP TABLE t3; \ No newline at end of file +DROP TABLE t3; diff --git a/mysql-test/suite/galera/t/MDEV-28053.test b/mysql-test/suite/galera/t/MDEV-28053.test index f3d7a775454..d4e93e95845 100644 --- a/mysql-test/suite/galera/t/MDEV-28053.test +++ b/mysql-test/suite/galera/t/MDEV-28053.test @@ -39,6 +39,7 @@ while ($counter) { --disable_result_log --eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3; START SLAVE; + --eval SELECT MASTER_GTID_WAIT('$gtid', 600) --enable_result_log --enable_query_log diff --git a/mysql-test/suite/galera/t/MDEV-33136.test b/mysql-test/suite/galera/t/MDEV-33136.test index f7f5cdfed56..dc1ae1aecdd 100644 --- a/mysql-test/suite/galera/t/MDEV-33136.test +++ b/mysql-test/suite/galera/t/MDEV-33136.test @@ -10,6 +10,7 @@ # transaction in the MDL conflict handling code. --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_debug_sync.inc --source include/have_debug.inc diff --git a/mysql-test/suite/galera/t/MDEV-34647.test b/mysql-test/suite/galera/t/MDEV-34647.test index 41cd941df88..2cf4b627f76 100644 --- a/mysql-test/suite/galera/t/MDEV-34647.test +++ b/mysql-test/suite/galera/t/MDEV-34647.test @@ -45,7 +45,6 @@ select * from t2; select * from t3; select * from t4; select * from t5; -set global wsrep_mode=default; --connection node_1 drop table t1,t2,t3,t4,t5; diff --git a/mysql-test/suite/galera/t/MDEV-6860.test b/mysql-test/suite/galera/t/MDEV-6860.test index e254dbceeeb..19b9e9cdd7c 100644 --- a/mysql-test/suite/galera/t/MDEV-6860.test +++ b/mysql-test/suite/galera/t/MDEV-6860.test @@ -4,7 +4,7 @@ --connection node_2 --disable_query_log ---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3, MASTER_USE_GTID=slave_pos; +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3, master_use_gtid=slave_pos; --enable_query_log START SLAVE; diff --git a/mysql-test/suite/galera/t/MW-284.test b/mysql-test/suite/galera/t/MW-284.test index bc630912d57..2c2102655ea 100644 --- a/mysql-test/suite/galera/t/MW-284.test +++ b/mysql-test/suite/galera/t/MW-284.test @@ -2,15 +2,16 @@ # MW-284 Slave I/O retry on ER_COM_UNKNOWN_ERROR # ---source include/have_log_bin.inc --source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_log_bin.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 call mtr.add_suppression("\\[ERROR\\] Error reading packet from server: WSREP has not yet prepared node for application use "); call mtr.add_suppression("WSREP has not yet prepared node for application use"); --disable_query_log ---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_1, MASTER_USER='root', MASTER_CONNECT_RETRY=1; +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1, master_connect_retry=1; --enable_query_log --connection node_1 @@ -29,7 +30,7 @@ SET global wsrep_sync_wait=0; --connection node_3 SELECT @@wsrep_on; --sleep 1 -call mtr.add_suppression("Error reading packet from server: WSREP has not yet prepared node for application use (server_errno=1047)"); +call mtr.add_suppression("Error reading packet from server: WSREP has not yet prepared node for application use \\(server_errno ?= ?1047\\)"); START SLAVE; --let $slave_param= Slave_IO_Running --let $slave_param_value= Connecting diff --git a/mysql-test/suite/galera/t/MW-416.test b/mysql-test/suite/galera/t/MW-416.test index 90f3afdd193..379873c0749 100644 --- a/mysql-test/suite/galera/t/MW-416.test +++ b/mysql-test/suite/galera/t/MW-416.test @@ -25,7 +25,7 @@ ALTER PROCEDURE proc1 COMMENT 'foo'; ALTER SERVER srv OPTIONS (USER 'sally'); --error 1044,1142,1227 ALTER TABLE tbl DROP COLUMN col; ---error 1044,1142,1227,1370 +--error 1044,1142,1227 ALTER VIEW vw AS SELECT 1; --error 1044,1227 @@ -40,11 +40,11 @@ CREATE FUNCTION fun1 RETURNS STRING SONAME 'funlib.so'; CREATE PROCEDURE proc1() BEGIN END; --error 1044,1142,1227 CREATE INDEX idx ON tbl(id); ---error 1044,1142,1227,1370 +--error 1044,1227 CREATE SERVER srv FOREIGN DATA WRAPPER 'fdw' OPTIONS (USER 'user'); --error 1044,1142,1227 CREATE TABLE t (i int); ---error 1044,1142,1227,1370 +--error 1044,1142,1227 CREATE TRIGGER trg BEFORE UPDATE ON t FOR EACH ROW BEGIN END; --error 1044,1142,1227 CREATE VIEW vw AS SELECT 1; @@ -57,13 +57,13 @@ DROP EVENT ev; DROP FUNCTION fun1; --error 1044,1142,1227 DROP INDEX idx ON t0; ---error 1044,1142,1227,1370 +--error 1044,1227,1370 DROP PROCEDURE proc1; --error 1044,1227 DROP SERVEr srv; --error 1044,1142,1227 DROP TABLE t0; ---error 1044,1142,1227,1360,1370 +--error 1044,1227,1360 DROP TRIGGER trg; --error 1044,1142,1227 DROP VIEW vw; diff --git a/mysql-test/suite/galera/t/binlog_checksum.test b/mysql-test/suite/galera/t/binlog_checksum.test index 8f6091235a1..5aab68a7746 100644 --- a/mysql-test/suite/galera/t/binlog_checksum.test +++ b/mysql-test/suite/galera/t/binlog_checksum.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/have_innodb.inc --echo # On node_1 --connection node_1 diff --git a/mysql-test/suite/galera/t/galera_2primary_replica.test b/mysql-test/suite/galera/t/galera_2primary_replica.test index fb57c6637d0..e31bc7859fa 100644 --- a/mysql-test/suite/galera/t/galera_2primary_replica.test +++ b/mysql-test/suite/galera/t/galera_2primary_replica.test @@ -41,17 +41,19 @@ grant all on *.* to repl2@'%'; --let $node_1 = replica --let $node_2 = node_2 +--let $node_3 = primary1 +--let $node_4 = primary2 --source include/auto_increment_offset_save.inc --connection replica --echo # Galera replica changing master to primary1 ---disable_query_log SET @@default_master_connection='stream1'; +--disable_query_log --eval CHANGE MASTER 'stream1' 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 -SET @@default_master_connection='stream2'; --echo # Primary node changing master to primary2 +SET @@default_master_connection='stream2'; --disable_query_log --eval CHANGE MASTER 'stream2' TO master_host='127.0.0.1', master_user='repl2', master_password='repl2', master_port=$NODE_MYPORT_4, master_use_gtid=slave_pos; --enable_query_log diff --git a/mysql-test/suite/galera/t/galera_alter_engine_myisam.test b/mysql-test/suite/galera/t/galera_alter_engine_myisam.test index 57c057f9869..77e46a2f883 100644 --- a/mysql-test/suite/galera/t/galera_alter_engine_myisam.test +++ b/mysql-test/suite/galera/t/galera_alter_engine_myisam.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_aria.inc # @@ -38,4 +39,3 @@ DROP TABLE t1; --disable_query_log SET GLOBAL wsrep_mode = DEFAULT; --enable_query_log - diff --git a/mysql-test/suite/galera/t/galera_as_slave_nonprim.test b/mysql-test/suite/galera/t/galera_as_slave_nonprim.test index 42414761e62..a45d3fd8b6f 100644 --- a/mysql-test/suite/galera/t/galera_as_slave_nonprim.test +++ b/mysql-test/suite/galera/t/galera_as_slave_nonprim.test @@ -17,9 +17,10 @@ --connection node_2 --disable_query_log ---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_4, MASTER_USER='root'; +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_4; --enable_query_log START SLAVE; + SET SESSION wsrep_sync_wait = 0; --connection node_4 diff --git a/mysql-test/suite/galera/t/galera_bf_abort_mariabackup.cnf b/mysql-test/suite/galera/t/galera_bf_abort_mariabackup.cnf index 857a4101406..1e6bbcce82f 100644 --- a/mysql-test/suite/galera/t/galera_bf_abort_mariabackup.cnf +++ b/mysql-test/suite/galera/t/galera_bf_abort_mariabackup.cnf @@ -6,10 +6,10 @@ 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' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_binlog_checksum.test b/mysql-test/suite/galera/t/galera_binlog_checksum.test index 12fb87a618c..e00e2169a50 100644 --- a/mysql-test/suite/galera/t/galera_binlog_checksum.test +++ b/mysql-test/suite/galera/t/galera_binlog_checksum.test @@ -38,8 +38,6 @@ SELECT * FROM t1; --connection node_1 DROP TABLE t1; ---disable_query_log SET @@global.wsrep_mode=DEFAULT; ---enable_query_log --echo # End of tests. diff --git a/mysql-test/suite/galera/t/galera_circular_replication.test b/mysql-test/suite/galera/t/galera_circular_replication.test index dbe85da4b23..312def70e06 100644 --- a/mysql-test/suite/galera/t/galera_circular_replication.test +++ b/mysql-test/suite/galera/t/galera_circular_replication.test @@ -45,6 +45,7 @@ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; --let $node_1 = replica1 --let $node_2 = node_2 --let $node_3 = primary2 +--let $node_4 = primary1 --source include/auto_increment_offset_save.inc --connection replica1 diff --git a/mysql-test/suite/galera/t/galera_defaults.test b/mysql-test/suite/galera/t/galera_defaults.test index ff08151327a..acf23b2bf11 100644 --- a/mysql-test/suite/galera/t/galera_defaults.test +++ b/mysql-test/suite/galera/t/galera_defaults.test @@ -13,11 +13,13 @@ --source include/force_restart.inc # Make sure that the test is operating on the right version of galera library. ---let $galera_version=26.4.11 +--let $galera_version=26.4.21 source ../wsrep/include/check_galera_version.inc; # Global Variables +SELECT COUNT(*) `expect 51` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%'; + SELECT VARIABLE_NAME, VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%' diff --git a/mysql-test/suite/galera/t/galera_disallow_local_gtid.test b/mysql-test/suite/galera/t/galera_disallow_local_gtid.test index b28bab1f8cb..2867e9e050e 100644 --- a/mysql-test/suite/galera/t/galera_disallow_local_gtid.test +++ b/mysql-test/suite/galera/t/galera_disallow_local_gtid.test @@ -101,4 +101,3 @@ DROP TABLE tab; DROP TABLE tab1; DROP TABLE tab2; DROP TABLE tab3; - diff --git a/mysql-test/suite/galera/t/galera_fk_truncate.cnf b/mysql-test/suite/galera/t/galera_fk_truncate.cnf new file mode 100644 index 00000000000..91e9199b092 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_fk_truncate.cnf @@ -0,0 +1,9 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +auto_increment_offset=1 +auto_increment_increment=1 + +[mysqld.2] +auto_increment_offset=2 +auto_increment_increment=1 diff --git a/mysql-test/suite/galera/t/galera_flush_local.test b/mysql-test/suite/galera/t/galera_flush_local.test index 207ce0ceae0..b9712fccf46 100644 --- a/mysql-test/suite/galera/t/galera_flush_local.test +++ b/mysql-test/suite/galera/t/galera_flush_local.test @@ -3,6 +3,7 @@ # PXC-391 --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_query_cache.inc --disable_warnings @@ -72,7 +73,6 @@ SELECT COUNT(*) AS EXPECT_10 FROM x1; SELECT COUNT(*) AS EXPECT_10000 FROM t2; SELECT COUNT(*) AS EXPECT_10 FROM x2; - --connection node_1 DROP TABLE t1, t2, x1, x2; CREATE TABLE t1 (f1 INTEGER); @@ -144,4 +144,3 @@ DROP TABLE t1, t2, x1, x2; --disable_query_log SET GLOBAL wsrep_mode = DEFAULT; --enable_query_log - diff --git a/mysql-test/suite/galera/t/galera_gcache_recover.cnf b/mysql-test/suite/galera/t/galera_gcache_recover.cnf index d1bea184e3e..0b4cba4ee2c 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover.cnf +++ b/mysql-test/suite/galera/t/galera_gcache_recover.cnf @@ -1,7 +1,7 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='gcache.recover=yes;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S' +wsrep_provider_options='gcache.recover=yes;gcache.size=128M;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;pc.wait_prim_timeout=PT60S' [mysqld.2] -wsrep_provider_options='gcache.recover=yes;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S' +wsrep_provider_options='gcache.recover=yes;gcache.size=128M;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;pc.wait_prim_timeout=PT60S' diff --git a/mysql-test/suite/galera/t/galera_gcache_recover.test b/mysql-test/suite/galera/t/galera_gcache_recover.test index fe2a65ee14e..b7ef486ae31 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover.test +++ b/mysql-test/suite/galera/t/galera_gcache_recover.test @@ -3,6 +3,7 @@ # --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/big_test.inc CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; diff --git a/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.cnf b/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.cnf index fee9d154817..1d64266a395 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.cnf +++ b/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.cnf @@ -3,7 +3,7 @@ [mysqld.1] max_allowed_packet=10M innodb_log_file_size=220M -wsrep_provider_options='gcache.recover=yes;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_provider_options='gcache.recover=yes;gcache.size=10M;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;pc.wait_prim_timeout=PT60S' [mysqld.2] -wsrep_provider_options='gcache.recover=yes;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_provider_options='gcache.recover=yes;gcache.size=10M;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;pc.wait_prim_timeout=PT60S' diff --git a/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test b/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test index 6b3e56d8a0f..99a5e621c08 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test +++ b/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test @@ -3,6 +3,7 @@ # --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/big_test.inc SET SESSION wsrep_sync_wait = 0; diff --git a/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.cnf b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.cnf index c6432f3607e..99d144a563e 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.cnf +++ b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.cnf @@ -2,8 +2,8 @@ [mysqld.1] innodb_log_file_size=220M -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.recover=yes;pc.ignore_sb=true;' +wsrep_provider_options='gcache.recover=yes;gcache.size=128M;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;pc.wait_prim_timeout=PT60S' [mysqld.2] innodb_log_file_size=220M -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.recover=yes;pc.ignore_sb=true;' +wsrep_provider_options='gcache.recover=yes;gcache.size=128M;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;pc.wait_prim_timeout=PT60S' diff --git a/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test index 3834607ce86..3c250077911 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test +++ b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test @@ -5,6 +5,7 @@ --source include/galera_cluster.inc --source include/big_test.inc +--source include/have_innodb.inc --source include/have_log_bin.inc SET SESSION wsrep_sync_wait = 0; diff --git a/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test index 0f68a02426e..e1ef2b4c20b 100644 --- a/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test +++ b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test @@ -13,6 +13,7 @@ # 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 + --echo #Connection 2 --connection node_2 --disable_query_log @@ -30,6 +31,7 @@ INSERT INTO t2 VALUES(3,33); SELECT @@global.gtid_binlog_state; --source include/save_master_gtid.inc + --echo #Connection 2 --connection node_2 --source include/sync_with_master_gtid.inc @@ -39,6 +41,7 @@ INSERT INTO t2 VALUES(4,44); INSERT INTO t2 VALUES(5,55); INSERT INTO t2 VALUES(6,66); SELECT @@global.gtid_binlog_state; + --echo #Connection 1 --connection node_1 --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME= 't2'; @@ -60,6 +63,7 @@ INSERT INTO t1 VALUES ('node1_committed_before'); INSERT INTO t1 VALUES ('node1_committed_before'); COMMIT; --source include/save_master_gtid.inc + --echo #Connection 2 --connection node_2 --source include/sync_with_master_gtid.inc @@ -68,6 +72,7 @@ START TRANSACTION; INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; + --echo #Connection 1 --connection node_1 --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME= 't1'; @@ -77,10 +82,12 @@ COMMIT; --let $node_1= node_1 --let $node_2= node_2 --source include/auto_increment_offset_save.inc + --echo #Connection 2 --connection node_2 --echo Shutting down server ... --source include/shutdown_mysqld.inc + --echo #Connection 1 --connection node_1 --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' @@ -90,6 +97,7 @@ START TRANSACTION; INSERT INTO t1 VALUES ('node1_committed_during'); INSERT INTO t1 VALUES ('node1_committed_during'); COMMIT; + --echo #Connection 2 --connection node_2 --echo Starting server ... @@ -103,11 +111,13 @@ START TRANSACTION; INSERT INTO t1 VALUES ('node2_committed_after'); INSERT INTO t1 VALUES ('node2_committed_after'); COMMIT; + --echo #Connection 1 --connection node_1 --let $wait_condition = SELECT COUNT(*) = 8 FROM t1; --source include/wait_condition.inc Select * from t1 order by f1; + --echo #Connection 2 --connection node_2 Select * from t1 order by f1; @@ -153,12 +163,14 @@ start slave; INSERT INTO t1 VALUES ('node2_slave_started'); SELECT count(*) from t1; SELECT @@global.gtid_binlog_state; + --echo #Connection 1 --connection node_1 --let $wait_condition = SELECT COUNT(*) = 12 FROM t1; --source include/wait_condition.inc SELECT count(*) from t1; SELECT @@global.gtid_binlog_state; + --echo #Connection 3 --connection node_3 DROP TABLE t2,t1; @@ -173,10 +185,12 @@ DROP TABLE t2,t1; --connection node_2 --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'; --source include/wait_condition.inc + --echo #Connection 1 --connection node_1 --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; --source include/wait_condition.inc + --echo #Connection 2 --connection node_2 STOP SLAVE; @@ -194,6 +208,7 @@ set global gtid_slave_pos=""; set global wsrep_on=OFF; reset master; set global wsrep_on=ON; + --echo #Connection 3 --connection node_3 reset master; diff --git a/mysql-test/suite/galera/t/galera_ist_mysqldump.test b/mysql-test/suite/galera/t/galera_ist_mysqldump.test index 73b406d016b..71be0919483 100644 --- a/mysql-test/suite/galera/t/galera_ist_mysqldump.test +++ b/mysql-test/suite/galera/t/galera_ist_mysqldump.test @@ -2,14 +2,14 @@ --source include/galera_cluster.inc --source include/have_innodb.inc ---source suite/galera/include/galera_sst_set_mysqldump.inc - call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to "); --let $node_1=node_1 --let $node_2=node_2 --source include/auto_increment_offset_save.inc +--source suite/galera/include/galera_sst_set_mysqldump.inc + # mysql-wsrep#33 - nnoDB: Failing assertion: xid_seqno > trx_sys_cur_xid_seqno in trx_sys_update_wsrep_checkpoint with mysqldump IST # --source suite/galera/include/galera_st_disconnect_slave.inc diff --git a/mysql-test/suite/galera/t/galera_kill_smallchanges.test b/mysql-test/suite/galera/t/galera_kill_smallchanges.test index 15e1727de03..bb1e76b5d7d 100644 --- a/mysql-test/suite/galera/t/galera_kill_smallchanges.test +++ b/mysql-test/suite/galera/t/galera_kill_smallchanges.test @@ -3,6 +3,7 @@ # --source include/galera_cluster.inc +--source include/have_innodb.inc # Save original auto_increment_offset values. --let $node_1=node_1 diff --git a/mysql-test/suite/galera/t/galera_many_rows.test b/mysql-test/suite/galera/t/galera_many_rows.test index 3623b3f33b0..0c2d974561a 100644 --- a/mysql-test/suite/galera/t/galera_many_rows.test +++ b/mysql-test/suite/galera/t/galera_many_rows.test @@ -1,5 +1,6 @@ --source include/big_test.inc --source include/galera_cluster.inc +--source include/have_innodb.inc # Save original auto_increment_offset values. --let $node_1=node_1 diff --git a/mysql-test/suite/galera/t/galera_partitioned_tables.test b/mysql-test/suite/galera/t/galera_partitioned_tables.test index f29adcf1501..8e52b59d97d 100644 --- a/mysql-test/suite/galera/t/galera_partitioned_tables.test +++ b/mysql-test/suite/galera/t/galera_partitioned_tables.test @@ -3,7 +3,7 @@ --source include/have_innodb.inc --source include/have_aria.inc -call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine partition for table.*"); +call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled\\. Storage engine partition for table"); --echo # wsrep-mode= DEFAULT SET GLOBAL wsrep_mode = ""; diff --git a/mysql-test/suite/galera/t/galera_query_cache_invalidate.test b/mysql-test/suite/galera/t/galera_query_cache_invalidate.test index b5560c54253..cafb223762a 100644 --- a/mysql-test/suite/galera/t/galera_query_cache_invalidate.test +++ b/mysql-test/suite/galera/t/galera_query_cache_invalidate.test @@ -29,7 +29,7 @@ call mtr.add_suppression("WSREP: Ignoring server id .* for non bootstrap node"); --connection node_3 --disable_query_log ---eval CHANGE MASTER TO master_host='127.0.0.1', master_user='root', MASTER_PORT=$NODE_MYPORT_1, master_use_gtid=current_pos +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1, master_use_gtid=current_pos; --enable_query_log START SLAVE; --source include/wait_for_slave_to_start.inc diff --git a/mysql-test/suite/galera/t/galera_restart_replica.test b/mysql-test/suite/galera/t/galera_restart_replica.test index 05ab77f2519..4c699433a0a 100644 --- a/mysql-test/suite/galera/t/galera_restart_replica.test +++ b/mysql-test/suite/galera/t/galera_restart_replica.test @@ -40,6 +40,7 @@ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; --let $node_1 = node_1 --let $node_2 = replica +--let $node_3 = primary --source include/auto_increment_offset_save.inc --connection replica diff --git a/mysql-test/suite/galera/t/galera_slave_replay.test b/mysql-test/suite/galera/t/galera_slave_replay.test index d289cfb3bd2..84502f6d33a 100644 --- a/mysql-test/suite/galera/t/galera_slave_replay.test +++ b/mysql-test/suite/galera/t/galera_slave_replay.test @@ -6,6 +6,7 @@ # or rollback and replay (depending on the nature of lock conflict). # +--source include/galera_cluster.inc --source include/have_innodb.inc --source include/have_log_bin.inc --source include/have_debug.inc @@ -13,9 +14,7 @@ --source include/galera_have_debug_sync.inc --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 - --connection node_2a ---source include/galera_cluster.inc ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; diff --git a/mysql-test/suite/galera/t/galera_split_brain.test b/mysql-test/suite/galera/t/galera_split_brain.test index b1ea9c9b4ab..bb6a4c8e648 100644 --- a/mysql-test/suite/galera/t/galera_split_brain.test +++ b/mysql-test/suite/galera/t/galera_split_brain.test @@ -13,6 +13,7 @@ --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 diff --git a/mysql-test/suite/galera/t/galera_ssl.test b/mysql-test/suite/galera/t/galera_ssl.test index e6346aa2151..984fca6ab96 100644 --- a/mysql-test/suite/galera/t/galera_ssl.test +++ b/mysql-test/suite/galera/t/galera_ssl.test @@ -9,6 +9,10 @@ --source include/galera_cluster.inc --source include/have_innodb.inc --source include/big_test.inc +--source include/have_perfschema.inc + +# Verify that SSL is handled by the provider. +SELECT COUNT(*) `expect 0` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE '%wsrep%'; SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; diff --git a/mysql-test/suite/galera/t/galera_ssl_compression.test b/mysql-test/suite/galera/t/galera_ssl_compression.test index 1df4aa26ebb..8d9dcbd6ced 100644 --- a/mysql-test/suite/galera/t/galera_ssl_compression.test +++ b/mysql-test/suite/galera/t/galera_ssl_compression.test @@ -8,6 +8,10 @@ --source include/galera_cluster.inc --source include/have_innodb.inc --source include/big_test.inc +--source include/have_perfschema.inc + +# Verify that SSL is handled by the provider. +SELECT COUNT(*) `expect 0` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE '%wsrep%'; SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; diff --git a/mysql-test/suite/galera/t/galera_ssl_upgrade.test b/mysql-test/suite/galera/t/galera_ssl_upgrade.test index 78897ffd738..f86aa3730f3 100644 --- a/mysql-test/suite/galera/t/galera_ssl_upgrade.test +++ b/mysql-test/suite/galera/t/galera_ssl_upgrade.test @@ -10,6 +10,9 @@ --source include/have_openssl.inc --source include/force_restart.inc +# Verify that SSL is handled by the provider. +SELECT COUNT(*) `expect 0` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE '%wsrep%'; + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf index 419ce9407ac..9c92b49c2c1 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup.cnf @@ -14,7 +14,7 @@ innodb_undo_tablespaces=0 wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' innodb_fast_shutdown=0 innodb_undo_tablespaces=3 -innodb_log_file_buffering +loose_innodb_log_file_buffering [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_strict_require_innodb.test b/mysql-test/suite/galera/t/galera_strict_require_innodb.test index b627fffe70c..6ca95432dbc 100644 --- a/mysql-test/suite/galera/t/galera_strict_require_innodb.test +++ b/mysql-test/suite/galera/t/galera_strict_require_innodb.test @@ -15,9 +15,10 @@ # In both cases apply flood control if >= 10 same warning # --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_aria.inc -call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine .*"); +call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled\\. Storage engine "); 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; @@ -114,4 +115,3 @@ DROP TABLE t1,t2,t3,t4; SET GLOBAL log_warnings=DEFAULT; SET GLOBAL wsrep_mode=DEFAULT; --disable_query_log - diff --git a/mysql-test/suite/galera/t/galera_strict_require_primary_key.test b/mysql-test/suite/galera/t/galera_strict_require_primary_key.test index dc5f9910396..4733c2e2ef4 100644 --- a/mysql-test/suite/galera/t/galera_strict_require_primary_key.test +++ b/mysql-test/suite/galera/t/galera_strict_require_primary_key.test @@ -14,9 +14,10 @@ # In both cases apply flood control if >= 10 same warning # --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_aria.inc -call mtr.add_suppression("WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table .*"); +call mtr.add_suppression("WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled\\. Table "); CREATE TABLE t1(a int, b varchar(50)) ENGINE=INNODB; CREATE TABLE t2(a int, b varchar(50)) ENGINE=MYISAM; @@ -140,4 +141,3 @@ DROP TABLE t1,t2,t3,t4; SET GLOBAL log_warnings=DEFAULT; SET GLOBAL wsrep_mode=DEFAULT; --disable_query_log - diff --git a/mysql-test/suite/galera/t/galera_sync_wait_upto.test b/mysql-test/suite/galera/t/galera_sync_wait_upto.test index 56d5aac73a7..4aba69f6152 100644 --- a/mysql-test/suite/galera/t/galera_sync_wait_upto.test +++ b/mysql-test/suite/galera/t/galera_sync_wait_upto.test @@ -3,6 +3,7 @@ # --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_debug.inc CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; diff --git a/mysql-test/suite/galera/t/galera_threadpool.test b/mysql-test/suite/galera/t/galera_threadpool.test index 78b26e6e89f..e5d2db15bec 100644 --- a/mysql-test/suite/galera/t/galera_threadpool.test +++ b/mysql-test/suite/galera/t/galera_threadpool.test @@ -5,7 +5,6 @@ --let $node_1 = node_1 --let $node_2 = node_2 - --source ../galera/include/auto_increment_offset_save.inc # diff --git a/mysql-test/suite/galera/t/galera_var_auto_inc_control_off.test b/mysql-test/suite/galera/t/galera_var_auto_inc_control_off.test index c0bbe5af8cf..241b62dbf8c 100644 --- a/mysql-test/suite/galera/t/galera_var_auto_inc_control_off.test +++ b/mysql-test/suite/galera/t/galera_var_auto_inc_control_off.test @@ -94,11 +94,13 @@ SELECT * FROM t1; --eval SET GLOBAL wsrep_auto_increment_control = $auto_increment_control_orig --eval SET GLOBAL auto_increment_increment = $auto_increment_increment_node1 --eval SET GLOBAL auto_increment_offset = $auto_increment_offset_node1 +--disconnect node_1a --connection node_2 --eval SET GLOBAL wsrep_auto_increment_control = $auto_increment_control_orig --eval SET GLOBAL auto_increment_increment = $auto_increment_increment_node2 --eval SET GLOBAL auto_increment_offset = $auto_increment_offset_node2 +--disconnect node_2a --enable_query_log diff --git a/mysql-test/suite/galera/t/galera_var_replicate_aria_off.test b/mysql-test/suite/galera/t/galera_var_replicate_aria_off.test index c0d8c5d6b3b..6946bc552ea 100644 --- a/mysql-test/suite/galera/t/galera_var_replicate_aria_off.test +++ b/mysql-test/suite/galera/t/galera_var_replicate_aria_off.test @@ -3,7 +3,6 @@ # --source include/galera_cluster.inc ---source include/have_innodb.inc --source include/have_aria.inc CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=Aria; diff --git a/mysql-test/suite/galera/t/galera_var_replicate_aria_on.test b/mysql-test/suite/galera/t/galera_var_replicate_aria_on.test index ac9a79e6196..c4367642102 100644 --- a/mysql-test/suite/galera/t/galera_var_replicate_aria_on.test +++ b/mysql-test/suite/galera/t/galera_var_replicate_aria_on.test @@ -234,4 +234,3 @@ SET GLOBAL wsrep_mode = DEFAULT; --connection node_2 SET GLOBAL wsrep_mode = DEFAULT; --enable_query_log - diff --git a/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test b/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test index f405ebfdc46..8cfe82fd457 100644 --- a/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test +++ b/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test @@ -77,8 +77,8 @@ DROP TABLE t1; # --connection node_1 -CREATE TABLE t1 (f1 INTEGER) ENGINE=MyISAM; -CREATE TABLE t2 (f1 INTEGER) ENGINE=InnoDB; +CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=MyISAM; +CREATE TABLE t2 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB; SET AUTOCOMMIT=OFF; START TRANSACTION; INSERT INTO t1 VALUES (1); @@ -126,6 +126,7 @@ INSERT INTO t1 VALUES (1); --connection node_1 COMMIT; DROP TABLE t1, t2; + # # Test prepared staments # @@ -200,21 +201,28 @@ SELECT * FROM t2 ORDER BY id; DROP TRIGGER tr1; DROP TRIGGER tr2; DROP TRIGGER tr3; -DROP TABLE t1,t2; +DROP TABLE t1, t2; + +CREATE TABLE t1 (a INT, b INT, UNIQUE(a)) ENGINE=MyISAM; +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=1; +INSERT INTO t1 (a,b) VALUES (10,20); + +--connection node_2 +SELECT * from t1; +--connection node_1 +DROP TABLE t1; --echo # --echo # MDEV-11152: wsrep_replicate_myisam: SELECT gets replicated using TO --echo # --connection node_1 -CREATE TABLE t1 (i INT) ENGINE=INNODB; +CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=INNODB; INSERT INTO t1 VALUES(1); # This command should not get replicated. SELECT * FROM t1; DROP TABLE t1; ---connection node_1 ---disable_query_log SET GLOBAL wsrep_mode = DEFAULT; + --connection node_2 SET GLOBAL wsrep_mode = DEFAULT; ---enable_query_log diff --git a/mysql-test/suite/galera/t/galera_var_wsrep_mode.test b/mysql-test/suite/galera/t/galera_var_wsrep_mode.test index 002dce0a05a..fdb033b0874 100644 --- a/mysql-test/suite/galera/t/galera_var_wsrep_mode.test +++ b/mysql-test/suite/galera/t/galera_var_wsrep_mode.test @@ -57,9 +57,3 @@ SELECT @@wsrep_mode; # reset SET GLOBAL wsrep_mode=DEFAULT; - - - - - - diff --git a/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test b/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test index 58371061a5f..c868e5e8e5b 100644 --- a/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test +++ b/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test @@ -91,10 +91,6 @@ CALL mtr.add_suppression("WSREP: Vote 0 \\(success\\) on .* is inconsistent with DROP TABLE t2; ---let $node_3=node_3 ---let $auto_increment_offset_node_3 = 3; ---let $node_4=node_4 ---let $auto_increment_offset_node_4 = 4; --source suite/galera/include/auto_increment_offset_restore.inc --disconnect node_3 diff --git a/mysql-test/suite/galera/t/galera_wan.test b/mysql-test/suite/galera/t/galera_wan.test index d148569d2cc..8b90381c4aa 100644 --- a/mysql-test/suite/galera/t/galera_wan.test +++ b/mysql-test/suite/galera/t/galera_wan.test @@ -12,7 +12,7 @@ CALL mtr.add_suppression("WSREP: Stray state UUID msg: "); CALL mtr.add_suppression("WSREP: .*Sending JOIN failed: "); -CALL mtr.add_suppression("WSREP: .*sending install message failed: Socket is not connected"); +CALL mtr.add_suppression("WSREP: .*sending install message failed: (Transport endpoint|Socket) is not connected"); CALL mtr.add_suppression("WSREP: .*There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); --let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; diff --git a/mysql-test/suite/galera/t/galera_wsrep_mode.test b/mysql-test/suite/galera/t/galera_wsrep_mode.test index a8e192123bd..d50018c1c4b 100644 --- a/mysql-test/suite/galera/t/galera_wsrep_mode.test +++ b/mysql-test/suite/galera/t/galera_wsrep_mode.test @@ -16,7 +16,6 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; DROP TABLE t1; SET GLOBAL wsrep_mode = default; - # MDEV-25698 SIGSEGV in wsrep_should_replicate_ddl SET GLOBAL wsrep_mode = STRICT_REPLICATION; diff --git a/mysql-test/suite/galera/t/galera_wsrep_schema_detached.test b/mysql-test/suite/galera/t/galera_wsrep_schema_detached.test index 34076761abb..fa80d329bc3 100644 --- a/mysql-test/suite/galera/t/galera_wsrep_schema_detached.test +++ b/mysql-test/suite/galera/t/galera_wsrep_schema_detached.test @@ -33,6 +33,7 @@ INSERT INTO mysql.wsrep_allowlist (ip) VALUES (0); SET GLOBAL wsrep_cluster_address = @wsrep_cluster_address_orig; SELECT 1; DELETE FROM mysql.wsrep_allowlist; + --connection node_2 --source include/kill_galera.inc diff --git a/mysql-test/suite/galera/t/mdev-29775.test b/mysql-test/suite/galera/t/mdev-29775.test index 2de477a4822..0a509ad12f1 100644 --- a/mysql-test/suite/galera/t/mdev-29775.test +++ b/mysql-test/suite/galera/t/mdev-29775.test @@ -72,10 +72,10 @@ SET GLOBAL wsrep_forced_binlog_format=DEFAULT; SET GLOBAL wsrep_mode=DEFAULT; SET GLOBAL wsrep_forced_binlog_format=MIXED; --error ER_WRONG_ARGUMENTS -SET GLOBAL wsrep_mode=REPLICATE_MYISAM; +SET GLOBAL wsrep_mode = REPLICATE_MYISAM; SET GLOBAL wsrep_forced_binlog_format=STATEMENT; --error ER_WRONG_ARGUMENTS -SET GLOBAL wsrep_mode=REPLICATE_MYISAM; +SET GLOBAL wsrep_mode = REPLICATE_MYISAM; SET GLOBAL wsrep_forced_binlog_format=DEFAULT; SET GLOBAL wsrep_mode=DEFAULT; diff --git a/mysql-test/suite/galera/t/mdev-30653.test b/mysql-test/suite/galera/t/mdev-30653.test index 658c4372d6b..425f93b3f8c 100644 --- a/mysql-test/suite/galera/t/mdev-30653.test +++ b/mysql-test/suite/galera/t/mdev-30653.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_aria.inc create table t1 (id serial, val int) engine=innodb; @@ -6,7 +7,8 @@ create table t2 (id serial, val int) engine=aria; insert into t1 values(1, 23); insert into t2 values(2, 42); -call mtr.add_suppression("WSREP: Replication of non-transactional engines is experimental. Storage engine Aria for table 'test'.'t2' is not supported in Galera"); + +call mtr.add_suppression("WSREP: Replication of non-transactional engines is experimental\\. Storage engine Aria for table 'test'\\.'t2' is not supported in Galera"); begin; update t1 set val=24 where id=1; diff --git a/mysql-test/suite/galera_3nodes/r/galera_garbd_backup.result b/mysql-test/suite/galera_3nodes/r/galera_garbd_backup.result index fdf3f5abde0..7d55b36ce0b 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_garbd_backup.result +++ b/mysql-test/suite/galera_3nodes/r/galera_garbd_backup.result @@ -1,7 +1,6 @@ connection node_2; connection node_1; connection node_1; -connection node_1; connection node_2; connection node_3; connection node_1; diff --git a/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result b/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result index f8fb9da6931..5fff759f14f 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result +++ b/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result @@ -57,7 +57,6 @@ Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci -CALL mtr.add_suppression("is inconsistent with group"); connection node_3; SHOW CREATE TABLE t1; Table Create Table @@ -80,4 +79,5 @@ CALL mtr.add_suppression("Native table .* has the wrong structure"); CALL mtr.add_suppression("Table 'mysql\\.gtid_slave_pos' doesn't exist"); connection node_2; # restart +CALL mtr.add_suppression("WSREP: .+ is inconsistent with group"); connection node_1; diff --git a/mysql-test/suite/galera_3nodes/t/galera_allowlist.cnf b/mysql-test/suite/galera_3nodes/t/galera_allowlist.cnf index 62f24c172af..21c412e3bb1 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_allowlist.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_allowlist.cnf @@ -7,7 +7,7 @@ wsrep_sst_method=rsync wsrep_allowlist="127.0.0.1,127.0.0.2,127.0.0.3" [mysqld.2] -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gmcast.listen_addr=127.0.0.2;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gmcast.listen_addr=127.0.0.2;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' # Variable is only used on bootstrap node, so this will be ignored wsrep_allowlist="127.0.0.1,127.0.0.2,127.0.0.3,127.0.0.4,127.0.0.5" @@ -18,9 +18,9 @@ wsrep_node_incoming_address=127.0.0.2:@mysqld.2.port wsrep_sst_receive_address='127.0.0.2:@mysqld.2.#sst_port' [mysqld.3] -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;gmcast.listen_addr=127.0.0.3;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.ignore_quorum=TRUE;pc.wait_prim=FALSE' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;gmcast.listen_addr=127.0.0.3;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.ignore_quorum=TRUE;pc.wait_prim=FALSE;gcache.size=10M' wsrep_node_address=127.0.0.3 wsrep_sst_receive_address=127.0.0.3:@mysqld.3.#sst_port wsrep_node_incoming_address=127.0.0.3:@mysqld.3.port -wsrep_sst_receive_address='127.0.0.3:@mysqld.3.#sst_port' \ No newline at end of file +wsrep_sst_receive_address='127.0.0.3:@mysqld.3.#sst_port' diff --git a/mysql-test/suite/galera_3nodes/t/galera_duplicate_primary_value.test b/mysql-test/suite/galera_3nodes/t/galera_duplicate_primary_value.test index 49ddb31d2d7..fe7f0b01607 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_duplicate_primary_value.test +++ b/mysql-test/suite/galera_3nodes/t/galera_duplicate_primary_value.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_debug.inc --source include/have_debug_sync.inc --source include/big_test.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.cnf b/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.cnf index 1457727270e..84500819cee 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.cnf @@ -5,12 +5,12 @@ wsrep_sst_method=rsync [mysqld.1] wsrep_node_name='node.1' -wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;socket.dynamic=true' +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;socket.dynamic=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] wsrep_node_name='node.2' -wsrep_provider_options='base_port=@mysqld.2.#galera_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.3] wsrep_node_name='node.3' -wsrep_provider_options='base_port=@mysqld.3.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;socket.dynamic=true' +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;socket.dynamic=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.test b/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.test index bdb6a9db55b..b4536762560 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.test +++ b/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.test @@ -14,7 +14,6 @@ --let $node_3 = node_3 --source ../galera/include/auto_increment_offset_save.inc - --connection node_1 --let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; --source include/wait_condition.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.test b/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.test index d1d8e643d8e..d9683083da1 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.test +++ b/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.test @@ -10,18 +10,16 @@ --source include/have_debug.inc --source include/have_debug_sync.inc ---connection node_1 -# Save original auto_increment_offset values. ---let $node_1=node_1 ---let $node_2=node_2 ---let $node_3=node_3 - --let $galera_connection_name = node_3 --let $galera_server_number = 3 --source include/galera_connect.inc --source suite/galera/include/galera_base_port.inc --let $NODE_GALERAPORT_3 = $_NODE_GALERAPORT +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 --source ../galera/include/auto_increment_offset_save.inc # Save galera ports diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test b/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test index 7020400e5ea..a8c1c1d6328 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test +++ b/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test @@ -17,7 +17,6 @@ call mtr.add_suppression("WSREP: gcs/src/gcs_core\\.cpp:core_handle_uuid_msg\\(\ --let $node_1 = node_1 --let $node_2 = node_2 --let $node_3 = node_3 - --source ../galera/include/auto_increment_offset_save.inc --connection node_1 diff --git a/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test index 71ca82be1d5..8c2f659aa26 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test +++ b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test @@ -14,7 +14,6 @@ --let $node_1 = node_1 --let $node_2 = node_2 --let $node_3 = node_3 - --source ../galera/include/auto_increment_offset_save.inc --connection node_1 diff --git a/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test b/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test index 6c7b255bdc3..a0837db3a4b 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test +++ b/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test @@ -69,7 +69,6 @@ SHOW CREATE TABLE t1; --connection node_2 SHOW CREATE TABLE t1; -CALL mtr.add_suppression("is inconsistent with group"); --connection node_3 SHOW CREATE TABLE t1; @@ -83,6 +82,7 @@ CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'PRIMARY'; check that col # restart node so we don't fail on WSREP_START_POSITION internal check --source include/restart_mysqld.inc --source include/wait_until_connected_again.inc +CALL mtr.add_suppression("WSREP: .+ is inconsistent with group"); --connection node_1 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; diff --git a/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test index d6e20d3bbfb..cde888b2621 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test +++ b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test @@ -9,6 +9,7 @@ --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connection node_1 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema_init.test b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema_init.test index 9b0b5599709..de639e54bf1 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema_init.test +++ b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema_init.test @@ -10,6 +10,7 @@ --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connection node_1 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/r/MDEV-26707.result b/mysql-test/suite/galera_3nodes_sr/r/MDEV-26707.result index 9addd29b0ea..b1c266dd605 100644 --- a/mysql-test/suite/galera_3nodes_sr/r/MDEV-26707.result +++ b/mysql-test/suite/galera_3nodes_sr/r/MDEV-26707.result @@ -2,7 +2,7 @@ connection node_2; connection node_1; connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; -connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; connect node_3a, 127.0.0.1, root, , test, $NODE_MYPORT_3; connection node_1; connection node_2; @@ -45,7 +45,7 @@ SET SESSION wsrep_sync_wait = 0; SET SESSION wsrep_sync_wait = DEFAULT; SET DEBUG_SYNC = 'now SIGNAL continue'; connection node_2; -ERROR HY000: Got error 6 "No such device or address" during COMMIT +ERROR HY000: Error while appending streaming replication fragment(provider status: Not connected to Primary Component) connection node_2a; SET DEBUG_SYNC = 'RESET'; connection node_1a; @@ -74,15 +74,15 @@ connection node_3a; SET SESSION wsrep_sync_wait = 0; SET SESSION wsrep_sync_wait = DEFAULT; connection node_1a; -SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; EXPECT_0 0 connection node_2a; -SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; EXPECT_0 0 connection node_3a; -SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; EXPECT_0 0 connection node_1; diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-817.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-817.test index a32da959429..73cb5624f0e 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/GCF-817.test +++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-817.test @@ -5,6 +5,7 @@ --source include/galera_cluster.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test index 700b3c38b6b..df446ebe541 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test +++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test @@ -7,6 +7,7 @@ --source include/force_restart.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/t/MDEV-26707.test b/mysql-test/suite/galera_3nodes_sr/t/MDEV-26707.test index a952b343d9f..86d31226979 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/MDEV-26707.test +++ b/mysql-test/suite/galera_3nodes_sr/t/MDEV-26707.test @@ -21,7 +21,7 @@ --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 ---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connect node_3a, 127.0.0.1, root, , test, $NODE_MYPORT_3 # Save original auto_increment_offset values. @@ -158,15 +158,15 @@ SET SESSION wsrep_sync_wait = DEFAULT; --connection node_1a --let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log --source include/wait_condition.inc -SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; --connection node_2a --let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log --source include/wait_condition.inc -SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; --connection node_3a --let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log --source include/wait_condition.inc -SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; --connection node_1 diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test index 18e1f0023c3..94f567d4c61 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test @@ -6,6 +6,7 @@ # Test the effect of gmcast.isolate on master during an SR transaction # --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_join_slave.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_join_slave.test index 95aa1a37a78..a8cb72c8e47 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_join_slave.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_join_slave.test @@ -9,6 +9,7 @@ --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connection node_1 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_master.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_master.test index c7e7528679b..cda2e335e4d 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_master.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_master.test @@ -6,6 +6,7 @@ --source include/have_innodb.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback.test index c0df6b2777a..a4d442ab5d8 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback.test @@ -9,6 +9,7 @@ --source include/have_innodb.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test index 4dba60ba79d..b32eafe5e9c 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test @@ -8,6 +8,7 @@ --source include/have_innodb.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test index b6355050836..47605772d13 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test @@ -9,6 +9,7 @@ --source include/force_restart.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.test index 62122fe4292..dfabd931485 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.test @@ -7,6 +7,7 @@ --source include/have_innodb.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_sr/disabled.def b/mysql-test/suite/galera_sr/disabled.def index 625f373ff1d..fcaf38a3d7b 100644 --- a/mysql-test/suite/galera_sr/disabled.def +++ b/mysql-test/suite/galera_sr/disabled.def @@ -9,5 +9,3 @@ # Do not use any TAB characters for whitespace. # ############################################################################## -# Links to below failures in MDEV-30172 -MDEV-25718 : timeout related to wsrep_sync_wait and DEBUG_SYNC diff --git a/mysql-test/suite/galera_sr/r/galera_sr_kill_all_norecovery.result b/mysql-test/suite/galera_sr/r/galera_sr_kill_all_norecovery.result index 7ef86c65915..963ed9507ab 100644 --- a/mysql-test/suite/galera_sr/r/galera_sr_kill_all_norecovery.result +++ b/mysql-test/suite/galera_sr/r/galera_sr_kill_all_norecovery.result @@ -2,6 +2,7 @@ connection node_2; connection node_1; connection node_1; connection node_2; +connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; SET SESSION wsrep_trx_fragment_size = 1; SET AUTOCOMMIT=OFF; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_myisam.result b/mysql-test/suite/galera_sr/r/galera_sr_myisam.result index 5f899f528cb..6ef3d1c485e 100644 --- a/mysql-test/suite/galera_sr/r/galera_sr_myisam.result +++ b/mysql-test/suite/galera_sr/r/galera_sr_myisam.result @@ -14,3 +14,4 @@ LENGTH(f1) = 65535 1 DROP TABLE t1; connection node_1; +SET GLOBAL wsrep_mode = DEFAULT; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test index f6f50fd50c9..6486ae419d0 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test +++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test @@ -11,6 +11,8 @@ --let $node_2=node_2 --source ../../galera/include/auto_increment_offset_save.inc +--connection node_1 + CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; SET SESSION wsrep_trx_fragment_size = 1; SET AUTOCOMMIT=OFF; @@ -26,7 +28,6 @@ INSERT INTO t1 VALUES (5); --let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; --source include/wait_condition.inc - # # Kill the entire cluster and restart # diff --git a/mysql-test/suite/galera_sr/t/galera_sr_myisam.test b/mysql-test/suite/galera_sr/t/galera_sr_myisam.test index ce9990ffd35..a8af84449aa 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_myisam.test +++ b/mysql-test/suite/galera_sr/t/galera_sr_myisam.test @@ -22,6 +22,4 @@ SELECT LENGTH(f1) = 65535 FROM t1; DROP TABLE t1; --connection node_1 ---disable_query_log SET GLOBAL wsrep_mode = DEFAULT; ---enable_query_log diff --git a/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test b/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test index 035ef873700..cad7a0d3a1e 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test +++ b/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test @@ -8,6 +8,7 @@ --let $node_1=node_1 --let $node_2=node_2 --source ../galera/include/auto_increment_offset_save.inc + --connection node_2 call mtr.add_suppression("WSREP: Failed to scan the last segment to the end\\. Last events may be missing\\. Last recovered event: "); diff --git a/mysql-test/suite/wsrep/README b/mysql-test/suite/wsrep/README index 988096071a4..143f3c96887 100644 --- a/mysql-test/suite/wsrep/README +++ b/mysql-test/suite/wsrep/README @@ -4,4 +4,3 @@ * As these tests are specific to wsrep-related functionalities, they must skip on server built without wsrep patch (vanilla). (-DWITH_WSREP=OFF) See : include/have_wsrep.inc, include/have_wsrep_enabled.inc, not_wsrep.inc - diff --git a/mysql-test/suite/wsrep/include/check_galera_version.inc b/mysql-test/suite/wsrep/include/check_galera_version.inc index 40cd157ca80..11cd02f6472 100644 --- a/mysql-test/suite/wsrep/include/check_galera_version.inc +++ b/mysql-test/suite/wsrep/include/check_galera_version.inc @@ -44,4 +44,3 @@ if (!`SELECT (@ACTUAL_GALERA_MINOR_VERSION > @GALERA_MINOR_VERSION) OR } --echo # Correct Galera library found - diff --git a/mysql-test/suite/wsrep/r/wsrep-recover-v25,binlogon.rdiff b/mysql-test/suite/wsrep/r/wsrep-recover-v25,binlogon.rdiff index 5fc091c7752..c6b231bc558 100644 --- a/mysql-test/suite/wsrep/r/wsrep-recover-v25,binlogon.rdiff +++ b/mysql-test/suite/wsrep/r/wsrep-recover-v25,binlogon.rdiff @@ -1,5 +1,5 @@ --- r/wsrep-recover-v25.result -+++ r/wsrep-recover-v25.reject ++++ r/wsrep-recover-v25,binlogoin.reject @@ -12,4 +12,16 @@ SELECT VARIABLE_VALUE `expect 6` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'; expect 6 diff --git a/sql/handler.cc b/sql/handler.cc index 7e7a060f0ca..c13f10b1fe1 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -7725,7 +7725,10 @@ int handler::ha_write_row(const uchar *buf) }); #endif /* WITH_WSREP */ if ((error= ha_check_overlaps(NULL, buf))) + { + DEBUG_SYNC_C("ha_write_row_end"); DBUG_RETURN(error); + } /* NOTE: this != table->file is true in 3 cases: @@ -7746,6 +7749,7 @@ int handler::ha_write_row(const uchar *buf) if (table->next_number_field && buf == table->record[0]) if (int err= update_auto_increment()) error= err; + DEBUG_SYNC_C("ha_write_row_end"); DBUG_RETURN(error); } } @@ -7768,13 +7772,10 @@ int handler::ha_write_row(const uchar *buf) error= binlog_log_row(table, 0, buf, log_func); } #ifdef WITH_WSREP - if (WSREP_NNULL(ha_thd()) && table_share->tmp_table == NO_TMP_TABLE && - ht->flags & HTON_WSREP_REPLICATION && - !error && (error= wsrep_after_row(ha_thd()))) - { - DEBUG_SYNC_C("ha_write_row_end"); - DBUG_RETURN(error); - } + THD *thd= ha_thd(); + if (WSREP_NNULL(thd) && table_share->tmp_table == NO_TMP_TABLE && + ht->flags & HTON_WSREP_REPLICATION && !error) + error= wsrep_after_row(thd); #endif /* WITH_WSREP */ } diff --git a/sql/sp_head.cc b/sql/sp_head.cc index 603d32a338e..45503f060db 100644 --- a/sql/sp_head.cc +++ b/sql/sp_head.cc @@ -1531,7 +1531,7 @@ sp_head::execute(THD *thd, bool merge_da_on_success) thd->wsrep_cs().reset_error(); /* Reset also thd->killed if it has been set during BF abort. */ if (killed_mask_hard(thd->killed) == KILL_QUERY) - thd->killed= NOT_KILLED; + thd->reset_killed(); /* if failed transaction was not replayed, must return with error from here */ if (!must_replay) err_status = 1; } diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 64fbd36f0d6..00b30b58c03 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1,5 +1,5 @@ /* Copyright (c) 2008, 2024, Codership Oy - Copyright (c) 2020, 2024, MariaDB + Copyright (c) 2020, 2025, MariaDB 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 @@ -2521,25 +2521,22 @@ bool wsrep_should_replicate_ddl(THD* thd, const handlerton *hton) case DB_TYPE_MYISAM: if (wsrep_check_mode(WSREP_MODE_REPLICATE_MYISAM)) return true; - else - WSREP_DEBUG("wsrep OSU failed for %s", wsrep_thd_query(thd)); + break; + case DB_TYPE_ARIA: + if (wsrep_check_mode(WSREP_MODE_REPLICATE_ARIA)) + return true; break; case DB_TYPE_PARTITION_DB: /* In most cases this means we could not find out table->file->partition_ht() */ return true; break; - case DB_TYPE_ARIA: - if (wsrep_check_mode(WSREP_MODE_REPLICATE_ARIA)) - return true; - else - WSREP_DEBUG("wsrep OSU failed for %s", wsrep_thd_query(thd)); - break; default: - WSREP_DEBUG("wsrep OSU failed for %s", wsrep_thd_query(thd)); break; } + WSREP_DEBUG("wsrep OSU failed for %s", wsrep_thd_query(thd)); + /* wsrep_mode = STRICT_REPLICATION, treat as error */ my_error(ER_GALERA_REPLICATION_NOT_SUPPORTED, MYF(0)); push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, @@ -2554,15 +2551,14 @@ bool wsrep_should_replicate_ddl_iterate(THD* thd, const TABLE_LIST* table_list) { for (const TABLE_LIST* it= table_list; it; it= it->next_global) { - if (it->table && !it->table_function) + const TABLE* table= it->table; + if (table && !it->table_function) { /* If this is partitioned table we need to find out implementing storage engine handlerton. */ - const handlerton *ht= it->table->file->partition_ht() ? - it->table->file->partition_ht() : - it->table->s->db_type(); - + const handlerton *ht= table->file->partition_ht(); + if (!ht) ht= table->s->db_type(); if (!wsrep_should_replicate_ddl(thd, ht)) return false; } @@ -2814,7 +2810,6 @@ fail: unireg_abort(1); } - /* returns: 0: statement was replicated as TOI @@ -3252,19 +3247,20 @@ void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx, const MDL_key *key) { THD *request_thd= requestor_ctx->get_thd(); - THD *granted_thd= ticket->get_ctx()->get_thd(); /* Fallback to the non-wsrep behaviour */ if (!WSREP(request_thd)) return; - const char* schema= key->db_name(); - int schema_len= key->db_name_length(); - mysql_mutex_lock(&request_thd->LOCK_thd_data); if (wsrep_thd_is_toi(request_thd) || wsrep_thd_is_applying(request_thd)) { + THD *granted_thd= ticket->get_ctx()->get_thd(); + + const char* schema= key->db_name(); + int schema_len= key->db_name_length(); + WSREP_DEBUG("wsrep_handle_mdl_conflict request TOI/APPLY for %s", wsrep_thd_query(request_thd)); THD_STAGE_INFO(request_thd, stage_waiting_isolation); @@ -3284,7 +3280,6 @@ void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx, /* Here we will call wsrep_abort_transaction so we should hold THD::LOCK_thd_data to protect victim from concurrent usage and THD::LOCK_thd_kill to protect from disconnect or delete. - */ mysql_mutex_lock(&granted_thd->LOCK_thd_kill); mysql_mutex_lock(&granted_thd->LOCK_thd_data); diff --git a/sql/wsrep_server_service.cc b/sql/wsrep_server_service.cc index 08ed9bd366f..e0fffa84457 100644 --- a/sql/wsrep_server_service.cc +++ b/sql/wsrep_server_service.cc @@ -192,6 +192,7 @@ void Wsrep_server_service::log_message(enum wsrep::log::level level, break; case wsrep::log::unknown: WSREP_UNKNOWN("%s", message); + assert(0); break; } } diff --git a/sql/wsrep_thd.h b/sql/wsrep_thd.h index bf5baf9ac7d..2fe3e123cea 100644 --- a/sql/wsrep_thd.h +++ b/sql/wsrep_thd.h @@ -237,25 +237,13 @@ static inline void wsrep_override_error(THD* thd, wsrep::client_error ce, enum wsrep::provider::status status) { - DBUG_ASSERT(ce != wsrep::e_success); - switch (ce) - { - case wsrep::e_error_during_commit: - if (status == wsrep::provider::error_size_exceeded) - wsrep_override_error(thd, ER_UNKNOWN_ERROR, "Maximum writeset size exceeded"); - else - wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, 0, status); - break; - case wsrep::e_deadlock_error: - wsrep_override_error(thd, ER_LOCK_DEADLOCK); - break; - case wsrep::e_interrupted_error: - wsrep_override_error(thd, ER_QUERY_INTERRUPTED); - break; - case wsrep::e_size_exceeded_error: + DBUG_ASSERT(ce != wsrep::e_success); + switch (ce) + { + case wsrep::e_error_during_commit: + if (status == wsrep::provider::error_size_exceeded) wsrep_override_error(thd, ER_UNKNOWN_ERROR, "Maximum writeset size exceeded"); - break; - case wsrep::e_append_fragment_error: + else /* TODO: Figure out better error number */ if (status) wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, @@ -265,17 +253,45 @@ static inline void wsrep_override_error(THD* thd, else wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, "Error while appending streaming replication fragment"); - break; - case wsrep::e_not_supported_error: - wsrep_override_error(thd, ER_NOT_SUPPORTED_YET); - break; - case wsrep::e_timeout_error: - wsrep_override_error(thd, ER_LOCK_WAIT_TIMEOUT); + break; + case wsrep::e_deadlock_error: + switch (thd->lex->sql_command) + { + case SQLCOM_XA_END: + case SQLCOM_XA_PREPARE: + wsrep_override_error(thd, ER_XA_RBDEADLOCK); break; default: - wsrep_override_error(thd, ER_UNKNOWN_ERROR); + wsrep_override_error(thd, ER_LOCK_DEADLOCK); break; } + break; + case wsrep::e_interrupted_error: + wsrep_override_error(thd, ER_QUERY_INTERRUPTED); + break; + case wsrep::e_size_exceeded_error: + wsrep_override_error(thd, ER_UNKNOWN_ERROR, "Maximum writeset size exceeded"); + break; + case wsrep::e_append_fragment_error: + /* TODO: Figure out better error number */ + if (status) + wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, + "Error while appending streaming replication fragment" + "(provider status: %s)", + wsrep::provider::to_string(status).c_str()); + else + wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, + "Error while appending streaming replication fragment"); + break; + case wsrep::e_not_supported_error: + wsrep_override_error(thd, ER_NOT_SUPPORTED_YET); + break; + case wsrep::e_timeout_error: + wsrep_override_error(thd, ER_LOCK_WAIT_TIMEOUT); + break; + default: + wsrep_override_error(thd, ER_UNKNOWN_ERROR); + } } /** From 1b9d5cdb83f235f313ae19bab1c6978837a566d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 28 Mar 2025 08:38:04 +0200 Subject: [PATCH 101/134] MDEV-35813: Valgrind test fixup log_checkpoint(): In cmake -DWITH_VALGRIND=ON builds, let us wait for all outstanding writes to complete, in order to avoid an unexpectedly large number of innodb_log_writes in the test innodb.page_cleaner. --- storage/innobase/buf/buf0flu.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index f62d9dc0f3c..edeb210f6f7 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -1879,6 +1879,14 @@ static bool log_checkpoint() noexcept if (recv_recovery_is_on()) recv_sys.apply(true); +#if defined HAVE_valgrind && !__has_feature(memory_sanitizer) + /* The built-in scheduler in Valgrind may neglect some threads for a + long time. Under Valgrind, let us explicitly wait for page write + completion in order to avoid a result difference in the test + innodb.page_cleaner. */ + os_aio_wait_until_no_pending_writes(false); +#endif + switch (srv_file_flush_method) { case SRV_NOSYNC: case SRV_O_DIRECT_NO_FSYNC: From 31c06951c61fc3f9c5356c39088231f89e209b78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 28 Mar 2025 09:05:20 +0200 Subject: [PATCH 102/134] MDEV-36420 Assertion failure in SET GLOBAL innodb_ft_aux_table innodb_ft_aux_table_validate(): If the table is found in InnoDB but not valid for the parameter, only invoke dict_sys.unlock() once. This fixes a regression due to MDEV-36122. --- mysql-test/suite/innodb_fts/r/innodb_ft_aux_table.result | 9 +++++++++ mysql-test/suite/innodb_fts/t/innodb_ft_aux_table.test | 9 +++++++++ storage/innobase/handler/ha_innodb.cc | 3 ++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/innodb_fts/r/innodb_ft_aux_table.result b/mysql-test/suite/innodb_fts/r/innodb_ft_aux_table.result index a1ffb0a5d09..34416dff883 100644 --- a/mysql-test/suite/innodb_fts/r/innodb_ft_aux_table.result +++ b/mysql-test/suite/innodb_fts/r/innodb_ft_aux_table.result @@ -118,4 +118,13 @@ KEY VALUE SELECT @@GLOBAL.innodb_ft_aux_table; @@GLOBAL.innodb_ft_aux_table test/t1 +CREATE TABLE t(a INT) ENGINE=InnoDB; +SET GLOBAL innodb_ft_aux_table='test/t'; +ERROR 42000: Variable 'innodb_ft_aux_table' can't be set to the value of 'test/t' +DROP TABLE t; +SET GLOBAL innodb_ft_aux_table='test/t'; +ERROR 42000: Variable 'innodb_ft_aux_table' can't be set to the value of 'test/t' +SELECT @@GLOBAL.innodb_ft_aux_table; +@@GLOBAL.innodb_ft_aux_table +test/t1 SET GLOBAL innodb_ft_aux_table = @save_ft_aux_table; diff --git a/mysql-test/suite/innodb_fts/t/innodb_ft_aux_table.test b/mysql-test/suite/innodb_fts/t/innodb_ft_aux_table.test index f9447aada60..2c0972083c9 100644 --- a/mysql-test/suite/innodb_fts/t/innodb_ft_aux_table.test +++ b/mysql-test/suite/innodb_fts/t/innodb_ft_aux_table.test @@ -41,4 +41,13 @@ SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHE; SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_INDEX_TABLE; SELECT * FROM INFORMATION_SCHEMA.INNODB_FT_CONFIG; SELECT @@GLOBAL.innodb_ft_aux_table; + +CREATE TABLE t(a INT) ENGINE=InnoDB; +--error ER_WRONG_VALUE_FOR_VAR +SET GLOBAL innodb_ft_aux_table='test/t'; +DROP TABLE t; +--error ER_WRONG_VALUE_FOR_VAR +SET GLOBAL innodb_ft_aux_table='test/t'; +SELECT @@GLOBAL.innodb_ft_aux_table; + SET GLOBAL innodb_ft_aux_table = @save_ft_aux_table; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index fdfd0cb395d..d9919c5ed77 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -17541,8 +17541,9 @@ static int innodb_ft_aux_table_validate(THD *thd, st_mysql_sys_var*, *static_cast(save) = table_name; return 0; } + } else { + dict_sys.unlock(); } - dict_sys.unlock(); return 1; } else { *static_cast(save) = NULL; From 8010a4128dea3955724f60031d564077285d2138 Mon Sep 17 00:00:00 2001 From: Kristian Nielsen Date: Fri, 28 Mar 2025 19:20:16 +0100 Subject: [PATCH 103/134] MDEV-36424: binlog_encryption.encrypted_master_switch_to_unencrypted_gtid Fails in BB 11.4+ The test case was missing a wait for the SQL thread to complete its work before checking the value of @@GLOBAL.gtid_slave_pos. Signed-off-by: Kristian Nielsen --- .../encrypted_master_switch_to_unencrypted_gtid.result | 3 +++ .../encrypted_master_switch_to_unencrypted_gtid.test | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.result b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.result index d05e3abd068..be7c9b819ff 100644 --- a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.result +++ b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.result @@ -59,6 +59,9 @@ INSERT INTO table3_no_encryption SELECT NULL,NOW(),b FROM table3_no_encryption; connection server_2; start slave; include/wait_for_slave_io_error.inc [errno=1236] +SELECT MASTER_GTID_WAIT("LAST_UNENCRYPTED_GTID", 60); +MASTER_GTID_WAIT("LAST_UNENCRYPTED_GTID", 60) +0 # Ensuring slave was unable to replicate any encrypted transactions.. # ..success SHOW TABLES; diff --git a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.test b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.test index 7f717190cbf..f95262d99b2 100644 --- a/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.test +++ b/mysql-test/suite/binlog_encryption/encrypted_master_switch_to_unencrypted_gtid.test @@ -122,6 +122,13 @@ start slave; --let $slave_io_errno= 1236 --source include/wait_for_slave_io_error.inc +# Wait for the SQL thread to have replicated to the expected point. Otherwise +# there is a race where the IO thread can stop with error and the test case +# check the @@GLOBAL.gtid_slave_pos before the SQL thread has had time to +# replicate the events queued by the IO thread (MDEV-36424). +--replace_result "$last_unencrypted_gtid" "LAST_UNENCRYPTED_GTID" +eval SELECT MASTER_GTID_WAIT("$last_unencrypted_gtid", 60); + --echo # Ensuring slave was unable to replicate any encrypted transactions.. --let $gsp= `SELECT @@global.gtid_slave_pos` if (`SELECT strcmp("$gsp","$last_unencrypted_gtid")`) From f56099a95db822d85ee17c114b8b7602a151f760 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Sat, 29 Mar 2025 10:14:56 +0200 Subject: [PATCH 104/134] Fix some tests mainly on Valgrind --- mysql-test/suite/innodb/r/undo_leak_fail.result | 2 +- mysql-test/suite/innodb/t/sys_truncate_debug.test | 2 ++ mysql-test/suite/innodb/t/sys_truncate_shutdown_debug.test | 2 ++ mysql-test/suite/innodb/t/temp_truncate_freed.test | 2 ++ mysql-test/suite/innodb/t/undo_leak_fail.test | 2 +- 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/innodb/r/undo_leak_fail.result b/mysql-test/suite/innodb/r/undo_leak_fail.result index 6aa89ec7d3d..83b976f785c 100644 --- a/mysql-test/suite/innodb/r/undo_leak_fail.result +++ b/mysql-test/suite/innodb/r/undo_leak_fail.result @@ -43,7 +43,7 @@ NAME FILE_SIZE innodb_system 77594624 # restart: --debug_dbug=d,unused_undo_free_fail_1 # Fail to free the segment due to previous shutdown -FOUND 4 /InnoDB: Cannot free the unused segments in system tablespace because a previous shutdown was not with innodb_fast_shutdown=0/ in mysqld.1.err +FOUND 1 /InnoDB: Cannot free the unused segments in system tablespace because a previous shutdown was not with innodb_fast_shutdown=0.*/ in mysqld.1.err SELECT NAME, FILE_SIZE FROM information_schema.innodb_sys_tablespaces WHERE SPACE = 0; NAME FILE_SIZE innodb_system 15728640 diff --git a/mysql-test/suite/innodb/t/sys_truncate_debug.test b/mysql-test/suite/innodb/t/sys_truncate_debug.test index 20fa981685d..be70ea743e9 100644 --- a/mysql-test/suite/innodb/t/sys_truncate_debug.test +++ b/mysql-test/suite/innodb/t/sys_truncate_debug.test @@ -3,6 +3,8 @@ --source include/not_embedded.inc --source include/have_debug.inc --source include/not_windows.inc +# This test is extremely slow on Valgrind (exceeding 4 hours). +--source include/not_valgrind.inc call mtr.add_suppression("InnoDB: Cannot shrink the system tablespace"); call mtr.add_suppression("InnoDB: Plugin initialization aborted"); diff --git a/mysql-test/suite/innodb/t/sys_truncate_shutdown_debug.test b/mysql-test/suite/innodb/t/sys_truncate_shutdown_debug.test index 8e8c91e7b47..d819ebe42ee 100644 --- a/mysql-test/suite/innodb/t/sys_truncate_shutdown_debug.test +++ b/mysql-test/suite/innodb/t/sys_truncate_shutdown_debug.test @@ -2,6 +2,8 @@ --source include/have_sequence.inc --source include/not_embedded.inc --source include/have_debug.inc +# This test is extremely slow on Valgrind (exceeding 4 hours). +--source include/not_valgrind.inc call mtr.add_suppression("InnoDB: Cannot shrink the system tablespace"); call mtr.add_suppression("InnoDB: Plugin initialization aborted"); diff --git a/mysql-test/suite/innodb/t/temp_truncate_freed.test b/mysql-test/suite/innodb/t/temp_truncate_freed.test index 1ab054331d6..fc321c30d74 100644 --- a/mysql-test/suite/innodb/t/temp_truncate_freed.test +++ b/mysql-test/suite/innodb/t/temp_truncate_freed.test @@ -14,4 +14,6 @@ SET GLOBAL innodb_truncate_temporary_tablespace_now=1; SET GLOBAL innodb_buffer_pool_size=10485760; set global innodb_immediate_scrub_data_uncompressed = @old_immediate_scrub_data_val; +# this may occasionally be aborted on a heavily loaded builder +--error 0,ER_WRONG_USAGE set global innodb_buffer_pool_size = @old_innodb_buffer_pool_size; diff --git a/mysql-test/suite/innodb/t/undo_leak_fail.test b/mysql-test/suite/innodb/t/undo_leak_fail.test index 0346293eda2..30ca437025d 100644 --- a/mysql-test/suite/innodb/t/undo_leak_fail.test +++ b/mysql-test/suite/innodb/t/undo_leak_fail.test @@ -49,7 +49,7 @@ let $restart_parameters=--debug_dbug=d,unused_undo_free_fail_1; let $shutdown_timeout=; --echo # Fail to free the segment due to previous shutdown ---let SEARCH_PATTERN= InnoDB: Cannot free the unused segments in system tablespace because a previous shutdown was not with innodb_fast_shutdown=0 +--let SEARCH_PATTERN= InnoDB: Cannot free the unused segments in system tablespace because a previous shutdown was not with innodb_fast_shutdown=0.* let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; --source include/search_pattern_in_file.inc From 30140c066d50f7e4ac4f490a9e081d9d605aea07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Sat, 29 Mar 2025 12:17:47 +0200 Subject: [PATCH 105/134] MDEV-32148 fixup: replace timestamp on Windows --- mysql-test/suite/versioning/t/derived.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/suite/versioning/t/derived.test b/mysql-test/suite/versioning/t/derived.test index f599ede97c1..dec5b6fa9f6 100644 --- a/mysql-test/suite/versioning/t/derived.test +++ b/mysql-test/suite/versioning/t/derived.test @@ -1,6 +1,6 @@ --source include/default_optimizer_switch.inc ---let $replace_regex_tsltz6= /TIMESTAMP..WITH LOCAL TIME ZONE..'....-..-.. ..:..:..[.]......'/TIMESTAMP\/*WITH LOCAL TIME ZONE*\/'YYYY-MM-DD hh:ss:mm:.uuuuuu'/ +--let $replace_regex_tsltz6= /(TIMESTAMP..WITH LOCAL TIME ZONE..'....-..-.. ..:..:..[.]......'|\(current_timestamp\(6\)\))/TIMESTAMP\/*WITH LOCAL TIME ZONE*\/'YYYY-MM-DD hh:ss:mm:.uuuuuu'/ create table emp ( From 402595f138db92a3bf7e67f30e24f682e6c3ca82 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 31 Mar 2025 11:10:12 +0200 Subject: [PATCH 106/134] fix main.timezone test for DST --- mysql-test/main/timezone.result | 1 - mysql-test/main/timezone.test | 7 +------ 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/mysql-test/main/timezone.result b/mysql-test/main/timezone.result index 67252038e72..3c3df8755c3 100644 --- a/mysql-test/main/timezone.result +++ b/mysql-test/main/timezone.result @@ -1,4 +1,3 @@ -DROP TABLE IF EXISTS t1; show variables like "system_time_zone"; Variable_name Value system_time_zone CET diff --git a/mysql-test/main/timezone.test b/mysql-test/main/timezone.test index cdc538540ba..91b4c83033e 100644 --- a/mysql-test/main/timezone.test +++ b/mysql-test/main/timezone.test @@ -7,13 +7,8 @@ disable_query_log; select FROM_UNIXTIME(24*3600); enable_query_log; -# Initialization ---disable_warnings -DROP TABLE IF EXISTS t1; ---enable_warnings - # The following is because of daylight saving time ---replace_result MEST CET MET CET +--replace_result MEST CET MET CET CEST CET show variables like "system_time_zone"; # From da9d575516e978e7df6a5bd16343f6ee33ee1a6e Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 21 Mar 2025 19:31:47 +0100 Subject: [PATCH 107/134] MDEV-35653 Assertion `commit_trx' failed in int innobase_commit(handlerton*, THD*, bool) cherry-pick adc1beb8680f from 11.7 --- storage/innobase/handler/ha_innodb.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index d9919c5ed77..6dc1b6cdc1f 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -4653,10 +4653,9 @@ innobase_commit( ut_ad("invalid state" == 0); /* fall through */ case TRX_STATE_PREPARED: - ut_ad(commit_trx || trx->is_wsrep()); - ut_ad(thd_test_options(thd, OPTION_NOT_AUTOCOMMIT - | OPTION_BEGIN) - || trx->is_wsrep()); + ut_ad(commit_trx || + !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT + | OPTION_BEGIN)); /* fall through */ case TRX_STATE_ACTIVE: /* Transaction is deregistered only in a commit or a From 0b37c2e7a8d62d1879b91c8eadf72329f9afbdd7 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 14 Feb 2025 14:58:31 +0100 Subject: [PATCH 108/134] MDEV-36084 mariadb-hotcopy requires '--port' set for operation since 10.11 --- scripts/mysqlhotcopy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/mysqlhotcopy.sh b/scripts/mysqlhotcopy.sh index d0821e663c4..601866c40c7 100644 --- a/scripts/mysqlhotcopy.sh +++ b/scripts/mysqlhotcopy.sh @@ -208,7 +208,7 @@ if ($opt{socket} and -S $opt{socket}) else { $dsn .= "host=" . $opt{host}; - if ($opt{host} ne "localhost") + if ($opt{host} ne "localhost" and $opt{port}) { $dsn .= ";port=". $opt{port}; } From 56b19ac03012be0d2dd0b612fcbeb13ef6fc5220 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 22 Mar 2025 21:40:06 +0100 Subject: [PATCH 109/134] MDEV-35953 mysql_stmt_errno() returns 0 after an error in mysql_stmt_execute() The goal of the fix for MDEV-34718 was to avoid Diagnostics_area::reset_diagnostics_area() changing DA_OK_BULK to DA_EMPTY for bulk operations. But it was too indiscriminative and also didn't reset DA_ERROR if the bulk operation was in progress. This was leaving Diagnostics_area in the inconsistent state: the status was DA_ERROR, but sql_errno was 0. Fix it to reset the DA_ERROR status as reset_diagnostics_area() is supposed to do. --- sql/sql_error.cc | 22 ++++++++--------- tests/mysql_client_test.c | 51 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 12 deletions(-) diff --git a/sql/sql_error.cc b/sql/sql_error.cc index 6a47e4b9cac..a9edbac9fd6 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -318,18 +318,16 @@ Diagnostics_area::reset_diagnostics_area() #endif get_warning_info()->clear_error_condition(); set_is_sent(false); - /** Tiny reset in debug mode to see garbage right away */ - if (!is_bulk_op()) - /* - For BULK DML operations (e.g. UPDATE) the data member m_status - has the value DA_OK_BULK. Keep this value in order to handle - m_affected_rows, m_statement_warn_count in correct way. Else, - the number of rows and the number of warnings affected by - the last statement executed as part of a trigger fired by the dml - (e.g. UPDATE statement fires a trigger on AFTER UPDATE) would counts - rows modified by trigger's statement. - */ - m_status= DA_EMPTY; + /* + For BULK DML operations (e.g. UPDATE) the data member m_status + has the value DA_OK_BULK. Keep this value in order to handle + m_affected_rows, m_statement_warn_count in correct way. Else, + the number of rows and the number of warnings affected by + the last statement executed as part of a trigger fired by the dml + (e.g. UPDATE statement fires a trigger on AFTER UPDATE) would counts + rows modified by trigger's statement. + */ + m_status= is_bulk_op() ? DA_OK_BULK : DA_EMPTY; DBUG_VOID_RETURN; } diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 5e8ec0701ff..a8c163eff2a 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -22886,8 +22886,58 @@ void test_mdev_10075() DIE_UNLESS(rc == 1); mysql_free_result(result); + mysql_query(mysql, "drop table t1"); } + +static void test_mdev35953() +{ +#ifndef EMBEDDED_LIBRARY + int rc; + MYSQL_STMT *stmt; + MYSQL_BIND bind[1]; + int vals[]= {1, 2}, count= array_elements(vals); + MYSQL *con= mysql_client_init(NULL); + DIE_UNLESS(con); + if (!mysql_real_connect(con, opt_host, opt_user, opt_password, current_db, + opt_port, opt_unix_socket, 0)) + { + fprintf(stderr, "Failed to connect to database: Error: %s\n", + mysql_error(con)); + exit(1); + } + rc= mysql_query(mysql, "create table t1 (a int)"); + myquery(rc); + + stmt= mysql_stmt_init(con); + rc= mysql_stmt_prepare(stmt, "insert into t1 (a) values (?)", -1); + check_execute(stmt, rc); + + memset(bind, 0, sizeof(bind)); + bind[0].buffer_type = MYSQL_TYPE_LONG; + bind[0].buffer = vals; + + mysql_stmt_attr_set(stmt, STMT_ATTR_ARRAY_SIZE, &count); + rc= mysql_stmt_bind_param(stmt, bind); + check_execute(stmt, rc); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + rc= mysql_query(mysql, "alter table t1 add xx int"); + myquery(rc); + + rc= mysql_stmt_execute(stmt); + check_execute(stmt, rc); + + mysql_stmt_close(stmt); + mysql_close(con); + + mysql_query(mysql, "drop table t1"); +#endif +} + + static struct my_tests_st my_tests[]= { { "test_mdev_20516", test_mdev_20516 }, { "test_mdev24827", test_mdev24827 }, @@ -23206,6 +23256,7 @@ static struct my_tests_st my_tests[]= { { "test_mdev_34958", test_mdev_34958 }, #endif { "test_mdev_10075", test_mdev_10075}, + { "test_mdev35953", test_mdev35953 }, { 0, 0 } }; From 8896de2baa953600bea9762ae54ecf06d3c72545 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 24 Mar 2025 20:21:45 +0100 Subject: [PATCH 110/134] MDEV-35746 support fmtlib-11.1.0 in 11.1.0 fmtlib removed support for FMT_STATIC_THOUSANDS_SEPARATOR https://github.com/fmtlib/fmt/commit/b3ccc2d210 to keep :L format working we need to use a proper std::locate now. use a custom our own locale which is the same as the default "C" one but uses comma as a thousand separator. Because any named locale, like "en_US.UTF-8" is not guaranteed to exist on the target system. Let's create a locale statically, this means there's no overhead for SFORMAT calls unless {:L} is used. For {:L} there's ~20% slowdown. --- cmake/libfmt.cmake | 5 ++--- sql/item_strfunc.cc | 10 ++++++++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cmake/libfmt.cmake b/cmake/libfmt.cmake index a9dc6937b86..7fded49b916 100644 --- a/cmake/libfmt.cmake +++ b/cmake/libfmt.cmake @@ -28,15 +28,14 @@ MACRO (CHECK_LIBFMT) IF(WITH_LIBFMT STREQUAL "system" OR WITH_LIBFMT STREQUAL "auto") SET(CMAKE_REQUIRED_INCLUDES ${LIBFMT_INCLUDE_DIR}) CHECK_CXX_SOURCE_RUNS( - "#define FMT_STATIC_THOUSANDS_SEPARATOR ',' - #define FMT_HEADER_ONLY 1 + "#define FMT_HEADER_ONLY 1 #include int main() { using ArgStore= fmt::dynamic_format_arg_store; ArgStore arg_store; int answer= 4321; arg_store.push_back(answer); - return fmt::vformat(\"{:L}\", arg_store).compare(\"4,321\"); + return fmt::vformat(\"{}\", arg_store).compare(\"4321\"); }" HAVE_SYSTEM_LIBFMT) SET(CMAKE_REQUIRED_INCLUDES) ENDIF() diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 04f471f9a5f..bea950d3cdf 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -56,7 +56,6 @@ C_MODE_END #include "sql_statistics.h" /* fmtlib include (https://fmt.dev/). */ -#define FMT_STATIC_THOUSANDS_SEPARATOR ',' #define FMT_HEADER_ONLY 1 #include "fmt/args.h" @@ -1403,6 +1402,13 @@ namespace fmt { }; }; +struct fmt_locale_comma : std::numpunct +{ + char do_thousands_sep() const override { return ','; } + std::string do_grouping() const override { return "\3"; } +}; +static std::locale fmt_locale(std::locale(), new fmt_locale_comma); + /* SFORMAT(format_string, ...) This function receives a formatting specification string and N parameters @@ -1455,7 +1461,7 @@ String *Item_func_sformat::val_str(String *res) /* Create the string output */ try { - auto text = fmt::vformat(fmt_arg->c_ptr_safe(), arg_store); + auto text = fmt::vformat(fmt_locale, fmt_arg->c_ptr_safe(), arg_store); res->length(0); res->set_charset(collation.collation); res->append(text.c_str(), text.size(), fmt_arg->charset()); From 8363d05f4df8b5c78723be0341f9229c52f14d0b Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 25 Mar 2025 18:49:03 +0100 Subject: [PATCH 111/134] Fix Windows build to use dynamic DLL runtime (MD) by default This change partially reverts commit b60aee58c7fda4c062f Previously, we compiled with the flags: /MT /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib, which resulted in a non-standard setup where the Universal C Runtime (UCRT) was dynamically linked, but the compiler runtime was statically linked. Goal was to reduce runtime dependency, while still using dynamic CRT However, now now causes subtle static initialization issues (and also some problems with MSVC ASAN) To fix, we now use standard /MD, so both C runtime and compiler runtime dynamically linked. MSVC redistributable DLL (vcruntime140.dll) is required on the system, similar to version 10.4. Our packaging, both zip and MSI, is already prepared for it. --- cmake/os/Windows.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index ac8779f3ad8..dfa90a4afea 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -121,7 +121,7 @@ IF(MSVC) # Disable mingw based pkg-config found in Strawberry perl SET(PKG_CONFIG_EXECUTABLE 0 CACHE INTERNAL "") - SET(MSVC_CRT_TYPE /MT CACHE STRING + SET(MSVC_CRT_TYPE /MD CACHE STRING "Runtime library - specify runtime library for linking (/MT,/MTd,/MD,/MDd)" ) SET(VALID_CRT_TYPES /MTd /MDd /MD /MT) From 77bebe9eb08035cf2ea8796c80b66cfa85fcf5d5 Mon Sep 17 00:00:00 2001 From: mariadb-DebarunBanerjee Date: Mon, 10 Mar 2025 12:39:56 +0530 Subject: [PATCH 112/134] MDEV-36226 Stall and crash when page cleaner fails to generate free pages during Async flush MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit During regular iteration the page cleaner does flush from flush list with some flush target and then goes for generating free pages from LRU tail. When asynchronous flush is triggered i.e. when 7/8 th of the LSN margin is filled in the redo log, the flush target for flush list is set to innodb_io_capacity_max. If it could flush all, the flush bandwidth for LRU flush is currently set to zero. If the LRU tail has dirty pages, page cleaner ends up freeing no pages in one iteration. The scenario could repeat across multiple iterations till async flush target is reached. During this time the DB system is starved of free pages resulting in apparent stall and in some cases dict_sys latch fatal error. Fix: In page cleaner iteration, before LRU flush, ensure we provide enough flush limit so that freeing pages is no blocked by dirty pages in LRU tail. Log IO and flush state if double write flush wait is long. Reviewed by: Marko Mäkelä --- mysql-test/mariadb-test-run.pl | 1 + storage/innobase/buf/buf0dblwr.cc | 53 +++++++++++++++++-- storage/innobase/buf/buf0flu.cc | 78 ++++++++++++++++++++++++++-- storage/innobase/dict/dict0dict.cc | 4 ++ storage/innobase/include/buf0buf.h | 3 ++ storage/innobase/include/buf0dblwr.h | 3 ++ storage/innobase/include/os0file.h | 2 + storage/innobase/os/os0file.cc | 6 +++ storage/innobase/srv/srv0srv.cc | 1 + 9 files changed, 143 insertions(+), 8 deletions(-) diff --git a/mysql-test/mariadb-test-run.pl b/mysql-test/mariadb-test-run.pl index a47be67a050..3694ed31c01 100755 --- a/mysql-test/mariadb-test-run.pl +++ b/mysql-test/mariadb-test-run.pl @@ -4464,6 +4464,7 @@ sub extract_warning_lines ($$) { qr/InnoDB: innodb_open_files .* should not be greater than/, qr/InnoDB: Trying to delete tablespace.*but there are.*pending/, qr/InnoDB: Tablespace 1[0-9]* was not found at .*, and innodb_force_recovery was set/, + qr/InnoDB: Long wait \([0-9]+ seconds\) for double-write buffer flush/, qr/Slave: Unknown table 't1' .* 1051/, qr/Slave SQL:.*(Internal MariaDB error code: [[:digit:]]+|Query:.*)/, qr/slave SQL thread aborted/, diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index b04460a020f..8cc44eb7972 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -603,20 +603,67 @@ static void buf_dblwr_check_block(const buf_page_t *bpage) noexcept } #endif /* UNIV_DEBUG */ +ATTRIBUTE_COLD void buf_dblwr_t::print_info() const noexcept +{ + mysql_mutex_assert_owner(&mutex); + const slot *flush_slot= active_slot == &slots[0] ? &slots[1] : &slots[0]; + + sql_print_information("InnoDB: Double Write State\n" + "-------------------\n" + "Batch running : %s\n" + "Active Slot - first_free: %zu reserved: %zu\n" + "Flush Slot - first_free: %zu reserved: %zu\n" + "-------------------", + (batch_running ? "true" : "false"), + active_slot->first_free, active_slot->reserved, + flush_slot->first_free, flush_slot->reserved); +} + bool buf_dblwr_t::flush_buffered_writes(const ulint size) noexcept { mysql_mutex_assert_owner(&mutex); ut_ad(size == block_size()); - for (;;) + const size_t max_count= 60 * 60; + const size_t first_log_count= 30; + const size_t fatal_threshold= + static_cast(srv_fatal_semaphore_wait_threshold); + size_t log_count= first_log_count; + + for (ulong count= 0;;) { if (!active_slot->first_free) return false; if (!batch_running) break; - my_cond_wait(&cond, &mutex.m_mutex); - } + timespec abstime; + set_timespec(abstime, 1); + my_cond_timedwait(&cond, &mutex.m_mutex, &abstime); + + if (count > fatal_threshold) + { + buf_pool.print_flush_info(); + print_info(); + ib::fatal() << "InnoDB: Long wait (" << count + << " seconds) for double-write buffer flush."; + } + else if (++count < first_log_count && !(count % 5)) + { + sql_print_information("InnoDB: Long wait (%zu seconds) for double-write" + " buffer flush.", count); + buf_pool.print_flush_info(); + print_info(); + } + else if (!(count % log_count)) + { + sql_print_warning("InnoDB: Long wait (%zu seconds) for double-write" + " buffer flush.", count); + buf_pool.print_flush_info(); + print_info(); + log_count= log_count >= max_count ? max_count : log_count * 2; + } + } ut_ad(active_slot->reserved == active_slot->first_free); ut_ad(!flushing_buffered_writes); diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index edeb210f6f7..71ee98b18be 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -1374,7 +1374,10 @@ static void buf_flush_LRU_list_batch(ulint max, flush_counters_t *n) noexcept break; } - if (neighbors && space->is_rotational()) + if (neighbors && space->is_rotational() && + /* Skip neighbourhood flush from LRU list if we haven't yet reached + half of the free page target. */ + UT_LIST_GET_LEN(buf_pool.free) * 2 >= free_limit) n->flushed+= buf_flush_try_neighbors(space, page_id, bpage, neighbors == 1, n->flushed, max); @@ -1763,8 +1766,16 @@ static ulint buf_flush_LRU(ulint max_n) noexcept buf_do_LRU_batch(max_n, &n); ulint pages= n.flushed; + ulint evicted= n.evicted; - if (n.evicted) + /* If we have exhausted flush quota, it is likely we exited before + generating enough free pages. Call once more with 0 flush to generate + free pages immediately as required. */ + if (pages >= max_n) + buf_do_LRU_batch(0, &n); + + evicted+= n.evicted; + if (evicted) { buf_pool.try_LRU_scan= true; pthread_cond_broadcast(&buf_pool.done_free); @@ -2339,6 +2350,11 @@ static void buf_flush_page_cleaner() noexcept DBUG_EXECUTE_IF("ib_page_cleaner_sleep", { std::this_thread::sleep_for(std::chrono::seconds(1)); + /* Cover the logging code in debug mode. */ + buf_pool.print_flush_info(); + buf_dblwr.lock(); + buf_dblwr.print_info(); + buf_dblwr.unlock(); }); lsn_limit= buf_flush_sync_lsn; @@ -2543,6 +2559,10 @@ static void buf_flush_page_cleaner() noexcept n= srv_max_io_capacity; n= n >= n_flushed ? n - n_flushed : 0; + /* It is critical to generate free pages to keep the system alive. Make + sure we are not hindered by dirty pages in LRU tail. */ + n= std::max(n, std::min(srv_max_io_capacity, + buf_pool.LRU_scan_depth)); goto LRU_flush; } @@ -2581,10 +2601,11 @@ ATTRIBUTE_COLD void buf_pool_t::LRU_warn() noexcept mysql_mutex_assert_owner(&mutex); try_LRU_scan= false; if (!LRU_warned.test_and_set(std::memory_order_acquire)) + { sql_print_warning("InnoDB: Could not free any blocks in the buffer pool!" - " %zu blocks are in use and %zu free." - " Consider increasing innodb_buffer_pool_size.", - UT_LIST_GET_LEN(LRU), UT_LIST_GET_LEN(free)); + " Consider increasing innodb_buffer_pool_size."); + buf_pool.print_flush_info(); + } } /** Initialize page_cleaner. */ @@ -2664,6 +2685,53 @@ void buf_flush_sync() noexcept thd_wait_end(nullptr); } +ATTRIBUTE_COLD void buf_pool_t::print_flush_info() const noexcept +{ + /* We do dirty read of UT_LIST count variable. */ + size_t lru_size= UT_LIST_GET_LEN(LRU); + size_t dirty_size= UT_LIST_GET_LEN(flush_list); + size_t free_size= UT_LIST_GET_LEN(free); + size_t dirty_pct= lru_size ? dirty_size * 100 / (lru_size + free_size) : 0; + sql_print_information("InnoDB: Buffer Pool pages\n" + "-------------------\n" + "LRU Pages : %zu\n" + "Free Pages : %zu\n" + "Dirty Pages: %zu : %zu%%\n" + "-------------------", + lru_size, free_size, dirty_size, dirty_pct); + + lsn_t lsn= log_sys.get_lsn(); + lsn_t clsn= log_sys.last_checkpoint_lsn; + sql_print_information("InnoDB: LSN flush parameters\n" + "-------------------\n" + "System LSN : %" PRIu64 "\n" + "Checkpoint LSN: %" PRIu64 "\n" + "Flush ASync LSN: %" PRIu64 "\n" + "Flush Sync LSN: %" PRIu64 "\n" + "-------------------", + lsn, clsn, buf_flush_async_lsn.load(), buf_flush_sync_lsn.load()); + + lsn_t age= lsn - clsn; + lsn_t age_pct= log_sys.max_checkpoint_age + ? age * 100 / log_sys.max_checkpoint_age : 0; + sql_print_information("InnoDB: LSN age parameters\n" + "-------------------\n" + "Current Age : %" PRIu64 " : %" PRIu64 "%%\n" + "Max Age(Async): %" PRIu64 "\n" + "Max Age(Sync) : %" PRIu64 "\n" + "Capacity : %" PRIu64 "\n" + "-------------------", + age, age_pct, log_sys.max_modified_age_async, log_sys.max_checkpoint_age, + log_sys.log_capacity); + + sql_print_information("InnoDB: Pending IO count\n" + "-------------------\n" + "Pending Read : %zu\n" + "Pending Write: %zu\n" + "-------------------", + os_aio_pending_reads_approx(), os_aio_pending_writes_approx()); +} + #ifdef UNIV_DEBUG /** Functor to validate the flush list. */ struct Check { diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index a08b8812e6d..4f293c41854 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -44,6 +44,7 @@ Created 1/8/1996 Heikki Tuuri #include "btr0cur.h" #include "btr0sea.h" #include "buf0buf.h" +#include "buf0flu.h" #include "data0type.h" #include "dict0boot.h" #include "dict0load.h" @@ -1024,7 +1025,10 @@ void dict_sys_t::lock_wait(SRW_LOCK_ARGS(const char *file, unsigned line)) noexc const ulong threshold= srv_fatal_semaphore_wait_threshold; if (waited >= threshold) + { + buf_pool.print_flush_info(); ib::fatal() << fatal_msg; + } if (waited > threshold / 4) ib::warn() << "A long wait (" << waited diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index eed41113659..605ce772b37 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -1951,6 +1951,9 @@ public: /** Issue a warning that we could not free up buffer pool pages. */ ATTRIBUTE_COLD void LRU_warn() noexcept; + /** Print buffer pool flush state information. */ + ATTRIBUTE_COLD void print_flush_info() const noexcept; + private: /** Temporary memory for page_compressed and encrypted I/O */ struct io_buf_t diff --git a/storage/innobase/include/buf0dblwr.h b/storage/innobase/include/buf0dblwr.h index 2737622a4d4..cef5d91214a 100644 --- a/storage/innobase/include/buf0dblwr.h +++ b/storage/innobase/include/buf0dblwr.h @@ -159,6 +159,9 @@ public: my_cond_wait(&cond, &mutex.m_mutex); mysql_mutex_unlock(&mutex); } + + /** Print double write state information. */ + ATTRIBUTE_COLD void print_info() const noexcept; }; /** The doublewrite buffer */ diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index 837d22f2d3b..ab25ba28bd4 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -1021,6 +1021,8 @@ size_t os_aio_pending_reads() noexcept; size_t os_aio_pending_reads_approx() noexcept; /** @return number of pending writes */ size_t os_aio_pending_writes() noexcept; +/** @return approximate number of pending writes */ +size_t os_aio_pending_writes_approx() noexcept; /** Wait until there are no pending asynchronous writes. @param declare whether the wait will be declared in tpool */ diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index abfc0d939eb..416a3f8f130 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -3481,6 +3481,12 @@ size_t os_aio_pending_writes() noexcept return pending; } +/** @return approximate number of pending writes */ +size_t os_aio_pending_writes_approx() noexcept +{ + return write_slots->pending_io_count(); +} + /** Wait until all pending asynchronous reads have completed. @param declare whether the wait will be declared in tpool */ void os_aio_wait_until_no_pending_reads(bool declare) noexcept diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index cc35a659a71..a6a588ab729 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -1220,6 +1220,7 @@ void srv_monitor_task(void*) now -= start; ulong waited = static_cast(now / 1000000); if (waited >= threshold) { + buf_pool.print_flush_info(); ib::fatal() << dict_sys.fatal_msg; } From 7d17ee97c2d07a1497c11aa475505d0a993563d0 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 30 Mar 2025 12:43:35 +0200 Subject: [PATCH 113/134] MDEV-36437 mariabackup - confusing error message when running out of file handles with partitioned MyISAM --- extra/mariabackup/common_engine.cc | 6 +++-- .../suite/mariabackup/partition_notwin.result | 11 ++++++++ .../suite/mariabackup/partition_notwin.test | 25 +++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 mysql-test/suite/mariabackup/partition_notwin.result create mode 100644 mysql-test/suite/mariabackup/partition_notwin.test diff --git a/extra/mariabackup/common_engine.cc b/extra/mariabackup/common_engine.cc index a4a8706243a..a360f63d84f 100644 --- a/extra/mariabackup/common_engine.cc +++ b/extra/mariabackup/common_engine.cc @@ -64,8 +64,10 @@ Table::copy(ds_ctxt_t *ds, MYSQL *con, bool no_lock, bool, unsigned thread_num) for (const auto &fname : m_fnames) { File file = mysql_file_open(0, fname.c_str(),O_RDONLY | O_SHARE, MYF(0)); if (file < 0) { - msg(thread_num, "Error on file %s open during %s table copy", - fname.c_str(), full_tname.c_str()); + char buf[MYSYS_STRERROR_SIZE]; + msg(thread_num, "Error %i on file %s open during %s table copy: %s", + errno, fname.c_str(), full_tname.c_str(), + my_strerror(buf, sizeof(buf), errno)); goto exit; } files.push_back(file); diff --git a/mysql-test/suite/mariabackup/partition_notwin.result b/mysql-test/suite/mariabackup/partition_notwin.result new file mode 100644 index 00000000000..6f2e1778ad9 --- /dev/null +++ b/mysql-test/suite/mariabackup/partition_notwin.result @@ -0,0 +1,11 @@ +# +# MDEV-36437 mariabackup - confusing error message when running out of file handles with partitioned MyISAM +# +create table t1 ( +id bigint(20) not null auto_increment, +primary key (id) +) engine=myisam +partition by hash (id) +partitions 600; +FOUND 1 /Error 24 on file ./test/t1#P#p\d+\.MY[DI] open during `test`.`t1` table copy: Too many open files/ in backup.log +drop table t1; diff --git a/mysql-test/suite/mariabackup/partition_notwin.test b/mysql-test/suite/mariabackup/partition_notwin.test new file mode 100644 index 00000000000..10687e19935 --- /dev/null +++ b/mysql-test/suite/mariabackup/partition_notwin.test @@ -0,0 +1,25 @@ +source include/not_windows.inc; +source include/have_partition.inc; +let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; +let $log=$MYSQL_TMP_DIR/backup.log; + +--echo # +--echo # MDEV-36437 mariabackup - confusing error message when running out of file handles with partitioned MyISAM +--echo # + +create table t1 ( + id bigint(20) not null auto_increment, + primary key (id) +) engine=myisam + partition by hash (id) + partitions 600; + +error 1; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $log 2>&1; +let SEARCH_FILE=$log; +let SEARCH_PATTERN=Error 24 on file ./test/t1#P#p\d+\.MY[DI] open during `test`.`t1` table copy: Too many open files; +source include/search_pattern_in_file.inc; + +rmdir $targetdir; +#remove_file $log; +drop table t1; From 6e339baad5fb4c4ed9200036733cfdf675278d80 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 30 Mar 2025 14:22:45 +0200 Subject: [PATCH 114/134] MDEV-28908 Confusing documentation and help output for --ssl-verify-server-cert use the same generic help text as in 11.4+ --- include/sslopt-longopts.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/sslopt-longopts.h b/include/sslopt-longopts.h index be3fedd923d..9760ac39c33 100644 --- a/include/sslopt-longopts.h +++ b/include/sslopt-longopts.h @@ -51,8 +51,7 @@ #ifdef MYSQL_CLIENT {"ssl-verify-server-cert", 0, - "Verify server's \"Common Name\" in its cert against hostname used " - "when connecting. This option is disabled by default.", + "Verify server's certificate to prevent man-in-the-middle attacks", &opt_ssl_verify_server_cert, &opt_ssl_verify_server_cert, 0, GET_BOOL, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif From fc60b89d0cb276cd70250023ebf4ff906a93874f Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 28 Mar 2025 12:16:51 +0100 Subject: [PATCH 115/134] MDEV-36283 "OpenEvent() failed" fatal error in mariadb-upgrade-service The issue occurs when mariadb-upgrade-service shuts down the server it started. There is a race condition where the server is online and responsive to pings but has not yet created the named Windows shutdown event. This fix refactors the startup/shutdown logic to ensure startup waits for the shutdown event. Additionally, mariadb-admin is unnecessary, as waiting for the named pipe is already sufficient. --- sql/mysql_upgrade_service.cc | 105 +++++++++++++++++++---------------- 1 file changed, 58 insertions(+), 47 deletions(-) diff --git a/sql/mysql_upgrade_service.cc b/sql/mysql_upgrade_service.cc index 02fae11a260..79a9057f4d3 100644 --- a/sql/mysql_upgrade_service.cc +++ b/sql/mysql_upgrade_service.cc @@ -302,13 +302,29 @@ void stop_mysqld_service() our --skip-grant-tables do not work anymore after mysql_upgrade that does "flush privileges". Instead, the shutdown event is set. */ +#define OPEN_EVENT_RETRY_SLEEP_MS 100 +#define OPEN_EVENT_MAX_RETRIES 50 + void initiate_mysqld_shutdown() { char event_name[32]; DWORD pid= GetProcessId(mysqld_process); sprintf_s(event_name, "MySQLShutdown%d", pid); - HANDLE shutdown_handle= OpenEvent(EVENT_MODIFY_STATE, FALSE, event_name); - if(!shutdown_handle) + + HANDLE shutdown_handle; + for (int i= 0;; i++) + { + shutdown_handle= OpenEvent(EVENT_MODIFY_STATE, FALSE, event_name); + if(shutdown_handle != nullptr || i == OPEN_EVENT_MAX_RETRIES) + break; + if (WaitForSingleObject(mysqld_process, OPEN_EVENT_RETRY_SLEEP_MS) != + WAIT_TIMEOUT) + { + die("server process exited before shutdown event was created"); + break; + } + } + if (!shutdown_handle) { die("OpenEvent() failed for shutdown event"); } @@ -403,6 +419,26 @@ static void change_service_config() } +/** + Waits until starting server can be connected to, via given named pipe, with timeout + Dies if either server process exited meanwhile, or when timeout was exceeded. +*/ +static void wait_for_server_startup(HANDLE process, const char *named_pipe, DWORD timeout_sec) +{ + unsigned long long end_time= GetTickCount64() + 1000ULL*timeout_sec; + for (;;) + { + if (WaitNamedPipe(named_pipe, 0)) + return; + + if (GetTickCount64() >= end_time) + die("Server did not startup after %lu seconds", timeout_sec); + + if (WaitForSingleObject(process, 100) != WAIT_TIMEOUT) + die("Server did not start"); + } +} + int main(int argc, char **argv) { @@ -482,6 +518,10 @@ int main(int argc, char **argv) DWORD start_duration_ms = 0; + char pipe_name[64]; + snprintf(pipe_name, sizeof(pipe_name), + "\\\\.\\pipe\\mysql_upgrade_service_%lu", GetCurrentProcessId()); + if (do_start_stop_server) { /* Start/stop server with --loose-innodb-fast-shutdown=1 */ @@ -493,37 +533,23 @@ int main(int argc, char **argv) { die("Cannot start mysqld.exe process, last error =%u", GetLastError()); } - char pipe_name[64]; - snprintf(pipe_name, sizeof(pipe_name), "\\\\.\\pipe\\mysql_upgrade_service_%lu", - GetCurrentProcessId()); - for (;;) + wait_for_server_startup(mysqld_process, pipe_name, startup_timeout); + // Server started, shut it down. + initiate_mysqld_shutdown(); + if (WaitForSingleObject((HANDLE)mysqld_process, shutdown_timeout * 1000) != WAIT_OBJECT_0) { - if (WaitForSingleObject(mysqld_process, 0) != WAIT_TIMEOUT) - die("mysqld.exe did not start"); - - if (WaitNamedPipe(pipe_name, 0)) - { - // Server started, shut it down. - initiate_mysqld_shutdown(); - if (WaitForSingleObject((HANDLE)mysqld_process, shutdown_timeout * 1000) != WAIT_OBJECT_0) - { - die("Could not shutdown server started with '--innodb-fast-shutdown=0'"); - } - DWORD exit_code; - if (!GetExitCodeProcess((HANDLE)mysqld_process, &exit_code)) - { - die("Could not get mysqld's exit code"); - } - if (exit_code) - { - die("Could not get successfully shutdown mysqld"); - } - CloseHandle(mysqld_process); - break; - } - Sleep(500); - start_duration_ms += 500; + die("Could not shutdown server"); } + DWORD exit_code; + if (!GetExitCodeProcess((HANDLE)mysqld_process, &exit_code)) + { + die("Could not get server's exit code"); + } + if (exit_code) + { + die("Could not get successfully shutdown server (exit code %u)",exit_code); + } + CloseHandle(mysqld_process); } log("Phase %d/%d: Fixing server config file%s", ++phase, max_phases, @@ -550,22 +576,7 @@ int main(int argc, char **argv) } log("Phase %d/%d: Waiting for startup to complete",++phase,max_phases); - start_duration_ms= 0; - for(;;) - { - if (WaitForSingleObject(mysqld_process, 0) != WAIT_TIMEOUT) - die("mysqld.exe did not start"); - - if (run_tool(P_WAIT, mysqladmin_path, "--protocol=pipe", socket_param, - "ping", "--no-beep", NULL) == 0) - { - break; - } - if (start_duration_ms > startup_timeout*1000) - die("Server did not come up in %d seconds",startup_timeout); - Sleep(500); - start_duration_ms+= 500; - } + wait_for_server_startup(mysqld_process, pipe_name, startup_timeout); log("Phase %d/%d: Running mysql_upgrade",++phase,max_phases); int upgrade_err= (int) run_tool(P_WAIT, mysqlupgrade_path, From a632a693865eab375d115465ca9fa0deb4ddf73d Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 28 Mar 2025 13:28:28 +0100 Subject: [PATCH 116/134] MDEV-36127 Add MTR test for mariadb-upgrade-service on Windows Added a test to verify mariadb-upgrade-service functionality on Windows. The test runs mariadb-install-db.exe to create a Windows service, then executes mariadb-upgrade-service.exe while the service is online or offline. There is no real cross-version upgrade in this test(not possible with MTR), the actual goal is just to run smoke-test. Last times mariadb-upgrade-service was broken (CONC-760, MDEV-30639) there were problems with named pipe connections, which could be detected and prevented by smoke-test alone. --- CMakeLists.txt | 2 +- .../main/mariadb-upgrade-service.result | 35 ++++++ mysql-test/main/mariadb-upgrade-service.test | 113 ++++++++++++++++++ mysql-test/mariadb-test-run.pl | 3 + sql/mysql_upgrade_service.cc | 20 ++-- 5 files changed, 164 insertions(+), 9 deletions(-) create mode 100644 mysql-test/main/mariadb-upgrade-service.result create mode 100644 mysql-test/main/mariadb-upgrade-service.test diff --git a/CMakeLists.txt b/CMakeLists.txt index 88edbcd3f4e..c6627d9ffc0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -633,7 +633,7 @@ IF(NOT WITHOUT_SERVER) perror replace) IF(WIN32) - ADD_DEPENDENCIES(minbuild echo mariadb-install-db my_safe_kill) + ADD_DEPENDENCIES(minbuild echo mariadb-install-db my_safe_kill mariadb-upgrade-service) ENDIF() ADD_CUSTOM_TARGET(smoketest COMMAND perl ./mysql-test-run.pl main.1st diff --git a/mysql-test/main/mariadb-upgrade-service.result b/mysql-test/main/mariadb-upgrade-service.result new file mode 100644 index 00000000000..a838b6e58a4 --- /dev/null +++ b/mysql-test/main/mariadb-upgrade-service.result @@ -0,0 +1,35 @@ +use mysql; +# run mysql_install_db with --service parameter +# Start service +# -- Upgrade service (online) -- +Phase 1/10: Stopping service +Phase 2/10: Start and stop server in the old version, to avoid crash recovery (skipped) +Phase 3/10: Fixing server config file +Phase 4/10: Starting mysqld for upgrade +Phase 5/10: Waiting for startup to complete +Phase 6/10: Running mysql_upgrade +Phase 7/10: Changing service configuration +Phase 8/10: Initiating server shutdown +Phase 9/10: Waiting for shutdown to complete +Phase 10/10: Starting service +Service 'SERVICE_NAME' successfully upgraded. +Log file is written to UPGRADE_LOG +# upgrade_success(online)=1 +# Service stopped +# -- Upgrade service (offline) -- +Phase 1/10: Stopping service +Phase 2/10: Start and stop server in the old version, to avoid crash recovery ,this can take some time +Phase 3/10: Fixing server config file +Phase 4/10: Starting mysqld for upgrade +Phase 5/10: Waiting for startup to complete +Phase 6/10: Running mysql_upgrade +Phase 7/10: Changing service configuration +Phase 8/10: Initiating server shutdown +Phase 9/10: Waiting for shutdown to complete +Phase 10/10: Starting service (skipped) +Service 'SERVICE_NAME' successfully upgraded. +Log file is written to UPGRADE_LOG +# upgrade_success(offline)=1 +# Delete service +connection default; +# restart diff --git a/mysql-test/main/mariadb-upgrade-service.test b/mysql-test/main/mariadb-upgrade-service.test new file mode 100644 index 00000000000..58132cbb05c --- /dev/null +++ b/mysql-test/main/mariadb-upgrade-service.test @@ -0,0 +1,113 @@ +source include/windows.inc; +let $datadir_name=data; +let $service_name_prefix=mariadb; +let $password=password; + +source include/check_windows_admin.inc; + +# The test uses return code from sc.exe utility, which are as follows +let $ERROR_SERVICE_DOES_NOT_EXIST= 1060; +let $ERROR_SERVICE_CANNOT_ACCEPT_CTRL=1061;# intermediate, during start or stop +let $ERROR_SERVICE_NOT_ACTIVE=1062;# service stopped +let $ERROR_INVALID_SERVICE_CONTROL=1052; # The requested control is not valid for this service + +let $sc_exe= C:\Windows\System32\sc.exe; +let $ddir= $MYSQLTEST_VARDIR/tmp/$datadir_name; +let $service_name=$service_name_prefix$MASTER_MYPORT; +let TMP= $MYSQLTEST_VARDIR/tmp; +let $upgrade_log=$TMP/mysql_upgrade_service.$service_name.log; + +use mysql; +error 0,1; +rmdir $ddir; + +--disable_result_log +error 0,$ERROR_SERVICE_DOES_NOT_EXIST; +exec $sc_exe delete $service_name; +--enable_result_log + +source include/shutdown_mysqld.inc; +echo # run mysql_install_db with --service parameter; +--disable_result_log +exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --port=$MASTER_MYPORT --password=$password --service=$service_name --verbose-bootstrap -R; +--enable_result_log + +echo # Start service; +--disable_result_log +exec $sc_exe start $service_name; +--enable_result_log + +enable_reconnect; +source include/wait_until_connected_again.inc; +disable_reconnect; + +echo # -- Upgrade service (online) --; +--replace_result $upgrade_log UPGRADE_LOG $service_name SERVICE_NAME +let $sys_errno=0; +let $upgrade_success = 1; +error 0,1; +exec $MARIADB_UPGRADE_SERVICE_EXE --service=$service_name; + +if($sys_errno != 0) +{ + let $upgrade_success = 0; +} + +echo # upgrade_success(online)=$upgrade_success; +file_exists $upgrade_log; +if ($upgrade_success == 0) +{ + echo --detailed error(online upgrade)--; + cat_file $upgrade_log; +} +# stop service +--disable_result_log +# Wait until stopped +let $sys_errno=0; +while($sys_errno != $ERROR_SERVICE_NOT_ACTIVE) +{ + --error 0,$ERROR_SERVICE_CANNOT_ACCEPT_CTRL,$ERROR_SERVICE_NOT_ACTIVE, $ERROR_INVALID_SERVICE_CONTROL + exec $sc_exe stop $service_name; + if($sys_errno != $ERROR_SERVICE_NOT_ACTIVE) + { + --real_sleep 0.1 + } +} +--enable_result_log +echo # Service stopped; + +echo # -- Upgrade service (offline) --; +--replace_result $upgrade_log UPGRADE_LOG $service_name SERVICE_NAME +let $sys_errno=0; +let $upgrade_success = 1; +error 0,1; +exec $MARIADB_UPGRADE_SERVICE_EXE --service=$service_name; + +if($sys_errno != 0) +{ + let $upgrade_success = 0; +} + +echo # upgrade_success(offline)=$upgrade_success; +file_exists $upgrade_log; +if ($upgrade_success == 0) +{ + echo --detailed error(online upgrade)--; + cat_file $upgrade_log; +} + +echo # Delete service; +let $sys_errno=0; +--disable_result_log +exec $sc_exe delete $service_name; +--enable_result_log + +# Cleanup +source include/wait_until_disconnected.inc; +rmdir $ddir; +remove_file $upgrade_log; +let TEMP=$old_temp; + +#restart original server +connection default; +source include/start_mysqld.inc; diff --git a/mysql-test/mariadb-test-run.pl b/mysql-test/mariadb-test-run.pl index 57fb5580139..4bf4096b37d 100755 --- a/mysql-test/mariadb-test-run.pl +++ b/mysql-test/mariadb-test-run.pl @@ -2226,6 +2226,9 @@ sub environment_setup { { $ENV{'MYSQL_INSTALL_DB_EXE'}= mtr_exe_exists("$bindir/sql$multiconfig/mariadb-install-db", "$bindir/bin/mariadb-install-db"); + $ENV{'MARIADB_UPGRADE_SERVICE_EXE'}= mtr_exe_exists("$bindir/sql$multiconfig/mariadb-upgrade-service", + "$bindir/bin/mariadb-upgrade-service"); + $ENV{'MARIADB_UPGRADE_EXE'}= mtr_exe_exists("$path_client_bindir/mariadb-upgrade"); } my $client_config_exe= diff --git a/sql/mysql_upgrade_service.cc b/sql/mysql_upgrade_service.cc index 79a9057f4d3..5492bccd239 100644 --- a/sql/mysql_upgrade_service.cc +++ b/sql/mysql_upgrade_service.cc @@ -45,7 +45,6 @@ extern int upgrade_config_file(const char *myini_path); "OPTIONS:" static char mysqld_path[MAX_PATH]; -static char mysqladmin_path[MAX_PATH]; static char mysqlupgrade_path[MAX_PATH]; static char defaults_file_param[MAX_PATH + 16]; /*--defaults-file= */ @@ -455,8 +454,9 @@ int main(int argc, char **argv) /* Get full path to mysqld, we need it when changing service configuration. - Assume installation layout, i.e mysqld.exe, mysqladmin.exe, mysqlupgrade.exe - and mysql_upgrade_service.exe are in the same directory. + Assume mysqld.exe in the same directory as this program. + mysql_upgrade.exe is either in the same directory, or pointed to by + MARIADB_UPGRADE_EXE environment variable (in case of MTR running it) */ GetModuleFileName(NULL, bindir, FN_REFLEN); p= strrchr(bindir, FN_LIBCHAR); @@ -465,15 +465,19 @@ int main(int argc, char **argv) *p= 0; } sprintf_s(mysqld_path, "%s\\mysqld.exe", bindir); - sprintf_s(mysqladmin_path, "%s\\mysqladmin.exe", bindir); sprintf_s(mysqlupgrade_path, "%s\\mysql_upgrade.exe", bindir); - char *paths[]= {mysqld_path, mysqladmin_path, mysqlupgrade_path}; - for(int i= 0; i< 3;i++) + if (access(mysqld_path, 0)) + die("File %s does not exist", mysqld_path); + if (access(mysqlupgrade_path, 0)) { - if(GetFileAttributes(paths[i]) == INVALID_FILE_ATTRIBUTES) - die("File %s does not exist", paths[i]); + /* Try to get path from environment variable, set by MTR */ + char *alt_mysqlupgrade_path= getenv("MARIADB_UPGRADE_EXE"); + if (alt_mysqlupgrade_path) + sprintf_s(mysqlupgrade_path, "%s", alt_mysqlupgrade_path); } + if (access(mysqlupgrade_path, 0)) + die("File %s does not exist", mysqld_path); /* Messages written on stdout should not be buffered, GUI upgrade program From 0545695de7ec7bfd408f761b802400789c4881f9 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 31 Mar 2025 15:21:14 +0200 Subject: [PATCH 117/134] MDEV-36426 Crash handler output needs newline before "Optimizer switch" --- sql/signal_handler.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index b1c570ade03..c1052e690d1 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -277,7 +277,7 @@ extern "C" sig_handler handle_fatal_signal(int sig) my_safe_printf_stderr("Status: %s\n", kreason); my_safe_printf_stderr("Query (%p): ", thd->query()); my_safe_print_str(thd->query(), MY_MIN(65536U, thd->query_length())); - my_safe_printf_stderr("%s", "Optimizer switch: "); + my_safe_printf_stderr("%s", "\nOptimizer switch: "); ulonglong optsw= thd->variables.optimizer_switch; for (uint i= 0; optimizer_switch_names[i+1]; i++, optsw >>= 1) { From 866c06ac2d6f43e316ef463b4177e55f874d1693 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 31 Mar 2025 17:11:52 +1100 Subject: [PATCH 118/134] MDEV-36441 MDEV-35452 Fix extra spider_same_server_link warnings in view-protocol With --view-protocol, mtr transforms a SELECT query to two queries: 1. CREATE OR REPLACE VIEW mysqltest_tmp_v AS ... 2. SELECT * FROM mysqltest_tmp_v where ... is the original query. Further mtr may run the first query in a separate connection. On the other hand if the data node is the same as the spider node, spider_same_server_link is required for connection to the data node. Therefore, for mtr --view-protocol tests often spider_same_server_link needs to be set on both session and global levels. In this patch we add the missing "SET GLOBAL spider_same_server_link=1" queries to tests that fail with wrong results due to this issue. It does not fix --view-protocol for all the affected tests, because there are other issues fixed in subsequent patches. --- storage/spider/mysql-test/spider/bugfix/r/mdev_26345.result | 1 + storage/spider/mysql-test/spider/bugfix/r/mdev_29002.result | 1 + storage/spider/mysql-test/spider/bugfix/r/mdev_29163.result | 1 + storage/spider/mysql-test/spider/bugfix/r/mdev_29502.result | 1 + storage/spider/mysql-test/spider/bugfix/r/mdev_29962.result | 1 + storage/spider/mysql-test/spider/bugfix/r/mdev_30392.result | 1 + storage/spider/mysql-test/spider/bugfix/r/mdev_30408.result | 1 + storage/spider/mysql-test/spider/bugfix/r/mdev_31338.result | 1 + storage/spider/mysql-test/spider/bugfix/r/mdev_31645.result | 1 + storage/spider/mysql-test/spider/bugfix/r/mdev_34003.result | 1 + storage/spider/mysql-test/spider/bugfix/r/mdev_35874.result | 1 + storage/spider/mysql-test/spider/bugfix/r/subquery.result | 1 + storage/spider/mysql-test/spider/bugfix/t/mdev_26345.test | 1 + storage/spider/mysql-test/spider/bugfix/t/mdev_29002.test | 1 + storage/spider/mysql-test/spider/bugfix/t/mdev_29163.test | 1 + storage/spider/mysql-test/spider/bugfix/t/mdev_29502.test | 1 + storage/spider/mysql-test/spider/bugfix/t/mdev_29962.test | 1 + storage/spider/mysql-test/spider/bugfix/t/mdev_30392.test | 1 + storage/spider/mysql-test/spider/bugfix/t/mdev_30408.test | 1 + storage/spider/mysql-test/spider/bugfix/t/mdev_31338.test | 1 + storage/spider/mysql-test/spider/bugfix/t/mdev_31645.test | 1 + storage/spider/mysql-test/spider/bugfix/t/mdev_34003.test | 1 + storage/spider/mysql-test/spider/bugfix/t/mdev_35874.test | 1 + storage/spider/mysql-test/spider/bugfix/t/subquery.test | 1 + 24 files changed, 24 insertions(+) diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_26345.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_26345.result index f7d78521472..9f569795299 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_26345.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_26345.result @@ -5,6 +5,7 @@ for child3 MDEV-26345 SELECT MIN on Spider table returns more rows than expected set spider_same_server_link= 1; +set global spider_same_server_link= 1; CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); create table t2 (a int, b int, PRIMARY KEY (a, b)); diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29002.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29002.result index 894f51c5e36..2cc1fa15f87 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_29002.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29002.result @@ -2,6 +2,7 @@ for master_1 for child2 for child3 SET spider_same_server_link= on; +SET global spider_same_server_link= on; CREATE SERVER s FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t (a INT); diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29163.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29163.result index f58ab605e11..938f72ff430 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_29163.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29163.result @@ -5,6 +5,7 @@ for master_1 for child2 for child3 set spider_same_server_link=1; +set global spider_same_server_link=1; CREATE SERVER s FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t1 (a INT); CREATE TABLE t2 (b INT); diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29502.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29502.result index 7749898eb6f..2fe6f8bdcd5 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_29502.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29502.result @@ -5,6 +5,7 @@ for master_1 for child2 for child3 set spider_same_server_link=1; +set global spider_same_server_link=1; CREATE SERVER $srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t (a INT); INSERT INTO t VALUES (23),(48); diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_29962.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_29962.result index 0767df7d988..ab157109275 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_29962.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_29962.result @@ -5,6 +5,7 @@ for master_1 for child2 for child3 set spider_same_server_link= 1; +set global spider_same_server_link= 1; CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t (c INT) ENGINE=InnoDB; diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_30392.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_30392.result index cefa5248d44..ae6c49fc657 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_30392.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_30392.result @@ -5,6 +5,7 @@ for master_1 for child2 for child3 set spider_same_server_link=1; +set global spider_same_server_link=1; CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(2); diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_30408.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_30408.result index aa44e683102..029dfbcb830 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_30408.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_30408.result @@ -3,6 +3,7 @@ for child2 for child3 set @@optimizer_switch="semijoin=off"; set spider_same_server_link= 1; +set global spider_same_server_link=1; CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); create table ten(a int primary key); diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_31338.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_31338.result index f156cf38a15..93d88ed6fa9 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_31338.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_31338.result @@ -5,6 +5,7 @@ for master_1 for child2 for child3 set spider_same_server_link=1; +set global spider_same_server_link=1; CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t (c BLOB) ENGINE=InnoDB; CREATE TABLE ts (c BLOB) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"'; diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_31645.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_31645.result index 5197abd3fb6..d97b23b14a0 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_31645.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_31645.result @@ -5,6 +5,7 @@ for master_1 for child2 for child3 set spider_same_server_link=1; +set global spider_same_server_link=1; CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t1 ( a bigint(20) NOT NULL, b bigint(20) DEFAULT 0, PRIMARY KEY (a)); CREATE TABLE t2 ( a bigint(20) NOT NULL, b bigint(20) DEFAULT 0, PRIMARY KEY (a)) ENGINE=SPIDER COMMENT='srv "srv", WRAPPER "mysql", TABLE "t1"'; diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_34003.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_34003.result index b78f18d19dd..ad910b6b3a8 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_34003.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_34003.result @@ -2,6 +2,7 @@ for master_1 for child2 for child3 set spider_same_server_link= 1; +set global spider_same_server_link= 1; CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); create table t2 (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=InnoDB; diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_35874.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_35874.result index 9425babbb22..d00d002a912 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/mdev_35874.result +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_35874.result @@ -5,6 +5,7 @@ for master_1 for child2 for child3 set spider_same_server_link= 1; +set global spider_same_server_link= 1; CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t1 (c6 decimal(6,0)) ENGINE=InnoDB; diff --git a/storage/spider/mysql-test/spider/bugfix/r/subquery.result b/storage/spider/mysql-test/spider/bugfix/r/subquery.result index 280f57155bd..b186699ea51 100644 --- a/storage/spider/mysql-test/spider/bugfix/r/subquery.result +++ b/storage/spider/mysql-test/spider/bugfix/r/subquery.result @@ -5,6 +5,7 @@ for master_1 for child2 for child3 set spider_same_server_link=1; +set global spider_same_server_link=1; CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); create table t1 (c1 int); create table t2 (c2 int); diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_26345.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_26345.test index 72069253e84..b14df3bf332 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_26345.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_26345.test @@ -11,6 +11,7 @@ --echo set spider_same_server_link= 1; +set global spider_same_server_link= 1; evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29002.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29002.test index 51620a5a23c..5e539e8e1e7 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_29002.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29002.test @@ -4,6 +4,7 @@ --enable_result_log --enable_query_log SET spider_same_server_link= on; +SET global spider_same_server_link= on; evalp CREATE SERVER s FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29163.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29163.test index 2e56583d831..4d14dbeba49 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_29163.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29163.test @@ -7,6 +7,7 @@ --enable_result_log --enable_query_log set spider_same_server_link=1; +set global spider_same_server_link=1; evalp CREATE SERVER s FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t1 (a INT); diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29502.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29502.test index bacf5073125..91a8cad5f8b 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_29502.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29502.test @@ -9,6 +9,7 @@ --enable_query_log set spider_same_server_link=1; +set global spider_same_server_link=1; --let $srv=srv_mdev_29502 evalp CREATE SERVER $srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_29962.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_29962.test index 65735d43e7d..2ee3d099c90 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_29962.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_29962.test @@ -8,6 +8,7 @@ --enable_query_log set spider_same_server_link= 1; +set global spider_same_server_link= 1; evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_30392.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_30392.test index 36e06f3f3c4..da8df16b7fc 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_30392.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_30392.test @@ -7,6 +7,7 @@ --enable_result_log --enable_query_log set spider_same_server_link=1; +set global spider_same_server_link=1; evalp CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t1 (a INT); diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_30408.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_30408.test index 8f76c1209b6..7f29c1bbdca 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_30408.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_30408.test @@ -6,6 +6,7 @@ set @@optimizer_switch="semijoin=off"; set spider_same_server_link= 1; +set global spider_same_server_link=1; evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_31338.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_31338.test index a3698c97717..8847e2ad29f 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_31338.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_31338.test @@ -10,6 +10,7 @@ --enable_query_log set spider_same_server_link=1; +set global spider_same_server_link=1; evalp CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t (c BLOB) ENGINE=InnoDB; CREATE TABLE ts (c BLOB) ENGINE=Spider COMMENT='WRAPPER "mysql",srv "srv",TABLE "t"'; diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_31645.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_31645.test index 4dfe3b57e50..5ab11ed7a0f 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_31645.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_31645.test @@ -7,6 +7,7 @@ --enable_result_log --enable_query_log set spider_same_server_link=1; +set global spider_same_server_link=1; evalp CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); CREATE TABLE t1 ( a bigint(20) NOT NULL, b bigint(20) DEFAULT 0, PRIMARY KEY (a)); diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_34003.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_34003.test index f81259b99a9..e2a325dcc5a 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_34003.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_34003.test @@ -4,6 +4,7 @@ --enable_result_log --enable_query_log set spider_same_server_link= 1; +set global spider_same_server_link= 1; evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); create table t2 (c INT KEY,c1 BLOB,c2 TEXT) ENGINE=InnoDB; diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_35874.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_35874.test index beeec416a8d..601c0cdb1ef 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/mdev_35874.test +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_35874.test @@ -9,6 +9,7 @@ --enable_query_log --source include/have_innodb.inc set spider_same_server_link= 1; +set global spider_same_server_link= 1; evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); diff --git a/storage/spider/mysql-test/spider/bugfix/t/subquery.test b/storage/spider/mysql-test/spider/bugfix/t/subquery.test index 70238a524a6..b6db6d22102 100644 --- a/storage/spider/mysql-test/spider/bugfix/t/subquery.test +++ b/storage/spider/mysql-test/spider/bugfix/t/subquery.test @@ -7,6 +7,7 @@ --enable_result_log --enable_query_log set spider_same_server_link=1; +set global spider_same_server_link=1; evalp CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); create table t1 (c1 int); create table t2 (c2 int); From 1db7ccc124759355c4daa86433f2ecb2a18a40ee Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Sun, 30 Mar 2025 18:54:23 +0300 Subject: [PATCH 119/134] MDEV-31122 Server crash in get_lock_data / mysql_lock_abort_for_thread While ALTER thread tries to notify SELECT thread about lock conflict it accesses its TABLE object (THD::notify_shared_lock()) and lock data (mysql_lock_abort_for_thread()). As part of accessing lock data it calls ha_partition::store_lock() which iterates over all partitions and does their store_lock(). The problem is SELECT opened 2 read partitions, but ha_partition::store_lock() tries to access all partitions as indicated in m_tot_parts which is 4. So the last 2 partitions m_file[2] and m_file[3] are uninitialized and store_lock() accesses uninitialized data. The code in ha_partition::store_lock() does this wrong handling to use all partitions specifically for the case of mysql_lock_abort_for_thread(), this is conducted with comment: /* This can be called from get_lock_data() in mysql_lock_abort_for_thread(), even when thd != table->in_use. In that case don't use partition pruning, but use all partitions instead to avoid using another threads structures. */ if (thd != table->in_use) { for (i= 0; i < m_tot_parts; i++) to= m_file[i]->store_lock(thd, to, lock_type); } The explanation is "to avoid using another threads structures" does not really explain why this change was needed. The change was originally introduced by: commit 9b7cccaf319 Author: Mattias Jonsson Date: Wed May 30 00:14:39 2012 +0200 WL#4443: final code change for dlenevs review. - Don't use pruning in lock_count(). - Don't use pruning in store_lock() if not owning thd. - Renamed is_fields_used_in_trigger to is_fields_updated_in_trigger() and check if they may be updated. - moved out mark_fields_used(TRG_EVENT_UPDATE) from mark_columns_needed_for_update(). And reverted the changed call order. And call mark_fields_used(TRG_EVENT_UPDATE) instead. which also fails to explain the rationale of the change. The original idea of WL#4443 is to reduce locks and this change does not happen to serve this goal. So reverting this change restores original behaviour of using only partitions marked for use and fixes invalid access to uninitialized data. --- mysql-test/main/partition_myisam.result | 21 +++++++++++++++ mysql-test/main/partition_myisam.test | 28 ++++++++++++++++++++ sql/ha_partition.cc | 34 ++++++++----------------- 3 files changed, 60 insertions(+), 23 deletions(-) diff --git a/mysql-test/main/partition_myisam.result b/mysql-test/main/partition_myisam.result index 3509d2f284c..a96624df1ee 100644 --- a/mysql-test/main/partition_myisam.result +++ b/mysql-test/main/partition_myisam.result @@ -259,3 +259,24 @@ CHECK TABLE `t1` EXTENDED; Table Op Msg_type Msg_text test.t1 check status OK DROP TABLE t1; +# +# MDEV-31122 Server crash in get_lock_data / mysql_lock_abort_for_thread +# +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT, c varchar(5)) +PARTITION BY RANGE COLUMNS(c) +SUBPARTITION by key(b) SUBPARTITIONS 2 ( +PARTITION p0 VALUES LESS THAN ('m'), +PARTITION p1 VALUES LESS THAN ('z') +); +connect con1,localhost,root,,; +HANDLER t1 OPEN; +SELECT b FROM t2 PARTITION (p0); +connection default; +SET lock_wait_timeout= 1; +ALTER TABLE t1 FORCE; +connection con1; +b +disconnect con1; +connection default; +DROP TABLE t2, t1; diff --git a/mysql-test/main/partition_myisam.test b/mysql-test/main/partition_myisam.test index b26b619a958..70bd4a77794 100644 --- a/mysql-test/main/partition_myisam.test +++ b/mysql-test/main/partition_myisam.test @@ -249,3 +249,31 @@ ALTER TABLE `t1` ADD PRIMARY KEY (`a`); ALTER TABLE `t1` REMOVE PARTITIONING; CHECK TABLE `t1` EXTENDED; DROP TABLE t1; + +--echo # +--echo # MDEV-31122 Server crash in get_lock_data / mysql_lock_abort_for_thread +--echo # +CREATE TABLE t1 (a INT); + +CREATE TABLE t2 (b INT, c varchar(5)) + PARTITION BY RANGE COLUMNS(c) + SUBPARTITION by key(b) SUBPARTITIONS 2 ( + PARTITION p0 VALUES LESS THAN ('m'), + PARTITION p1 VALUES LESS THAN ('z') + ); + +--connect (con1,localhost,root,,) +HANDLER t1 OPEN; +--send + SELECT b FROM t2 PARTITION (p0); + +--connection default +SET lock_wait_timeout= 1; +--error 0,ER_STATEMENT_TIMEOUT,ER_LOCK_WAIT_TIMEOUT +ALTER TABLE t1 FORCE; + +--connection con1 +--reap +--disconnect con1 +--connection default +DROP TABLE t2, t1; diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 95763eaf477..64ffb25d4fe 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -4269,31 +4269,19 @@ THR_LOCK_DATA **ha_partition::store_lock(THD *thd, DBUG_ENTER("ha_partition::store_lock"); DBUG_ASSERT(thd == current_thd); - /* - This can be called from get_lock_data() in mysql_lock_abort_for_thread(), - even when thd != table->in_use. In that case don't use partition pruning, - but use all partitions instead to avoid using another threads structures. - */ - if (thd != table->in_use) - { - for (i= 0; i < m_tot_parts; i++) - to= m_file[i]->store_lock(thd, to, lock_type); - } - else - { - MY_BITMAP *used_partitions= lock_type == TL_UNLOCK || - lock_type == TL_IGNORE ? - &m_locked_partitions : - &m_part_info->lock_partitions; + MY_BITMAP *used_partitions= lock_type == TL_UNLOCK || + lock_type == TL_IGNORE ? + &m_locked_partitions : + &m_part_info->lock_partitions; - for (i= bitmap_get_first_set(used_partitions); - i < m_tot_parts; - i= bitmap_get_next_set(used_partitions, i)) - { - DBUG_PRINT("info", ("store lock %u iteration", i)); - to= m_file[i]->store_lock(thd, to, lock_type); - } + for (i= bitmap_get_first_set(used_partitions); + i < m_tot_parts; + i= bitmap_get_next_set(used_partitions, i)) + { + DBUG_PRINT("info", ("store lock %u iteration", i)); + to= m_file[i]->store_lock(thd, to, lock_type); } + DBUG_RETURN(to); } From c1492f3d077e47a015c6e4c5dcd2107b803ac3f4 Mon Sep 17 00:00:00 2001 From: Aleksey Midenkov Date: Sun, 30 Mar 2025 18:54:23 +0300 Subject: [PATCH 120/134] MDEV-36115 InnoDB: assertion: node->pcur->rel_pos == BTR_PCUR_ON in row_update_for_mysql 932ec586 (MDEV-23644) in TABLE::delete_row() added ha_delete_row() for the case of HA_ERR_FOREIGN_DUPLICATE_KEY. The problem is ha_update_row() called beforewards may change m_last_part which is required for ha_delete_row() to delete from correct partition. The fix reverts m_last_part in case ha_partition::update_row() fails. --- mysql-test/suite/versioning/r/partition.result | 14 ++++++++++++++ mysql-test/suite/versioning/t/partition.test | 16 ++++++++++++++++ sql/ha_partition.cc | 3 ++- 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result index 1ceb9c443a2..7e920fb3187 100644 --- a/mysql-test/suite/versioning/r/partition.result +++ b/mysql-test/suite/versioning/r/partition.result @@ -1791,6 +1791,20 @@ drop table t; create table t (a int) with system versioning partition by system_time partitions 3; ERROR HY000: Maybe missing parameters: no rotation condition for multiple HISTORY partitions. # +# MDEV-36115 InnoDB: assertion: node->pcur->rel_pos == BTR_PCUR_ON +# in row_update_for_mysql +# +create table t (a int key) engine=innodb +with system versioning +partition by key() partitions 3; +start transaction; +insert into t values (1),(2),(3),(4),(5),(6),(7),(8); +set timestamp=+1; +delete from t; +insert into t values (1),(2); +DELETE from t; +drop table t; +# # End of 10.5 tests # set global innodb_stats_persistent= @save_persistent; diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index 840af2d6cec..3d31b1c6864 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -1563,6 +1563,22 @@ drop table t; --error WARN_VERS_PARAMETERS create table t (a int) with system versioning partition by system_time partitions 3; +--echo # +--echo # MDEV-36115 InnoDB: assertion: node->pcur->rel_pos == BTR_PCUR_ON +--echo # in row_update_for_mysql +--echo # +create table t (a int key) engine=innodb +with system versioning +partition by key() partitions 3; + +start transaction; +insert into t values (1),(2),(3),(4),(5),(6),(7),(8); +set timestamp=+1; +delete from t; +insert into t values (1),(2); +DELETE from t; +drop table t; + --echo # --echo # End of 10.5 tests --echo # diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 64ffb25d4fe..d053eed62fe 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -4616,7 +4616,6 @@ int ha_partition::update_row(const uchar *old_data, const uchar *new_data) } - m_last_part= new_part_id; start_part_bulk_insert(thd, new_part_id); DBUG_ASSERT(!m_file[new_part_id]->row_logging); if (new_part_id == old_part_id) @@ -4651,6 +4650,8 @@ int ha_partition::update_row(const uchar *old_data, const uchar *new_data) goto exit; } + m_last_part= new_part_id; + exit: /* if updating an auto_increment column, update From 10b2187a942b0d53aede244fcf283b118706e65b Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 31 Mar 2025 23:03:13 +0200 Subject: [PATCH 121/134] Fix random mariabackup crashes with latest pcre2. Seen on Windows using newest pcre2-10.45. Tests that use regular expression e.g., mariabackup.partial, fail very often. To fix, serialize regexec calls, which are documented as non-thread-safe in https://www.pcre.org/current/doc/html/pcre2posix.html. --- extra/mariabackup/xtrabackup.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 9b6a8b4c316..8428f70ba6e 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -2544,6 +2544,15 @@ my_bool regex_list_check_match( const regex_list_t& list, const char* name) { + if (list.empty()) return (FALSE); + + /* + regexec/pcre2_regexec is not threadsafe, also documented. + Serialize access from multiple threads to compiled regexes. + */ + static std::mutex regex_match_mutex; + std::lock_guard lock(regex_match_mutex); + regmatch_t tables_regmatch[1]; for (regex_list_t::const_iterator i = list.begin(), end = list.end(); i != end; ++i) { From d9ff22063aa60f87042ab6f5fd52ffe83ae5e744 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Tue, 25 Mar 2025 10:20:00 +1100 Subject: [PATCH 122/134] update C/C --- libmariadb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmariadb b/libmariadb index 5d34e4820fb..ba712ddf961 160000 --- a/libmariadb +++ b/libmariadb @@ -1 +1 @@ -Subproject commit 5d34e4820fbb64fe662d44d0b19871e486f2a466 +Subproject commit ba712ddf9611304e8dfc12e829ad899222d1b4cb From 41565615c5e986af121782e4b330a6dca7fc8125 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Sun, 9 Mar 2025 20:33:58 +0100 Subject: [PATCH 123/134] galera: synchronization changes to stop random test failures --- .../include/auto_increment_offset_save.inc | 1 - .../galera/include/galera_dump_sr_table.inc | 1 - .../include/galera_st_shutdown_slave.inc | 1 - .../include/galera_start_replication.inc | 4 +- .../galera/include/galera_wsrep_recover.inc | 4 +- mysql-test/suite/galera/r/MW-284.result | 2 +- .../galera/r/galera_2primary_replica.result | 5 +- .../suite/galera/r/galera_bf_kill.result | 2 + .../suite/galera/r/galera_bf_lock_wait.result | 2 + .../galera/r/galera_binlog_checksum.result | 1 - .../r/galera_circular_replication.result | 1 + .../suite/galera/r/galera_flush_local.result | 48 +++++----- .../galera/r/galera_ist_mysqldump.result | 6 +- .../galera/r/galera_restart_replica.result | 1 + .../suite/galera/r/galera_slave_replay.result | 4 +- .../suite/galera/r/galera_split_brain.result | 1 + mysql-test/suite/galera/r/galera_ssl.result | 3 + .../galera/r/galera_ssl_compression.result | 3 + .../suite/galera/r/galera_ssl_upgrade.result | 3 + .../r/galera_var_replicate_myisam_off.result | 7 +- .../r/galera_var_replicate_myisam_on.result | 88 +++++++++---------- mysql-test/suite/galera/r/galera_wan.result | 2 +- mysql-test/suite/galera/t/GCF-939.test | 2 + mysql-test/suite/galera/t/MDEV-26266.test | 1 - mysql-test/suite/galera/t/MDEV-28053.test | 1 + mysql-test/suite/galera/t/MDEV-6860.test | 2 +- mysql-test/suite/galera/t/MW-284.test | 7 +- .../galera/t/galera_2primary_replica.test | 6 +- .../galera/t/galera_as_slave_nonprim.test | 3 +- mysql-test/suite/galera/t/galera_bf_kill.test | 2 + .../suite/galera/t/galera_bf_lock_wait.test | 2 + .../galera/t/galera_binlog_checksum.test | 3 + .../galera/t/galera_circular_replication.test | 1 + .../suite/galera/t/galera_defaults.test | 2 +- .../suite/galera/t/galera_fk_truncate.cnf | 9 ++ .../suite/galera/t/galera_flush_local.test | 17 ++-- .../suite/galera/t/galera_gcache_recover.cnf | 4 +- .../suite/galera/t/galera_gcache_recover.test | 1 + .../t/galera_gcache_recover_full_gcache.cnf | 4 +- .../t/galera_gcache_recover_full_gcache.test | 1 + .../t/galera_gcache_recover_manytrx.cnf | 4 +- .../t/galera_gcache_recover_manytrx.test | 1 + .../galera/t/galera_gtid_slave_sst_rsync.test | 15 ++++ .../suite/galera/t/galera_ist_mysqldump.test | 4 +- .../galera/t/galera_kill_smallchanges.test | 1 + .../suite/galera/t/galera_many_rows.test | 1 + .../t/galera_query_cache_invalidate.test | 2 +- .../galera/t/galera_restart_replica.test | 1 + .../suite/galera/t/galera_slave_replay.test | 3 +- .../suite/galera/t/galera_split_brain.test | 1 + mysql-test/suite/galera/t/galera_ssl.test | 4 + .../galera/t/galera_ssl_compression.test | 4 + .../suite/galera/t/galera_ssl_upgrade.test | 3 + .../suite/galera/t/galera_sync_wait_upto.test | 1 + .../suite/galera/t/galera_threadpool.test | 1 - .../t/galera_var_replicate_myisam_off.test | 4 +- .../t/galera_var_replicate_myisam_on.test | 54 ++++++------ mysql-test/suite/galera/t/galera_wan.test | 2 +- .../suite/galera/t/mysql-wsrep#198.test | 2 +- .../r/galera_garbd_backup.result | 1 - .../r/galera_vote_rejoin_mysqldump.result | 2 +- .../galera_3nodes/t/galera_garbd_backup.test | 10 +-- .../galera_3nodes/t/galera_pc_bootstrap.test | 1 - .../t/galera_safe_to_bootstrap.test | 1 - .../t/galera_vote_rejoin_mysqldump.test | 2 +- .../galera_3nodes/t/galera_wsrep_schema.test | 1 + .../t/galera_wsrep_schema_init.test | 1 + .../galera_3nodes_sr/r/MDEV-26707.result | 8 +- .../suite/galera_3nodes_sr/t/GCF-817.test | 1 + .../suite/galera_3nodes_sr/t/GCF-832.test | 1 + .../suite/galera_3nodes_sr/t/MDEV-26707.test | 8 +- .../t/galera_sr_isolate_master.test | 1 + .../t/galera_sr_join_slave.test | 1 + .../t/galera_sr_kill_master.test | 1 + ...ra_sr_kill_slave_after_apply_rollback.test | 1 + ...a_sr_kill_slave_after_apply_rollback2.test | 1 + .../t/galera_sr_kill_slave_before_apply.test | 1 + .../t/galera_sr_threeway_split.test | 1 + .../r/galera_sr_kill_all_norecovery.result | 1 + .../suite/galera_sr/r/galera_sr_myisam.result | 4 +- .../t/galera_sr_kill_all_norecovery.test | 3 +- .../suite/galera_sr/t/galera_sr_myisam.test | 2 +- .../galera_sr/t/galera_sr_shutdown_slave.test | 1 + mysql-test/suite/wsrep/README | 1 - .../wsrep/include/check_galera_version.inc | 1 - .../wsrep/r/wsrep-recover-v25,binlogon.rdiff | 4 +- sql/handler.cc | 15 ++-- sql/wsrep_high_priority_service.cc | 4 +- sql/wsrep_mysqld.cc | 36 +++++--- sql/wsrep_server_service.cc | 7 +- sql/wsrep_sst.cc | 2 +- 91 files changed, 287 insertions(+), 204 deletions(-) create mode 100644 mysql-test/suite/galera/t/galera_fk_truncate.cnf diff --git a/mysql-test/suite/galera/include/auto_increment_offset_save.inc b/mysql-test/suite/galera/include/auto_increment_offset_save.inc index 216c689ec8c..a6ce62b5d8e 100644 --- a/mysql-test/suite/galera/include/auto_increment_offset_save.inc +++ b/mysql-test/suite/galera/include/auto_increment_offset_save.inc @@ -42,4 +42,3 @@ if ($node_4) --connection $node_4 let $auto_increment_offset_node_4 = `SELECT @@global.auto_increment_offset`; } - diff --git a/mysql-test/suite/galera/include/galera_dump_sr_table.inc b/mysql-test/suite/galera/include/galera_dump_sr_table.inc index 1e6ff5548d2..91dcf8be46f 100644 --- a/mysql-test/suite/galera/include/galera_dump_sr_table.inc +++ b/mysql-test/suite/galera/include/galera_dump_sr_table.inc @@ -25,4 +25,3 @@ while ($seqno <= $sr_max) --inc $seqno } - diff --git a/mysql-test/suite/galera/include/galera_st_shutdown_slave.inc b/mysql-test/suite/galera/include/galera_st_shutdown_slave.inc index 7492e9f3579..1f7371704e6 100644 --- a/mysql-test/suite/galera/include/galera_st_shutdown_slave.inc +++ b/mysql-test/suite/galera/include/galera_st_shutdown_slave.inc @@ -118,4 +118,3 @@ SELECT * from t1; SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; DROP TABLE t1; COMMIT; - diff --git a/mysql-test/suite/galera/include/galera_start_replication.inc b/mysql-test/suite/galera/include/galera_start_replication.inc index b9b201106d7..fd208742d86 100644 --- a/mysql-test/suite/galera/include/galera_start_replication.inc +++ b/mysql-test/suite/galera/include/galera_start_replication.inc @@ -41,9 +41,9 @@ perl; my $counter = 1000; #my $found = false - + while ($counter > 0) { - + open(FILE, "$logfile") or die("Unable to open $logfile : $!\n"); my $new_sync_count = () = grep(/Synchronized with group/g,); close(FILE); diff --git a/mysql-test/suite/galera/include/galera_wsrep_recover.inc b/mysql-test/suite/galera/include/galera_wsrep_recover.inc index efe803dcc9f..1f1427a68e6 100644 --- a/mysql-test/suite/galera/include/galera_wsrep_recover.inc +++ b/mysql-test/suite/galera/include/galera_wsrep_recover.inc @@ -9,14 +9,14 @@ if (!$wsrep_recover_additional) } --perl - use strict; + use strict; my $wsrep_start_position_str = "grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'"; my $wsrep_start_position = `grep -a 'WSREP: Recovered position:' $ENV{MYSQL_TMP_DIR}/galera_wsrep_recover.log | sed 's/.*WSREP\:\ Recovered\ position://' | sed 's/^[ \t]*//'`; chomp($wsrep_start_position); die if $wsrep_start_position eq ''; - open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/galera_wsrep_start_position.inc") or die; + open(FILE, ">", "$ENV{MYSQL_TMP_DIR}/galera_wsrep_start_position.inc") or die; print FILE "--let \$galera_wsrep_start_position = $wsrep_start_position\n"; close FILE; EOF diff --git a/mysql-test/suite/galera/r/MW-284.result b/mysql-test/suite/galera/r/MW-284.result index ba8b67e9c31..d03948fe28f 100644 --- a/mysql-test/suite/galera/r/MW-284.result +++ b/mysql-test/suite/galera/r/MW-284.result @@ -13,7 +13,7 @@ connection node_3; SELECT @@wsrep_on; @@wsrep_on 0 -call mtr.add_suppression("Error reading packet from server: WSREP has not yet prepared node for application use (server_errno=1047)"); +call mtr.add_suppression("Error reading packet from server: WSREP has not yet prepared node for application use \\(server_errno ?= ?1047\\)"); START SLAVE; include/wait_for_slave_param.inc [Slave_IO_Running] connection node_1; diff --git a/mysql-test/suite/galera/r/galera_2primary_replica.result b/mysql-test/suite/galera/r/galera_2primary_replica.result index 8bdbf5be962..9901caa9eb6 100644 --- a/mysql-test/suite/galera/r/galera_2primary_replica.result +++ b/mysql-test/suite/galera/r/galera_2primary_replica.result @@ -13,10 +13,13 @@ grant all on *.* to repl2@'%'; connect replica, 127.0.0.1, root, , test, $NODE_MYPORT_1; connection replica; connection node_2; +connection primary1; +connection primary2; connection replica; # Galera replica changing master to primary1 -SET @@default_master_connection='stream2'; +SET @@default_master_connection='stream1'; # Primary node changing master to primary2 +SET @@default_master_connection='stream2'; START ALL SLAVES; Warnings: Note 1937 SLAVE 'stream1' started diff --git a/mysql-test/suite/galera/r/galera_bf_kill.result b/mysql-test/suite/galera/r/galera_bf_kill.result index 71b0366081b..e6ddf3fc3c5 100644 --- a/mysql-test/suite/galera/r/galera_bf_kill.result +++ b/mysql-test/suite/galera/r/galera_bf_kill.result @@ -1,10 +1,12 @@ connection node_2; connection node_1; connection node_2; +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); CREATE TABLE t1(a int not null primary key auto_increment,b int) engine=InnoDB; insert into t1 values (NULL,1); connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; connection node_2a; +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); begin; update t1 set a = 5; connection node_2; diff --git a/mysql-test/suite/galera/r/galera_bf_lock_wait.result b/mysql-test/suite/galera/r/galera_bf_lock_wait.result index 9e5cb2d9266..590fcea2997 100644 --- a/mysql-test/suite/galera/r/galera_bf_lock_wait.result +++ b/mysql-test/suite/galera/r/galera_bf_lock_wait.result @@ -1,8 +1,10 @@ connection node_2; connection node_1; connection node_2; +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); call mtr.add_suppression("WSREP: Trying to continue unpaused monitor"); connection node_1; +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); call mtr.add_suppression("WSREP: Trying to continue unpaused monitor"); CREATE TABLE t1 ENGINE=InnoDB select 1 as a, 1 as b union select 2, 2; ALTER TABLE t1 add primary key(a); diff --git a/mysql-test/suite/galera/r/galera_binlog_checksum.result b/mysql-test/suite/galera/r/galera_binlog_checksum.result index 3ef7cf5c41e..d0e7bdcb2ba 100644 --- a/mysql-test/suite/galera/r/galera_binlog_checksum.result +++ b/mysql-test/suite/galera/r/galera_binlog_checksum.result @@ -27,5 +27,4 @@ i 1 connection node_1; DROP TABLE t1; -SET @@global.wsrep_replicate_myisam=0; # End of tests. diff --git a/mysql-test/suite/galera/r/galera_circular_replication.result b/mysql-test/suite/galera/r/galera_circular_replication.result index 72340977005..0094283d40b 100644 --- a/mysql-test/suite/galera/r/galera_circular_replication.result +++ b/mysql-test/suite/galera/r/galera_circular_replication.result @@ -12,6 +12,7 @@ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; connection replica1; connection node_2; connection primary2; +connection primary1; connection replica1; # Galera replica changing master to primary1 START SLAVE; diff --git a/mysql-test/suite/galera/r/galera_flush_local.result b/mysql-test/suite/galera/r/galera_flush_local.result index 146833fc3c8..2b5384c6881 100644 --- a/mysql-test/suite/galera/r/galera_flush_local.result +++ b/mysql-test/suite/galera/r/galera_flush_local.result @@ -64,18 +64,18 @@ test.x2 repair status OK connection node_2; wsrep_last_committed_diff 1 -SELECT COUNT(*) = 10 FROM t1; -COUNT(*) = 10 -1 -SELECT COUNT(*) = 10 FROM x1; -COUNT(*) = 10 -1 -SELECT COUNT(*) = 10000 FROM t2; -COUNT(*) = 10000 -1 -SELECT COUNT(*) = 10 FROM x2; -COUNT(*) = 10 -1 +SELECT COUNT(*) AS EXPECT_10 FROM t1; +EXPECT_10 +10 +SELECT COUNT(*) AS EXPECT_10 FROM x1; +EXPECT_10 +10 +SELECT COUNT(*) AS EXPECT_10000 FROM t2; +EXPECT_10000 +10000 +SELECT COUNT(*) AS EXPECT_10 FROM x2; +EXPECT_10 +10 connection node_1; DROP TABLE t1, t2, x1, x2; CREATE TABLE t1 (f1 INTEGER); @@ -143,18 +143,18 @@ wsrep_last_committed_diff 1 wsrep_last_committed_diff2 1 -SELECT COUNT(*) = 10 FROM t1; -COUNT(*) = 10 -1 -SELECT COUNT(*) = 10 FROM x1; -COUNT(*) = 10 -1 -SELECT COUNT(*) = 10000 FROM t2; -COUNT(*) = 10000 -1 -SELECT COUNT(*) = 10 FROM x2; -COUNT(*) = 10 -1 +SELECT COUNT(*) AS EXPECT_10 FROM t1; +EXPECT_10 +10 +SELECT COUNT(*) AS EXPECT_10 FROM x1; +EXPECT_10 +10 +SELECT COUNT(*) AS EXPECT_10000 FROM t2; +EXPECT_10000 +10000 +SELECT COUNT(*) AS EXPECT_10 FROM x2; +EXPECT_10 +10 connection node_1; set wsrep_on=1; DROP TABLE t1, t2, x1, x2; diff --git a/mysql-test/suite/galera/r/galera_ist_mysqldump.result b/mysql-test/suite/galera/r/galera_ist_mysqldump.result index 8737819e552..3a5647c1893 100644 --- a/mysql-test/suite/galera/r/galera_ist_mysqldump.result +++ b/mysql-test/suite/galera/r/galera_ist_mysqldump.result @@ -1,5 +1,8 @@ connection node_2; connection node_1; +call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to "); +connection node_1; +connection node_2; Setting SST method to mysqldump ... call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to '127\\.0\\.0\\.1'"); call mtr.add_suppression("Failed to load slave replication state from table mysql\\.gtid_slave_pos"); @@ -9,9 +12,6 @@ GRANT ALL PRIVILEGES ON *.* TO 'sst'; SET GLOBAL wsrep_sst_auth = 'sst:'; connection node_2; SET GLOBAL wsrep_sst_method = 'mysqldump'; -call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to "); -connection node_1; -connection node_2; Performing State Transfer on a server that has been shut down cleanly and restarted connection node_1; CREATE TABLE t1 (id int not null primary key,f1 CHAR(255)) ENGINE=InnoDB; diff --git a/mysql-test/suite/galera/r/galera_restart_replica.result b/mysql-test/suite/galera/r/galera_restart_replica.result index efc9a83a168..1691f9822a8 100644 --- a/mysql-test/suite/galera/r/galera_restart_replica.result +++ b/mysql-test/suite/galera/r/galera_restart_replica.result @@ -7,6 +7,7 @@ grant all on *.* to repl@'%'; ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; connection node_1; connection replica; +connection primary; connection replica; START SLAVE; connection primary; diff --git a/mysql-test/suite/galera/r/galera_slave_replay.result b/mysql-test/suite/galera/r/galera_slave_replay.result index 263e1a675d5..19b562d76d4 100644 --- a/mysql-test/suite/galera/r/galera_slave_replay.result +++ b/mysql-test/suite/galera/r/galera_slave_replay.result @@ -1,7 +1,7 @@ -connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; -connection node_2a; connection node_2; connection node_1; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +connection node_2a; ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; connection node_3; diff --git a/mysql-test/suite/galera/r/galera_split_brain.result b/mysql-test/suite/galera/r/galera_split_brain.result index 374fb31afd1..b3b052b82ba 100644 --- a/mysql-test/suite/galera/r/galera_split_brain.result +++ b/mysql-test/suite/galera/r/galera_split_brain.result @@ -2,6 +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"); diff --git a/mysql-test/suite/galera/r/galera_ssl.result b/mysql-test/suite/galera/r/galera_ssl.result index ec3b717e3f3..b3f33112382 100644 --- a/mysql-test/suite/galera/r/galera_ssl.result +++ b/mysql-test/suite/galera/r/galera_ssl.result @@ -1,5 +1,8 @@ connection node_2; connection node_1; +SELECT COUNT(*) `expect 0` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE '%wsrep%'; +expect 0 +0 SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; VARIABLE_VALUE = 'Synced' 1 diff --git a/mysql-test/suite/galera/r/galera_ssl_compression.result b/mysql-test/suite/galera/r/galera_ssl_compression.result index 545f4babfe1..c5f7c65d303 100644 --- a/mysql-test/suite/galera/r/galera_ssl_compression.result +++ b/mysql-test/suite/galera/r/galera_ssl_compression.result @@ -1,5 +1,8 @@ connection node_2; connection node_1; +SELECT COUNT(*) `expect 0` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE '%wsrep%'; +expect 0 +0 SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; VARIABLE_VALUE = 'Synced' 1 diff --git a/mysql-test/suite/galera/r/galera_ssl_upgrade.result b/mysql-test/suite/galera/r/galera_ssl_upgrade.result index 9030850b67e..1b69d7b6980 100644 --- a/mysql-test/suite/galera/r/galera_ssl_upgrade.result +++ b/mysql-test/suite/galera/r/galera_ssl_upgrade.result @@ -1,5 +1,8 @@ connection node_2; connection node_1; +SELECT COUNT(*) `expect 0` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE '%wsrep%'; +expect 0 +0 connection node_1; connection node_2; connection node_1; diff --git a/mysql-test/suite/galera/r/galera_var_replicate_myisam_off.result b/mysql-test/suite/galera/r/galera_var_replicate_myisam_off.result index 8968f89d11b..66c2e8255be 100644 --- a/mysql-test/suite/galera/r/galera_var_replicate_myisam_off.result +++ b/mysql-test/suite/galera/r/galera_var_replicate_myisam_off.result @@ -4,9 +4,8 @@ SET GLOBAL wsrep_replicate_myisam = FALSE; CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=MyISAM; INSERT INTO t1 VALUES (1); connection node_2; -SELECT COUNT(*) = 0 FROM t1; -COUNT(*) = 0 -1 +SELECT COUNT(*) AS EXPECT_0 FROM t1; +EXPECT_0 +0 connection node_1; -SET GLOBAL wsrep_replicate_myisam = 0; DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result b/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result index 314da703e58..3e616552368 100644 --- a/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result +++ b/mysql-test/suite/galera/r/galera_var_replicate_myisam_on.result @@ -1,7 +1,6 @@ connection node_2; connection node_1; connection node_1; -connection node_1; SET GLOBAL wsrep_replicate_myisam = TRUE; connection node_2; SET GLOBAL wsrep_replicate_myisam = TRUE; @@ -11,9 +10,9 @@ INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (2), (3); INSERT INTO t1 SELECT 4 FROM DUAL UNION ALL SELECT 5 FROM DUAL; connection node_2; -SELECT COUNT(*) = 5 FROM t1; -COUNT(*) = 5 -1 +SELECT COUNT(*) AS EXPECT_5 FROM t1; +EXPECT_5 +5 DROP TABLE t1; connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 VARCHAR(100)) ENGINE=MyISAM; @@ -21,36 +20,36 @@ INSERT INTO t1 VALUES (1, 'abc'),(2,'abc'), (3, 'xxx'); REPLACE INTO t1 VALUES (1, 'klm'), (2,'xyz'); REPLACE INTO t1 SELECT 3, 'yyy' FROM DUAL; connection node_2; -SELECT COUNT(*) = 3 FROM t1; -COUNT(*) = 3 +SELECT COUNT(*) AS EXPECT_3 FROM t1; +EXPECT_3 +3 +SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 1 AND f2 = 'klm'; +EXPECT_1 1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1 AND f2 = 'klm'; -COUNT(*) = 1 +SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 2 AND f2 = 'xyz'; +EXPECT_1 1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2 AND f2 = 'xyz'; -COUNT(*) = 1 -1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 3 AND f2 = 'yyy'; -COUNT(*) = 1 +SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 3 AND f2 = 'yyy'; +EXPECT_1 1 connection node_1; UPDATE t1 SET f2 = 'zzz' WHERE f2 = 'yyy'; connection node_2; -SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'zzz'; -COUNT(*) = 1 +SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f2 = 'zzz'; +EXPECT_1 1 connection node_1; DELETE FROM t1 WHERE f2 = 'zzz'; connection node_2; -SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'zzz'; -COUNT(*) = 0 -1 +SELECT COUNT(*) AS EXPECT_0 FROM t1 WHERE f2 = 'zzz'; +EXPECT_0 +0 connection node_1; TRUNCATE TABLE t1; connection node_2; -SELECT COUNT(*) = 0 FROM t1; -COUNT(*) = 0 -1 +SELECT COUNT(*) AS EXPECT_0 FROM t1; +EXPECT_0 +0 DROP TABLE t1; connection node_1; CREATE TABLE t1 (f1 INTEGER NOT NULL PRIMARY KEY) ENGINE=MyISAM; @@ -61,11 +60,11 @@ INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (1); COMMIT; connection node_2; -SELECT COUNT(*) = 1 FROM t1; -COUNT(*) = 1 +SELECT COUNT(*) AS EXPECT_1 FROM t1; +EXPECT_1 1 -SELECT COUNT(*) = 1 FROM t2; -COUNT(*) = 1 +SELECT COUNT(*) AS EXPECT_1 FROM t2; +EXPECT_1 1 connection node_1; START TRANSACTION; @@ -75,14 +74,13 @@ ROLLBACK; Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back connection node_2; -SELECT COUNT(*) = 2 FROM t1; -COUNT(*) = 2 +SELECT COUNT(*) AS EXPECT_2 FROM t1; +EXPECT_2 +2 +SELECT COUNT(*) AS EXPECT_1 FROM t2; +EXPECT_1 1 -SELECT COUNT(*) = 1 FROM t2; -COUNT(*) = 1 -1 -DROP TABLE t1; -DROP TABLE t2; +DROP TABLE t1, t2; connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=MyISAM; CREATE TABLE t2 (f2 INTEGER PRIMARY KEY) ENGINE=InnoDB; @@ -94,18 +92,7 @@ INSERT INTO t1 VALUES (1); ERROR 23000: Duplicate entry '1' for key 'PRIMARY' connection node_1; COMMIT; -DROP TABLE t1; -DROP TABLE t2; -# -# MDEV-11152: wsrep_replicate_myisam: SELECT gets replicated using TO -# -connection node_1; -CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=INNODB; -INSERT INTO t1 VALUES(1); -SELECT * FROM t1; -i -1 -DROP TABLE t1; +DROP TABLE t1, t2; connection node_1; CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY, b INT) ENGINE=MyISAM; INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10); @@ -236,10 +223,9 @@ id b DROP TRIGGER tr1; DROP TRIGGER tr2; DROP TRIGGER tr3; -DROP TABLE t1,t2; +DROP TABLE t1, t2; CREATE TABLE t1 (a INT, b INT, UNIQUE(a)) ENGINE=MyISAM; CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=1; -SET GLOBAL wsrep_replicate_myisam=ON; INSERT INTO t1 (a,b) VALUES (10,20); connection node_2; SELECT * from t1; @@ -247,4 +233,14 @@ a b 1 20 connection node_1; DROP TABLE t1; +# +# MDEV-11152: wsrep_replicate_myisam: SELECT gets replicated using TO +# +connection node_1; +CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=INNODB; +INSERT INTO t1 VALUES(1); +SELECT * FROM t1; +i +1 +DROP TABLE t1; connection node_2; diff --git a/mysql-test/suite/galera/r/galera_wan.result b/mysql-test/suite/galera/r/galera_wan.result index 1fa36456c4d..af5314635e6 100644 --- a/mysql-test/suite/galera/r/galera_wan.result +++ b/mysql-test/suite/galera/r/galera_wan.result @@ -2,7 +2,7 @@ connection node_2; connection node_1; CALL mtr.add_suppression("WSREP: Stray state UUID msg: "); CALL mtr.add_suppression("WSREP: .*Sending JOIN failed: "); -CALL mtr.add_suppression("WSREP: .*sending install message failed: Socket is not connected"); +CALL mtr.add_suppression("WSREP: .*sending install message failed: (Transport endpoint|Socket) is not connected"); CALL mtr.add_suppression("WSREP: .*There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 4 diff --git a/mysql-test/suite/galera/t/GCF-939.test b/mysql-test/suite/galera/t/GCF-939.test index a9b9077d5ef..c2fbfa8685e 100644 --- a/mysql-test/suite/galera/t/GCF-939.test +++ b/mysql-test/suite/galera/t/GCF-939.test @@ -3,6 +3,7 @@ # --source include/galera_cluster.inc +--source include/have_innodb.inc --exec rm -rf $MYSQLTEST_VARDIR/mysqld.2/data/GRA_*.log @@ -30,5 +31,6 @@ SELECT * FROM t1; DROP TABLE t1; CALL mtr.add_suppression("Ignoring error 'Unknown table 'test\\.t1'' on query"); + --connection node_2 CALL mtr.add_suppression("Error 'Unknown table 'test\\.t1'' on query"); diff --git a/mysql-test/suite/galera/t/MDEV-26266.test b/mysql-test/suite/galera/t/MDEV-26266.test index 8560cb3c7b6..e9097a1d32e 100644 --- a/mysql-test/suite/galera/t/MDEV-26266.test +++ b/mysql-test/suite/galera/t/MDEV-26266.test @@ -33,5 +33,4 @@ INSERT INTO t2 VALUES (4); INSERT INTO t2 VALUES (5); --error ER_LOCK_DEADLOCK CREATE VIEW v1 AS SELECT c1 FROM t1 WHERE c1 IN (SELECT a FROM t2) GROUP BY c1; - DROP TABLE t1,t2; diff --git a/mysql-test/suite/galera/t/MDEV-28053.test b/mysql-test/suite/galera/t/MDEV-28053.test index f3d7a775454..d4e93e95845 100644 --- a/mysql-test/suite/galera/t/MDEV-28053.test +++ b/mysql-test/suite/galera/t/MDEV-28053.test @@ -39,6 +39,7 @@ while ($counter) { --disable_result_log --eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3; START SLAVE; + --eval SELECT MASTER_GTID_WAIT('$gtid', 600) --enable_result_log --enable_query_log diff --git a/mysql-test/suite/galera/t/MDEV-6860.test b/mysql-test/suite/galera/t/MDEV-6860.test index e254dbceeeb..19b9e9cdd7c 100644 --- a/mysql-test/suite/galera/t/MDEV-6860.test +++ b/mysql-test/suite/galera/t/MDEV-6860.test @@ -4,7 +4,7 @@ --connection node_2 --disable_query_log ---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3, MASTER_USE_GTID=slave_pos; +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_3, master_use_gtid=slave_pos; --enable_query_log START SLAVE; diff --git a/mysql-test/suite/galera/t/MW-284.test b/mysql-test/suite/galera/t/MW-284.test index bc630912d57..2c2102655ea 100644 --- a/mysql-test/suite/galera/t/MW-284.test +++ b/mysql-test/suite/galera/t/MW-284.test @@ -2,15 +2,16 @@ # MW-284 Slave I/O retry on ER_COM_UNKNOWN_ERROR # ---source include/have_log_bin.inc --source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_log_bin.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 call mtr.add_suppression("\\[ERROR\\] Error reading packet from server: WSREP has not yet prepared node for application use "); call mtr.add_suppression("WSREP has not yet prepared node for application use"); --disable_query_log ---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_1, MASTER_USER='root', MASTER_CONNECT_RETRY=1; +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1, master_connect_retry=1; --enable_query_log --connection node_1 @@ -29,7 +30,7 @@ SET global wsrep_sync_wait=0; --connection node_3 SELECT @@wsrep_on; --sleep 1 -call mtr.add_suppression("Error reading packet from server: WSREP has not yet prepared node for application use (server_errno=1047)"); +call mtr.add_suppression("Error reading packet from server: WSREP has not yet prepared node for application use \\(server_errno ?= ?1047\\)"); START SLAVE; --let $slave_param= Slave_IO_Running --let $slave_param_value= Connecting diff --git a/mysql-test/suite/galera/t/galera_2primary_replica.test b/mysql-test/suite/galera/t/galera_2primary_replica.test index fb57c6637d0..e31bc7859fa 100644 --- a/mysql-test/suite/galera/t/galera_2primary_replica.test +++ b/mysql-test/suite/galera/t/galera_2primary_replica.test @@ -41,17 +41,19 @@ grant all on *.* to repl2@'%'; --let $node_1 = replica --let $node_2 = node_2 +--let $node_3 = primary1 +--let $node_4 = primary2 --source include/auto_increment_offset_save.inc --connection replica --echo # Galera replica changing master to primary1 ---disable_query_log SET @@default_master_connection='stream1'; +--disable_query_log --eval CHANGE MASTER 'stream1' 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 -SET @@default_master_connection='stream2'; --echo # Primary node changing master to primary2 +SET @@default_master_connection='stream2'; --disable_query_log --eval CHANGE MASTER 'stream2' TO master_host='127.0.0.1', master_user='repl2', master_password='repl2', master_port=$NODE_MYPORT_4, master_use_gtid=slave_pos; --enable_query_log diff --git a/mysql-test/suite/galera/t/galera_as_slave_nonprim.test b/mysql-test/suite/galera/t/galera_as_slave_nonprim.test index 42414761e62..a45d3fd8b6f 100644 --- a/mysql-test/suite/galera/t/galera_as_slave_nonprim.test +++ b/mysql-test/suite/galera/t/galera_as_slave_nonprim.test @@ -17,9 +17,10 @@ --connection node_2 --disable_query_log ---eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_4, MASTER_USER='root'; +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_4; --enable_query_log START SLAVE; + SET SESSION wsrep_sync_wait = 0; --connection node_4 diff --git a/mysql-test/suite/galera/t/galera_bf_kill.test b/mysql-test/suite/galera/t/galera_bf_kill.test index 6947733bb24..b59eef11cd3 100644 --- a/mysql-test/suite/galera/t/galera_bf_kill.test +++ b/mysql-test/suite/galera/t/galera_bf_kill.test @@ -7,11 +7,13 @@ # --connection node_2 +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); CREATE TABLE t1(a int not null primary key auto_increment,b int) engine=InnoDB; insert into t1 values (NULL,1); --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 --connection node_2a +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); begin; update t1 set a = 5; diff --git a/mysql-test/suite/galera/t/galera_bf_lock_wait.test b/mysql-test/suite/galera/t/galera_bf_lock_wait.test index 9ad3bbc36c6..d7832c59ebf 100644 --- a/mysql-test/suite/galera/t/galera_bf_lock_wait.test +++ b/mysql-test/suite/galera/t/galera_bf_lock_wait.test @@ -3,9 +3,11 @@ --source include/big_test.inc --connection node_2 +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); call mtr.add_suppression("WSREP: Trying to continue unpaused monitor"); --connection node_1 +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); call mtr.add_suppression("WSREP: Trying to continue unpaused monitor"); CREATE TABLE t1 ENGINE=InnoDB select 1 as a, 1 as b union select 2, 2; diff --git a/mysql-test/suite/galera/t/galera_binlog_checksum.test b/mysql-test/suite/galera/t/galera_binlog_checksum.test index 09d7a02f312..79588358e0f 100644 --- a/mysql-test/suite/galera/t/galera_binlog_checksum.test +++ b/mysql-test/suite/galera/t/galera_binlog_checksum.test @@ -38,6 +38,9 @@ SELECT * FROM t1; --connection node_1 DROP TABLE t1; + +--disable_query_log eval SET @@global.wsrep_replicate_myisam=$wsrep_replicate_myisam_saved; +--enable_query_log --echo # End of tests. diff --git a/mysql-test/suite/galera/t/galera_circular_replication.test b/mysql-test/suite/galera/t/galera_circular_replication.test index dbe85da4b23..312def70e06 100644 --- a/mysql-test/suite/galera/t/galera_circular_replication.test +++ b/mysql-test/suite/galera/t/galera_circular_replication.test @@ -45,6 +45,7 @@ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; --let $node_1 = replica1 --let $node_2 = node_2 --let $node_3 = primary2 +--let $node_4 = primary1 --source include/auto_increment_offset_save.inc --connection replica1 diff --git a/mysql-test/suite/galera/t/galera_defaults.test b/mysql-test/suite/galera/t/galera_defaults.test index c43dbe7a705..82b30215481 100644 --- a/mysql-test/suite/galera/t/galera_defaults.test +++ b/mysql-test/suite/galera/t/galera_defaults.test @@ -13,7 +13,7 @@ --source include/force_restart.inc # Make sure that the test is operating on the right version of galera library. ---let $galera_version=26.4.11 +--let $galera_version=26.4.21 source ../wsrep/include/check_galera_version.inc; # Global Variables diff --git a/mysql-test/suite/galera/t/galera_fk_truncate.cnf b/mysql-test/suite/galera/t/galera_fk_truncate.cnf new file mode 100644 index 00000000000..91e9199b092 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_fk_truncate.cnf @@ -0,0 +1,9 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +auto_increment_offset=1 +auto_increment_increment=1 + +[mysqld.2] +auto_increment_offset=2 +auto_increment_increment=1 diff --git a/mysql-test/suite/galera/t/galera_flush_local.test b/mysql-test/suite/galera/t/galera_flush_local.test index 24acd9ec4ff..0432196fe4a 100644 --- a/mysql-test/suite/galera/t/galera_flush_local.test +++ b/mysql-test/suite/galera/t/galera_flush_local.test @@ -68,11 +68,10 @@ REPAIR LOCAL TABLE x1, x2; --eval SELECT $wsrep_last_committed_after = $wsrep_last_committed_before AS wsrep_last_committed_diff; --enable_query_log -SELECT COUNT(*) = 10 FROM t1; -SELECT COUNT(*) = 10 FROM x1; -SELECT COUNT(*) = 10000 FROM t2; -SELECT COUNT(*) = 10 FROM x2; - +SELECT COUNT(*) AS EXPECT_10 FROM t1; +SELECT COUNT(*) AS EXPECT_10 FROM x1; +SELECT COUNT(*) AS EXPECT_10000 FROM t2; +SELECT COUNT(*) AS EXPECT_10 FROM x2; --connection node_1 DROP TABLE t1, t2, x1, x2; @@ -133,10 +132,10 @@ REPAIR TABLE x1, x2; --eval SELECT $wsrep_last_committed_after2 = $wsrep_last_committed_before + 9 AS wsrep_last_committed_diff2; --enable_query_log -SELECT COUNT(*) = 10 FROM t1; -SELECT COUNT(*) = 10 FROM x1; -SELECT COUNT(*) = 10000 FROM t2; -SELECT COUNT(*) = 10 FROM x2; +SELECT COUNT(*) AS EXPECT_10 FROM t1; +SELECT COUNT(*) AS EXPECT_10 FROM x1; +SELECT COUNT(*) AS EXPECT_10000 FROM t2; +SELECT COUNT(*) AS EXPECT_10 FROM x2; --connection node_1 set wsrep_on=1; diff --git a/mysql-test/suite/galera/t/galera_gcache_recover.cnf b/mysql-test/suite/galera/t/galera_gcache_recover.cnf index d1bea184e3e..0b4cba4ee2c 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover.cnf +++ b/mysql-test/suite/galera/t/galera_gcache_recover.cnf @@ -1,7 +1,7 @@ !include ../galera_2nodes.cnf [mysqld.1] -wsrep_provider_options='gcache.recover=yes;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S' +wsrep_provider_options='gcache.recover=yes;gcache.size=128M;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;pc.wait_prim_timeout=PT60S' [mysqld.2] -wsrep_provider_options='gcache.recover=yes;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S' +wsrep_provider_options='gcache.recover=yes;gcache.size=128M;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;pc.wait_prim_timeout=PT60S' diff --git a/mysql-test/suite/galera/t/galera_gcache_recover.test b/mysql-test/suite/galera/t/galera_gcache_recover.test index fe2a65ee14e..b7ef486ae31 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover.test +++ b/mysql-test/suite/galera/t/galera_gcache_recover.test @@ -3,6 +3,7 @@ # --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/big_test.inc CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; diff --git a/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.cnf b/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.cnf index fee9d154817..1d64266a395 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.cnf +++ b/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.cnf @@ -3,7 +3,7 @@ [mysqld.1] max_allowed_packet=10M innodb_log_file_size=220M -wsrep_provider_options='gcache.recover=yes;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_provider_options='gcache.recover=yes;gcache.size=10M;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;pc.wait_prim_timeout=PT60S' [mysqld.2] -wsrep_provider_options='gcache.recover=yes;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' +wsrep_provider_options='gcache.recover=yes;gcache.size=10M;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;pc.wait_prim_timeout=PT60S' diff --git a/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test b/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test index 6b3e56d8a0f..99a5e621c08 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test +++ b/mysql-test/suite/galera/t/galera_gcache_recover_full_gcache.test @@ -3,6 +3,7 @@ # --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/big_test.inc SET SESSION wsrep_sync_wait = 0; diff --git a/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.cnf b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.cnf index c6432f3607e..99d144a563e 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.cnf +++ b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.cnf @@ -2,8 +2,8 @@ [mysqld.1] innodb_log_file_size=220M -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.recover=yes;pc.ignore_sb=true;' +wsrep_provider_options='gcache.recover=yes;gcache.size=128M;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;pc.wait_prim_timeout=PT60S' [mysqld.2] innodb_log_file_size=220M -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.recover=yes;pc.ignore_sb=true;' +wsrep_provider_options='gcache.recover=yes;gcache.size=128M;pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;pc.wait_prim_timeout=PT60S' diff --git a/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test index 3834607ce86..3c250077911 100644 --- a/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test +++ b/mysql-test/suite/galera/t/galera_gcache_recover_manytrx.test @@ -5,6 +5,7 @@ --source include/galera_cluster.inc --source include/big_test.inc +--source include/have_innodb.inc --source include/have_log_bin.inc SET SESSION wsrep_sync_wait = 0; diff --git a/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test index 0f68a02426e..e1ef2b4c20b 100644 --- a/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test +++ b/mysql-test/suite/galera/t/galera_gtid_slave_sst_rsync.test @@ -13,6 +13,7 @@ # 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 + --echo #Connection 2 --connection node_2 --disable_query_log @@ -30,6 +31,7 @@ INSERT INTO t2 VALUES(3,33); SELECT @@global.gtid_binlog_state; --source include/save_master_gtid.inc + --echo #Connection 2 --connection node_2 --source include/sync_with_master_gtid.inc @@ -39,6 +41,7 @@ INSERT INTO t2 VALUES(4,44); INSERT INTO t2 VALUES(5,55); INSERT INTO t2 VALUES(6,66); SELECT @@global.gtid_binlog_state; + --echo #Connection 1 --connection node_1 --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME= 't2'; @@ -60,6 +63,7 @@ INSERT INTO t1 VALUES ('node1_committed_before'); INSERT INTO t1 VALUES ('node1_committed_before'); COMMIT; --source include/save_master_gtid.inc + --echo #Connection 2 --connection node_2 --source include/sync_with_master_gtid.inc @@ -68,6 +72,7 @@ START TRANSACTION; INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; + --echo #Connection 1 --connection node_1 --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME= 't1'; @@ -77,10 +82,12 @@ COMMIT; --let $node_1= node_1 --let $node_2= node_2 --source include/auto_increment_offset_save.inc + --echo #Connection 2 --connection node_2 --echo Shutting down server ... --source include/shutdown_mysqld.inc + --echo #Connection 1 --connection node_1 --let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' @@ -90,6 +97,7 @@ START TRANSACTION; INSERT INTO t1 VALUES ('node1_committed_during'); INSERT INTO t1 VALUES ('node1_committed_during'); COMMIT; + --echo #Connection 2 --connection node_2 --echo Starting server ... @@ -103,11 +111,13 @@ START TRANSACTION; INSERT INTO t1 VALUES ('node2_committed_after'); INSERT INTO t1 VALUES ('node2_committed_after'); COMMIT; + --echo #Connection 1 --connection node_1 --let $wait_condition = SELECT COUNT(*) = 8 FROM t1; --source include/wait_condition.inc Select * from t1 order by f1; + --echo #Connection 2 --connection node_2 Select * from t1 order by f1; @@ -153,12 +163,14 @@ start slave; INSERT INTO t1 VALUES ('node2_slave_started'); SELECT count(*) from t1; SELECT @@global.gtid_binlog_state; + --echo #Connection 1 --connection node_1 --let $wait_condition = SELECT COUNT(*) = 12 FROM t1; --source include/wait_condition.inc SELECT count(*) from t1; SELECT @@global.gtid_binlog_state; + --echo #Connection 3 --connection node_3 DROP TABLE t2,t1; @@ -173,10 +185,12 @@ DROP TABLE t2,t1; --connection node_2 --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't2'; --source include/wait_condition.inc + --echo #Connection 1 --connection node_1 --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; --source include/wait_condition.inc + --echo #Connection 2 --connection node_2 STOP SLAVE; @@ -194,6 +208,7 @@ set global gtid_slave_pos=""; set global wsrep_on=OFF; reset master; set global wsrep_on=ON; + --echo #Connection 3 --connection node_3 reset master; diff --git a/mysql-test/suite/galera/t/galera_ist_mysqldump.test b/mysql-test/suite/galera/t/galera_ist_mysqldump.test index 73b406d016b..71be0919483 100644 --- a/mysql-test/suite/galera/t/galera_ist_mysqldump.test +++ b/mysql-test/suite/galera/t/galera_ist_mysqldump.test @@ -2,14 +2,14 @@ --source include/galera_cluster.inc --source include/have_innodb.inc ---source suite/galera/include/galera_sst_set_mysqldump.inc - call mtr.add_suppression("WSREP: wsrep_sst_method is set to 'mysqldump' yet mysqld bind_address is set to "); --let $node_1=node_1 --let $node_2=node_2 --source include/auto_increment_offset_save.inc +--source suite/galera/include/galera_sst_set_mysqldump.inc + # mysql-wsrep#33 - nnoDB: Failing assertion: xid_seqno > trx_sys_cur_xid_seqno in trx_sys_update_wsrep_checkpoint with mysqldump IST # --source suite/galera/include/galera_st_disconnect_slave.inc diff --git a/mysql-test/suite/galera/t/galera_kill_smallchanges.test b/mysql-test/suite/galera/t/galera_kill_smallchanges.test index 15e1727de03..bb1e76b5d7d 100644 --- a/mysql-test/suite/galera/t/galera_kill_smallchanges.test +++ b/mysql-test/suite/galera/t/galera_kill_smallchanges.test @@ -3,6 +3,7 @@ # --source include/galera_cluster.inc +--source include/have_innodb.inc # Save original auto_increment_offset values. --let $node_1=node_1 diff --git a/mysql-test/suite/galera/t/galera_many_rows.test b/mysql-test/suite/galera/t/galera_many_rows.test index 3623b3f33b0..0c2d974561a 100644 --- a/mysql-test/suite/galera/t/galera_many_rows.test +++ b/mysql-test/suite/galera/t/galera_many_rows.test @@ -1,5 +1,6 @@ --source include/big_test.inc --source include/galera_cluster.inc +--source include/have_innodb.inc # Save original auto_increment_offset values. --let $node_1=node_1 diff --git a/mysql-test/suite/galera/t/galera_query_cache_invalidate.test b/mysql-test/suite/galera/t/galera_query_cache_invalidate.test index b5560c54253..cafb223762a 100644 --- a/mysql-test/suite/galera/t/galera_query_cache_invalidate.test +++ b/mysql-test/suite/galera/t/galera_query_cache_invalidate.test @@ -29,7 +29,7 @@ call mtr.add_suppression("WSREP: Ignoring server id .* for non bootstrap node"); --connection node_3 --disable_query_log ---eval CHANGE MASTER TO master_host='127.0.0.1', master_user='root', MASTER_PORT=$NODE_MYPORT_1, master_use_gtid=current_pos +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1, master_use_gtid=current_pos; --enable_query_log START SLAVE; --source include/wait_for_slave_to_start.inc diff --git a/mysql-test/suite/galera/t/galera_restart_replica.test b/mysql-test/suite/galera/t/galera_restart_replica.test index 05ab77f2519..4c699433a0a 100644 --- a/mysql-test/suite/galera/t/galera_restart_replica.test +++ b/mysql-test/suite/galera/t/galera_restart_replica.test @@ -40,6 +40,7 @@ ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; --let $node_1 = node_1 --let $node_2 = replica +--let $node_3 = primary --source include/auto_increment_offset_save.inc --connection replica diff --git a/mysql-test/suite/galera/t/galera_slave_replay.test b/mysql-test/suite/galera/t/galera_slave_replay.test index d289cfb3bd2..84502f6d33a 100644 --- a/mysql-test/suite/galera/t/galera_slave_replay.test +++ b/mysql-test/suite/galera/t/galera_slave_replay.test @@ -6,6 +6,7 @@ # or rollback and replay (depending on the nature of lock conflict). # +--source include/galera_cluster.inc --source include/have_innodb.inc --source include/have_log_bin.inc --source include/have_debug.inc @@ -13,9 +14,7 @@ --source include/galera_have_debug_sync.inc --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 - --connection node_2a ---source include/galera_cluster.inc ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; diff --git a/mysql-test/suite/galera/t/galera_split_brain.test b/mysql-test/suite/galera/t/galera_split_brain.test index b1ea9c9b4ab..bb6a4c8e648 100644 --- a/mysql-test/suite/galera/t/galera_split_brain.test +++ b/mysql-test/suite/galera/t/galera_split_brain.test @@ -13,6 +13,7 @@ --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 diff --git a/mysql-test/suite/galera/t/galera_ssl.test b/mysql-test/suite/galera/t/galera_ssl.test index e6346aa2151..984fca6ab96 100644 --- a/mysql-test/suite/galera/t/galera_ssl.test +++ b/mysql-test/suite/galera/t/galera_ssl.test @@ -9,6 +9,10 @@ --source include/galera_cluster.inc --source include/have_innodb.inc --source include/big_test.inc +--source include/have_perfschema.inc + +# Verify that SSL is handled by the provider. +SELECT COUNT(*) `expect 0` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE '%wsrep%'; SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; diff --git a/mysql-test/suite/galera/t/galera_ssl_compression.test b/mysql-test/suite/galera/t/galera_ssl_compression.test index 1df4aa26ebb..8d9dcbd6ced 100644 --- a/mysql-test/suite/galera/t/galera_ssl_compression.test +++ b/mysql-test/suite/galera/t/galera_ssl_compression.test @@ -8,6 +8,10 @@ --source include/galera_cluster.inc --source include/have_innodb.inc --source include/big_test.inc +--source include/have_perfschema.inc + +# Verify that SSL is handled by the provider. +SELECT COUNT(*) `expect 0` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE '%wsrep%'; SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; diff --git a/mysql-test/suite/galera/t/galera_ssl_upgrade.test b/mysql-test/suite/galera/t/galera_ssl_upgrade.test index 78897ffd738..f86aa3730f3 100644 --- a/mysql-test/suite/galera/t/galera_ssl_upgrade.test +++ b/mysql-test/suite/galera/t/galera_ssl_upgrade.test @@ -10,6 +10,9 @@ --source include/have_openssl.inc --source include/force_restart.inc +# Verify that SSL is handled by the provider. +SELECT COUNT(*) `expect 0` FROM performance_schema.socket_instances WHERE EVENT_NAME LIKE '%wsrep%'; + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera/t/galera_sync_wait_upto.test b/mysql-test/suite/galera/t/galera_sync_wait_upto.test index 56d5aac73a7..4aba69f6152 100644 --- a/mysql-test/suite/galera/t/galera_sync_wait_upto.test +++ b/mysql-test/suite/galera/t/galera_sync_wait_upto.test @@ -3,6 +3,7 @@ # --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_debug.inc CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; diff --git a/mysql-test/suite/galera/t/galera_threadpool.test b/mysql-test/suite/galera/t/galera_threadpool.test index 78b26e6e89f..e5d2db15bec 100644 --- a/mysql-test/suite/galera/t/galera_threadpool.test +++ b/mysql-test/suite/galera/t/galera_threadpool.test @@ -5,7 +5,6 @@ --let $node_1 = node_1 --let $node_2 = node_2 - --source ../galera/include/auto_increment_offset_save.inc # diff --git a/mysql-test/suite/galera/t/galera_var_replicate_myisam_off.test b/mysql-test/suite/galera/t/galera_var_replicate_myisam_off.test index 1261963520c..2056d4d6785 100644 --- a/mysql-test/suite/galera/t/galera_var_replicate_myisam_off.test +++ b/mysql-test/suite/galera/t/galera_var_replicate_myisam_off.test @@ -12,9 +12,11 @@ CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=MyISAM; INSERT INTO t1 VALUES (1); --connection node_2 -SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) AS EXPECT_0 FROM t1; --connection node_1 +--disable_query_log --eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig +--enable_query_log DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test b/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test index 0a364452576..ad0a7a37d63 100644 --- a/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test +++ b/mysql-test/suite/galera/t/galera_var_replicate_myisam_on.test @@ -5,7 +5,6 @@ --source include/galera_cluster.inc --source include/have_innodb.inc ---connection node_1 --let $wsrep_replicate_myisam_orig = `SELECT @@wsrep_replicate_myisam` --connection node_1 @@ -24,7 +23,7 @@ INSERT INTO t1 VALUES (2), (3); INSERT INTO t1 SELECT 4 FROM DUAL UNION ALL SELECT 5 FROM DUAL; --connection node_2 -SELECT COUNT(*) = 5 FROM t1; +SELECT COUNT(*) AS EXPECT_5 FROM t1; DROP TABLE t1; @@ -39,10 +38,10 @@ REPLACE INTO t1 VALUES (1, 'klm'), (2,'xyz'); REPLACE INTO t1 SELECT 3, 'yyy' FROM DUAL; --connection node_2 -SELECT COUNT(*) = 3 FROM t1; -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 1 AND f2 = 'klm'; -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2 AND f2 = 'xyz'; -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 3 AND f2 = 'yyy'; +SELECT COUNT(*) AS EXPECT_3 FROM t1; +SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 1 AND f2 = 'klm'; +SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 2 AND f2 = 'xyz'; +SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f1 = 3 AND f2 = 'yyy'; # # UPDATE @@ -52,7 +51,7 @@ SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 3 AND f2 = 'yyy'; UPDATE t1 SET f2 = 'zzz' WHERE f2 = 'yyy'; --connection node_2 -SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'zzz'; +SELECT COUNT(*) AS EXPECT_1 FROM t1 WHERE f2 = 'zzz'; # # DELETE @@ -62,7 +61,7 @@ SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'zzz'; DELETE FROM t1 WHERE f2 = 'zzz'; --connection node_2 -SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'zzz'; +SELECT COUNT(*) AS EXPECT_0 FROM t1 WHERE f2 = 'zzz'; # # TRUNCATE @@ -72,7 +71,7 @@ SELECT COUNT(*) = 0 FROM t1 WHERE f2 = 'zzz'; TRUNCATE TABLE t1; --connection node_2 -SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) AS EXPECT_0 FROM t1; DROP TABLE t1; # @@ -89,8 +88,8 @@ INSERT INTO t2 VALUES (1); COMMIT; --connection node_2 -SELECT COUNT(*) = 1 FROM t1; -SELECT COUNT(*) = 1 FROM t2; +SELECT COUNT(*) AS EXPECT_1 FROM t1; +SELECT COUNT(*) AS EXPECT_1 FROM t2; # # Transaction rollback @@ -103,11 +102,10 @@ INSERT INTO t2 VALUES (2); ROLLBACK; --connection node_2 -SELECT COUNT(*) = 2 FROM t1; -SELECT COUNT(*) = 1 FROM t2; +SELECT COUNT(*) AS EXPECT_2 FROM t1; +SELECT COUNT(*) AS EXPECT_1 FROM t2; -DROP TABLE t1; -DROP TABLE t2; +DROP TABLE t1, t2; # # Transaction conflict @@ -129,18 +127,7 @@ INSERT INTO t1 VALUES (1); --connection node_1 COMMIT; -DROP TABLE t1; -DROP TABLE t2; - ---echo # ---echo # MDEV-11152: wsrep_replicate_myisam: SELECT gets replicated using TO ---echo # ---connection node_1 -CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=INNODB; -INSERT INTO t1 VALUES(1); -# This command should not get replicated. -SELECT * FROM t1; -DROP TABLE t1; +DROP TABLE t1, t2; # # Test prepared staments @@ -216,11 +203,10 @@ SELECT * FROM t2 ORDER BY id; DROP TRIGGER tr1; DROP TRIGGER tr2; DROP TRIGGER tr3; -DROP TABLE t1,t2; +DROP TABLE t1, t2; CREATE TABLE t1 (a INT, b INT, UNIQUE(a)) ENGINE=MyISAM; CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW SET NEW.a=1; -SET GLOBAL wsrep_replicate_myisam=ON; INSERT INTO t1 (a,b) VALUES (10,20); --connection node_2 @@ -228,6 +214,16 @@ SELECT * from t1; --connection node_1 DROP TABLE t1; +--echo # +--echo # MDEV-11152: wsrep_replicate_myisam: SELECT gets replicated using TO +--echo # +--connection node_1 +CREATE TABLE t1 (i INT NOT NULL PRIMARY KEY) ENGINE=INNODB; +INSERT INTO t1 VALUES(1); +# This command should not get replicated. +SELECT * FROM t1; +DROP TABLE t1; + --disable_query_log --eval SET GLOBAL wsrep_replicate_myisam = $wsrep_replicate_myisam_orig --enable_query_log diff --git a/mysql-test/suite/galera/t/galera_wan.test b/mysql-test/suite/galera/t/galera_wan.test index d148569d2cc..8b90381c4aa 100644 --- a/mysql-test/suite/galera/t/galera_wan.test +++ b/mysql-test/suite/galera/t/galera_wan.test @@ -12,7 +12,7 @@ CALL mtr.add_suppression("WSREP: Stray state UUID msg: "); CALL mtr.add_suppression("WSREP: .*Sending JOIN failed: "); -CALL mtr.add_suppression("WSREP: .*sending install message failed: Socket is not connected"); +CALL mtr.add_suppression("WSREP: .*sending install message failed: (Transport endpoint|Socket) is not connected"); CALL mtr.add_suppression("WSREP: .*There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside"); --let $wait_condition = SELECT VARIABLE_VALUE = 4 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; diff --git a/mysql-test/suite/galera/t/mysql-wsrep#198.test b/mysql-test/suite/galera/t/mysql-wsrep#198.test index dceae6e17e9..98dea684f0d 100644 --- a/mysql-test/suite/galera/t/mysql-wsrep#198.test +++ b/mysql-test/suite/galera/t/mysql-wsrep#198.test @@ -20,7 +20,7 @@ LOCK TABLE t2 WRITE; --connection node_2 SET SESSION wsrep_sync_wait = 0; ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'; +--let $wait_condition = SELECT COUNT(*) BETWEEN 1 AND 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for table metadata lock%' OR STATE LIKE 'Waiting to execute in isolation%'; --let $wait_condition_on_error_output = SELECT * FROM INFORMATION_SCHEMA.PROCESSLIST --source include/wait_condition_with_debug_and_kill.inc diff --git a/mysql-test/suite/galera_3nodes/r/galera_garbd_backup.result b/mysql-test/suite/galera_3nodes/r/galera_garbd_backup.result index fdf3f5abde0..7d55b36ce0b 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_garbd_backup.result +++ b/mysql-test/suite/galera_3nodes/r/galera_garbd_backup.result @@ -1,7 +1,6 @@ connection node_2; connection node_1; connection node_1; -connection node_1; connection node_2; connection node_3; connection node_1; diff --git a/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result b/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result index 124b9d1976e..7177f9bf312 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result +++ b/mysql-test/suite/galera_3nodes/r/galera_vote_rejoin_mysqldump.result @@ -57,7 +57,6 @@ Table Create Table t1 CREATE TABLE `t1` ( `f1` int(11) DEFAULT NULL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci -CALL mtr.add_suppression("is inconsistent with group"); connection node_3; SHOW CREATE TABLE t1; Table Create Table @@ -80,4 +79,5 @@ CALL mtr.add_suppression("Native table .* has the wrong structure"); CALL mtr.add_suppression("Table 'mysql\\.gtid_slave_pos' doesn't exist"); connection node_2; # restart +CALL mtr.add_suppression("WSREP: .+ is inconsistent with group"); connection node_1; diff --git a/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.test b/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.test index d1d8e643d8e..d9683083da1 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.test +++ b/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.test @@ -10,18 +10,16 @@ --source include/have_debug.inc --source include/have_debug_sync.inc ---connection node_1 -# Save original auto_increment_offset values. ---let $node_1=node_1 ---let $node_2=node_2 ---let $node_3=node_3 - --let $galera_connection_name = node_3 --let $galera_server_number = 3 --source include/galera_connect.inc --source suite/galera/include/galera_base_port.inc --let $NODE_GALERAPORT_3 = $_NODE_GALERAPORT +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 --source ../galera/include/auto_increment_offset_save.inc # Save galera ports diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test b/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test index 7020400e5ea..a8c1c1d6328 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test +++ b/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test @@ -17,7 +17,6 @@ call mtr.add_suppression("WSREP: gcs/src/gcs_core\\.cpp:core_handle_uuid_msg\\(\ --let $node_1 = node_1 --let $node_2 = node_2 --let $node_3 = node_3 - --source ../galera/include/auto_increment_offset_save.inc --connection node_1 diff --git a/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test index 71ca82be1d5..8c2f659aa26 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test +++ b/mysql-test/suite/galera_3nodes/t/galera_safe_to_bootstrap.test @@ -14,7 +14,6 @@ --let $node_1 = node_1 --let $node_2 = node_2 --let $node_3 = node_3 - --source ../galera/include/auto_increment_offset_save.inc --connection node_1 diff --git a/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test b/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test index 6c7b255bdc3..a0837db3a4b 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test +++ b/mysql-test/suite/galera_3nodes/t/galera_vote_rejoin_mysqldump.test @@ -69,7 +69,6 @@ SHOW CREATE TABLE t1; --connection node_2 SHOW CREATE TABLE t1; -CALL mtr.add_suppression("is inconsistent with group"); --connection node_3 SHOW CREATE TABLE t1; @@ -83,6 +82,7 @@ CALL mtr.add_suppression("Slave SQL: Error 'Can't DROP 'PRIMARY'; check that col # restart node so we don't fail on WSREP_START_POSITION internal check --source include/restart_mysqld.inc --source include/wait_until_connected_again.inc +CALL mtr.add_suppression("WSREP: .+ is inconsistent with group"); --connection node_1 --let $wait_condition = SELECT VARIABLE_VALUE = 3 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; diff --git a/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test index d6e20d3bbfb..cde888b2621 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test +++ b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema.test @@ -9,6 +9,7 @@ --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connection node_1 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema_init.test b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema_init.test index 9b0b5599709..de639e54bf1 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema_init.test +++ b/mysql-test/suite/galera_3nodes/t/galera_wsrep_schema_init.test @@ -10,6 +10,7 @@ --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connection node_1 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/r/MDEV-26707.result b/mysql-test/suite/galera_3nodes_sr/r/MDEV-26707.result index 9addd29b0ea..6891be559d8 100644 --- a/mysql-test/suite/galera_3nodes_sr/r/MDEV-26707.result +++ b/mysql-test/suite/galera_3nodes_sr/r/MDEV-26707.result @@ -2,7 +2,7 @@ connection node_2; connection node_1; connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; -connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; connect node_3a, 127.0.0.1, root, , test, $NODE_MYPORT_3; connection node_1; connection node_2; @@ -74,15 +74,15 @@ connection node_3a; SET SESSION wsrep_sync_wait = 0; SET SESSION wsrep_sync_wait = DEFAULT; connection node_1a; -SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; EXPECT_0 0 connection node_2a; -SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; EXPECT_0 0 connection node_3a; -SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; EXPECT_0 0 connection node_1; diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-817.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-817.test index a32da959429..73cb5624f0e 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/GCF-817.test +++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-817.test @@ -5,6 +5,7 @@ --source include/galera_cluster.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test b/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test index 700b3c38b6b..df446ebe541 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test +++ b/mysql-test/suite/galera_3nodes_sr/t/GCF-832.test @@ -7,6 +7,7 @@ --source include/force_restart.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/t/MDEV-26707.test b/mysql-test/suite/galera_3nodes_sr/t/MDEV-26707.test index a952b343d9f..86d31226979 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/MDEV-26707.test +++ b/mysql-test/suite/galera_3nodes_sr/t/MDEV-26707.test @@ -21,7 +21,7 @@ --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 --connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 ---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connect node_3a, 127.0.0.1, root, , test, $NODE_MYPORT_3 # Save original auto_increment_offset values. @@ -158,15 +158,15 @@ SET SESSION wsrep_sync_wait = DEFAULT; --connection node_1a --let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log --source include/wait_condition.inc -SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; --connection node_2a --let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log --source include/wait_condition.inc -SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; --connection node_3a --let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log --source include/wait_condition.inc -SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; +SELECT COUNT(*) AS EXPECT_0 FROM mysql.wsrep_streaming_log; --connection node_1 diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test index 18e1f0023c3..94f567d4c61 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_isolate_master.test @@ -6,6 +6,7 @@ # Test the effect of gmcast.isolate on master during an SR transaction # --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_join_slave.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_join_slave.test index 95aa1a37a78..a8cb72c8e47 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_join_slave.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_join_slave.test @@ -9,6 +9,7 @@ --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 --connection node_1 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_master.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_master.test index c7e7528679b..cda2e335e4d 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_master.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_master.test @@ -6,6 +6,7 @@ --source include/have_innodb.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback.test index c0df6b2777a..a4d442ab5d8 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback.test @@ -9,6 +9,7 @@ --source include/have_innodb.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test index 4dba60ba79d..b32eafe5e9c 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_after_apply_rollback2.test @@ -8,6 +8,7 @@ --source include/have_innodb.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test index b6355050836..47605772d13 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_kill_slave_before_apply.test @@ -9,6 +9,7 @@ --source include/force_restart.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.test b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.test index 62122fe4292..dfabd931485 100644 --- a/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.test +++ b/mysql-test/suite/galera_3nodes_sr/t/galera_sr_threeway_split.test @@ -7,6 +7,7 @@ --source include/have_innodb.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 diff --git a/mysql-test/suite/galera_sr/r/galera_sr_kill_all_norecovery.result b/mysql-test/suite/galera_sr/r/galera_sr_kill_all_norecovery.result index 7ef86c65915..963ed9507ab 100644 --- a/mysql-test/suite/galera_sr/r/galera_sr_kill_all_norecovery.result +++ b/mysql-test/suite/galera_sr/r/galera_sr_kill_all_norecovery.result @@ -2,6 +2,7 @@ connection node_2; connection node_1; connection node_1; connection node_2; +connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; SET SESSION wsrep_trx_fragment_size = 1; SET AUTOCOMMIT=OFF; diff --git a/mysql-test/suite/galera_sr/r/galera_sr_myisam.result b/mysql-test/suite/galera_sr/r/galera_sr_myisam.result index 97818f072e1..8ab11c35857 100644 --- a/mysql-test/suite/galera_sr/r/galera_sr_myisam.result +++ b/mysql-test/suite/galera_sr/r/galera_sr_myisam.result @@ -6,8 +6,8 @@ SET SESSION wsrep_trx_fragment_size = 1; SET GLOBAL wsrep_replicate_myisam = TRUE; INSERT INTO t1 VALUES (REPEAT('x', 65535)); connection node_2; -SELECT COUNT(*) = 1 FROM t1; -COUNT(*) = 1 +SELECT COUNT(*) AS EXPECT_1 FROM t1; +EXPECT_1 1 SELECT LENGTH(f1) = 65535 FROM t1; LENGTH(f1) = 65535 diff --git a/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test index f6f50fd50c9..6486ae419d0 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test +++ b/mysql-test/suite/galera_sr/t/galera_sr_kill_all_norecovery.test @@ -11,6 +11,8 @@ --let $node_2=node_2 --source ../../galera/include/auto_increment_offset_save.inc +--connection node_1 + CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; SET SESSION wsrep_trx_fragment_size = 1; SET AUTOCOMMIT=OFF; @@ -26,7 +28,6 @@ INSERT INTO t1 VALUES (5); --let $wait_condition = SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; --source include/wait_condition.inc - # # Kill the entire cluster and restart # diff --git a/mysql-test/suite/galera_sr/t/galera_sr_myisam.test b/mysql-test/suite/galera_sr/t/galera_sr_myisam.test index b037f817610..5bde6db3366 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_myisam.test +++ b/mysql-test/suite/galera_sr/t/galera_sr_myisam.test @@ -18,7 +18,7 @@ SET GLOBAL wsrep_replicate_myisam = TRUE; INSERT INTO t1 VALUES (REPEAT('x', 65535)); --connection node_2 -SELECT COUNT(*) = 1 FROM t1; +SELECT COUNT(*) AS EXPECT_1 FROM t1; SELECT LENGTH(f1) = 65535 FROM t1; DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test b/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test index 035ef873700..cad7a0d3a1e 100644 --- a/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test +++ b/mysql-test/suite/galera_sr/t/galera_sr_shutdown_slave.test @@ -8,6 +8,7 @@ --let $node_1=node_1 --let $node_2=node_2 --source ../galera/include/auto_increment_offset_save.inc + --connection node_2 call mtr.add_suppression("WSREP: Failed to scan the last segment to the end\\. Last events may be missing\\. Last recovered event: "); diff --git a/mysql-test/suite/wsrep/README b/mysql-test/suite/wsrep/README index 988096071a4..143f3c96887 100644 --- a/mysql-test/suite/wsrep/README +++ b/mysql-test/suite/wsrep/README @@ -4,4 +4,3 @@ * As these tests are specific to wsrep-related functionalities, they must skip on server built without wsrep patch (vanilla). (-DWITH_WSREP=OFF) See : include/have_wsrep.inc, include/have_wsrep_enabled.inc, not_wsrep.inc - diff --git a/mysql-test/suite/wsrep/include/check_galera_version.inc b/mysql-test/suite/wsrep/include/check_galera_version.inc index 40cd157ca80..11cd02f6472 100644 --- a/mysql-test/suite/wsrep/include/check_galera_version.inc +++ b/mysql-test/suite/wsrep/include/check_galera_version.inc @@ -44,4 +44,3 @@ if (!`SELECT (@ACTUAL_GALERA_MINOR_VERSION > @GALERA_MINOR_VERSION) OR } --echo # Correct Galera library found - diff --git a/mysql-test/suite/wsrep/r/wsrep-recover-v25,binlogon.rdiff b/mysql-test/suite/wsrep/r/wsrep-recover-v25,binlogon.rdiff index 596abf9c681..c6b231bc558 100644 --- a/mysql-test/suite/wsrep/r/wsrep-recover-v25,binlogon.rdiff +++ b/mysql-test/suite/wsrep/r/wsrep-recover-v25,binlogon.rdiff @@ -1,5 +1,5 @@ ---- r/wsrep-recover-v25.result 2019-02-28 09:20:56.153775856 +0200 -+++ r/wsrep-recover-v25.reject 2019-02-28 09:22:16.578113115 +0200 +--- r/wsrep-recover-v25.result ++++ r/wsrep-recover-v25,binlogoin.reject @@ -12,4 +12,16 @@ SELECT VARIABLE_VALUE `expect 6` FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_last_committed'; expect 6 diff --git a/sql/handler.cc b/sql/handler.cc index 75c79f2bb5a..d243a2149a8 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -7331,7 +7331,10 @@ int handler::ha_write_row(const uchar *buf) }); #endif /* WITH_WSREP */ if ((error= ha_check_overlaps(NULL, buf))) + { + DEBUG_SYNC_C("ha_write_row_end"); DBUG_RETURN(error); + } /* NOTE: this != table->file is true in 3 cases: @@ -7352,6 +7355,7 @@ int handler::ha_write_row(const uchar *buf) if (table->next_number_field && buf == table->record[0]) if (int err= update_auto_increment()) error= err; + DEBUG_SYNC_C("ha_write_row_end"); DBUG_RETURN(error); } } @@ -7374,13 +7378,10 @@ int handler::ha_write_row(const uchar *buf) error= binlog_log_row(table, 0, buf, log_func); } #ifdef WITH_WSREP - if (WSREP_NNULL(ha_thd()) && table_share->tmp_table == NO_TMP_TABLE && - ht->flags & HTON_WSREP_REPLICATION && - !error && (error= wsrep_after_row(ha_thd()))) - { - DEBUG_SYNC_C("ha_write_row_end"); - DBUG_RETURN(error); - } + THD *thd= ha_thd(); + if (WSREP_NNULL(thd) && table_share->tmp_table == NO_TMP_TABLE && + ht->flags & HTON_WSREP_REPLICATION && !error) + error= wsrep_after_row(thd); #endif /* WITH_WSREP */ } diff --git a/sql/wsrep_high_priority_service.cc b/sql/wsrep_high_priority_service.cc index 798398b1bd9..ce3459db08e 100644 --- a/sql/wsrep_high_priority_service.cc +++ b/sql/wsrep_high_priority_service.cc @@ -610,7 +610,7 @@ int Wsrep_applier_service::apply_write_set(const wsrep::ws_meta& ws_meta, int ret= apply_events(thd, m_rli, data, err, true); thd->close_temporary_tables(); - if (!ret && !(ws_meta.flags() & wsrep::provider::flag::commit)) + if (!ret && !wsrep::commits_transaction(ws_meta.flags())) { thd->wsrep_cs().fragment_applied(ws_meta.seqno()); } @@ -778,7 +778,7 @@ int Wsrep_replayer_service::apply_write_set(const wsrep::ws_meta& ws_meta, } ret= ret || apply_events(thd, m_rli, data, err, true); thd->close_temporary_tables(); - if (!ret && !(ws_meta.flags() & wsrep::provider::flag::commit)) + if (!ret && !wsrep::commits_transaction(ws_meta.flags())) { thd->wsrep_cs().fragment_applied(ws_meta.seqno()); } diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index f0fc9c37dae..d6332ae947d 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1,5 +1,5 @@ -/* Copyright (c) 2008, 2024, Codership Oy - Copyright (c) 2020, 2024, MariaDB +/* Copyright (c) 2008, 2025, Codership Oy + Copyright (c) 2020, 2025, MariaDB 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 @@ -50,6 +50,7 @@ #include "log_event.h" #include "sql_connect.h" #include "thread_cache.h" +#include "debug_sync.h" #include @@ -851,12 +852,13 @@ int wsrep_init() wsrep_init_position(); wsrep_sst_auth_init(); - if (strlen(wsrep_provider)== 0 || - !strcmp(wsrep_provider, WSREP_NONE)) + if (!*wsrep_provider || + !strcasecmp(wsrep_provider, WSREP_NONE)) { // enable normal operation in case no provider is specified global_system_variables.wsrep_on= 0; - int err= Wsrep_server_state::instance().load_provider(wsrep_provider, wsrep_provider_options ? wsrep_provider_options : ""); + int err= Wsrep_server_state::instance().load_provider( + wsrep_provider, wsrep_provider_options ? wsrep_provider_options : ""); if (err) { DBUG_PRINT("wsrep",("wsrep::init() failed: %d", err)); @@ -2398,7 +2400,6 @@ fail: unireg_abort(1); } - /* returns: 0: statement was replicated as TOI @@ -2414,6 +2415,7 @@ static int wsrep_TOI_begin(THD *thd, const char *db, const char *table, DBUG_ASSERT(wsrep_OSU_method_get(thd) == WSREP_OSU_TOI); WSREP_DEBUG("TOI Begin: %s", wsrep_thd_query(thd)); + DEBUG_SYNC(thd, "wsrep_before_toi_begin"); if (wsrep_can_run_in_toi(thd, db, table, table_list, create_info) == false) { @@ -2793,20 +2795,29 @@ void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx, if (!WSREP_ON) return; THD *request_thd= requestor_ctx->get_thd(); - THD *granted_thd= ticket->get_ctx()->get_thd(); - - const char* schema= key->db_name(); - int schema_len= key->db_name_length(); mysql_mutex_lock(&request_thd->LOCK_thd_data); if (wsrep_thd_is_toi(request_thd) || - wsrep_thd_is_applying(request_thd)) { + wsrep_thd_is_applying(request_thd)) + { + THD *granted_thd= ticket->get_ctx()->get_thd(); + + const char* schema= key->db_name(); + int schema_len= key->db_name_length(); mysql_mutex_unlock(&request_thd->LOCK_thd_data); WSREP_MDL_LOG(DEBUG, "MDL conflict ", schema, schema_len, request_thd, granted_thd); ticket->wsrep_report(wsrep_debug); + DEBUG_SYNC(request_thd, "before_wsrep_thd_abort"); + DBUG_EXECUTE_IF("sync.before_wsrep_thd_abort", { + const char act[]= "now " + "SIGNAL sync.before_wsrep_thd_abort_reached " + "WAIT_FOR signal.before_wsrep_thd_abort"; + DBUG_ASSERT(!debug_sync_set_action(request_thd, STRING_WITH_LEN(act))); + };); + /* Here we will call wsrep_abort_transaction so we should hold THD::LOCK_thd_data to protect victim from concurrent usage and THD::LOCK_thd_kill to protect from disconnect or delete. @@ -2905,13 +2916,12 @@ void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx, } } } + DEBUG_SYNC(request_thd, "after_wsrep_thd_abort"); } else { mysql_mutex_unlock(&request_thd->LOCK_thd_data); } - - DEBUG_SYNC(request_thd, "after_wsrep_thd_abort"); } /**/ diff --git a/sql/wsrep_server_service.cc b/sql/wsrep_server_service.cc index b50a3081660..e5393ba47b8 100644 --- a/sql/wsrep_server_service.cc +++ b/sql/wsrep_server_service.cc @@ -93,7 +93,8 @@ wsrep_create_streaming_applier(THD *orig_thd, const char *ctx) streaming transaction is BF aborted and streaming applier is created from BF aborter context. */ Wsrep_threadvars saved_threadvars(wsrep_save_threadvars()); - wsrep_reset_threadvars(saved_threadvars.cur_thd); + if (saved_threadvars.cur_thd) + wsrep_reset_threadvars(saved_threadvars.cur_thd); THD *thd= 0; Wsrep_applier_service *ret= 0; if (!wsrep_create_threadvars() && @@ -110,7 +111,8 @@ wsrep_create_streaming_applier(THD *orig_thd, const char *ctx) } /* Restore original thread local storage state before returning. */ wsrep_restore_threadvars(saved_threadvars); - wsrep_store_threadvars(saved_threadvars.cur_thd); + if (saved_threadvars.cur_thd) + wsrep_store_threadvars(saved_threadvars.cur_thd); return ret; } @@ -187,6 +189,7 @@ void Wsrep_server_service::log_message(enum wsrep::log::level level, break; case wsrep::log::unknown: WSREP_UNKNOWN("%s", message); + assert(0); break; } } diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index 504510fbbf6..e9bc38a4ed3 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -464,7 +464,7 @@ bool wsrep_sst_received (THD* thd, if (WSREP_ON) { int const rcode(seqno < 0 ? seqno : 0); - error= wsrep_sst_complete(thd,rcode, sst_gtid); + error= wsrep_sst_complete(thd, rcode, sst_gtid); } return error; From fa55b36c1e8fdf51aff5f05d00fd9cd33e7715f9 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Fri, 28 Mar 2025 22:38:18 +0100 Subject: [PATCH 124/134] galera tests: corrections for garbd-related tests --- mysql-test/suite/galera/r/GAL-401.result | 2 +- mysql-test/suite/galera/r/MDEV-21479.result | 2 +- mysql-test/suite/galera/r/MDEV-35946.result | 2 +- mysql-test/suite/galera/t/GAL-401.test | 2 +- mysql-test/suite/galera/t/MDEV-21479.test | 2 +- mysql-test/suite/galera/t/MDEV-35946.test | 4 +--- .../suite/galera_3nodes/r/galera_garbd.result | 8 +++----- .../r/galera_garbd_backup.result | 7 +++---- .../suite/galera_3nodes/t/galera_garbd.test | 11 +++------- .../galera_3nodes/t/galera_garbd_backup.test | 20 +++++++++---------- 10 files changed, 25 insertions(+), 35 deletions(-) diff --git a/mysql-test/suite/galera/r/GAL-401.result b/mysql-test/suite/galera/r/GAL-401.result index 9522dc80bad..a7bc8c0545f 100644 --- a/mysql-test/suite/galera/r/GAL-401.result +++ b/mysql-test/suite/galera/r/GAL-401.result @@ -24,6 +24,6 @@ t1 CREATE TABLE `t1` ( PRIMARY KEY (`f1`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci DROP TABLE t1; -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender (.*) is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender .+ ?is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); connection node_1; SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=false'; diff --git a/mysql-test/suite/galera/r/MDEV-21479.result b/mysql-test/suite/galera/r/MDEV-21479.result index de00413bdcc..2a583d705cf 100644 --- a/mysql-test/suite/galera/r/MDEV-21479.result +++ b/mysql-test/suite/galera/r/MDEV-21479.result @@ -66,7 +66,7 @@ SHOW STATUS LIKE 'wsrep_desync_count'; Variable_name Value wsrep_desync_count 0 SET @@global.wsrep_desync = 0; -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender (.*) is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender .+ ?is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); connection node_1; # Wait until both nodes are back to cluster SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=false'; diff --git a/mysql-test/suite/galera/r/MDEV-35946.result b/mysql-test/suite/galera/r/MDEV-35946.result index 1ebc88c1a48..5933f7fcfba 100644 --- a/mysql-test/suite/galera/r/MDEV-35946.result +++ b/mysql-test/suite/galera/r/MDEV-35946.result @@ -13,4 +13,4 @@ SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME VARIABLE_VALUE Primary SET SESSION wsrep_sync_wait=DEFAULT; -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender (.*) is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender .+ ?is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); diff --git a/mysql-test/suite/galera/t/GAL-401.test b/mysql-test/suite/galera/t/GAL-401.test index 243fde23642..7ce342ad3a5 100644 --- a/mysql-test/suite/galera/t/GAL-401.test +++ b/mysql-test/suite/galera/t/GAL-401.test @@ -48,7 +48,7 @@ SET @@global.wsrep_desync = 0; SET SESSION wsrep_sync_wait=15; SHOW CREATE TABLE t1; DROP TABLE t1; -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender (.*) is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender .+ ?is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); --connection node_1 --let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; diff --git a/mysql-test/suite/galera/t/MDEV-21479.test b/mysql-test/suite/galera/t/MDEV-21479.test index 17451b3bb77..112e1361826 100644 --- a/mysql-test/suite/galera/t/MDEV-21479.test +++ b/mysql-test/suite/galera/t/MDEV-21479.test @@ -77,7 +77,7 @@ SET @@global.wsrep_desync = 0; --let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; --source include/wait_condition.inc -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender (.*) is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender .+ ?is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); --connection node_1 --echo # Wait until both nodes are back to cluster diff --git a/mysql-test/suite/galera/t/MDEV-35946.test b/mysql-test/suite/galera/t/MDEV-35946.test index 23c3d463a48..790448a4812 100644 --- a/mysql-test/suite/galera/t/MDEV-35946.test +++ b/mysql-test/suite/galera/t/MDEV-35946.test @@ -25,7 +25,6 @@ SET SESSION wsrep_sync_wait=DEFAULT; --error ER_LOCK_WAIT_TIMEOUT DELETE FROM mysql.wsrep_streaming_log; - # # Reconnect to the cluster # @@ -36,6 +35,5 @@ SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; SET SESSION wsrep_sync_wait=DEFAULT; - --source include/auto_increment_offset_restore.inc -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender (.*) is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender .+ ?is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); diff --git a/mysql-test/suite/galera_3nodes/r/galera_garbd.result b/mysql-test/suite/galera_3nodes/r/galera_garbd.result index 676ba7e8a0e..12d1f78cc9c 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_garbd.result +++ b/mysql-test/suite/galera_3nodes/r/galera_garbd.result @@ -2,8 +2,6 @@ connection node_2; connection node_1; connection node_1; connection node_2; -connection node_1; -connection node_2; connection node_3; Killing node #3 to free ports for garbd ... connection node_3; @@ -26,8 +24,8 @@ DROP TABLE t1; Restarting node #3 to satisfy MTR's end-of-test checks connection node_3; connection node_1; -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); connection node_2; -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); connection node_3; -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); diff --git a/mysql-test/suite/galera_3nodes/r/galera_garbd_backup.result b/mysql-test/suite/galera_3nodes/r/galera_garbd_backup.result index 7d55b36ce0b..638b1553039 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_garbd_backup.result +++ b/mysql-test/suite/galera_3nodes/r/galera_garbd_backup.result @@ -11,7 +11,6 @@ CREATE TABLE t1 (f1 INTEGER, f2 varchar(1024)) Engine=InnoDB; CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); INSERT INTO t1 (f2) SELECT REPEAT('x', 1024) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; -connection node_2; Killing node #3 to free ports for garbd ... connection node_3; connection node_1; @@ -33,8 +32,8 @@ Restarting node #3 to satisfy MTR's end-of-test checks connection node_3; connection node_1; connection node_1; -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); connection node_2; -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); connection node_3; -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); diff --git a/mysql-test/suite/galera_3nodes/t/galera_garbd.test b/mysql-test/suite/galera_3nodes/t/galera_garbd.test index da1956d8c85..6618728b651 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_garbd.test +++ b/mysql-test/suite/galera_3nodes/t/galera_garbd.test @@ -9,14 +9,9 @@ --source include/big_test.inc # Save galera ports ---connection node_1 --source suite/galera/include/galera_base_port.inc --let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT ---connection node_2 ---source suite/galera/include/galera_base_port.inc ---let $NODE_GALERAPORT_2 = $_NODE_GALERAPORT - --let $galera_connection_name = node_3 --let $galera_server_number = 3 --source include/galera_connect.inc @@ -81,10 +76,10 @@ let $restart_noprint=2; # Workaround for galera#101 --connection node_1 -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); --connection node_2 -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); --connection node_3 -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); diff --git a/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.test b/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.test index d9683083da1..61256642242 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.test +++ b/mysql-test/suite/galera_3nodes/t/galera_garbd_backup.test @@ -10,6 +10,10 @@ --source include/have_debug.inc --source include/have_debug_sync.inc +# Save galera ports +--source suite/galera/include/galera_base_port.inc +--let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT + --let $galera_connection_name = node_3 --let $galera_server_number = 3 --source include/galera_connect.inc @@ -22,10 +26,7 @@ --let $node_3=node_3 --source ../galera/include/auto_increment_offset_save.inc -# Save galera ports --connection node_1 ---source suite/galera/include/galera_base_port.inc ---let $NODE_GALERAPORT_1 = $_NODE_GALERAPORT --let $datadir= `SELECT @@datadir` --let $innodb_max_dirty_pages_pct = `SELECT @@innodb_max_dirty_pages_pct` @@ -39,10 +40,6 @@ CREATE TABLE t1 (f1 INTEGER, f2 varchar(1024)) Engine=InnoDB; CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); INSERT INTO t1 (f2) SELECT REPEAT('x', 1024) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; - ---connection node_2 ---source suite/galera/include/galera_base_port.inc ---let $NODE_GALERAPORT_2 = $_NODE_GALERAPORT --echo Killing node #3 to free ports for garbd ... --connection node_3 @@ -122,13 +119,16 @@ let $restart_noprint=2; --eval SET GLOBAL innodb_max_dirty_pages_pct_lwm = $innodb_max_dirty_pages_pct_lwm --enable_query_log +# Restore original auto_increment_offset values. --source ../galera/include/auto_increment_offset_restore.inc +# Workaround for galera#101 + --connection node_1 -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); --connection node_2 -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); --connection node_3 -CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0 (.*) is not in state transfer \\(SYNCED\\)"); +CALL mtr.add_suppression("WSREP: Protocol violation\\. JOIN message sender 1\\.0( \\(.*\\))? is not in state transfer \\(SYNCED\\)\\. Message ignored\\."); From 88eec3a9a1f57b634b9b8b3b1af78bad121920cc Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Wed, 26 Mar 2025 16:03:14 +0100 Subject: [PATCH 125/134] MDEV-36393 Test failure on galera_sr.GCF-572 Fix a regression on test galera_sr.GCF-572 introduced by commit c9a6adba. This commit partially reverted a trivial test fix for the galera_sr.GCF-572 test (commit 11ef59fb), which was targeted at 10.6. This is backporting the fix from commit 11ef59fb fix to 10.5, so that the test stays the same all versions >= 10.5. Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera_sr/r/GCF-572.result | 4 +--- mysql-test/suite/galera_sr/t/GCF-572.test | 1 - 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/mysql-test/suite/galera_sr/r/GCF-572.result b/mysql-test/suite/galera_sr/r/GCF-572.result index 8bffe4fcc25..b28ce1ae346 100644 --- a/mysql-test/suite/galera_sr/r/GCF-572.result +++ b/mysql-test/suite/galera_sr/r/GCF-572.result @@ -37,9 +37,6 @@ f1 f2 SET SESSION wsrep_trx_fragment_size = 10000; START TRANSACTION; INSERT INTO t1 VALUE (10, 'node1'); -SELECT COUNT(*) FROM mysql.wsrep_streaming_log; -COUNT(*) -0 connection node_1a; INSERT INTO t1 VALUES(15, 'node2'); connection node_1; @@ -48,6 +45,7 @@ f1 f2 1 node1 5 node2 10 node1 +15 node2 INSERT INTO t1 VALUES(15, 'node1'); ERROR 23000: Duplicate entry '15' for key 'PRIMARY' COMMIT; diff --git a/mysql-test/suite/galera_sr/t/GCF-572.test b/mysql-test/suite/galera_sr/t/GCF-572.test index bba68c1d822..b9bd90d1a96 100644 --- a/mysql-test/suite/galera_sr/t/GCF-572.test +++ b/mysql-test/suite/galera_sr/t/GCF-572.test @@ -61,7 +61,6 @@ SET SESSION wsrep_trx_fragment_size = 10000; START TRANSACTION; INSERT INTO t1 VALUE (10, 'node1'); -SELECT COUNT(*) FROM mysql.wsrep_streaming_log; --connection node_1a INSERT INTO t1 VALUES(15, 'node2'); From d698b784c8bc3492c2ac7883a14bb7e824362bf1 Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Fri, 20 Dec 2024 15:13:33 +0100 Subject: [PATCH 126/134] MDEV-35658 Assertion `commit_trx' failed in test galera_as_master The test issues a simple INSERT statement, while sql_log_bin = 0. This option disables writes to binlog. However, since MDEV-7205, the option does not affect Galera, so changes are still replicated. So sql_log_bin=off, "partially" disabled the binlog and the INSERT will involve both binlog and innodb, thus requiring internal 2 phase commit (2PC). In 2PC INSERT is first prepared, which will make it transition to PREPARED state in innodb, and later committed which causes the new assertion from MDEV-24035 to fail. Running the same test with sql_log_bin enabled also results in 2PC, but the execution has one more step for ordered commit, between prepare and commit. Ordered commit causes the transaction state to transition back to TRX_STATE_NOT_STARTED. Thus avoiding the assertion. This patch makes sure that when sql_log_bin=off, the ordered commit step is not skipped, thus going through the expected state transitions in the storage engine. Signed-off-by: Julius Goryavsky --- sql/log.cc | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/sql/log.cc b/sql/log.cc index e459e3a5b52..0131acbb83d 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -7788,7 +7788,12 @@ MYSQL_BIN_LOG::write_transaction_to_binlog(THD *thd, { DBUG_RETURN(0); } - else if (!(thd->variables.option_bits & OPTION_BIN_LOG)) + + if (!(thd->variables.option_bits & OPTION_BIN_LOG) +#ifdef WITH_WSREP + && !WSREP(thd) +#endif + ) { cache_mngr->need_unlog= false; DBUG_RETURN(0); @@ -8683,6 +8688,13 @@ MYSQL_BIN_LOG::write_transaction_or_stmt(group_commit_entry *entry, { binlog_cache_mngr *mngr= entry->cache_mngr; DBUG_ENTER("MYSQL_BIN_LOG::write_transaction_or_stmt"); +#ifdef WITH_WSREP + if (WSREP(entry->thd) && + !(entry->thd->variables.option_bits & OPTION_BIN_LOG)) + { + DBUG_RETURN(0); + } +#endif /* WITH_WSREP */ /* An error in the trx_cache will truncate the cache to the last good From dd54ce9e10ff6553ab946bb35ec08381865ea42b Mon Sep 17 00:00:00 2001 From: Denis Protivensky Date: Tue, 18 Feb 2025 16:09:44 +0300 Subject: [PATCH 127/134] MDEV-36116: Remove debug assert in TOI when executing thread is killed Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera/r/MDEV-36116.result | 22 +++++++++++ mysql-test/suite/galera/t/MDEV-36116.test | 43 +++++++++++++++++++++ sql/wsrep_mysqld.cc | 3 +- 3 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/galera/r/MDEV-36116.result create mode 100644 mysql-test/suite/galera/t/MDEV-36116.test diff --git a/mysql-test/suite/galera/r/MDEV-36116.result b/mysql-test/suite/galera/r/MDEV-36116.result new file mode 100644 index 00000000000..11899b9c09b --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-36116.result @@ -0,0 +1,22 @@ +connection node_2; +connection node_1; +connect con1,127.0.0.1,root,,test,$NODE_MYPORT_1; +connection node_1; +CALL mtr.add_suppression("CREATE TABLE isolation failure"); +SET DEBUG_SYNC = 'wsrep_kill_thd_before_enter_toi SIGNAL may_kill WAIT_FOR continue'; +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +connection con1; +SET DEBUG_SYNC = 'now WAIT_FOR may_kill'; +SET DEBUG_SYNC = 'now SIGNAL continue'; +connection node_1; +ERROR HY000: Lost connection to MySQL server during query +connection node_2; +SHOW TABLES LIKE 't1'; +Tables_in_test (t1) +connection con1; +SHOW TABLES LIKE 't1'; +Tables_in_test (t1) +SET DEBUG_SYNC = 'RESET'; +disconnect con1; +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera/t/MDEV-36116.test b/mysql-test/suite/galera/t/MDEV-36116.test new file mode 100644 index 00000000000..eb166e69066 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-36116.test @@ -0,0 +1,43 @@ +# +# MDEV-36116: TOI crashes in debug assert if executing thread is killed. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/have_debug.inc + +--connect con1,127.0.0.1,root,,test,$NODE_MYPORT_1 + +# Start TOI operation and wait for the thread to be killed. +--connection node_1 +CALL mtr.add_suppression("CREATE TABLE isolation failure"); + +--let $connection_id = `SELECT CONNECTION_ID()` +SET DEBUG_SYNC = 'wsrep_kill_thd_before_enter_toi SIGNAL may_kill WAIT_FOR continue'; +--send + CREATE TABLE t1 (a INT) ENGINE=InnoDB; + +# Kill the thread and let it continue. +--connection con1 +SET DEBUG_SYNC = 'now WAIT_FOR may_kill'; +--disable_query_log +--eval KILL CONNECTION $connection_id +--enable_query_log +SET DEBUG_SYNC = 'now SIGNAL continue'; + +--connection node_1 +--error 2013 +--reap + +# Verify no tables created on either nodes. +--connection node_2 +SHOW TABLES LIKE 't1'; + +--connection con1 +SHOW TABLES LIKE 't1'; + +# Cleanup +SET DEBUG_SYNC = 'RESET'; +--disconnect con1 +--source include/galera_end.inc diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index d6332ae947d..22d66379835 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -2625,12 +2625,13 @@ int wsrep_to_isolation_begin(THD *thd, const char *db_, const char *table_, const wsrep::key_array *fk_tables, const HA_CREATE_INFO *create_info) { + DEBUG_SYNC(thd, "wsrep_kill_thd_before_enter_toi"); mysql_mutex_lock(&thd->LOCK_thd_kill); const killed_state killed = thd->killed; mysql_mutex_unlock(&thd->LOCK_thd_kill); if (killed) { - DBUG_ASSERT(FALSE); + /* The thread may have been killed as a result of memory pressure. */ return -1; } From 25737dbab7fec6d05a50353baf5b15ad97dcbd0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 13 Mar 2025 11:48:03 +0200 Subject: [PATCH 128/134] MDEV-33850 : For Galera, create sequence with low cache got signal 6 error: [ERROR] WSREP: FSM: no such a transition REPLICATING -> COMMITTED Problem was that transacton was BF-aborted after certification succeeded and transaction tried to rollback and during rollback binlog stmt cache containing sequence value reservations was written into binlog. Transaction must replay because certification succeeded but transaction must not be written into binlog yet, it will be done during commit after the replay. Fix is to skip binlog write if transaction must replay and in replay we need to reset binlog stmt cache. Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera/disabled.def | 1 - .../suite/galera/r/galera_sequences.result | 3 + .../galera/r/galera_sequences_bf_kill.result | 152 ++++++++ .../r/galera_sequences_transaction.result | 350 ++++++++++++++++++ .../suite/galera/t/galera_sequences.test | 2 + .../galera/t/galera_sequences_bf_kill.cnf | 9 + .../t/galera_sequences_bf_kill.combinations | 5 + .../galera/t/galera_sequences_bf_kill.test | 115 ++++++ .../galera/t/galera_sequences_transaction.cnf | 9 + .../galera_sequences_transaction.combinations | 5 + .../t/galera_sequences_transaction.test | 255 +++++++++++++ sql/log.cc | 10 + sql/wsrep_client_service.cc | 6 + 13 files changed, 921 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/galera/r/galera_sequences_bf_kill.result create mode 100644 mysql-test/suite/galera/r/galera_sequences_transaction.result create mode 100644 mysql-test/suite/galera/t/galera_sequences_bf_kill.cnf create mode 100644 mysql-test/suite/galera/t/galera_sequences_bf_kill.combinations create mode 100644 mysql-test/suite/galera/t/galera_sequences_bf_kill.test create mode 100644 mysql-test/suite/galera/t/galera_sequences_transaction.cnf create mode 100644 mysql-test/suite/galera/t/galera_sequences_transaction.combinations create mode 100644 mysql-test/suite/galera/t/galera_sequences_transaction.test diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 538d2d36759..23bf40c409a 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -10,7 +10,6 @@ # ############################################################################## -galera_sequences : MDEV-35934/MDEV-33850 For Galera, create sequence with low cache got signal 6 error: [ERROR] WSREP: FSM: no such a transition REPLICATING -> COMMITTED galera_wan : MDEV-35940 Unallowed state transition: donor -> synced in galera_wan galera_vote_rejoin_ddl : MDEV-35940 Unallowed state transition: donor -> synced in galera_wan MW-329 : MDEV-35951 Complete freeze during MW-329 test diff --git a/mysql-test/suite/galera/r/galera_sequences.result b/mysql-test/suite/galera/r/galera_sequences.result index e78b89d4b09..7cdeffff1e3 100644 --- a/mysql-test/suite/galera/r/galera_sequences.result +++ b/mysql-test/suite/galera/r/galera_sequences.result @@ -47,6 +47,9 @@ select NEXT VALUE FOR Seq1_1; NEXT VALUE FOR Seq1_1 4 connection node_1; +SHOW CREATE SEQUENCE Seq1_1; +Table Create Table +Seq1_1 CREATE SEQUENCE `Seq1_1` start with 1 minvalue 1 maxvalue 9223372036854775806 increment by 1 nocache nocycle ENGINE=InnoDB DROP SEQUENCE Seq1_1; connection node_1; CREATE TABLE t2 (d CHAR(1)KEY); diff --git a/mysql-test/suite/galera/r/galera_sequences_bf_kill.result b/mysql-test/suite/galera/r/galera_sequences_bf_kill.result new file mode 100644 index 00000000000..39d11337b4f --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sequences_bf_kill.result @@ -0,0 +1,152 @@ +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, f2 INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 0), (3, 0); +connection node_1; +START TRANSACTION; +INSERT INTO t1 VALUES (4, next value for s); +INSERT INTO t1 VALUES (5, next value for s); +INSERT INTO t1 VALUES (6, next value for s); +INSERT INTO t1 VALUES (7, next value for s); +INSERT INTO t1 VALUES (8, next value for s); +INSERT INTO t1 VALUES (9, next value for s); +INSERT INTO t1 VALUES (10, next value for s); +INSERT INTO t1 VALUES (11, next value for s); +INSERT INTO t1 VALUES (12, next value for s); +INSERT INTO t1 VALUES (13, next value for s); +INSERT INTO t1 VALUES (14, next value for s); +SELECT * FROM t1 WHERE f1 > 0 FOR UPDATE; +f1 f2 +1 0 +3 0 +4 1 +5 3 +6 5 +7 7 +8 9 +9 11 +10 13 +11 15 +12 17 +13 19 +14 21 +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET SESSION wsrep_sync_wait=0; +SET GLOBAL wsrep_provider_options = 'dbug=d,apply_monitor_slave_enter_sync'; +connection node_2; +INSERT INTO t1 VALUES (2, 2); +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync'; +connection node_1; +COMMIT; +connection node_1a; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'dbug=d,abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=apply_monitor_slave_enter_sync'; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=abort_trx_end'; +SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync'; +connection node_1; +wsrep_local_replays +1 +INSERT INTO t1 VALUES (22, next value for s); +INSERT INTO t1 VALUES (23, next value for s); +INSERT INTO t1 VALUES (24, next value for s); +INSERT INTO t1 VALUES (25, next value for s); +INSERT INTO t1 VALUES (26, next value for s); +INSERT INTO t1 VALUES (27, next value for s); +INSERT INTO t1 VALUES (28, next value for s); +INSERT INTO t1 VALUES (29, next value for s); +INSERT INTO t1 VALUES (30, next value for s); +INSERT INTO t1 VALUES (31, next value for s); +INSERT INTO t1 VALUES (32, next value for s); +INSERT INTO t1 VALUES (33, next value for s); +INSERT INTO t1 VALUES (34, next value for s); +INSERT INTO t1 VALUES (35, next value for s); +connection node_1; +SELECT * FROM t1; +f1 f2 +1 0 +2 2 +3 0 +4 1 +5 3 +6 5 +7 7 +8 9 +9 11 +10 13 +11 15 +12 17 +13 19 +14 21 +22 31 +23 33 +24 35 +25 37 +26 39 +27 41 +28 43 +29 45 +30 47 +31 49 +32 51 +33 53 +34 55 +35 57 +SELECT LASTVAL(s); +LASTVAL(s) +57 +connection node_2; +SELECT * FROM t1; +f1 f2 +1 0 +2 2 +3 0 +4 1 +5 3 +6 5 +7 7 +8 9 +9 11 +10 13 +11 15 +12 17 +13 19 +14 21 +22 31 +23 33 +24 35 +25 37 +26 39 +27 41 +28 43 +29 45 +30 47 +31 49 +32 51 +33 53 +34 55 +35 57 +SELECT LASTVAL(s); +LASTVAL(s) +NULL +connection node_1; +SELECT NEXTVAL(s); +NEXTVAL(s) +59 +connection node_2; +SELECT NEXTVAL(s); +NEXTVAL(s) +62 +DROP SEQUENCE s; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_sequences_transaction.result b/mysql-test/suite/galera/r/galera_sequences_transaction.result new file mode 100644 index 00000000000..c1cfdc4aa20 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sequences_transaction.result @@ -0,0 +1,350 @@ +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; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2; +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); +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; +connection node_2; +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); +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; +connection node_2a; +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); +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; +connection node_1a; +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); +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; +connection node_2; +SELECT LASTVAL(s); +LASTVAL(s) +40 +connection node_1; +SELECT LASTVAL(s); +LASTVAL(s) +19 +connection node_2a; +SELECT LASTVAL(s); +LASTVAL(s) +60 +connection node_1a; +SELECT LASTVAL(s); +LASTVAL(s) +79 +connection node_1; +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 +22 1 +24 1 +26 1 +28 1 +30 1 +32 1 +34 1 +36 1 +38 1 +40 1 +42 1 +44 1 +46 1 +48 1 +50 1 +52 1 +54 1 +56 1 +58 1 +60 1 +61 1 +63 1 +65 1 +67 1 +69 1 +71 1 +73 1 +75 1 +77 1 +79 1 +connection node_2; +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 +22 1 +24 1 +26 1 +28 1 +30 1 +32 1 +34 1 +36 1 +38 1 +40 1 +42 1 +44 1 +46 1 +48 1 +50 1 +52 1 +54 1 +56 1 +58 1 +60 1 +61 1 +63 1 +65 1 +67 1 +69 1 +71 1 +73 1 +75 1 +77 1 +79 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); +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); +ROLLBACK; +connection node_2; +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); +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); +ROLLBACK; +connection node_2a; +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); +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); +ROLLBACK; +connection node_1a; +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); +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); +ROLLBACK; +connection node_2; +SELECT LASTVAL(s); +LASTVAL(s) +20 +connection node_1; +SELECT LASTVAL(s); +LASTVAL(s) +19 +connection node_2a; +SELECT LASTVAL(s); +LASTVAL(s) +40 +connection node_1a; +SELECT LASTVAL(s); +LASTVAL(s) +39 +connection node_1; +SELECT * FROM t1; +f1 f2 +connection node_2; +SELECT * FROM t1; +f1 f2 +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); +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_1a; +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); +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_2a; +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); +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 (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); +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_1; +COMMIT; +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) +40 +connection node_1; +SELECT LASTVAL(s); +LASTVAL(s) +19 +connection node_2a; +SELECT LASTVAL(s); +LASTVAL(s) +20 +connection node_1a; +SELECT LASTVAL(s); +LASTVAL(s) +39 +connection node_1; +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 * 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; +DROP TABLE t1; +DROP SEQUENCE s; diff --git a/mysql-test/suite/galera/t/galera_sequences.test b/mysql-test/suite/galera/t/galera_sequences.test index db388de2551..9e18353893b 100644 --- a/mysql-test/suite/galera/t/galera_sequences.test +++ b/mysql-test/suite/galera/t/galera_sequences.test @@ -3,6 +3,7 @@ --source include/have_sequence.inc --source include/have_aria.inc +--disable_ps2_protocol # # MDEV-19353 : Alter Sequence do not replicate to another nodes with in Galera Cluster # @@ -47,6 +48,7 @@ SHOW CREATE SEQUENCE Seq1_1; select NEXT VALUE FOR Seq1_1; --connection node_1 +SHOW CREATE SEQUENCE Seq1_1; DROP SEQUENCE Seq1_1; # diff --git a/mysql-test/suite/galera/t/galera_sequences_bf_kill.cnf b/mysql-test/suite/galera/t/galera_sequences_bf_kill.cnf new file mode 100644 index 00000000000..8701e86db5f --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sequences_bf_kill.cnf @@ -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 diff --git a/mysql-test/suite/galera/t/galera_sequences_bf_kill.combinations b/mysql-test/suite/galera/t/galera_sequences_bf_kill.combinations new file mode 100644 index 00000000000..cef98e75213 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sequences_bf_kill.combinations @@ -0,0 +1,5 @@ +[binlogon] +log-bin +log-slave-updates + +[binlogoff] diff --git a/mysql-test/suite/galera/t/galera_sequences_bf_kill.test b/mysql-test/suite/galera/t/galera_sequences_bf_kill.test new file mode 100644 index 00000000000..3c53a103d44 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sequences_bf_kill.test @@ -0,0 +1,115 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/have_debug_sync.inc +--source include/galera_have_debug_sync.inc + +--disable_ps2_protocol +# +# We create InnoDB seqeuence with small cache that is then +# used as default value for column in table. +# +--connection node_1 +--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` +CREATE SEQUENCE s INCREMENT=0 CACHE=5 ENGINE=InnoDB; +CREATE TABLE t1 (f1 INT PRIMARY KEY, f2 INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1, 0), (3, 0); +--connection node_1 +START TRANSACTION; +INSERT INTO t1 VALUES (4, next value for s); # No conflict in cert +INSERT INTO t1 VALUES (5, next value for s); # No conflict in cert +INSERT INTO t1 VALUES (6, next value for s); # No conflict in cert +INSERT INTO t1 VALUES (7, next value for s); # No conflict in cert +INSERT INTO t1 VALUES (8, next value for s); # No conflict in cert +INSERT INTO t1 VALUES (9, next value for s); # No conflict in cert +INSERT INTO t1 VALUES (10, next value for s); # No conflict in cert +INSERT INTO t1 VALUES (11, next value for s); # No conflict in cert +INSERT INTO t1 VALUES (12, next value for s); # No conflict in cert +INSERT INTO t1 VALUES (13, next value for s); # No conflict in cert +INSERT INTO t1 VALUES (14, next value for s); # No conflict in cert +SELECT * FROM t1 WHERE f1 > 0 FOR UPDATE; # Should cause GAP lock between 1 and 3 + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +SET SESSION wsrep_sync_wait=0; +# Block the applier on node #1 and issue a conflicting update on node #2 +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_set_sync_point.inc + +# +# Send conflicting INSERT +# +--connection node_2 +INSERT INTO t1 VALUES (2, 2); # This should BF abort because of GAP lock + +--connection node_1a +--source include/galera_wait_sync_point.inc +--source include/galera_clear_sync_point.inc + +# Block the commit, send the COMMIT and wait until it gets blocked +--let $galera_sync_point = commit_monitor_master_enter_sync +--source include/galera_set_sync_point.inc + +--connection node_1 +--send COMMIT + +--connection node_1a + +--let $galera_sync_point = apply_monitor_slave_enter_sync commit_monitor_master_enter_sync +--source include/galera_wait_sync_point.inc +--source include/galera_clear_sync_point.inc + +--let $galera_sync_point = abort_trx_end +--source include/galera_set_sync_point.inc +--let $galera_sync_point = apply_monitor_slave_enter_sync +--source include/galera_signal_sync_point.inc +--let $galera_sync_point = abort_trx_end commit_monitor_master_enter_sync +--source include/galera_wait_sync_point.inc + +# Let the transactions proceed +--source include/galera_clear_sync_point.inc +--let $galera_sync_point = abort_trx_end +--source include/galera_signal_sync_point.inc +--let $galera_sync_point = commit_monitor_master_enter_sync +--source include/galera_signal_sync_point.inc + +# Commit succeeds +--connection node_1 +--reap + +# wsrep_local_replays has increased by 1 +--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` +--disable_query_log +--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old = 1 AS wsrep_local_replays; +--enable_query_log + +INSERT INTO t1 VALUES (22, next value for s); +INSERT INTO t1 VALUES (23, next value for s); +INSERT INTO t1 VALUES (24, next value for s); +INSERT INTO t1 VALUES (25, next value for s); +INSERT INTO t1 VALUES (26, next value for s); +INSERT INTO t1 VALUES (27, next value for s); +INSERT INTO t1 VALUES (28, next value for s); +INSERT INTO t1 VALUES (29, next value for s); +INSERT INTO t1 VALUES (30, next value for s); +INSERT INTO t1 VALUES (31, next value for s); +INSERT INTO t1 VALUES (32, next value for s); +INSERT INTO t1 VALUES (33, next value for s); +INSERT INTO t1 VALUES (34, next value for s); +INSERT INTO t1 VALUES (35, next value for s); + +--connection node_1 +SELECT * FROM t1; +SELECT LASTVAL(s); + +--connection node_2 +SELECT * FROM t1; +SELECT LASTVAL(s); + +--connection node_1 +SELECT NEXTVAL(s); + +--connection node_2 +SELECT NEXTVAL(s); + +DROP SEQUENCE s; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_sequences_transaction.cnf b/mysql-test/suite/galera/t/galera_sequences_transaction.cnf new file mode 100644 index 00000000000..8701e86db5f --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sequences_transaction.cnf @@ -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 diff --git a/mysql-test/suite/galera/t/galera_sequences_transaction.combinations b/mysql-test/suite/galera/t/galera_sequences_transaction.combinations new file mode 100644 index 00000000000..cef98e75213 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sequences_transaction.combinations @@ -0,0 +1,5 @@ +[binlogon] +log-bin +log-slave-updates + +[binlogoff] diff --git a/mysql-test/suite/galera/t/galera_sequences_transaction.test b/mysql-test/suite/galera/t/galera_sequences_transaction.test new file mode 100644 index 00000000000..f3dc7d51285 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sequences_transaction.test @@ -0,0 +1,255 @@ +--source include/galera_cluster.inc +--source include/have_sequence.inc + +--disable_ps2_protocol +# +# Case 1: Separate transactions from few connections +# +--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; + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 + +--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); +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; + +--connection node_2 +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); +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; + +--connection node_2a +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); +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; + +--connection node_1a +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); +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; + +--connection node_2 +SELECT LASTVAL(s); +--connection node_1 +SELECT LASTVAL(s); +--connection node_2a +SELECT LASTVAL(s); +--connection node_1a +SELECT LASTVAL(s); + +--connection node_1 +SELECT * FROM t1; +--connection node_2 +SELECT * FROM t1; + +--connection node_1 +DROP TABLE t1; +DROP SEQUENCE s; + +# +# Case 2: All rollback +# +--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); +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); +ROLLBACK; + +--connection node_2 +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); +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); +ROLLBACK; + +--connection node_2a +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); +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); +ROLLBACK; + +--connection node_1a +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); +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); +ROLLBACK; + +--connection node_2 +SELECT LASTVAL(s); +--connection node_1 +SELECT LASTVAL(s); +--connection node_2a +SELECT LASTVAL(s); +--connection node_1a +SELECT LASTVAL(s); + +--connection node_1 +SELECT * FROM t1; +--connection node_2 +SELECT * FROM t1; + +--connection node_1 +DROP TABLE t1; +DROP SEQUENCE s; +# +# Case 3: Mixed transactions +# +--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); +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_1a +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); +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_2a +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); +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 (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); +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_1 +COMMIT; +--connection node_1a +ROLLBACK; +--connection node_2 +--error ER_LOCK_DEADLOCK +COMMIT; +--connection node_2a +--error ER_LOCK_DEADLOCK +ROLLBACK; + +--connection node_2 +SELECT LASTVAL(s); +--connection node_1 +SELECT LASTVAL(s); +--connection node_2a +SELECT LASTVAL(s); +--connection node_1a +SELECT LASTVAL(s); + +--connection node_1 +SELECT * FROM t1; +--connection node_2 +SELECT * FROM t1; + +--connection node_1 +DROP TABLE t1; +DROP SEQUENCE s; diff --git a/sql/log.cc b/sql/log.cc index 0131acbb83d..1ad927ef9e5 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1812,6 +1812,16 @@ binlog_flush_cache(THD *thd, binlog_cache_mngr *cache_mngr, if (using_trx && thd->binlog_flush_pending_rows_event(TRUE, TRUE)) DBUG_RETURN(1); +#ifdef WITH_WSREP + /* Wsrep transaction was BF aborted but it must replay because certification + succeeded. The transaction must not be written into binlog yet, it will + be done during commit after the replay. */ + if (WSREP(thd) && wsrep_must_replay(thd)) + { + DBUG_RETURN(0); + } +#endif /* WITH_WSREP */ + /* Doing a commit or a rollback including non-transactional tables, i.e., ending a transaction where we might write the transaction diff --git a/sql/wsrep_client_service.cc b/sql/wsrep_client_service.cc index 808c92f0516..cde58defd03 100644 --- a/sql/wsrep_client_service.cc +++ b/sql/wsrep_client_service.cc @@ -306,6 +306,12 @@ enum wsrep::provider::status Wsrep_client_service::replay() replayer_service.replay_status(ret); } + // In Galera we allow only InnoDB sequences, thus + // sequence table updates are in writeset. + // Binlog cache needs reset so that binlog_close + // does not write cache to binlog file yet. + binlog_reset_cache(m_thd); + replayer_thd->main_security_ctx = old_ctx; delete replayer_thd; DBUG_RETURN(ret); From 5003dac220a943de4d375cddbaae2c4f5357c082 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Wed, 2 Apr 2025 04:00:04 +0200 Subject: [PATCH 129/134] MDEV-36116: Post-merge correction for 10.6+ --- mysql-test/suite/galera/r/MDEV-36116.result | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/suite/galera/r/MDEV-36116.result b/mysql-test/suite/galera/r/MDEV-36116.result index 11899b9c09b..f7b4031ae54 100644 --- a/mysql-test/suite/galera/r/MDEV-36116.result +++ b/mysql-test/suite/galera/r/MDEV-36116.result @@ -9,7 +9,7 @@ connection con1; SET DEBUG_SYNC = 'now WAIT_FOR may_kill'; SET DEBUG_SYNC = 'now SIGNAL continue'; connection node_1; -ERROR HY000: Lost connection to MySQL server during query +ERROR HY000: Lost connection to server during query connection node_2; SHOW TABLES LIKE 't1'; Tables_in_test (t1) From b983a911e979a44111f2ece6d02bc8e8cfe99678 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Wed, 2 Apr 2025 03:51:44 +0200 Subject: [PATCH 130/134] galera mtr tests: synchronization between branches and editions --- mysql-test/suite/galera/r/MDEV-34647.result | 1 - .../r/galera_alter_engine_myisam.result | 1 + .../r/galera_bf_abort_mariabackup.result | 2 +- .../suite/galera/r/galera_gcs_fragment.result | 2 +- .../galera/r/galera_partitioned_tables.result | 2 +- .../r/galera_strict_require_innodb.result | 2 +- .../galera_strict_require_primary_key.result | 2 +- mysql-test/suite/galera/r/mdev-30653.result | 2 +- mysql-test/suite/galera/t/MDEV-33136.test | 1 + mysql-test/suite/galera/t/MDEV-34647.test | 1 - .../suite/galera/t/binlog_checksum.test | 1 + .../galera/t/galera_alter_engine_myisam.test | 4 +- .../galera/t/galera_bf_abort_mariabackup.cnf | 4 +- .../galera/t/galera_bf_abort_mariabackup.test | 2 +- .../suite/galera/t/galera_bf_kill_debug.test | 4 +- .../galera/t/galera_disallow_local_gtid.test | 1 - .../galera/t/galera_partitioned_tables.test | 2 +- .../t/galera_strict_require_innodb.test | 4 +- .../t/galera_strict_require_primary_key.test | 4 +- .../t/galera_var_auto_inc_control_off.test | 2 + .../t/galera_var_replicate_aria_off.test | 1 - .../t/galera_var_replicate_aria_on.test | 1 - .../suite/galera/t/galera_var_wsrep_mode.test | 6 -- .../galera/t/galera_var_wsrep_strict_ddl.test | 1 - .../galera/t/galera_vote_rejoin_ddl.test | 4 -- .../suite/galera/t/galera_wsrep_mode.test | 1 - mysql-test/suite/galera/t/mdev-30653.test | 4 +- .../t/galera_duplicate_primary_value.test | 1 + .../t/galera_dynamic_protocol.cnf | 6 +- .../t/galera_dynamic_protocol.test | 1 - .../galera_3nodes_sr/r/MDEV-26707.result | 2 +- sql/handler.cc | 1 + sql/wsrep_mysqld.cc | 25 ++++--- sql/wsrep_thd.h | 66 ++++++++++++------- 34 files changed, 83 insertions(+), 81 deletions(-) diff --git a/mysql-test/suite/galera/r/MDEV-34647.result b/mysql-test/suite/galera/r/MDEV-34647.result index 0333f14ece1..0bdab65d963 100644 --- a/mysql-test/suite/galera/r/MDEV-34647.result +++ b/mysql-test/suite/galera/r/MDEV-34647.result @@ -95,7 +95,6 @@ id val 4 d 5 d 6 d -set global wsrep_mode=default; connection node_1; drop table t1,t2,t3,t4,t5; set global wsrep_mode=default; diff --git a/mysql-test/suite/galera/r/galera_alter_engine_myisam.result b/mysql-test/suite/galera/r/galera_alter_engine_myisam.result index f29c83cad95..98a133c32bc 100644 --- a/mysql-test/suite/galera/r/galera_alter_engine_myisam.result +++ b/mysql-test/suite/galera/r/galera_alter_engine_myisam.result @@ -26,3 +26,4 @@ COUNT(*) = 1 1 DROP TABLE t1; connection node_1; +SET GLOBAL wsrep_mode = DEFAULT; diff --git a/mysql-test/suite/galera/r/galera_bf_abort_mariabackup.result b/mysql-test/suite/galera/r/galera_bf_abort_mariabackup.result index 88c200ee933..88e49c651db 100644 --- a/mysql-test/suite/galera/r/galera_bf_abort_mariabackup.result +++ b/mysql-test/suite/galera/r/galera_bf_abort_mariabackup.result @@ -51,7 +51,7 @@ 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 = ""; +SET GLOBAL wsrep_mode = DEFAULT; connection node_1; DROP TABLE t; disconnect node_2; diff --git a/mysql-test/suite/galera/r/galera_gcs_fragment.result b/mysql-test/suite/galera/r/galera_gcs_fragment.result index bdd749047ee..cac35a78f1c 100644 --- a/mysql-test/suite/galera/r/galera_gcs_fragment.result +++ b/mysql-test/suite/galera/r/galera_gcs_fragment.result @@ -22,7 +22,7 @@ INSERT INTO t1 VALUES (2, "bbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa connection node_1a; SET GLOBAL wsrep_provider_options = 'signal=gcs_core_after_frag_send'; connection node_1; -ERROR HY000: Got error 6 "No such device or address" during COMMIT +ERROR HY000: Error while appending streaming replication fragment(provider status: Not connected to Primary Component) INSERT INTO t1 VALUES (3, "cccccaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"); SELECT * FROM t1; f1 f2 diff --git a/mysql-test/suite/galera/r/galera_partitioned_tables.result b/mysql-test/suite/galera/r/galera_partitioned_tables.result index 3f24cae1495..b68c1786ff7 100644 --- a/mysql-test/suite/galera/r/galera_partitioned_tables.result +++ b/mysql-test/suite/galera/r/galera_partitioned_tables.result @@ -1,6 +1,6 @@ connection node_2; connection node_1; -call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine partition for table.*"); +call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled\\. Storage engine partition for table"); # wsrep-mode= DEFAULT SET GLOBAL wsrep_mode = ""; SELECT @@wsrep_mode; diff --git a/mysql-test/suite/galera/r/galera_strict_require_innodb.result b/mysql-test/suite/galera/r/galera_strict_require_innodb.result index cc243cd3813..47adc5e9285 100644 --- a/mysql-test/suite/galera/r/galera_strict_require_innodb.result +++ b/mysql-test/suite/galera/r/galera_strict_require_innodb.result @@ -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\\. Storage engine "); 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; diff --git a/mysql-test/suite/galera/r/galera_strict_require_primary_key.result b/mysql-test/suite/galera/r/galera_strict_require_primary_key.result index 4a05f6405ed..ffdbb89170f 100644 --- a/mysql-test/suite/galera/r/galera_strict_require_primary_key.result +++ b/mysql-test/suite/galera/r/galera_strict_require_primary_key.result @@ -1,6 +1,6 @@ connection node_2; connection node_1; -call mtr.add_suppression("WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table .*"); +call mtr.add_suppression("WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled\\. Table "); CREATE TABLE t1(a int, b varchar(50)) ENGINE=INNODB; CREATE TABLE t2(a int, b varchar(50)) ENGINE=MYISAM; CREATE TABLE t3(a int, b varchar(50)) ENGINE=MEMORY; diff --git a/mysql-test/suite/galera/r/mdev-30653.result b/mysql-test/suite/galera/r/mdev-30653.result index 43f525ceace..2a6099ae915 100644 --- a/mysql-test/suite/galera/r/mdev-30653.result +++ b/mysql-test/suite/galera/r/mdev-30653.result @@ -4,7 +4,7 @@ create table t1 (id serial, val int) engine=innodb; create table t2 (id serial, val int) engine=aria; insert into t1 values(1, 23); insert into t2 values(2, 42); -call mtr.add_suppression("WSREP: Replication of non-transactional engines is experimental. Storage engine Aria for table 'test'.'t2' is not supported in Galera"); +call mtr.add_suppression("WSREP: Replication of non-transactional engines is experimental\\. Storage engine Aria for table 'test'\\.'t2' is not supported in Galera"); begin; update t1 set val=24 where id=1; update t2 set val=41 where id=2; diff --git a/mysql-test/suite/galera/t/MDEV-33136.test b/mysql-test/suite/galera/t/MDEV-33136.test index 12765ef6dfb..4b484eb47da 100644 --- a/mysql-test/suite/galera/t/MDEV-33136.test +++ b/mysql-test/suite/galera/t/MDEV-33136.test @@ -10,6 +10,7 @@ # transaction in the MDL conflict handling code. --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_debug_sync.inc --source include/have_debug.inc diff --git a/mysql-test/suite/galera/t/MDEV-34647.test b/mysql-test/suite/galera/t/MDEV-34647.test index 41cd941df88..2cf4b627f76 100644 --- a/mysql-test/suite/galera/t/MDEV-34647.test +++ b/mysql-test/suite/galera/t/MDEV-34647.test @@ -45,7 +45,6 @@ select * from t2; select * from t3; select * from t4; select * from t5; -set global wsrep_mode=default; --connection node_1 drop table t1,t2,t3,t4,t5; diff --git a/mysql-test/suite/galera/t/binlog_checksum.test b/mysql-test/suite/galera/t/binlog_checksum.test index 8f6091235a1..5aab68a7746 100644 --- a/mysql-test/suite/galera/t/binlog_checksum.test +++ b/mysql-test/suite/galera/t/binlog_checksum.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/have_innodb.inc --echo # On node_1 --connection node_1 diff --git a/mysql-test/suite/galera/t/galera_alter_engine_myisam.test b/mysql-test/suite/galera/t/galera_alter_engine_myisam.test index 57c057f9869..6f23abab6f3 100644 --- a/mysql-test/suite/galera/t/galera_alter_engine_myisam.test +++ b/mysql-test/suite/galera/t/galera_alter_engine_myisam.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_aria.inc # @@ -35,7 +36,4 @@ SELECT COUNT(*) = 1 FROM t1; DROP TABLE t1; --connection node_1 ---disable_query_log SET GLOBAL wsrep_mode = DEFAULT; ---enable_query_log - diff --git a/mysql-test/suite/galera/t/galera_bf_abort_mariabackup.cnf b/mysql-test/suite/galera/t/galera_bf_abort_mariabackup.cnf index 857a4101406..1e6bbcce82f 100644 --- a/mysql-test/suite/galera/t/galera_bf_abort_mariabackup.cnf +++ b/mysql-test/suite/galera/t/galera_bf_abort_mariabackup.cnf @@ -6,10 +6,10 @@ 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' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' [mysqld.2] -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' +wsrep_provider_options='pc.ignore_sb=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=1' [sst] transferfmt=@ENV.MTR_GALERA_TFMT diff --git a/mysql-test/suite/galera/t/galera_bf_abort_mariabackup.test b/mysql-test/suite/galera/t/galera_bf_abort_mariabackup.test index 34c3f5d3621..90d674313bf 100644 --- a/mysql-test/suite/galera/t/galera_bf_abort_mariabackup.test +++ b/mysql-test/suite/galera/t/galera_bf_abort_mariabackup.test @@ -126,7 +126,7 @@ let SEARCH_PATTERN = Resuming and resyncing the provider; 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 = ""; +SET GLOBAL wsrep_mode = DEFAULT; --connection node_1 DROP TABLE t; diff --git a/mysql-test/suite/galera/t/galera_bf_kill_debug.test b/mysql-test/suite/galera/t/galera_bf_kill_debug.test index a89bd1d06b2..ddf9522c12f 100644 --- a/mysql-test/suite/galera/t/galera_bf_kill_debug.test +++ b/mysql-test/suite/galera/t/galera_bf_kill_debug.test @@ -89,7 +89,7 @@ SET DEBUG_SYNC = "now SIGNAL continue_kill"; --reap --connection node_2a ---error 0,1213,2013 +--error 0,1213,2013,2026 select * from t1; --connection node_2b @@ -130,7 +130,7 @@ SET DEBUG_SYNC = "now WAIT_FOR bwoc_reached"; SET DEBUG_SYNC = "now SIGNAL bwoc_continue"; --connection node_2a ---error 0,1213 +--error 0,1213,2013,2026 --reap --connection node_2 diff --git a/mysql-test/suite/galera/t/galera_disallow_local_gtid.test b/mysql-test/suite/galera/t/galera_disallow_local_gtid.test index b28bab1f8cb..2867e9e050e 100644 --- a/mysql-test/suite/galera/t/galera_disallow_local_gtid.test +++ b/mysql-test/suite/galera/t/galera_disallow_local_gtid.test @@ -101,4 +101,3 @@ DROP TABLE tab; DROP TABLE tab1; DROP TABLE tab2; DROP TABLE tab3; - diff --git a/mysql-test/suite/galera/t/galera_partitioned_tables.test b/mysql-test/suite/galera/t/galera_partitioned_tables.test index f29adcf1501..8e52b59d97d 100644 --- a/mysql-test/suite/galera/t/galera_partitioned_tables.test +++ b/mysql-test/suite/galera/t/galera_partitioned_tables.test @@ -3,7 +3,7 @@ --source include/have_innodb.inc --source include/have_aria.inc -call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine partition for table.*"); +call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled\\. Storage engine partition for table"); --echo # wsrep-mode= DEFAULT SET GLOBAL wsrep_mode = ""; diff --git a/mysql-test/suite/galera/t/galera_strict_require_innodb.test b/mysql-test/suite/galera/t/galera_strict_require_innodb.test index b627fffe70c..6ca95432dbc 100644 --- a/mysql-test/suite/galera/t/galera_strict_require_innodb.test +++ b/mysql-test/suite/galera/t/galera_strict_require_innodb.test @@ -15,9 +15,10 @@ # In both cases apply flood control if >= 10 same warning # --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_aria.inc -call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled. Storage engine .*"); +call mtr.add_suppression("WSREP: wsrep_mode = STRICT_REPLICATION enabled\\. Storage engine "); 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; @@ -114,4 +115,3 @@ DROP TABLE t1,t2,t3,t4; SET GLOBAL log_warnings=DEFAULT; SET GLOBAL wsrep_mode=DEFAULT; --disable_query_log - diff --git a/mysql-test/suite/galera/t/galera_strict_require_primary_key.test b/mysql-test/suite/galera/t/galera_strict_require_primary_key.test index dc5f9910396..4733c2e2ef4 100644 --- a/mysql-test/suite/galera/t/galera_strict_require_primary_key.test +++ b/mysql-test/suite/galera/t/galera_strict_require_primary_key.test @@ -14,9 +14,10 @@ # In both cases apply flood control if >= 10 same warning # --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_aria.inc -call mtr.add_suppression("WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled. Table .*"); +call mtr.add_suppression("WSREP: wsrep_mode = REQUIRED_PRIMARY_KEY enabled\\. Table "); CREATE TABLE t1(a int, b varchar(50)) ENGINE=INNODB; CREATE TABLE t2(a int, b varchar(50)) ENGINE=MYISAM; @@ -140,4 +141,3 @@ DROP TABLE t1,t2,t3,t4; SET GLOBAL log_warnings=DEFAULT; SET GLOBAL wsrep_mode=DEFAULT; --disable_query_log - diff --git a/mysql-test/suite/galera/t/galera_var_auto_inc_control_off.test b/mysql-test/suite/galera/t/galera_var_auto_inc_control_off.test index c0bbe5af8cf..241b62dbf8c 100644 --- a/mysql-test/suite/galera/t/galera_var_auto_inc_control_off.test +++ b/mysql-test/suite/galera/t/galera_var_auto_inc_control_off.test @@ -94,11 +94,13 @@ SELECT * FROM t1; --eval SET GLOBAL wsrep_auto_increment_control = $auto_increment_control_orig --eval SET GLOBAL auto_increment_increment = $auto_increment_increment_node1 --eval SET GLOBAL auto_increment_offset = $auto_increment_offset_node1 +--disconnect node_1a --connection node_2 --eval SET GLOBAL wsrep_auto_increment_control = $auto_increment_control_orig --eval SET GLOBAL auto_increment_increment = $auto_increment_increment_node2 --eval SET GLOBAL auto_increment_offset = $auto_increment_offset_node2 +--disconnect node_2a --enable_query_log diff --git a/mysql-test/suite/galera/t/galera_var_replicate_aria_off.test b/mysql-test/suite/galera/t/galera_var_replicate_aria_off.test index c0d8c5d6b3b..6946bc552ea 100644 --- a/mysql-test/suite/galera/t/galera_var_replicate_aria_off.test +++ b/mysql-test/suite/galera/t/galera_var_replicate_aria_off.test @@ -3,7 +3,6 @@ # --source include/galera_cluster.inc ---source include/have_innodb.inc --source include/have_aria.inc CREATE TABLE t1 (f1 INT PRIMARY KEY) Engine=Aria; diff --git a/mysql-test/suite/galera/t/galera_var_replicate_aria_on.test b/mysql-test/suite/galera/t/galera_var_replicate_aria_on.test index ac9a79e6196..c4367642102 100644 --- a/mysql-test/suite/galera/t/galera_var_replicate_aria_on.test +++ b/mysql-test/suite/galera/t/galera_var_replicate_aria_on.test @@ -234,4 +234,3 @@ SET GLOBAL wsrep_mode = DEFAULT; --connection node_2 SET GLOBAL wsrep_mode = DEFAULT; --enable_query_log - diff --git a/mysql-test/suite/galera/t/galera_var_wsrep_mode.test b/mysql-test/suite/galera/t/galera_var_wsrep_mode.test index 002dce0a05a..fdb033b0874 100644 --- a/mysql-test/suite/galera/t/galera_var_wsrep_mode.test +++ b/mysql-test/suite/galera/t/galera_var_wsrep_mode.test @@ -57,9 +57,3 @@ SELECT @@wsrep_mode; # reset SET GLOBAL wsrep_mode=DEFAULT; - - - - - - diff --git a/mysql-test/suite/galera/t/galera_var_wsrep_strict_ddl.test b/mysql-test/suite/galera/t/galera_var_wsrep_strict_ddl.test index 2aa76d46f82..a2edf27c3dc 100644 --- a/mysql-test/suite/galera/t/galera_var_wsrep_strict_ddl.test +++ b/mysql-test/suite/galera/t/galera_var_wsrep_strict_ddl.test @@ -10,4 +10,3 @@ SELECT @@global.wsrep_strict_ddl; SET @@global.wsrep_strict_ddl=OFF; SELECT @@global.wsrep_mode; SELECT @@global.wsrep_strict_ddl; - diff --git a/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test b/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test index 58371061a5f..c868e5e8e5b 100644 --- a/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test +++ b/mysql-test/suite/galera/t/galera_vote_rejoin_ddl.test @@ -91,10 +91,6 @@ CALL mtr.add_suppression("WSREP: Vote 0 \\(success\\) on .* is inconsistent with DROP TABLE t2; ---let $node_3=node_3 ---let $auto_increment_offset_node_3 = 3; ---let $node_4=node_4 ---let $auto_increment_offset_node_4 = 4; --source suite/galera/include/auto_increment_offset_restore.inc --disconnect node_3 diff --git a/mysql-test/suite/galera/t/galera_wsrep_mode.test b/mysql-test/suite/galera/t/galera_wsrep_mode.test index a8e192123bd..d50018c1c4b 100644 --- a/mysql-test/suite/galera/t/galera_wsrep_mode.test +++ b/mysql-test/suite/galera/t/galera_wsrep_mode.test @@ -16,7 +16,6 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; DROP TABLE t1; SET GLOBAL wsrep_mode = default; - # MDEV-25698 SIGSEGV in wsrep_should_replicate_ddl SET GLOBAL wsrep_mode = STRICT_REPLICATION; diff --git a/mysql-test/suite/galera/t/mdev-30653.test b/mysql-test/suite/galera/t/mdev-30653.test index 658c4372d6b..425f93b3f8c 100644 --- a/mysql-test/suite/galera/t/mdev-30653.test +++ b/mysql-test/suite/galera/t/mdev-30653.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_aria.inc create table t1 (id serial, val int) engine=innodb; @@ -6,7 +7,8 @@ create table t2 (id serial, val int) engine=aria; insert into t1 values(1, 23); insert into t2 values(2, 42); -call mtr.add_suppression("WSREP: Replication of non-transactional engines is experimental. Storage engine Aria for table 'test'.'t2' is not supported in Galera"); + +call mtr.add_suppression("WSREP: Replication of non-transactional engines is experimental\\. Storage engine Aria for table 'test'\\.'t2' is not supported in Galera"); begin; update t1 set val=24 where id=1; diff --git a/mysql-test/suite/galera_3nodes/t/galera_duplicate_primary_value.test b/mysql-test/suite/galera_3nodes/t/galera_duplicate_primary_value.test index 49ddb31d2d7..fe7f0b01607 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_duplicate_primary_value.test +++ b/mysql-test/suite/galera_3nodes/t/galera_duplicate_primary_value.test @@ -1,4 +1,5 @@ --source include/galera_cluster.inc +--source include/have_innodb.inc --source include/have_debug.inc --source include/have_debug_sync.inc --source include/big_test.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.cnf b/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.cnf index 1457727270e..84500819cee 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.cnf +++ b/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.cnf @@ -5,12 +5,12 @@ wsrep_sst_method=rsync [mysqld.1] wsrep_node_name='node.1' -wsrep_provider_options='base_port=@mysqld.1.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;socket.dynamic=true' +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;socket.dynamic=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.2] wsrep_node_name='node.2' -wsrep_provider_options='base_port=@mysqld.2.#galera_port' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' [mysqld.3] wsrep_node_name='node.3' -wsrep_provider_options='base_port=@mysqld.3.#galera_port;socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;socket.dynamic=true' +wsrep_provider_options='socket.ssl=yes;socket.ssl_cert=@ENV.MYSQL_TEST_DIR/std_data/galera-cert.pem;socket.ssl_key=@ENV.MYSQL_TEST_DIR/std_data/galera-key.pem;socket.dynamic=true;repl.causal_read_timeout=PT90S;base_port=@mysqld.3.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;pc.wait_prim_timeout=PT60S;gcache.size=10M' diff --git a/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.test b/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.test index bdb6a9db55b..b4536762560 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.test +++ b/mysql-test/suite/galera_3nodes/t/galera_dynamic_protocol.test @@ -14,7 +14,6 @@ --let $node_3 = node_3 --source ../galera/include/auto_increment_offset_save.inc - --connection node_1 --let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; --source include/wait_condition.inc diff --git a/mysql-test/suite/galera_3nodes_sr/r/MDEV-26707.result b/mysql-test/suite/galera_3nodes_sr/r/MDEV-26707.result index 6891be559d8..b1c266dd605 100644 --- a/mysql-test/suite/galera_3nodes_sr/r/MDEV-26707.result +++ b/mysql-test/suite/galera_3nodes_sr/r/MDEV-26707.result @@ -45,7 +45,7 @@ SET SESSION wsrep_sync_wait = 0; SET SESSION wsrep_sync_wait = DEFAULT; SET DEBUG_SYNC = 'now SIGNAL continue'; connection node_2; -ERROR HY000: Got error 6 "No such device or address" during COMMIT +ERROR HY000: Error while appending streaming replication fragment(provider status: Not connected to Primary Component) connection node_2a; SET DEBUG_SYNC = 'RESET'; connection node_1a; diff --git a/sql/handler.cc b/sql/handler.cc index 8fce97c3ea4..44b88e0e656 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -7774,6 +7774,7 @@ int handler::ha_write_row(const uchar *buf) Log_func *log_func= Write_rows_log_event::binlog_row_logging_function; error= binlog_log_row(table, 0, buf, log_func); } + #ifdef WITH_WSREP THD *thd= ha_thd(); if (WSREP_NNULL(thd) && table_share->tmp_table == NO_TMP_TABLE && diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index bd5c8b929bf..e2d61325847 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -2473,25 +2473,22 @@ bool wsrep_should_replicate_ddl(THD* thd, const handlerton *hton) case DB_TYPE_MYISAM: if (wsrep_check_mode(WSREP_MODE_REPLICATE_MYISAM)) return true; - else - WSREP_DEBUG("wsrep OSU failed for %s", wsrep_thd_query(thd)); + break; + case DB_TYPE_ARIA: + if (wsrep_check_mode(WSREP_MODE_REPLICATE_ARIA)) + return true; break; case DB_TYPE_PARTITION_DB: /* In most cases this means we could not find out table->file->partition_ht() */ return true; break; - case DB_TYPE_ARIA: - if (wsrep_check_mode(WSREP_MODE_REPLICATE_ARIA)) - return true; - else - WSREP_DEBUG("wsrep OSU failed for %s", wsrep_thd_query(thd)); - break; default: - WSREP_DEBUG("wsrep OSU failed for %s", wsrep_thd_query(thd)); break; } + WSREP_DEBUG("wsrep OSU failed for %s", wsrep_thd_query(thd)); + /* wsrep_mode = STRICT_REPLICATION, treat as error */ my_error(ER_GALERA_REPLICATION_NOT_SUPPORTED, MYF(0)); push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, @@ -2506,15 +2503,14 @@ bool wsrep_should_replicate_ddl_iterate(THD* thd, const TABLE_LIST* table_list) { for (const TABLE_LIST* it= table_list; it; it= it->next_global) { - if (it->table && !it->table_function) + const TABLE* table= it->table; + if (table && !it->table_function) { /* If this is partitioned table we need to find out implementing storage engine handlerton. */ - const handlerton *ht= it->table->file->partition_ht() ? - it->table->file->partition_ht() : - it->table->s->db_type(); - + const handlerton *ht= table->file->partition_ht(); + if (!ht) ht= table->s->db_type(); if (!wsrep_should_replicate_ddl(thd, ht)) return false; } @@ -3208,6 +3204,7 @@ void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx, THD *request_thd= requestor_ctx->get_thd(); mysql_mutex_lock(&request_thd->LOCK_thd_data); + if (wsrep_thd_is_toi(request_thd) || wsrep_thd_is_applying(request_thd)) { diff --git a/sql/wsrep_thd.h b/sql/wsrep_thd.h index bf5baf9ac7d..2fe3e123cea 100644 --- a/sql/wsrep_thd.h +++ b/sql/wsrep_thd.h @@ -237,25 +237,13 @@ static inline void wsrep_override_error(THD* thd, wsrep::client_error ce, enum wsrep::provider::status status) { - DBUG_ASSERT(ce != wsrep::e_success); - switch (ce) - { - case wsrep::e_error_during_commit: - if (status == wsrep::provider::error_size_exceeded) - wsrep_override_error(thd, ER_UNKNOWN_ERROR, "Maximum writeset size exceeded"); - else - wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, 0, status); - break; - case wsrep::e_deadlock_error: - wsrep_override_error(thd, ER_LOCK_DEADLOCK); - break; - case wsrep::e_interrupted_error: - wsrep_override_error(thd, ER_QUERY_INTERRUPTED); - break; - case wsrep::e_size_exceeded_error: + DBUG_ASSERT(ce != wsrep::e_success); + switch (ce) + { + case wsrep::e_error_during_commit: + if (status == wsrep::provider::error_size_exceeded) wsrep_override_error(thd, ER_UNKNOWN_ERROR, "Maximum writeset size exceeded"); - break; - case wsrep::e_append_fragment_error: + else /* TODO: Figure out better error number */ if (status) wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, @@ -265,17 +253,45 @@ static inline void wsrep_override_error(THD* thd, else wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, "Error while appending streaming replication fragment"); - break; - case wsrep::e_not_supported_error: - wsrep_override_error(thd, ER_NOT_SUPPORTED_YET); - break; - case wsrep::e_timeout_error: - wsrep_override_error(thd, ER_LOCK_WAIT_TIMEOUT); + break; + case wsrep::e_deadlock_error: + switch (thd->lex->sql_command) + { + case SQLCOM_XA_END: + case SQLCOM_XA_PREPARE: + wsrep_override_error(thd, ER_XA_RBDEADLOCK); break; default: - wsrep_override_error(thd, ER_UNKNOWN_ERROR); + wsrep_override_error(thd, ER_LOCK_DEADLOCK); break; } + break; + case wsrep::e_interrupted_error: + wsrep_override_error(thd, ER_QUERY_INTERRUPTED); + break; + case wsrep::e_size_exceeded_error: + wsrep_override_error(thd, ER_UNKNOWN_ERROR, "Maximum writeset size exceeded"); + break; + case wsrep::e_append_fragment_error: + /* TODO: Figure out better error number */ + if (status) + wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, + "Error while appending streaming replication fragment" + "(provider status: %s)", + wsrep::provider::to_string(status).c_str()); + else + wsrep_override_error(thd, ER_ERROR_DURING_COMMIT, + "Error while appending streaming replication fragment"); + break; + case wsrep::e_not_supported_error: + wsrep_override_error(thd, ER_NOT_SUPPORTED_YET); + break; + case wsrep::e_timeout_error: + wsrep_override_error(thd, ER_LOCK_WAIT_TIMEOUT); + break; + default: + wsrep_override_error(thd, ER_UNKNOWN_ERROR); + } } /** From c01bff4a106326c633f9b899238ab5afe736f64a Mon Sep 17 00:00:00 2001 From: Denis Protivensky Date: Tue, 25 Mar 2025 13:59:00 +0300 Subject: [PATCH 131/134] MDEV-36360: Don't grab table-level X locks for applied inserts It prevents a crash in wsrep_report_error() which happened when appliers would run with FK and UK checks disabled and erroneously execute plain inserts as bulk inserts. Moreover, in release builds such a behavior could lead to deadlocks between two applier threads if a thread waiting for a table-level lock was ordered before the lock holder. In that case the lock holder would proceed to commit order and wait forever for the now-blocked other applier thread to commit before. Signed-off-by: Julius Goryavsky --- .../suite/galera_3nodes/r/MDEV-36360.result | 61 ++++++++++ .../suite/galera_3nodes/t/MDEV-36360.test | 110 ++++++++++++++++++ sql/wsrep_applier.cc | 15 +++ storage/innobase/handler/ha_innodb.cc | 11 ++ storage/innobase/row/row0ins.cc | 21 ++-- 5 files changed, 210 insertions(+), 8 deletions(-) create mode 100644 mysql-test/suite/galera_3nodes/r/MDEV-36360.result create mode 100644 mysql-test/suite/galera_3nodes/t/MDEV-36360.test diff --git a/mysql-test/suite/galera_3nodes/r/MDEV-36360.result b/mysql-test/suite/galera_3nodes/r/MDEV-36360.result new file mode 100644 index 00000000000..2778c3e7bd8 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/r/MDEV-36360.result @@ -0,0 +1,61 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_3; +connection node_1; +CREATE TABLE parent ( +id INT PRIMARY KEY +) ENGINE=InnoDB; +CREATE TABLE child ( +id INT PRIMARY KEY, +parent_id INT, +KEY (parent_id), +CONSTRAINT FOREIGN KEY (parent_id) REFERENCES parent(id) +) ENGINE=InnoDB; +INSERT INTO parent VALUES (1), (2); +connection node_3; +SET SESSION wsrep_on = OFF; +DELETE FROM parent WHERE id = 1; +SET SESSION wsrep_on = ON; +Restarting server 3 with one applier thread having FK and UK checks disabled +SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_after_write_row'; +connection node_1; +INSERT INTO child VALUES (1, 1); +connection node_3; +SET DEBUG_SYNC = 'now WAIT_FOR sync.wsrep_after_write_row_reached'; +SET GLOBAL DEBUG_DBUG = ''; +SET wsrep_sync_wait = 0; +SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL signal.wsrep_after_write_row'; +INSERT INTO child VALUES (2, 2); +SET DEBUG_SYNC = 'RESET'; +include/assert_grep.inc [no FK constraint failure] +Server 3 +SELECT COUNT(*) AS EXPECT_1 FROM parent; +EXPECT_1 +1 +SELECT COUNT(*) AS EXPECT_2 FROM child; +EXPECT_2 +2 +connection node_1; +Server 1 +SET wsrep_sync_wait = 15; +SELECT COUNT(*) AS EXPECT_2 FROM parent; +EXPECT_2 +2 +SELECT COUNT(*) AS EXPECT_2 FROM child; +EXPECT_2 +2 +connection node_2; +Server 2 +SET wsrep_sync_wait = 15; +SELECT COUNT(*) AS EXPECT_2 FROM parent; +EXPECT_2 +2 +SELECT COUNT(*) AS EXPECT_2 FROM child; +EXPECT_2 +2 +DROP TABLE child; +DROP TABLE parent; +disconnect node_2; +disconnect node_1; diff --git a/mysql-test/suite/galera_3nodes/t/MDEV-36360.test b/mysql-test/suite/galera_3nodes/t/MDEV-36360.test new file mode 100644 index 00000000000..31f077fb818 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/MDEV-36360.test @@ -0,0 +1,110 @@ +# +# MDEV-36360: Don't grab table-level X locks for applied inserts. +# +# It prevents a debug crash in wsrep_report_error() which happened when appliers would run +# with FK and UK checks disabled and erroneously execute plain inserts as bulk inserts. +# +# Moreover, in release builds such a behavior could lead to deadlocks between two applier +# threads if a thread waiting for a table-level lock was ordered before the lock holder. +# In that case the lock holder would proceed to commit order and wait forever for the +# now-blocked other applier thread to commit before. +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source include/have_debug.inc + +--let $galera_connection_name = node_3 +--let $galera_server_number = 3 +--source include/galera_connect.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc + +# Create parent and child tables. +--connection node_1 +CREATE TABLE parent ( + id INT PRIMARY KEY +) ENGINE=InnoDB; + +CREATE TABLE child ( + id INT PRIMARY KEY, + parent_id INT, + KEY (parent_id), + CONSTRAINT FOREIGN KEY (parent_id) REFERENCES parent(id) +) ENGINE=InnoDB; + +# Fill the parent table with rows that will later be used by the child. +INSERT INTO parent VALUES (1), (2); + +# Wait until the rows are replicated on node #3. +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 2 FROM parent +--source include/wait_condition.inc + +# Delete one row from the parent table on node #3 and rejoin the cluster. +SET SESSION wsrep_on = OFF; +DELETE FROM parent WHERE id = 1; +SET SESSION wsrep_on = ON; +--echo Restarting server 3 with one applier thread having FK and UK checks disabled +--source include/shutdown_mysqld.inc +--let $start_mysqld_params = --wsrep_slave_FK_checks=0 --wsrep_slave_UK_checks=0 +--source ../galera/include/start_mysqld.inc + +# Stop the applier after writing a row into the child table. +SET GLOBAL DEBUG_DBUG = 'd,sync.wsrep_after_write_row'; + +# Insert a child row that will be applied on node #3, but should not +# grab table-level X-lock. +--connection node_1 +INSERT INTO child VALUES (1, 1); + +--connection node_3 +SET DEBUG_SYNC = 'now WAIT_FOR sync.wsrep_after_write_row_reached'; +# Now that the applier has hit the global sync point wait, reset it +# so that the upcoming insert avoids it. +SET GLOBAL DEBUG_DBUG = ''; +# Don't wait for applied insert to commit. +SET wsrep_sync_wait = 0; +SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL signal.wsrep_after_write_row'; +# The insert should pass the sync point, as otherwise if the applied insert +# grabs table-level X-lock, they'll both deadlock forever. +INSERT INTO child VALUES (2, 2); +SET DEBUG_SYNC = 'RESET'; + +--let $assert_select = foreign key constraint fails +--let $assert_count = 0 +--let $assert_text = no FK constraint failure +--let $assert_only_after = CURRENT_TEST +--let $assert_file = $MYSQLTEST_VARDIR/log/mysqld.3.err +--source include/assert_grep.inc + +# Child row insert is applied even though there's no parent row. +--echo Server 3 +SELECT COUNT(*) AS EXPECT_1 FROM parent; +SELECT COUNT(*) AS EXPECT_2 FROM child; + +# Check other nodes have both parent and child rows. +--connection node_1 +--echo Server 1 +SET wsrep_sync_wait = 15; +SELECT COUNT(*) AS EXPECT_2 FROM parent; +SELECT COUNT(*) AS EXPECT_2 FROM child; + +--connection node_2 +--echo Server 2 +SET wsrep_sync_wait = 15; +SELECT COUNT(*) AS EXPECT_2 FROM parent; +SELECT COUNT(*) AS EXPECT_2 FROM child; + +DROP TABLE child; +DROP TABLE parent; + +# Restore original auto_increment_offset values. +--source ../galera/include/auto_increment_offset_restore.inc + +--source include/galera_end.inc diff --git a/sql/wsrep_applier.cc b/sql/wsrep_applier.cc index 289688c8470..ee3da59d4f2 100644 --- a/sql/wsrep_applier.cc +++ b/sql/wsrep_applier.cc @@ -203,6 +203,21 @@ int wsrep_apply_events(THD* thd, } } + if (LOG_EVENT_IS_WRITE_ROW(typ) || + LOG_EVENT_IS_UPDATE_ROW(typ) || + LOG_EVENT_IS_DELETE_ROW(typ)) + { + Rows_log_event* rle = static_cast(ev); + if (thd_test_options(thd, OPTION_RELAXED_UNIQUE_CHECKS)) + { + rle->set_flags(Rows_log_event::RELAXED_UNIQUE_CHECKS_F); + } + if (thd_test_options(thd, OPTION_NO_FOREIGN_KEY_CHECKS)) + { + rle->set_flags(Rows_log_event::NO_FOREIGN_KEY_CHECKS_F); + } + } + /* Use the original server id for logging. */ thd->set_server_id(ev->server_id); thd->lex->current_select= 0; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 6dc1b6cdc1f..ca1ba831677 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -7986,6 +7986,17 @@ set_max_autoinc: error, m_prebuilt->table->flags, m_user_thd); #ifdef WITH_WSREP +#ifdef ENABLED_DEBUG_SYNC + DBUG_EXECUTE_IF("sync.wsrep_after_write_row", + { + const char act[]= + "now " + "SIGNAL sync.wsrep_after_write_row_reached " + "WAIT_FOR signal.wsrep_after_write_row"; + DBUG_ASSERT(!debug_sync_set_action(m_user_thd, STRING_WITH_LEN(act))); + };); +#endif /* ENABLED_DEBUG_SYNC */ + if (!error_result && trx->is_wsrep() && !trx->is_bulk_insert() && wsrep_thd_is_local(m_user_thd) diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index adc852725dd..31cefab99cd 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -2733,6 +2733,15 @@ err_exit: DBUG_EXECUTE_IF("row_ins_row_level", goto skip_bulk_insert;); +#ifdef WITH_WSREP + /* Appliers never execute bulk insert statements directly. */ + if (trx->is_wsrep() && + !wsrep_thd_is_local_transaction(trx->mysql_thd)) + { + goto skip_bulk_insert; + } +#endif /* WITH_WSREP */ + if (!(flags & BTR_NO_UNDO_LOG_FLAG) && page_is_empty(block->page.frame) && !entry->is_metadata() && !trx->duplicates @@ -2760,15 +2769,11 @@ err_exit: } #ifdef WITH_WSREP - if (trx->is_wsrep()) + if (trx->is_wsrep() && + wsrep_append_table_key(trx->mysql_thd, *index->table)) { - if (!wsrep_thd_is_local_transaction(trx->mysql_thd)) - goto skip_bulk_insert; - if (wsrep_append_table_key(trx->mysql_thd, *index->table)) - { - trx->error_state = DB_ROLLBACK; - goto err_exit; - } + trx->error_state = DB_ROLLBACK; + goto err_exit; } #endif /* WITH_WSREP */ From 8a05f45bc36f962a813f5a0f99172c386bd2eebe Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Mon, 31 Mar 2025 18:07:15 +0400 Subject: [PATCH 132/134] MDEV-36361 Wrong utf8mb4_0900_bin alias for utf8mb4_bin (should be utf8mb4_nopad_bin) `mtr --view ctype_utf8mb4_0900` failed after this commit: commit 3bbe11acd93ad63ed1d90656e11a665d6326996f MDEV-20912 Add support for utf8mb4_0900_* collations in MariaDB Server (Note, this commit was also pushed with a wrong MDEV in the commit comment) This patch changes ctype_utf8mb4_0900.test to work with and without --view. --- mysql-test/main/ctype_utf8mb4_0900.result | 11 ++++++++--- mysql-test/main/ctype_utf8mb4_0900.test | 9 +++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/mysql-test/main/ctype_utf8mb4_0900.result b/mysql-test/main/ctype_utf8mb4_0900.result index 83718c7a126..6d0421900b9 100644 --- a/mysql-test/main/ctype_utf8mb4_0900.result +++ b/mysql-test/main/ctype_utf8mb4_0900.result @@ -206,8 +206,13 @@ FROM information_schema.collations WHERE collation_name='utf8mb4_0900_bin'; collation_name id comment utf8mb4_0900_bin 309 Alias for utf8mb4_nopad_bin -SET NAMES utf8mb4 COLLATE utf8mb4_0900_bin; -SELECT 'a\t'<'a' AS c1; -c1 +CREATE TABLE t1 ( +a VARCHAR(32), +b VARCHAR(32) +) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_bin; +INSERT INTO t1 VALUES ('a\t', 'a'); +SELECT a Date: Wed, 2 Apr 2025 08:12:29 +0300 Subject: [PATCH 133/134] MDEV-35813: even more robust test case The test in commit 1756b0f37dd8e5ce8c9cdb9fec8299ba64dd5dee is occasionally failing if there are unexpectedly many page cleaner batches that are updating the log checkpoint by small amounts. This occurs in particular when running the server under Valgrind. Let us insert the same number of records with a larger number of statements in a hope that the test would then be more likely to pass. --- mysql-test/suite/innodb/r/page_cleaner.result | 16 +++----------- mysql-test/suite/innodb/t/page_cleaner.test | 21 ++++++++----------- 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/mysql-test/suite/innodb/r/page_cleaner.result b/mysql-test/suite/innodb/r/page_cleaner.result index 93c986a93c9..a7c32bfca49 100644 --- a/mysql-test/suite/innodb/r/page_cleaner.result +++ b/mysql-test/suite/innodb/r/page_cleaner.result @@ -2,7 +2,7 @@ SET @save_pct= @@GLOBAL.innodb_max_dirty_pages_pct; SET @save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm; SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0; SET GLOBAL innodb_max_dirty_pages_pct=0.0; -CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0; +CREATE TABLE t(a INT) ENGINE=InnoDB STATS_PERSISTENT=0; connect prevent_purge,localhost,root; START TRANSACTION WITH CONSISTENT SNAPSHOT; connection default; @@ -11,20 +11,10 @@ SET GLOBAL innodb_max_dirty_pages_pct=90.0; SELECT variable_value INTO @log_writes FROM information_schema.global_status WHERE variable_name='innodb_log_writes'; BEGIN; -INSERT INTO t SELECT * FROM seq_1_to_500; -INSERT INTO t SELECT * FROM seq_501_to_1000; -INSERT INTO t SELECT * FROM seq_1001_to_1500; -INSERT INTO t SELECT * FROM seq_1501_to_2000; -INSERT INTO t SELECT * FROM seq_2001_to_2500; -INSERT INTO t SELECT * FROM seq_2501_to_3000; -INSERT INTO t SELECT * FROM seq_3001_to_3500; -INSERT INTO t SELECT * FROM seq_3501_to_4000; -INSERT INTO t SELECT * FROM seq_4001_to_4500; -INSERT INTO t SELECT * FROM seq_4501_to_5000; ROLLBACK; -SELECT if(variable_value-@log_writes<10,'ok',variable_value-@log_writes) +SELECT if(variable_value-@log_writes<500,'ok',variable_value-@log_writes) FROM information_schema.global_status WHERE variable_name='innodb_log_writes'; -if(variable_value-@log_writes<10,'ok',variable_value-@log_writes) +if(variable_value-@log_writes<500,'ok',variable_value-@log_writes) ok disconnect prevent_purge; SELECT variable_value>0 FROM information_schema.global_status diff --git a/mysql-test/suite/innodb/t/page_cleaner.test b/mysql-test/suite/innodb/t/page_cleaner.test index 8568bc7ae6f..408f48262fc 100644 --- a/mysql-test/suite/innodb/t/page_cleaner.test +++ b/mysql-test/suite/innodb/t/page_cleaner.test @@ -7,7 +7,7 @@ SET @save_pct_lwm= @@GLOBAL.innodb_max_dirty_pages_pct_lwm; SET GLOBAL innodb_max_dirty_pages_pct_lwm=0.0; SET GLOBAL innodb_max_dirty_pages_pct=0.0; -CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0; +CREATE TABLE t(a INT) ENGINE=InnoDB STATS_PERSISTENT=0; --connect (prevent_purge,localhost,root) START TRANSACTION WITH CONSISTENT SNAPSHOT; --connection default @@ -27,19 +27,16 @@ WHERE variable_name='innodb_log_writes'; --enable_cursor_protocol BEGIN; -INSERT INTO t SELECT * FROM seq_1_to_500; -INSERT INTO t SELECT * FROM seq_501_to_1000; -INSERT INTO t SELECT * FROM seq_1001_to_1500; -INSERT INTO t SELECT * FROM seq_1501_to_2000; -INSERT INTO t SELECT * FROM seq_2001_to_2500; -INSERT INTO t SELECT * FROM seq_2501_to_3000; -INSERT INTO t SELECT * FROM seq_3001_to_3500; -INSERT INTO t SELECT * FROM seq_3501_to_4000; -INSERT INTO t SELECT * FROM seq_4001_to_4500; -INSERT INTO t SELECT * FROM seq_4501_to_5000; +--disable_query_log +let $N=500; +while ($N) { + INSERT INTO t SELECT * FROM seq_1_to_10; + dec $N; +} +--enable_query_log ROLLBACK; -SELECT if(variable_value-@log_writes<10,'ok',variable_value-@log_writes) +SELECT if(variable_value-@log_writes<500,'ok',variable_value-@log_writes) FROM information_schema.global_status WHERE variable_name='innodb_log_writes'; --disconnect prevent_purge From 4d1484f0458f262cd101d03041c75c3e085d3b6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 2 Apr 2025 09:33:09 +0300 Subject: [PATCH 134/134] Merge fixup This fixes up 74f0b99edf8ef233a384b3d19d92513455d2db3c --- storage/innobase/buf/buf0flu.cc | 2 +- storage/innobase/include/buf0buf.h | 6 +++--- storage/innobase/row/row0ins.cc | 5 +---- 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 9908c6d4e4c..81f78a40527 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -2748,7 +2748,7 @@ ATTRIBUTE_COLD void buf_pool_t::LRU_warn() noexcept LRU_warned= true; sql_print_warning("InnoDB: Could not free any blocks in the buffer pool!" " Consider increasing innodb_buffer_pool_size."); - buf_pool.print_flush_info(); + print_flush_info(); } } diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index f27dabad4d0..caa9093c6d1 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -1906,13 +1906,13 @@ public: /** Issue a warning that we could not free up buffer pool pages. */ ATTRIBUTE_COLD void LRU_warn() noexcept; + /** Print buffer pool flush state information. */ + ATTRIBUTE_COLD void print_flush_info() const noexcept; + /** Collect buffer pool metadata. @param pool_info buffer pool metadata */ void get_info(buf_pool_info_t *pool_info) noexcept; - /** Print buffer pool flush state information. */ - ATTRIBUTE_COLD void print_flush_info() const noexcept; - private: /** Temporary memory for page_compressed and encrypted I/O */ struct io_buf_t diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index 5006ab562ec..d355b674c49 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -2755,11 +2755,8 @@ err_exit: #ifdef WITH_WSREP /* Appliers never execute bulk insert statements directly. */ - if (trx->is_wsrep() && - !wsrep_thd_is_local_transaction(trx->mysql_thd)) - { + if (trx->is_wsrep() && !wsrep_thd_is_local_transaction(trx->mysql_thd)) goto row_level_insert; - } #endif /* WITH_WSREP */ if (!(flags & BTR_NO_UNDO_LOG_FLAG)