From 694d91da8969cc9ef8af9b7f9b59947faa82508f Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Mon, 9 Dec 2024 08:54:17 +0100 Subject: [PATCH 01/84] MDEV-35604: SIGSEGV in filter_query_type | log_statement_ex / auditing Take into account that filter_query_type can get empty query after skip_set_statement run on incorrect query. --- .../suite/plugins/r/server_audit_pwd_mask.result | 9 +++++++++ .../suite/plugins/t/server_audit_pwd_mask.test | 16 ++++++++++++++++ plugin/server_audit/server_audit.c | 2 ++ 3 files changed, 27 insertions(+) diff --git a/mysql-test/suite/plugins/r/server_audit_pwd_mask.result b/mysql-test/suite/plugins/r/server_audit_pwd_mask.result index ce90230f1ea..8068bbcf4d8 100644 --- a/mysql-test/suite/plugins/r/server_audit_pwd_mask.result +++ b/mysql-test/suite/plugins/r/server_audit_pwd_mask.result @@ -30,4 +30,13 @@ DROP USER u2; set global server_audit_logging=off; UNINSTALL PLUGIN ed25519; UNINSTALL PLUGIN server_audit; +# +# MDEV-35604: SIGSEGV in filter_query_type | log_statement_ex / auditing +# +INSTALL PLUGIN server_audit SONAME 'server_audit'; +SET GLOBAL server_audit_logging=ON; +SET STATEMENT max_error_count=1 SELECT 1; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SELECT 1' at line 1 +SET GLOBAL server_audit_logging=OFF; +UNINSTALL SONAME 'server_audit'; # end of 10.5 tests diff --git a/mysql-test/suite/plugins/t/server_audit_pwd_mask.test b/mysql-test/suite/plugins/t/server_audit_pwd_mask.test index b393e22d11e..fe660795ab3 100644 --- a/mysql-test/suite/plugins/t/server_audit_pwd_mask.test +++ b/mysql-test/suite/plugins/t/server_audit_pwd_mask.test @@ -56,4 +56,20 @@ UNINSTALL PLUGIN ed25519; UNINSTALL PLUGIN server_audit; --enable_warnings +--echo # +--echo # MDEV-35604: SIGSEGV in filter_query_type | log_statement_ex / auditing +--echo # + +INSTALL PLUGIN server_audit SONAME 'server_audit'; +SET GLOBAL server_audit_logging=ON; + +--ERROR ER_PARSE_ERROR +SET STATEMENT max_error_count=1 SELECT 1; + +# Cleanup +SET GLOBAL server_audit_logging=OFF; +--disable_warnings +UNINSTALL SONAME 'server_audit'; +--enable_warnings + --echo # end of 10.5 tests diff --git a/plugin/server_audit/server_audit.c b/plugin/server_audit/server_audit.c index 0f1a53183a3..8b49f354f47 100644 --- a/plugin/server_audit/server_audit.c +++ b/plugin/server_audit/server_audit.c @@ -1765,6 +1765,8 @@ static int filter_query_type(const char *query, struct sa_keyword *kwd) char fword[MAX_KEYWORD + 1], nword[MAX_KEYWORD + 1]; int len, nlen= 0; const struct sa_keyword *l_keywords; + if (!query) + return SQLCOM_NOTHING; while (*query && (is_space(*query) || *query == '(' || *query == '/')) { From 9428647be36b1141a91ce31ae06e2664d794c7b0 Mon Sep 17 00:00:00 2001 From: Dave Gosselin Date: Thu, 5 Dec 2024 14:02:09 -0500 Subject: [PATCH 02/84] MDEV-35585 unit.json_normalize crashes on mac Like MDEV-35583, initialize THR_KEY_mysys explicitly by calling MY_INIT and my_end. --- unittest/json_lib/json_normalize-t.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/unittest/json_lib/json_normalize-t.c b/unittest/json_lib/json_normalize-t.c index f72e90175e2..646e74af3e2 100644 --- a/unittest/json_lib/json_normalize-t.c +++ b/unittest/json_lib/json_normalize-t.c @@ -241,8 +241,10 @@ check_number_normalize(const char *in, const char *expected) int -main(void) +main(int argc, char** argv) { + MY_INIT(argv[0]); + plan(88); diag("Testing json_normalization."); @@ -276,5 +278,6 @@ main(void) test_json_normalize_nested_deep(); test_json_normalize_non_utf8(); + my_end(MY_CHECK_ERROR); return exit_status(); } From 1a557d087c4977b555f6872850759d41be785a69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 9 Dec 2024 12:53:38 +0200 Subject: [PATCH 03/84] MDEV-35608 Fake PMEM on /dev/shm no longer works In commit 6acada713a95a605b3aa65bd519fbd4532ad23e5 the logic for treating the file system of /dev/shm as if it were persistent memory was broken. Let us restore the original logic, so that we will have some more CI coverage of the memory-mapped redo log interface. --- storage/innobase/log/log0log.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 3c2257aeab4..82f9e1ffe19 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -255,6 +255,10 @@ static void *log_mmap(os_file_t file, if (!read_only) # ifdef HAVE_PMEM prot= PROT_READ | PROT_WRITE; + +# ifdef __linux__ /* On Linux, we pretend that /dev/shm is PMEM */ +remap: +# endif # else return MAP_FAILED; # endif @@ -270,8 +274,9 @@ static void *log_mmap(os_file_t file, # ifdef HAVE_PMEM # ifdef __linux__ /* On Linux, we pretend that /dev/shm is PMEM */ - if (srv_operation < SRV_OPERATION_BACKUP) + if (flags != MAP_SHARED && srv_operation < SRV_OPERATION_BACKUP) { + flags= MAP_SHARED; struct stat st; if (!fstat(file, &st)) { @@ -283,6 +288,7 @@ static void *log_mmap(os_file_t file, is_pmem= st.st_dev == st_dev; if (!is_pmem) return ptr; /* MAP_FAILED */ + goto remap; } } } From b9e592a786a8fc9f12cb80cb42c24e274037f153 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Mon, 9 Dec 2024 16:54:31 +0530 Subject: [PATCH 04/84] MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)' failed in cmp_rec_rec_simple_field Problem: ======= InnoDB wrongly stores the primary key field in externally stored off page during bulk insert operation. This leads to assert failure. Solution: ======== row_merge_buf_blob(): Should store the primary key fields inline. Store the variable length field data externally based on the row format of the table. row_merge_buf_write(): check whether the record size exceeds the maximum record size. row_merge_copy_blob_from_file(): Construct the tuple based on the variable length field --- .../suite/innodb/r/alter_copy_bulk.result | 24 +++ .../innodb/r/innodb-64k-crash,dynamic.rdiff | 8 + .../innodb/r/innodb-64k-crash,redundant.rdiff | 52 ++++++ .../suite/innodb/r/innodb-64k-crash.result | 50 ++++++ .../innodb/r/insert_into_empty,32k.rdiff | 8 +- .../suite/innodb/r/insert_into_empty,4k.rdiff | 34 +++- .../innodb/r/insert_into_empty,64k.rdiff | 8 +- .../suite/innodb/r/insert_into_empty,8k.rdiff | 38 +++++ .../suite/innodb/r/insert_into_empty.result | 23 +++ .../suite/innodb/t/alter_copy_bulk.test | 25 +++ .../suite/innodb/t/innodb-64k-crash.opt | 1 + .../suite/innodb/t/innodb-64k-crash.test | 62 +++++++ .../suite/innodb/t/insert_into_empty.test | 28 +++- storage/innobase/row/row0merge.cc | 156 ++++++++++-------- 14 files changed, 443 insertions(+), 74 deletions(-) create mode 100644 mysql-test/suite/innodb/r/innodb-64k-crash,dynamic.rdiff create mode 100644 mysql-test/suite/innodb/r/innodb-64k-crash,redundant.rdiff create mode 100644 mysql-test/suite/innodb/r/insert_into_empty,8k.rdiff create mode 100644 mysql-test/suite/innodb/t/innodb-64k-crash.opt diff --git a/mysql-test/suite/innodb/r/alter_copy_bulk.result b/mysql-test/suite/innodb/r/alter_copy_bulk.result index e64853f72a4..cd57d95af96 100644 --- a/mysql-test/suite/innodb/r/alter_copy_bulk.result +++ b/mysql-test/suite/innodb/r/alter_copy_bulk.result @@ -66,4 +66,28 @@ SELECT COUNT(*) FROM t; COUNT(*) 2 DROP TABLE t1, t2, t; +# +# MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)' +# failed in cmp_rec_rec_simple_field +# +CREATE TABLE t1(a BLOB, b VARCHAR(2048), PRIMARY KEY (b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES +(REPEAT('x',4805),'a'), (REPEAT('x',16111),'b'), +(REPEAT('x',65535),'c'), (REPEAT('x',11312),'d'), +(REPEAT('x',35177),'e'), (REPEAT('x',65535),'f'), +(REPEAT('x',1988),'g'), (NULL,REPEAT('x',2048)), +(REPEAT('x',2503),'h'), (REPEAT('x',33152),'i'), +(REPEAT('x',65535),'j'), (REPEAT('x',1988),'k'), +(REPEAT('x',65535),'l'), (REPEAT('x',65535),'m'), +(REPEAT('x',65535),'n'), (REPEAT('x',65535),'o'), +(REPEAT('x',1988),'p'), (REPEAT('x',2503),'q'), +(REPEAT('x',65535),'r'), (REPEAT('x',65535),'s'), +(REPEAT('x',65535),'t'), (REPEAT('x',3169),'u'), +(REPEAT('x',7071),'v'), (REPEAT('x',16111),'w'), +(REPEAT('x',2325),'x'), (REPEAT('x',33152),'y'), +(REPEAT('x',65535),'z'), (REPEAT('x',65535),'aa'), +(REPEAT('x',16111),'bb'), (REPEAT('x',4805),'cc'), +(REPEAT('x',65535),'dd'); +ALTER TABLE t1 FORCE, ALGORITHM=COPY; +DROP TABLE t1; SET GLOBAL innodb_stats_persistent=@default_stats_persistent; diff --git a/mysql-test/suite/innodb/r/innodb-64k-crash,dynamic.rdiff b/mysql-test/suite/innodb/r/innodb-64k-crash,dynamic.rdiff new file mode 100644 index 00000000000..83c5e3aa787 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-64k-crash,dynamic.rdiff @@ -0,0 +1,8 @@ +--- innodb-64k-crash.result 2024-11-28 10:37:26.491384671 +0530 ++++ innodb-64k-crash.reject 2024-11-28 11:05:46.461405444 +0530 +@@ -334,5 +334,4 @@ + REPEAT('s', 1024), REPEAT('t', 1024), + REPEAT('u', 1024), REPEAT('v', 1024), + REPEAT('w', 1024), REPEAT('x', 1024)); +-ERROR 42000: Row size too large (> 16383). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-64k-crash,redundant.rdiff b/mysql-test/suite/innodb/r/innodb-64k-crash,redundant.rdiff new file mode 100644 index 00000000000..637512a2448 --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-64k-crash,redundant.rdiff @@ -0,0 +1,52 @@ +--- innodb-64k-crash.result 2024-11-28 10:37:26.491384671 +0530 ++++ innodb-64k-crash.reject 2024-11-28 11:10:13.381250612 +0530 +@@ -290,49 +290,3 @@ + # MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)' + # failed in cmp_rec_rec_simple_field + # +-CREATE TABLE t1(f1 int not null, f2 text, f3 text, f4 text, +-f5 text, f6 text, f7 text, f8 text, +-f9 text, f10 text, f11 text, f12 text, +-f13 text, f14 text, f15 text, f16 text, +-f17 text, f18 text, f19 text, f20 text, +-f21 text, f22 text, f23 text, f24 text, +-f25 text, PRIMARY KEY(f1))ENGINE=InnoDB; +-SET STATEMENT unique_checks=0,foreign_key_checks=0 FOR +-INSERT INTO t1 VALUES(1, REPEAT('a', 1024), REPEAT('b', 1024), +-REPEAT('c', 1024), REPEAT('d', 1024), +-REPEAT('e', 1024), REPEAT('f', 1024), +-REPEAT('g', 4096), REPEAT('h', 1024), +-REPEAT('i', 1024), REPEAT('j', 1024), +-REPEAT('k', 1024), REPEAT('l', 1024), +-REPEAT('m', 1024), REPEAT('n', 1024), +-REPEAT('o', 1024), REPEAT('p', 1024), +-REPEAT('q', 1024), REPEAT('r', 1024), +-REPEAT('s', 1024), REPEAT('t', 1024), +-REPEAT('u', 1024), REPEAT('v', 1024), +-REPEAT('w', 1024), REPEAT('x', 1024)), +-(2, REPEAT('a', 1024), REPEAT('b', 1024), +-REPEAT('c', 1024), REPEAT('d', 1024), +-REPEAT('e', 1024), REPEAT('f', 1024), +-REPEAT('g', 4096), REPEAT('h', 1024), +-REPEAT('i', 1024), REPEAT('j', 1024), +-REPEAT('k', 1024), REPEAT('l', 1024), +-REPEAT('m', 1024), REPEAT('n', 1024), +-REPEAT('o', 1024), REPEAT('p', 1024), +-REPEAT('q', 1024), REPEAT('r', 1024), +-REPEAT('s', 1024), REPEAT('t', 1024), +-REPEAT('u', 1024), REPEAT('v', 1024), +-REPEAT('w', 1024), REPEAT('x', 1024)), +-(3, REPEAT('a', 1024), REPEAT('b', 1024), +-REPEAT('c', 1024), REPEAT('d', 1024), +-REPEAT('e', 1024), REPEAT('f', 1024), +-REPEAT('g', 4096), REPEAT('h', 1024), +-REPEAT('i', 1024), REPEAT('j', 1024), +-REPEAT('k', 1024), REPEAT('l', 1024), +-REPEAT('m', 1024), REPEAT('n', 1024), +-REPEAT('o', 1024), REPEAT('p', 1024), +-REPEAT('q', 1024), REPEAT('r', 1024), +-REPEAT('s', 1024), REPEAT('t', 1024), +-REPEAT('u', 1024), REPEAT('v', 1024), +-REPEAT('w', 1024), REPEAT('x', 1024)); +-ERROR 42000: Row size too large (> 16383). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +-DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/innodb-64k-crash.result b/mysql-test/suite/innodb/r/innodb-64k-crash.result index 1f3b41f75a6..2b00f9988c2 100644 --- a/mysql-test/suite/innodb/r/innodb-64k-crash.result +++ b/mysql-test/suite/innodb/r/innodb-64k-crash.result @@ -286,3 +286,53 @@ Table Op Msg_type Msg_text test.t1 check status OK test.t2 check status OK drop table t1,t2; +# +# MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)' +# failed in cmp_rec_rec_simple_field +# +CREATE TABLE t1(f1 int not null, f2 text, f3 text, f4 text, +f5 text, f6 text, f7 text, f8 text, +f9 text, f10 text, f11 text, f12 text, +f13 text, f14 text, f15 text, f16 text, +f17 text, f18 text, f19 text, f20 text, +f21 text, f22 text, f23 text, f24 text, +f25 text, PRIMARY KEY(f1))ENGINE=InnoDB; +SET STATEMENT unique_checks=0,foreign_key_checks=0 FOR +INSERT INTO t1 VALUES(1, REPEAT('a', 1024), REPEAT('b', 1024), +REPEAT('c', 1024), REPEAT('d', 1024), +REPEAT('e', 1024), REPEAT('f', 1024), +REPEAT('g', 4096), REPEAT('h', 1024), +REPEAT('i', 1024), REPEAT('j', 1024), +REPEAT('k', 1024), REPEAT('l', 1024), +REPEAT('m', 1024), REPEAT('n', 1024), +REPEAT('o', 1024), REPEAT('p', 1024), +REPEAT('q', 1024), REPEAT('r', 1024), +REPEAT('s', 1024), REPEAT('t', 1024), +REPEAT('u', 1024), REPEAT('v', 1024), +REPEAT('w', 1024), REPEAT('x', 1024)), +(2, REPEAT('a', 1024), REPEAT('b', 1024), +REPEAT('c', 1024), REPEAT('d', 1024), +REPEAT('e', 1024), REPEAT('f', 1024), +REPEAT('g', 4096), REPEAT('h', 1024), +REPEAT('i', 1024), REPEAT('j', 1024), +REPEAT('k', 1024), REPEAT('l', 1024), +REPEAT('m', 1024), REPEAT('n', 1024), +REPEAT('o', 1024), REPEAT('p', 1024), +REPEAT('q', 1024), REPEAT('r', 1024), +REPEAT('s', 1024), REPEAT('t', 1024), +REPEAT('u', 1024), REPEAT('v', 1024), +REPEAT('w', 1024), REPEAT('x', 1024)), +(3, REPEAT('a', 1024), REPEAT('b', 1024), +REPEAT('c', 1024), REPEAT('d', 1024), +REPEAT('e', 1024), REPEAT('f', 1024), +REPEAT('g', 4096), REPEAT('h', 1024), +REPEAT('i', 1024), REPEAT('j', 1024), +REPEAT('k', 1024), REPEAT('l', 1024), +REPEAT('m', 1024), REPEAT('n', 1024), +REPEAT('o', 1024), REPEAT('p', 1024), +REPEAT('q', 1024), REPEAT('r', 1024), +REPEAT('s', 1024), REPEAT('t', 1024), +REPEAT('u', 1024), REPEAT('v', 1024), +REPEAT('w', 1024), REPEAT('x', 1024)); +ERROR 42000: Row size too large (> 16383). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/insert_into_empty,32k.rdiff b/mysql-test/suite/innodb/r/insert_into_empty,32k.rdiff index 9d40decbb30..ba7e68ad890 100644 --- a/mysql-test/suite/innodb/r/insert_into_empty,32k.rdiff +++ b/mysql-test/suite/innodb/r/insert_into_empty,32k.rdiff @@ -1,4 +1,6 @@ -@@ -377,8 +377,6 @@ +--- insert_into_empty.result ++++ insert_into_empty,32k.result +@@ -446,12 +446,9 @@ c09 text, c10 text, c11 text, c12 text) ENGINE=InnoDB; SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= COMPACT; ALTER TABLE t1 FORCE; @@ -7,3 +9,7 @@ INSERT IGNORE INTO t1 VALUES (1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)), (2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)); +-ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CHECK TABLE t1; + Table Op Msg_type Msg_text + test.t1 check status OK diff --git a/mysql-test/suite/innodb/r/insert_into_empty,4k.rdiff b/mysql-test/suite/innodb/r/insert_into_empty,4k.rdiff index ad3d03a7eae..358005bbeff 100644 --- a/mysql-test/suite/innodb/r/insert_into_empty,4k.rdiff +++ b/mysql-test/suite/innodb/r/insert_into_empty,4k.rdiff @@ -1,10 +1,38 @@ ---- a/mysql-test/suite/innodb/r/insert_into_empty.result -+++ b/mysql-test/suite/innodb/r/insert_into_empty.result -@@ -430,6 +430,7 @@ +--- insert_into_empty.result ++++ insert_into_empty,4k.result +@@ -451,7 +451,7 @@ INSERT IGNORE INTO t1 VALUES (1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)), (2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)); +-ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +ERROR 42000: Row size too large (> 1982). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK +@@ -541,26 +541,4 @@ + DELETE FROM t1; + commit; + DROP TABLE t1; +-# +-# MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)' +-# failed in cmp_rec_rec_simple_field +-# +-CREATE TABLE t1(a BLOB, b VARCHAR(2048), PRIMARY KEY (b)) ENGINE=InnoDB; +-INSERT INTO t1 VALUES (REPEAT('x',4805),'a'), (REPEAT('x',16111),'b'), +-(REPEAT('x',65535),'c'), (REPEAT('x',11312),'d'), +-(REPEAT('x',35177),'e'), (REPEAT('x',65535),'f'), +-(REPEAT('x',1988),'g'), (NULL,REPEAT('x',2048)), +-(REPEAT('x',2503),'h'), (REPEAT('x',33152),'i'), +-(REPEAT('x',65535),'j'), (REPEAT('x',1988),'k'), +-(REPEAT('x',65535),'l'), (REPEAT('x',65535),'m'), +-(REPEAT('x',65535),'n'), (REPEAT('x',65535),'o'), +-(REPEAT('x',1988),'p'), (REPEAT('x',2503),'q'), +-(REPEAT('x',65535),'r'), (REPEAT('x',65535),'s'), +-(REPEAT('x',65535),'t'), (REPEAT('x',3169),'u'), +-(REPEAT('x',7071),'v'), (REPEAT('x',16111),'w'), +-(REPEAT('x',2325),'x'), (REPEAT('x',33152),'y'), +-(REPEAT('x',65535),'z'), (REPEAT('x',65535),'aa'), +-(REPEAT('x',16111),'bb'), (REPEAT('x',4805),'cc'), +-(REPEAT('x',65535),'dd'); +-DROP TABLE t1; + # End of 10.11 tests diff --git a/mysql-test/suite/innodb/r/insert_into_empty,64k.rdiff b/mysql-test/suite/innodb/r/insert_into_empty,64k.rdiff index 9d40decbb30..e3d784a7c88 100644 --- a/mysql-test/suite/innodb/r/insert_into_empty,64k.rdiff +++ b/mysql-test/suite/innodb/r/insert_into_empty,64k.rdiff @@ -1,4 +1,6 @@ -@@ -377,8 +377,6 @@ +--- insert_into_empty.result ++++ insert_into_empty,64k.result +@@ -446,12 +446,9 @@ c09 text, c10 text, c11 text, c12 text) ENGINE=InnoDB; SET GLOBAL INNODB_DEFAULT_ROW_FORMAT= COMPACT; ALTER TABLE t1 FORCE; @@ -7,3 +9,7 @@ INSERT IGNORE INTO t1 VALUES (1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)), (2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)); +-ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CHECK TABLE t1; + Table Op Msg_type Msg_text + test.t1 check status OK diff --git a/mysql-test/suite/innodb/r/insert_into_empty,8k.rdiff b/mysql-test/suite/innodb/r/insert_into_empty,8k.rdiff new file mode 100644 index 00000000000..99ad06d971a --- /dev/null +++ b/mysql-test/suite/innodb/r/insert_into_empty,8k.rdiff @@ -0,0 +1,38 @@ +--- insert_into_empty.result ++++ insert_into_empty,8k.result +@@ -451,7 +451,7 @@ + INSERT IGNORE INTO t1 VALUES + (1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)), + (2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)); +-ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. ++ERROR 42000: Row size too large (> 4030). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. + CHECK TABLE t1; + Table Op Msg_type Msg_text + test.t1 check status OK +@@ -541,26 +541,4 @@ + DELETE FROM t1; + commit; + DROP TABLE t1; +-# +-# MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)' +-# failed in cmp_rec_rec_simple_field +-# +-CREATE TABLE t1(a BLOB, b VARCHAR(2048), PRIMARY KEY (b)) ENGINE=InnoDB; +-INSERT INTO t1 VALUES (REPEAT('x',4805),'a'), (REPEAT('x',16111),'b'), +-(REPEAT('x',65535),'c'), (REPEAT('x',11312),'d'), +-(REPEAT('x',35177),'e'), (REPEAT('x',65535),'f'), +-(REPEAT('x',1988),'g'), (NULL,REPEAT('x',2048)), +-(REPEAT('x',2503),'h'), (REPEAT('x',33152),'i'), +-(REPEAT('x',65535),'j'), (REPEAT('x',1988),'k'), +-(REPEAT('x',65535),'l'), (REPEAT('x',65535),'m'), +-(REPEAT('x',65535),'n'), (REPEAT('x',65535),'o'), +-(REPEAT('x',1988),'p'), (REPEAT('x',2503),'q'), +-(REPEAT('x',65535),'r'), (REPEAT('x',65535),'s'), +-(REPEAT('x',65535),'t'), (REPEAT('x',3169),'u'), +-(REPEAT('x',7071),'v'), (REPEAT('x',16111),'w'), +-(REPEAT('x',2325),'x'), (REPEAT('x',33152),'y'), +-(REPEAT('x',65535),'z'), (REPEAT('x',65535),'aa'), +-(REPEAT('x',16111),'bb'), (REPEAT('x',4805),'cc'), +-(REPEAT('x',65535),'dd'); +-DROP TABLE t1; + # End of 10.11 tests diff --git a/mysql-test/suite/innodb/r/insert_into_empty.result b/mysql-test/suite/innodb/r/insert_into_empty.result index cdc730d2b6d..4277d2c3fa6 100644 --- a/mysql-test/suite/innodb/r/insert_into_empty.result +++ b/mysql-test/suite/innodb/r/insert_into_empty.result @@ -451,6 +451,7 @@ Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB o INSERT IGNORE INTO t1 VALUES (1, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)), (2, REPEAT('x',4805), REPEAT('t',2211), REPEAT('u',974), REPEAT('e',871), REPEAT('z',224), REPEAT('j',978), REPEAT('n',190), REPEAT('t',888), REPEAT('x',32768), REPEAT('e',968), REPEAT('b',913), REPEAT('x',12107)); +ERROR 42000: Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK @@ -540,4 +541,26 @@ INSERT INTO t1 VALUES(2,0); DELETE FROM t1; commit; DROP TABLE t1; +# +# MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)' +# failed in cmp_rec_rec_simple_field +# +CREATE TABLE t1(a BLOB, b VARCHAR(2048), PRIMARY KEY (b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (REPEAT('x',4805),'a'), (REPEAT('x',16111),'b'), +(REPEAT('x',65535),'c'), (REPEAT('x',11312),'d'), +(REPEAT('x',35177),'e'), (REPEAT('x',65535),'f'), +(REPEAT('x',1988),'g'), (NULL,REPEAT('x',2048)), +(REPEAT('x',2503),'h'), (REPEAT('x',33152),'i'), +(REPEAT('x',65535),'j'), (REPEAT('x',1988),'k'), +(REPEAT('x',65535),'l'), (REPEAT('x',65535),'m'), +(REPEAT('x',65535),'n'), (REPEAT('x',65535),'o'), +(REPEAT('x',1988),'p'), (REPEAT('x',2503),'q'), +(REPEAT('x',65535),'r'), (REPEAT('x',65535),'s'), +(REPEAT('x',65535),'t'), (REPEAT('x',3169),'u'), +(REPEAT('x',7071),'v'), (REPEAT('x',16111),'w'), +(REPEAT('x',2325),'x'), (REPEAT('x',33152),'y'), +(REPEAT('x',65535),'z'), (REPEAT('x',65535),'aa'), +(REPEAT('x',16111),'bb'), (REPEAT('x',4805),'cc'), +(REPEAT('x',65535),'dd'); +DROP TABLE t1; # End of 10.11 tests diff --git a/mysql-test/suite/innodb/t/alter_copy_bulk.test b/mysql-test/suite/innodb/t/alter_copy_bulk.test index 2d195617ea4..bc19aca00da 100644 --- a/mysql-test/suite/innodb/t/alter_copy_bulk.test +++ b/mysql-test/suite/innodb/t/alter_copy_bulk.test @@ -83,4 +83,29 @@ CREATE TABLE t engine=innodb SELECT t2.f2 FROM t2 JOIN t1 ON t1.f1 = t2.f1 AND t1.f3 = '' AND t1.f2=1 ; SELECT COUNT(*) FROM t; DROP TABLE t1, t2, t; + +--echo # +--echo # MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)' +--echo # failed in cmp_rec_rec_simple_field +--echo # +CREATE TABLE t1(a BLOB, b VARCHAR(2048), PRIMARY KEY (b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES + (REPEAT('x',4805),'a'), (REPEAT('x',16111),'b'), + (REPEAT('x',65535),'c'), (REPEAT('x',11312),'d'), + (REPEAT('x',35177),'e'), (REPEAT('x',65535),'f'), + (REPEAT('x',1988),'g'), (NULL,REPEAT('x',2048)), + (REPEAT('x',2503),'h'), (REPEAT('x',33152),'i'), + (REPEAT('x',65535),'j'), (REPEAT('x',1988),'k'), + (REPEAT('x',65535),'l'), (REPEAT('x',65535),'m'), + (REPEAT('x',65535),'n'), (REPEAT('x',65535),'o'), + (REPEAT('x',1988),'p'), (REPEAT('x',2503),'q'), + (REPEAT('x',65535),'r'), (REPEAT('x',65535),'s'), + (REPEAT('x',65535),'t'), (REPEAT('x',3169),'u'), + (REPEAT('x',7071),'v'), (REPEAT('x',16111),'w'), + (REPEAT('x',2325),'x'), (REPEAT('x',33152),'y'), + (REPEAT('x',65535),'z'), (REPEAT('x',65535),'aa'), + (REPEAT('x',16111),'bb'), (REPEAT('x',4805),'cc'), + (REPEAT('x',65535),'dd'); +ALTER TABLE t1 FORCE, ALGORITHM=COPY; +DROP TABLE t1; SET GLOBAL innodb_stats_persistent=@default_stats_persistent; diff --git a/mysql-test/suite/innodb/t/innodb-64k-crash.opt b/mysql-test/suite/innodb/t/innodb-64k-crash.opt new file mode 100644 index 00000000000..c856c2d215a --- /dev/null +++ b/mysql-test/suite/innodb/t/innodb-64k-crash.opt @@ -0,0 +1 @@ +--innodb_sort_buffer_size=65536 diff --git a/mysql-test/suite/innodb/t/innodb-64k-crash.test b/mysql-test/suite/innodb/t/innodb-64k-crash.test index 93f6f79edf3..61735890618 100644 --- a/mysql-test/suite/innodb/t/innodb-64k-crash.test +++ b/mysql-test/suite/innodb/t/innodb-64k-crash.test @@ -2,6 +2,7 @@ --source include/have_innodb_64k.inc # Embedded server does not support restarting --source include/not_embedded.inc +--source innodb_default_row_format.inc let $MYSQLD_DATADIR= `select @@datadir`; @@ -314,3 +315,64 @@ connection default; check table t1,t2; drop table t1,t2; + +--echo # +--echo # MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)' +--echo # failed in cmp_rec_rec_simple_field +--echo # +let $row_format= `select @@global.innodb_default_row_format`; +if ($row_format != "redundant") +{ +CREATE TABLE t1(f1 int not null, f2 text, f3 text, f4 text, + f5 text, f6 text, f7 text, f8 text, + f9 text, f10 text, f11 text, f12 text, + f13 text, f14 text, f15 text, f16 text, + f17 text, f18 text, f19 text, f20 text, + f21 text, f22 text, f23 text, f24 text, + f25 text, PRIMARY KEY(f1))ENGINE=InnoDB; +let $error_code = ER_TOO_BIG_ROWSIZE; +if ($row_format == "dynamic") +{ + let $error_code = 0; +} + +--error $error_code +SET STATEMENT unique_checks=0,foreign_key_checks=0 FOR +INSERT INTO t1 VALUES(1, REPEAT('a', 1024), REPEAT('b', 1024), + REPEAT('c', 1024), REPEAT('d', 1024), + REPEAT('e', 1024), REPEAT('f', 1024), + REPEAT('g', 4096), REPEAT('h', 1024), + REPEAT('i', 1024), REPEAT('j', 1024), + REPEAT('k', 1024), REPEAT('l', 1024), + REPEAT('m', 1024), REPEAT('n', 1024), + REPEAT('o', 1024), REPEAT('p', 1024), + REPEAT('q', 1024), REPEAT('r', 1024), + REPEAT('s', 1024), REPEAT('t', 1024), + REPEAT('u', 1024), REPEAT('v', 1024), + REPEAT('w', 1024), REPEAT('x', 1024)), + (2, REPEAT('a', 1024), REPEAT('b', 1024), + REPEAT('c', 1024), REPEAT('d', 1024), + REPEAT('e', 1024), REPEAT('f', 1024), + REPEAT('g', 4096), REPEAT('h', 1024), + REPEAT('i', 1024), REPEAT('j', 1024), + REPEAT('k', 1024), REPEAT('l', 1024), + REPEAT('m', 1024), REPEAT('n', 1024), + REPEAT('o', 1024), REPEAT('p', 1024), + REPEAT('q', 1024), REPEAT('r', 1024), + REPEAT('s', 1024), REPEAT('t', 1024), + REPEAT('u', 1024), REPEAT('v', 1024), + REPEAT('w', 1024), REPEAT('x', 1024)), + (3, REPEAT('a', 1024), REPEAT('b', 1024), + REPEAT('c', 1024), REPEAT('d', 1024), + REPEAT('e', 1024), REPEAT('f', 1024), + REPEAT('g', 4096), REPEAT('h', 1024), + REPEAT('i', 1024), REPEAT('j', 1024), + REPEAT('k', 1024), REPEAT('l', 1024), + REPEAT('m', 1024), REPEAT('n', 1024), + REPEAT('o', 1024), REPEAT('p', 1024), + REPEAT('q', 1024), REPEAT('r', 1024), + REPEAT('s', 1024), REPEAT('t', 1024), + REPEAT('u', 1024), REPEAT('v', 1024), + REPEAT('w', 1024), REPEAT('x', 1024)); +DROP TABLE t1; +} diff --git a/mysql-test/suite/innodb/t/insert_into_empty.test b/mysql-test/suite/innodb/t/insert_into_empty.test index a4e6592477f..79f6c23f7ee 100644 --- a/mysql-test/suite/innodb/t/insert_into_empty.test +++ b/mysql-test/suite/innodb/t/insert_into_empty.test @@ -484,7 +484,7 @@ ALTER TABLE t1 FORCE; let $page_size= `SELECT @@innodb_page_size`; let $error_code = 0; -if ($page_size == 4096) { +if ($page_size <= 16384) { let $error_code = ER_TOO_BIG_ROWSIZE; } @@ -593,4 +593,30 @@ INSERT INTO t1 VALUES(2,0); DELETE FROM t1; commit; DROP TABLE t1; + + +if ($page_size >= 16384) { +--echo # +--echo # MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)' +--echo # failed in cmp_rec_rec_simple_field +--echo # +CREATE TABLE t1(a BLOB, b VARCHAR(2048), PRIMARY KEY (b)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (REPEAT('x',4805),'a'), (REPEAT('x',16111),'b'), + (REPEAT('x',65535),'c'), (REPEAT('x',11312),'d'), + (REPEAT('x',35177),'e'), (REPEAT('x',65535),'f'), + (REPEAT('x',1988),'g'), (NULL,REPEAT('x',2048)), + (REPEAT('x',2503),'h'), (REPEAT('x',33152),'i'), + (REPEAT('x',65535),'j'), (REPEAT('x',1988),'k'), + (REPEAT('x',65535),'l'), (REPEAT('x',65535),'m'), + (REPEAT('x',65535),'n'), (REPEAT('x',65535),'o'), + (REPEAT('x',1988),'p'), (REPEAT('x',2503),'q'), + (REPEAT('x',65535),'r'), (REPEAT('x',65535),'s'), + (REPEAT('x',65535),'t'), (REPEAT('x',3169),'u'), + (REPEAT('x',7071),'v'), (REPEAT('x',16111),'w'), + (REPEAT('x',2325),'x'), (REPEAT('x',33152),'y'), + (REPEAT('x',65535),'z'), (REPEAT('x',65535),'aa'), + (REPEAT('x',16111),'bb'), (REPEAT('x',4805),'cc'), + (REPEAT('x',65535),'dd'); +DROP TABLE t1; +} --echo # End of 10.11 tests diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index f14ae66cf74..b4f260c3ab0 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -1057,7 +1057,8 @@ length in the field data @param heap heap to store the blob offset and length @return DB_SUCCESS if successful */ static dberr_t row_merge_write_blob_to_tmp_file( - dfield_t *field, merge_file_t *blob_file,mem_heap_t **heap) + dfield_t *field, uint32_t local_len, + merge_file_t *blob_file, mem_heap_t **heap) { if (blob_file->fd == OS_FILE_CLOSED) { @@ -1066,83 +1067,74 @@ static dberr_t row_merge_write_blob_to_tmp_file( return DB_OUT_OF_MEMORY; } uint64_t val= blob_file->offset; - uint32_t len= field->len; + uint32_t field_len= field->len; dberr_t err= os_file_write( IORequestWrite, "(bulk insert)", blob_file->fd, - field->data, blob_file->offset, len); + static_cast(field->data) + local_len, blob_file->offset, + field_len - local_len); if (err != DB_SUCCESS) return err; - byte *data= static_cast - (mem_heap_alloc(*heap, BTR_EXTERN_FIELD_REF_SIZE)); + byte *data= + static_cast(mem_heap_alloc(*heap, + local_len + BTR_EXTERN_FIELD_REF_SIZE)); + memcpy(data, field->data, local_len); + dfield_set_data(field, data, local_len + BTR_EXTERN_FIELD_REF_SIZE); + dfield_set_ext(field); + + data+= local_len; /* Write zeroes for first 8 bytes */ memset(data, 0, 8); /* Write offset for next 8 bytes */ mach_write_to_8(data + 8, val); /* Write length of the blob in 4 bytes */ - mach_write_to_4(data + 16, len); - blob_file->offset+= field->len; + mach_write_to_4(data + 16, field_len - local_len); + blob_file->offset+= (field_len - local_len); blob_file->n_rec++; - dfield_set_data(field, data, BTR_EXTERN_FIELD_REF_SIZE); - dfield_set_ext(field); return err; } -/** This function is invoked when tuple size is greater than -innodb_sort_buffer_size. Basically it recreates the tuple -by writing the blob field to the temporary file. -@param entry index fields to be encode the blob +/** Variable length field data or fixed length +character greater than 255 can be stored externally. Instead +of storing it externally, InnoDB should store it in temporary +file and write offset, length into the tuple field +@param fields index fields to be encode the blob @param blob_file file to store the blob data +@param index index for the tuple to be stored @param heap heap to store the blob offset and blob length -@return tuple which fits into sort_buffer_size */ -static dtuple_t* row_merge_buf_large_tuple(const dtuple_t &entry, - merge_file_t *blob_file, - mem_heap_t **heap) +@return error code */ +static +dberr_t row_merge_buf_blob(dfield_t *fields, + merge_file_t *blob_file, + const dict_index_t *index, + mem_heap_t **heap) { - if (!*heap) - *heap= mem_heap_create(DTUPLE_EST_ALLOC(entry.n_fields)); + const uint blob_prefix= dict_table_has_atomic_blobs(index->table) + ? 0 + : REC_ANTELOPE_MAX_INDEX_COL_LEN; + const uint min_local_len = blob_prefix + ? blob_prefix + FIELD_REF_SIZE + : 2 * FIELD_REF_SIZE; - dtuple_t *tuple= dtuple_copy(&entry, *heap); - for (ulint i= 0; i < tuple->n_fields; i++) + for (ulint i= index->first_user_field(); i < index->n_fields; i++) { - dfield_t *field= &tuple->fields[i]; - if (dfield_is_null(field) || field->len <= 2000) + dfield_t *field= &fields[i]; + if (dfield_is_null(field) || index->fields[i].fixed_len) continue; - dberr_t err= row_merge_write_blob_to_tmp_file(field, blob_file, heap); - if (err != DB_SUCCESS) - return nullptr; - } - - return tuple; -} - - -/** Write the field data whose length is more than 2000 bytes -into blob temporary file and write offset, length into the -tuple field -@param entry index fields to be encode the blob -@param n_fields number of fields in the entry -@param heap heap to store the blob offset and blob length -@param blob_file file to store the blob data */ -static dberr_t row_merge_buf_blob(const mtuple_t *entry, ulint n_fields, - mem_heap_t **heap, merge_file_t *blob_file) -{ - - if (!*heap) - *heap= mem_heap_create(100); - - for (ulint i= 0; i < n_fields; i++) - { - dfield_t *field= &entry->fields[i]; - if (dfield_is_null(field) || field->len <= 2000) - continue; - - dberr_t err= row_merge_write_blob_to_tmp_file(field, blob_file, heap); - if (err != DB_SUCCESS) - return err; + if (field->len > min_local_len && + DATA_BIG_COL(index->fields[i].col)) + { + if (*heap == nullptr) + *heap= mem_heap_create(256); + dberr_t err= + row_merge_write_blob_to_tmp_file(field, blob_prefix, + blob_file, heap); + if (err) + return err; + } } return DB_SUCCESS; @@ -1172,8 +1164,10 @@ dberr_t row_merge_buf_write(const row_merge_buf_t *buf, if (blob_file) { ut_ad(buf->index->is_primary()); - err = row_merge_buf_blob( - entry, n_fields, &blob_heap, blob_file); + + err = row_merge_buf_blob(entry->fields, + blob_file, buf->index, + &blob_heap); if (err != DB_SUCCESS) { goto func_exit; } @@ -1181,9 +1175,17 @@ dberr_t row_merge_buf_write(const row_merge_buf_t *buf, ulint rec_size= row_merge_buf_encode( &b, index, entry, n_fields); - if (blob_file && rec_size > srv_page_size) { - err = DB_TOO_BIG_RECORD; - goto func_exit; + if (blob_file) { + ulint rec_max_size = + (srv_page_size == UNIV_PAGE_SIZE_MAX) + ? REDUNDANT_REC_MAX_DATA_SIZE + : page_get_free_space_of_empty( + dict_table_is_comp( + index->table)) / 2; + if (rec_size > rec_max_size) { + err = DB_TOO_BIG_RECORD; + goto func_exit; + } } ut_ad(b < &block[srv_sort_buf_size]); @@ -3561,10 +3563,16 @@ in field data for the tuple @param tuple tuple to be inserted @param heap heap to allocate the memory for the blob storage @param blob_file file to handle blob data */ -static dberr_t row_merge_copy_blob_from_file(dtuple_t *tuple, mem_heap_t *heap, +static dberr_t row_merge_copy_blob_from_file(dtuple_t *tuple, + dict_index_t *index, + mem_heap_t *heap, merge_file_t *blob_file) { - for (ulint i = 0; i < dtuple_get_n_fields(tuple); i++) + ut_ad(tuple->n_fields == index->n_fields); + const uint blob_prefix= dict_table_has_atomic_blobs(index->table) + ? 0 + : REC_ANTELOPE_MAX_INDEX_COL_LEN; + for (ulint i = index->first_user_field(); i < tuple->n_fields; i++) { dfield_t *field= dtuple_get_nth_field(tuple, i); const byte *field_data= static_cast(dfield_get_data(field)); @@ -3575,15 +3583,18 @@ static dberr_t row_merge_copy_blob_from_file(dtuple_t *tuple, mem_heap_t *heap, ut_a(field_len >= BTR_EXTERN_FIELD_REF_SIZE); ut_ad(!dfield_is_null(field)); + field_data += blob_prefix; ut_ad(mach_read_from_8(field_data) == 0); uint64_t offset= mach_read_from_8(field_data + 8); uint32_t len= mach_read_from_4(field_data + 16); - byte *data= (byte*) mem_heap_alloc(heap, len); - if (dberr_t err= os_file_read(IORequestRead, blob_file->fd, data, + byte *data= (byte*) mem_heap_alloc(heap, blob_prefix + len); + memcpy(data, field->data, blob_prefix); + if (dberr_t err= os_file_read(IORequestRead, blob_file->fd, + data + blob_prefix, offset, len, nullptr)) return err; - dfield_set_data(field, data, len); + dfield_set_data(field, data, blob_prefix + len); } return DB_SUCCESS; @@ -3805,7 +3816,7 @@ row_merge_insert_index_tuples( if (!dtuple_get_n_ext(dtuple)) { } else if (blob_file) { error = row_merge_copy_blob_from_file( - dtuple, tuple_heap, blob_file); + dtuple, index, tuple_heap, blob_file); if (error != DB_SUCCESS) { break; } @@ -5172,6 +5183,7 @@ dberr_t row_merge_bulk_t::bulk_insert_buffered(const dtuple_t &row, const dict_index_t &ind, trx_t *trx) { + ut_ad(row.n_fields == ind.n_fields); dberr_t err= DB_SUCCESS; ulint i= 0; mem_heap_t *large_tuple_heap= nullptr; @@ -5197,8 +5209,16 @@ add_to_buf: if (buf->n_tuples == 0) { /* Tuple data size is greater than srv_sort_buf_size */ - dtuple_t *big_tuple= row_merge_buf_large_tuple( - row, &m_blob_file, &large_tuple_heap); + ut_ad(i == 0); + if (!large_tuple_heap) + large_tuple_heap= mem_heap_create(DTUPLE_EST_ALLOC(row.n_fields)); + + dtuple_t *big_tuple= dtuple_copy(&row, large_tuple_heap); + err= row_merge_buf_blob(big_tuple->fields, &m_blob_file, + &ind, &large_tuple_heap); + if (err) + goto func_exit; + if (row_merge_bulk_buf_add(buf, *ind.table, *big_tuple)) { i++; From d92d271648db812f89071594b8178145e10e2b83 Mon Sep 17 00:00:00 2001 From: Dave Gosselin Date: Mon, 15 Apr 2024 15:17:30 -0400 Subject: [PATCH 05/84] MDEV-35583 Tests failing on macOS These tests rely on THR_KEY_mysys but it is not initialized. On Linux, the corresponding thread variable is null, but on macOS it has a nonzero value. In all cases, initialize the variable explicitly by calling MY_INIT and my_end appropriately. --- unittest/mysys/dynstring-t.c | 5 ++++- unittest/sql/my_json_writer-t.cc | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/unittest/mysys/dynstring-t.c b/unittest/mysys/dynstring-t.c index 194d435dfff..32a6b2a50e3 100644 --- a/unittest/mysys/dynstring-t.c +++ b/unittest/mysys/dynstring-t.c @@ -26,8 +26,10 @@ static void check(const char *res) str1.length= 0; } -int main(void) +int main(int argc, char** argv) { + MY_INIT(argv[0]); + plan(23); IF_WIN(skip_all("Test of POSIX shell escaping rules, not for CMD.EXE\n"), ); @@ -69,6 +71,7 @@ int main(void) dynstr_free(&str1); + my_end(MY_CHECK_ERROR); return exit_status(); } diff --git a/unittest/sql/my_json_writer-t.cc b/unittest/sql/my_json_writer-t.cc index 6398a589c33..5b295980b53 100644 --- a/unittest/sql/my_json_writer-t.cc +++ b/unittest/sql/my_json_writer-t.cc @@ -51,6 +51,8 @@ public: int main(int args, char **argv) { + MY_INIT(argv[0]); + plan(NO_PLAN); diag("Testing Json_writer checks"); @@ -123,6 +125,7 @@ int main(int args, char **argv) diag("Done"); + my_end(MY_CHECK_ERROR); return exit_status(); } From bf7cfa2535618bfe9962c725555680e799fdcd18 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Thu, 5 Dec 2024 15:31:40 +1100 Subject: [PATCH 06/84] MDEV-35574 remove obsolete pthread_exit calls Threads can normally exit without a explicit pthread_exit call. There seem to date to old glibc bugs, many around 2.2.5. The semi related bug was https://bugs.mysql.com/bug.php?id=82886. To improve safety in the signal handlers DBUG_* code was removed. These where also needed to avoid some MSAN unresolved stack issues. This is effectively a backport of 2719cc4925c032f483edb0e61c0f487e0c429ae6. --- client/mysqlimport.c | 1 - client/mysqltest.cc | 1 - mysys/thr_alarm.c | 3 +-- mysys/thr_timer.c | 3 +-- plugin/feedback/sender_thread.cc | 1 - sql/mysqld.cc | 7 +------ storage/mroonga/vendor/groonga/src/groonga_benchmark.c | 7 +------ tests/thread_test.c | 1 - unittest/mysys/stack_allocation-t.c | 1 - unittest/sql/my_apc-t.cc | 1 - 10 files changed, 4 insertions(+), 22 deletions(-) diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 405eda8cc10..687fd8c2061 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -631,7 +631,6 @@ error: pthread_cond_signal(&count_threshhold); pthread_mutex_unlock(&counter_mutex); mysql_thread_end(); - pthread_exit(0); return 0; } diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 71025814fcf..becb411947f 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -991,7 +991,6 @@ end_thread: cn->mysql= 0; cn->query_done= 1; mysql_thread_end(); - pthread_exit(0); DBUG_RETURN(0); } diff --git a/mysys/thr_alarm.c b/mysys/thr_alarm.c index af22e7cc45c..6a3bc153462 100644 --- a/mysys/thr_alarm.c +++ b/mysys/thr_alarm.c @@ -566,8 +566,7 @@ static void *alarm_handler(void *arg __attribute__((unused))) alarm_thread_running= 0; mysql_cond_signal(&COND_alarm); mysql_mutex_unlock(&LOCK_alarm); - pthread_exit(0); - return 0; /* Impossible */ + return 0; } #endif /* USE_ALARM_THREAD */ #endif diff --git a/mysys/thr_timer.c b/mysys/thr_timer.c index 00fc74cdf77..6e9e5a421e0 100644 --- a/mysys/thr_timer.c +++ b/mysys/thr_timer.c @@ -330,8 +330,7 @@ static void *timer_handler(void *arg __attribute__((unused))) } mysql_mutex_unlock(&LOCK_timer); my_thread_end(); - pthread_exit(0); - return 0; /* Impossible */ + return 0; } diff --git a/plugin/feedback/sender_thread.cc b/plugin/feedback/sender_thread.cc index 68aaa4c5dc7..453f367c289 100644 --- a/plugin/feedback/sender_thread.cc +++ b/plugin/feedback/sender_thread.cc @@ -290,7 +290,6 @@ pthread_handler_t background_thread(void *arg __attribute__((unused))) } my_thread_end(); - pthread_exit(0); return 0; } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index dd2d9df4c1c..a9fa24c2064 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2948,7 +2948,6 @@ pthread_handler_t signal_hand(void *) sigset_t set; int sig; my_thread_init(); // Init new thread - DBUG_ENTER("signal_hand"); signal_thread_in_use= 1; /* @@ -3014,7 +3013,6 @@ pthread_handler_t signal_hand(void *) /* switch to the old log message processing */ logger.set_handlers(global_system_variables.sql_log_slow ? LOG_FILE:LOG_NONE, opt_log ? LOG_FILE:LOG_NONE); - DBUG_PRINT("info",("Got signal: %d abort_loop: %d",sig,abort_loop)); break_connect_loop(); DBUG_ASSERT(abort_loop); @@ -3050,12 +3048,9 @@ pthread_handler_t signal_hand(void *) break; /* purecov: tested */ } } - DBUG_PRINT("quit", ("signal_handler: calling my_thread_end()")); my_thread_end(); - DBUG_LEAVE; // Must match DBUG_ENTER() signal_thread_in_use= 0; - pthread_exit(0); // Safety - return(0); /* purecov: deadcode */ + return nullptr; } static void check_data_home(const char *path) diff --git a/storage/mroonga/vendor/groonga/src/groonga_benchmark.c b/storage/mroonga/vendor/groonga/src/groonga_benchmark.c index 267bb278764..a4918137d4f 100644 --- a/storage/mroonga/vendor/groonga/src/groonga_benchmark.c +++ b/storage/mroonga/vendor/groonga/src/groonga_benchmark.c @@ -271,12 +271,7 @@ error_exit_in_thread(intptr_t code) CRITICAL_SECTION_ENTER(grntest_cs); grntest_stop_flag = 1; CRITICAL_SECTION_LEAVE(grntest_cs); -#ifdef WIN32 - _endthreadex(code); -#else - pthread_exit((void *)code); -#endif /* WIN32 */ - return 0; + return code; } diff --git a/tests/thread_test.c b/tests/thread_test.c index d0c33b47b9c..a26e69bdf75 100644 --- a/tests/thread_test.c +++ b/tests/thread_test.c @@ -70,7 +70,6 @@ end: thread_count--; pthread_cond_signal(&COND_thread_count); /* Tell main we are ready */ pthread_mutex_unlock(&LOCK_thread_count); - pthread_exit(0); return 0; } diff --git a/unittest/mysys/stack_allocation-t.c b/unittest/mysys/stack_allocation-t.c index 2b044c80f42..23b75a8f148 100644 --- a/unittest/mysys/stack_allocation-t.c +++ b/unittest/mysys/stack_allocation-t.c @@ -91,7 +91,6 @@ pthread_handler_t thread_stack_check(void *arg __attribute__((unused))) test_stack_detection(1, STACK_ALLOC_SMALL_BLOCK_SIZE-1); test_stack_detection(2, STACK_ALLOC_SMALL_BLOCK_SIZE+1); my_thread_end(); - pthread_exit(0); return 0; } diff --git a/unittest/sql/my_apc-t.cc b/unittest/sql/my_apc-t.cc index 8fb9181377a..c91a5015b6e 100644 --- a/unittest/sql/my_apc-t.cc +++ b/unittest/sql/my_apc-t.cc @@ -108,7 +108,6 @@ void *test_apc_service_thread(void *ptr) apc_target.destroy(); mysql_mutex_destroy(&target_mutex); my_thread_end(); - pthread_exit(0); return NULL; } From 807e4f320fe5e4531fbc178552b8c30f09a7d2df Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Tue, 10 Dec 2024 18:00:37 +1100 Subject: [PATCH 07/84] Change my_umask{,_dir} to mode_t and remove os_innodb_umask MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit os_innodb_umask was of the incorrect type resulting in warnings in clang-19. The correct type is mode_t. As os_innodb_umask was set during innnodb_init from my_umask, corrected the type there along with its companion my_umask_dir. Because of this, the defaults mask values in innodb never had an effect. The resulting change allow found signed differences in my_create{,_nosymlink}, open_nosymlinks: mysys/my_create.c:47:20: error: operand of ?: changes signedness from ‘int’ to ‘mode_t’ {aka ‘unsigned int’} due to unsignedness of other operand [-Werror=sign-compare] 47 | CreateFlags ? CreateFlags : my_umask); Ref: clang-19 warnings: [55/123] Building CXX object storage/innobase/CMakeFiles/innobase.dir/os/os0file.cc.o storage/innobase/os/os0file.cc:1075:46: warning: implicit conversion loses integer precision: 'ulint' (aka 'unsigned long') to 'mode_t' (aka 'unsigned int') [-Wshorten-64-to-32] 1075 | file = open(name, create_flag | O_CLOEXEC, os_innodb_umask); | ~~~~ ^~~~~~~~~~~~~~~ storage/innobase/os/os0file.cc:1249:46: warning: implicit conversion loses integer precision: 'ulint' (aka 'unsigned long') to 'mode_t' (aka 'unsigned int') [-Wshorten-64-to-32] 1249 | file = open(name, create_flag | O_CLOEXEC, os_innodb_umask); | ~~~~ ^~~~~~~~~~~~~~~ storage/innobase/os/os0file.cc:1381:45: warning: implicit conversion loses integer precision: 'ulint' (aka 'unsigned long') to 'mode_t' (aka 'unsigned int') [-Wshorten-64-to-32] 1381 | file = open(name, create_flag | O_CLOEXEC, os_innodb_umask); | ~~~~ ^~~~~~~~~~~~~~~ --- include/my_sys.h | 10 +++++----- mysys/my_create.c | 4 ++-- mysys/my_init.c | 8 ++++---- mysys/my_open.c | 2 +- mysys/my_static.c | 2 +- mysys/my_symlink2.c | 2 +- storage/innobase/handler/ha_innodb.cc | 2 -- storage/innobase/include/os0file.h | 5 ----- storage/innobase/os/os0file.cc | 28 +++------------------------ 9 files changed, 17 insertions(+), 46 deletions(-) diff --git a/include/my_sys.h b/include/my_sys.h index d1a0394086c..856640a3a90 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -246,9 +246,9 @@ extern void (*my_sigtstp_cleanup)(void), /* Executed before jump to shell */ (*my_sigtstp_restart)(void); /* Executed when coming from shell */ -extern MYSQL_PLUGIN_IMPORT int my_umask; /* Default creation mask */ -extern int my_umask_dir, - my_recived_signals, /* Signals we have got */ +extern MYSQL_PLUGIN_IMPORT mode_t my_umask; /* Default creation mask */ +extern mode_t my_umask_dir; +extern int my_recived_signals, /* Signals we have got */ my_safe_to_handle_signal, /* Set when allowed to SIGTSTP */ my_dont_interrupt; /* call remember_intr when set */ extern MYSQL_PLUGIN_IMPORT my_bool my_use_symdir; @@ -609,7 +609,7 @@ extern File my_open(const char *FileName,int Flags,myf MyFlags); extern File my_register_filename(File fd, const char *FileName, enum file_type type_of_file, uint error_message_number, myf MyFlags); -extern File my_create(const char *FileName,int CreateFlags, +extern File my_create(const char *FileName, mode_t CreateFlags, int AccessFlags, myf MyFlags); extern int my_close(File Filedes,myf MyFlags); extern int my_mkdir(const char *dir, int Flags, myf MyFlags); @@ -617,7 +617,7 @@ extern int my_readlink(char *to, const char *filename, myf MyFlags); extern int my_is_symlink(const char *filename); extern int my_realpath(char *to, const char *filename, myf MyFlags); extern File my_create_with_symlink(const char *linkname, const char *filename, - int createflags, int access_flags, + mode_t createflags, int access_flags, myf MyFlags); extern int my_rename_with_symlink(const char *from,const char *to,myf MyFlags); extern int my_symlink(const char *content, const char *linkname, myf MyFlags); diff --git a/mysys/my_create.c b/mysys/my_create.c index 6fb817da8df..32cc73a53c4 100644 --- a/mysys/my_create.c +++ b/mysys/my_create.c @@ -33,12 +33,12 @@ */ -File my_create(const char *FileName, int CreateFlags, int access_flags, +File my_create(const char *FileName, mode_t CreateFlags, int access_flags, myf MyFlags) { int fd; DBUG_ENTER("my_create"); - DBUG_PRINT("my",("Name: '%s' CreateFlags: %d AccessFlags: %d MyFlags: %lu", + DBUG_PRINT("my",("Name: '%s' CreateFlags: %u AccessFlags: %d MyFlags: %lu", FileName, CreateFlags, access_flags, MyFlags)); #if defined(_WIN32) fd= my_win_open(FileName, access_flags | O_CREAT); diff --git a/mysys/my_init.c b/mysys/my_init.c index 2b420da03be..fcb3ccfdf31 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -45,7 +45,7 @@ uint mysys_usage_id= 0; /* Incremented for each my_init() */ ulonglong my_thread_stack_size= (sizeof(void*) <= 4)? 65536: ((256-16)*1024); -static ulong atoi_octal(const char *str) +static mode_t atoi_octal(const char *str) { long int tmp; while (*str && my_isspace(&my_charset_latin1, *str)) @@ -53,7 +53,7 @@ static ulong atoi_octal(const char *str) str2int(str, (*str == '0' ? 8 : 10), /* Octalt or decimalt */ 0, INT_MAX, &tmp); - return (ulong) tmp; + return (mode_t) tmp; } MYSQL_FILE *mysql_stdin= NULL; @@ -82,10 +82,10 @@ my_bool my_init(void) /* Default creation of new files */ if ((str= getenv("UMASK")) != 0) - my_umask= (int) (atoi_octal(str) | 0600); + my_umask= atoi_octal(str) | 0600; /* Default creation of new dir's */ if ((str= getenv("UMASK_DIR")) != 0) - my_umask_dir= (int) (atoi_octal(str) | 0700); + my_umask_dir= atoi_octal(str) | 0700; init_glob_errs(); diff --git a/mysys/my_open.c b/mysys/my_open.c index 8b5f4f9435e..c39539342d9 100644 --- a/mysys/my_open.c +++ b/mysys/my_open.c @@ -20,7 +20,7 @@ #include "my_atomic.h" CREATE_NOSYMLINK_FUNCTION( - open_nosymlinks(const char *pathname, int flags, int mode), + open_nosymlinks(const char *pathname, int flags, mode_t mode), openat(dfd, filename, O_NOFOLLOW | flags, mode), open(pathname, O_NOFOLLOW | flags, mode) ); diff --git a/mysys/my_static.c b/mysys/my_static.c index 6c09ab8d94b..1e54c4c93b2 100644 --- a/mysys/my_static.c +++ b/mysys/my_static.c @@ -63,7 +63,7 @@ char curr_dir[FN_REFLEN]= {0}, home_dir_buff[FN_REFLEN]= {0}; ulong my_stream_opened=0,my_tmp_file_created=0; ulong my_file_total_opened= 0; -int my_umask=0664, my_umask_dir=0777; +mode_t my_umask=0664, my_umask_dir=0777; myf my_global_flags= 0; #ifndef DBUG_OFF diff --git a/mysys/my_symlink2.c b/mysys/my_symlink2.c index 0b580ecd32f..d9b31e3dfaf 100644 --- a/mysys/my_symlink2.c +++ b/mysys/my_symlink2.c @@ -26,7 +26,7 @@ #include File my_create_with_symlink(const char *linkname, const char *filename, - int createflags, int access_flags, myf MyFlags) + mode_t createflags, int access_flags, myf MyFlags) { File file; int tmp_errno; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 68d486b9457..ad0f894f924 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -4024,8 +4024,6 @@ static int innodb_init(void* p) test_filename)); #endif /* DBUG_OFF */ - os_file_set_umask(my_umask); - /* Setup the memory alloc/free tracing mechanisms before calling any functions that could possibly allocate memory. */ ut_new_boot(); diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h index 43320515fbd..e3dc5d16c8e 100644 --- a/storage/innobase/include/os0file.h +++ b/storage/innobase/include/os0file.h @@ -1135,11 +1135,6 @@ os_file_get_status( bool check_rw_perm, bool read_only); -/** Set the file create umask -@param[in] umask The umask to use for file creation. */ -void -os_file_set_umask(ulint umask); - #ifdef _WIN32 /** diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index f33797305dc..012f23b3b8d 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -140,18 +140,6 @@ static io_slots *write_slots; /** Number of retries for partial I/O's */ constexpr ulint NUM_RETRIES_ON_PARTIAL_IO = 10; -/* This specifies the file permissions InnoDB uses when it creates files in -Unix; the value of os_innodb_umask is initialized in ha_innodb.cc to -my_umask */ - -#ifndef _WIN32 -/** Umask for creating files */ -static ulint os_innodb_umask = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP; -#else -/** Umask for creating files */ -static ulint os_innodb_umask = 0; -#endif /* _WIN32 */ - Atomic_counter os_n_file_reads; static ulint os_bytes_read_since_printout; ulint os_n_file_writes; @@ -1072,7 +1060,7 @@ os_file_create_simple_func( bool retry; do { - file = open(name, create_flag | O_CLOEXEC, os_innodb_umask); + file = open(name, create_flag | O_CLOEXEC, my_umask); if (file == -1) { *success = false; @@ -1246,7 +1234,7 @@ os_file_create_func( bool retry; do { - file = open(name, create_flag | O_CLOEXEC, os_innodb_umask); + file = open(name, create_flag | O_CLOEXEC, my_umask); if (file == -1) { const char* operation; @@ -1378,7 +1366,7 @@ os_file_create_simple_no_error_handling_func( return(OS_FILE_CLOSED); } - file = open(name, create_flag | O_CLOEXEC, os_innodb_umask); + file = open(name, create_flag | O_CLOEXEC, my_umask); *success = (file != -1); @@ -3861,16 +3849,6 @@ os_aio_refresh_stats() os_last_printout = time(NULL); } - -/** -Set the file create umask -@param[in] umask The umask to use for file creation. */ -void -os_file_set_umask(ulint umask) -{ - os_innodb_umask = umask; -} - #ifdef _WIN32 /* Checks whether physical drive is on SSD.*/ From bfe7c8ff0ae2c18b38ee823d95d64e6ab60356af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 11 Dec 2024 14:44:42 +0200 Subject: [PATCH 08/84] MDEV-35494 fil_space_t::fil_space_t() may be unsafe with GCC -flifetime-dse MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fil_space_t::create(): Instead of invoking the default fil_space_t constructor on a zero-filled buffer, allocate an uninitialized buffer and invoke an explicitly defined constructor on it. Also, specify initializer expressions for all constant data members, so that all of them will be initialized in the constructor. fil_space_t::being_imported: Replaces part of fil_space_t::purpose. fil_space_t::is_being_imported(), fil_space_t::is_temporary(): Replaces fil_space_t::purpose. fil_space_t::id: Changed the type from ulint to uint32_t to reduce incompatibility with later branches that include commit ca501ffb04246dcaa1f1d433d916d8436e30602e (MDEV-26195). fil_space_t::try_to_close(): Do not attempt to close files that are in an I/O bound phase of ALTER TABLE…IMPORT TABLESPACE. log_file_op, first_page_init: recv_spaces_t: Use uint32_t for the tablespace id. Reviewed by: Debarun Banerjee --- extra/mariabackup/xtrabackup.cc | 50 ++--- storage/innobase/buf/buf0buf.cc | 5 +- storage/innobase/buf/buf0dblwr.cc | 3 +- storage/innobase/buf/buf0flu.cc | 20 +- storage/innobase/dict/dict0load.cc | 10 +- storage/innobase/dict/dict0mem.cc | 3 - storage/innobase/fil/fil0crypt.cc | 12 +- storage/innobase/fil/fil0fil.cc | 285 ++++++++++----------------- storage/innobase/fsp/fsp0fsp.cc | 11 +- storage/innobase/fsp/fsp0space.cc | 6 +- storage/innobase/fsp/fsp0sysspace.cc | 6 +- storage/innobase/handler/i_s.cc | 7 +- storage/innobase/ibuf/ibuf0ibuf.cc | 11 +- storage/innobase/include/fil0fil.h | 189 +++++++++--------- storage/innobase/include/log0recv.h | 8 +- storage/innobase/log/log0recv.cc | 20 +- storage/innobase/mtr/mtr0mtr.cc | 6 +- storage/innobase/os/os0file.cc | 14 +- storage/innobase/row/row0import.cc | 11 +- storage/innobase/srv/srv0start.cc | 6 +- storage/innobase/trx/trx0sys.cc | 3 +- 21 files changed, 310 insertions(+), 376 deletions(-) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index d7860627717..8aeeb7d7e9f 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -730,13 +730,15 @@ datafiles_iter_next(datafiles_iter_t *it) fil_system.space_list.begin() : std::next(it->space); - while (it->space != fil_system.space_list.end() && - (it->space->purpose != FIL_TYPE_TABLESPACE || - UT_LIST_GET_LEN(it->space->chain) == 0)) + while (it->space != fil_system.space_list.end() + && UT_LIST_GET_LEN(it->space->chain) == 0) ++it->space; if (it->space == fil_system.space_list.end()) goto end; + ut_ad(!it->space->is_temporary()); + ut_ad(!it->space->is_being_imported()); + it->node = UT_LIST_GET_FIRST(it->space->chain); end: @@ -907,7 +909,7 @@ err: @param[in] len length of name, in bytes @param[in] new_name new file name (NULL if not rename) @param[in] new_len length of new_name, in bytes (0 if NULL) */ -static void backup_file_op(ulint space_id, int type, +static void backup_file_op(uint32_t space_id, int type, const byte* name, ulint len, const byte* new_name, ulint new_len) { @@ -923,7 +925,8 @@ static void backup_file_op(ulint space_id, int type, std::string space_name = filename_to_spacename(name, len); ddl_tracker.id_to_name[space_id] = space_name; ddl_tracker.delete_defer(space_id, space_name); - msg("DDL tracking : create %zu \"%.*s\"", space_id, int(len), name); + msg("DDL tracking : create %" PRIu32 " \"%.*s\"", + space_id, int(len), name); } break; case FILE_MODIFY: @@ -939,7 +942,7 @@ static void backup_file_op(ulint space_id, int type, ddl_tracker.id_to_name[space_id] = new_space_name; ddl_tracker.rename_defer(space_id, old_space_name, new_space_name); - msg("DDL tracking : rename %zu \"%.*s\",\"%.*s\"", + msg("DDL tracking : rename %" PRIu32 " \"%.*s\",\"%.*s\"", space_id, int(len), name, int(new_len), new_name); } break; @@ -947,7 +950,8 @@ static void backup_file_op(ulint space_id, int type, ddl_tracker.drops.insert(space_id); ddl_tracker.delete_defer( space_id, filename_to_spacename(name, len)); - msg("DDL tracking : delete %zu \"%.*s\"", space_id, int(len), name); + msg("DDL tracking : delete %" PRIu32 " \"%.*s\"", + space_id, int(len), name); break; default: ut_ad(0); @@ -966,21 +970,22 @@ static void backup_file_op(ulint space_id, int type, We will abort backup in this case. */ -static void backup_file_op_fail(ulint space_id, int type, +static void backup_file_op_fail(uint32_t space_id, int type, const byte* name, ulint len, const byte* new_name, ulint new_len) { bool fail = false; switch(type) { case FILE_CREATE: - msg("DDL tracking : create %zu \"%.*s\"", space_id, int(len), name); + msg("DDL tracking : create %" PRIu32 " \"%.*s\"", + space_id, int(len), name); fail = !check_if_skip_table( filename_to_spacename(name, len).c_str()); break; case FILE_MODIFY: break; case FILE_RENAME: - msg("DDL tracking : rename %zu \"%.*s\",\"%.*s\"", + msg("DDL tracking : rename %" PRIu32 " \"%.*s\",\"%.*s\"", space_id, int(len), name, int(new_len), new_name); fail = !check_if_skip_table( filename_to_spacename(name, len).c_str()) @@ -990,7 +995,8 @@ static void backup_file_op_fail(ulint space_id, int type, case FILE_DELETE: fail = !check_if_skip_table( filename_to_spacename(name, len).c_str()); - msg("DDL tracking : delete %zu \"%.*s\"", space_id, int(len), name); + msg("DDL tracking : delete %" PRIu32 " \"%.*s\"", + space_id, int(len), name); break; default: ut_ad(0); @@ -1011,7 +1017,7 @@ static void backup_undo_trunc(uint32_t space_id) /* Function to store the space id of page0 INIT_PAGE @param space_id space id which has page0 init page */ -static void backup_first_page_op(ulint space_id) +static void backup_first_page_op(uint32_t space_id) { first_page_init_ids.insert(space_id); } @@ -3532,8 +3538,8 @@ static void xb_load_single_table_tablespace(const char *dirname, if (err == DB_SUCCESS && file->space_id() != SRV_TMP_SPACE_ID) { mysql_mutex_lock(&fil_system.mutex); space = fil_space_t::create( - file->space_id(), file->flags(), - FIL_TYPE_TABLESPACE, nullptr/* TODO: crypt_data */, + uint32_t(file->space_id()), file->flags(), false, + nullptr/* TODO: crypt_data */, FIL_ENCRYPTION_DEFAULT, file->handle() != OS_FILE_CLOSED); ut_ad(space); @@ -4998,8 +5004,8 @@ void CorruptedPages::backup_fix_ddl(ds_ctxt *ds_data, ds_ctxt *ds_meta) iter != ddl_tracker.tables_in_backup.end(); iter++) { - const std::string name = iter->second; - ulint id = iter->first; + uint32_t id = iter->first; + const std::string &name = iter->second; if (ddl_tracker.drops.find(id) != ddl_tracker.drops.end()) { dropped_tables.insert(name); @@ -5025,8 +5031,8 @@ void CorruptedPages::backup_fix_ddl(ds_ctxt *ds_data, ds_ctxt *ds_meta) iter != ddl_tracker.id_to_name.end(); iter++) { - ulint id = iter->first; - std::string name = iter->second; + uint32_t id = iter->first; + const std::string &name = iter->second; if (ddl_tracker.tables_in_backup.find(id) != ddl_tracker.tables_in_backup.end()) { /* already processed above */ @@ -5322,8 +5328,8 @@ exit: char tmpname[FN_REFLEN]; - snprintf(tmpname, FN_REFLEN, "%s/xtrabackup_tmp_#" ULINTPF, - dbname, fil_space->id); + snprintf(tmpname, FN_REFLEN, "%s/xtrabackup_tmp_#%" + PRIu32, dbname, fil_space->id); msg("mariabackup: Renaming %s to %s.ibd", fil_space->chain.start->name, tmpname); @@ -5378,8 +5384,8 @@ exit: ut_ad(fil_space_t::physical_size(flags) == info.page_size); mysql_mutex_lock(&fil_system.mutex); - fil_space_t* space = fil_space_t::create(info.space_id, flags, - FIL_TYPE_TABLESPACE, 0, + fil_space_t* space = fil_space_t::create(uint32_t(info.space_id), + flags, false, 0, FIL_ENCRYPTION_DEFAULT, true); mysql_mutex_unlock(&fil_system.mutex); if (space) { diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index ae604f0826c..4cc3cdf38c4 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -3643,8 +3643,7 @@ static dberr_t buf_page_check_corrupt(buf_page_t *bpage, const bool seems_encrypted = !node.space->full_crc32() && key_version && node.space->crypt_data && node.space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED; - ut_ad(node.space->purpose != FIL_TYPE_TEMPORARY || - node.space->full_crc32()); + ut_ad(!node.space->is_temporary() || node.space->full_crc32()); /* If traditional checksums match, we assume that page is not anymore encrypted. */ @@ -3652,7 +3651,7 @@ static dberr_t buf_page_check_corrupt(buf_page_t *bpage, && !buf_is_zeroes(span(dst_frame, node.space->physical_size())) && (key_version || node.space->is_compressed() - || node.space->purpose == FIL_TYPE_TEMPORARY)) { + || node.space->is_temporary())) { if (buf_page_full_crc32_is_corrupted( bpage->id().space(), dst_frame, node.space->is_compressed())) { diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index 31036bf978d..0060ee29fd9 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -750,7 +750,8 @@ void buf_dblwr_t::add_to_batch(const IORequest &request, size_t size) ut_ad(request.bpage); ut_ad(request.bpage->in_file()); ut_ad(request.node); - ut_ad(request.node->space->purpose == FIL_TYPE_TABLESPACE); + ut_ad(!request.node->space->is_temporary()); + ut_ad(!request.node->space->is_being_imported()); ut_ad(request.node->space->id == request.bpage->id().space()); ut_ad(request.node->space->referenced()); ut_ad(!srv_read_only_mode); diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index a513f2499f6..024866f4f75 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -639,7 +639,7 @@ static byte *buf_page_encrypt(fil_space_t* space, buf_page_t* bpage, byte* s, fil_space_crypt_t *crypt_data= space->crypt_data; bool encrypted, page_compressed; - if (space->purpose == FIL_TYPE_TEMPORARY) + if (space->is_temporary()) { ut_ad(!crypt_data); encrypted= innodb_encrypt_temporary_tables; @@ -685,13 +685,13 @@ static byte *buf_page_encrypt(fil_space_t* space, buf_page_t* bpage, byte* s, if (!page_compressed) { not_compressed: - d= space->purpose == FIL_TYPE_TEMPORARY + d= space->is_temporary() ? buf_tmp_page_encrypt(page_no, s, d) : fil_space_encrypt(space, page_no, s, d); } else { - ut_ad(space->purpose != FIL_TYPE_TEMPORARY); + ut_ad(!space->is_temporary()); /* First we compress the page content */ buf_tmp_reserve_compression_buf(*slot); byte *tmp= (*slot)->comp_buf; @@ -768,8 +768,7 @@ bool buf_page_t::flush(fil_space_t *space) mysql_mutex_assert_not_owner(&buf_pool.flush_list_mutex); ut_ad(in_file()); ut_ad(in_LRU_list); - ut_ad((space->purpose == FIL_TYPE_TEMPORARY) == - (space == fil_system.temp_space)); + ut_ad((space->is_temporary()) == (space == fil_system.temp_space)); ut_ad(space->referenced()); const auto s= state(); @@ -779,12 +778,12 @@ bool buf_page_t::flush(fil_space_t *space) (FIL_PAGE_LSN + (zip.data ? zip.data : frame))); ut_ad(lsn ? lsn >= oldest_modification() || oldest_modification() == 2 - : space->purpose != FIL_TYPE_TABLESPACE); + : (space->is_temporary() || space->is_being_imported())); if (s < UNFIXED) { ut_a(s >= FREED); - if (UNIV_LIKELY(space->purpose == FIL_TYPE_TABLESPACE)) + if (!space->is_temporary() && !space->is_being_imported()) { freed: if (lsn > log_sys.get_flushed_lsn()) @@ -800,7 +799,8 @@ bool buf_page_t::flush(fil_space_t *space) if (UNIV_UNLIKELY(lsn < space->get_create_lsn())) { - ut_ad(space->purpose == FIL_TYPE_TABLESPACE); + ut_ad(!space->is_temporary()); + ut_ad(!space->is_being_imported()); goto freed; } @@ -884,7 +884,7 @@ bool buf_page_t::flush(fil_space_t *space) if ((s & LRU_MASK) == REINIT || !space->use_doublewrite()) { - if (UNIV_LIKELY(space->purpose == FIL_TYPE_TABLESPACE) && + if (!space->is_temporary() && !space->is_being_imported() && lsn > log_sys.get_flushed_lsn()) log_write_up_to(lsn, true); space->io(IORequest{type, this, slot}, physical_offset(), size, @@ -1735,7 +1735,7 @@ done: if (acquired) space->release(); - if (space->purpose == FIL_TYPE_IMPORT) + if (space->is_being_imported()) os_aio_wait_until_no_pending_writes(true); else buf_dblwr.flush_buffered_writes(); diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc index e9efc10f994..917c4d51ee9 100644 --- a/storage/innobase/dict/dict0load.cc +++ b/storage/innobase/dict/dict0load.cc @@ -972,8 +972,10 @@ void dict_check_tablespaces_and_store_max_id(const std::set *spaces) const bool not_dropped{!rec_get_deleted_flag(rec, 0)}; /* Check that the .ibd file exists. */ - if (fil_ibd_open(not_dropped, FIL_TYPE_TABLESPACE, - space_id, dict_tf_to_fsp_flags(flags), + if (fil_ibd_open(space_id, dict_tf_to_fsp_flags(flags), + not_dropped + ? fil_space_t::VALIDATE_NOTHING + : fil_space_t::MAYBE_MISSING, name, filepath)) { } else if (!not_dropped) { } else if (srv_operation == SRV_OPERATION_NORMAL @@ -2291,8 +2293,8 @@ dict_load_tablespace( } table->space = fil_ibd_open( - 2, FIL_TYPE_TABLESPACE, table->space_id, - dict_tf_to_fsp_flags(table->flags), + table->space_id, dict_tf_to_fsp_flags(table->flags), + fil_space_t::VALIDATE_SPACE_ID, {table->name.m_name, strlen(table->name.m_name)}, filepath); if (!table->space) { diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc index 59189d3e053..9de43abbb17 100644 --- a/storage/innobase/dict/dict0mem.cc +++ b/storage/innobase/dict/dict0mem.cc @@ -136,9 +136,6 @@ dict_table_t *dict_table_t::create(const span &name, ulint n_cols, ulint n_v_cols, ulint flags, ulint flags2) { - ut_ad(!space || space->purpose == FIL_TYPE_TABLESPACE || - space->purpose == FIL_TYPE_TEMPORARY || - space->purpose == FIL_TYPE_IMPORT); ut_a(dict_tf2_is_valid(flags, flags2)); ut_a(!(flags2 & DICT_TF2_UNUSED_BIT_MASK)); diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index ddfa6440680..842f79569d9 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -1067,7 +1067,8 @@ default_encrypt_list only when default encrypt */ static bool fil_crypt_must_remove(const fil_space_t &space) { - ut_ad(space.purpose == FIL_TYPE_TABLESPACE); + ut_ad(!space.is_temporary()); + ut_ad(!space.is_being_imported()); fil_space_crypt_t *crypt_data = space.crypt_data; mysql_mutex_assert_owner(&fil_system.mutex); const ulong encrypt_tables= srv_encrypt_tables; @@ -1103,7 +1104,8 @@ fil_crypt_space_needs_rotation( fil_space_t* space = &*state->space; ut_ad(space->referenced()); - ut_ad(space->purpose == FIL_TYPE_TABLESPACE); + ut_ad(!space->is_temporary()); + ut_ad(!space->is_being_imported()); fil_space_crypt_t *crypt_data = space->crypt_data; @@ -1455,7 +1457,7 @@ space_list_t::iterator fil_space_t::next(space_list_t::iterator space, for (; space != fil_system.space_list.end(); ++space) { - if (space->purpose != FIL_TYPE_TABLESPACE) + if (space->is_temporary() || space->is_being_imported()) continue; const uint32_t n= space->acquire_low(); if (UNIV_LIKELY(!(n & (STOPPING | CLOSING)))) @@ -2137,9 +2139,9 @@ static void fil_crypt_default_encrypt_tables_fill() mysql_mutex_assert_owner(&fil_system.mutex); for (fil_space_t& space : fil_system.space_list) { - if (space.purpose != FIL_TYPE_TABLESPACE - || space.is_in_default_encrypt + if (space.is_in_default_encrypt || UT_LIST_GET_LEN(space.chain) == 0 + || space.is_temporary() || space.is_being_imported() || !space.acquire_if_not_stopped()) { continue; } diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index a682fd533e9..1f72c2bbd1f 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -81,17 +81,10 @@ bool fil_space_t::try_to_close(fil_space_t *ignore_space, bool print_info) mysql_mutex_assert_owner(&fil_system.mutex); for (fil_space_t &space : fil_system.space_list) { - if (&space == ignore_space) + if (&space == ignore_space || space.is_being_imported() || + !fil_is_user_tablespace_id(space.id)) continue; - switch (space.purpose) { - case FIL_TYPE_TEMPORARY: - continue; - case FIL_TYPE_IMPORT: - break; - case FIL_TYPE_TABLESPACE: - if (!fil_is_user_tablespace_id(space.id)) - continue; - } + ut_ad(!space.is_temporary()); /* We are using an approximation of LRU replacement policy. In fil_node_open_file_low(), newly opened files are moved to the end @@ -432,7 +425,7 @@ static bool fil_node_open_file(fil_node_t *node, const byte *page, bool no_lsn) srv_operation == SRV_OPERATION_BACKUP || srv_operation == SRV_OPERATION_RESTORE || srv_operation == SRV_OPERATION_RESTORE_DELTA); - ut_ad(node->space->purpose != FIL_TYPE_TEMPORARY); + ut_ad(!node->space->is_temporary()); ut_ad(node->space->referenced()); const auto old_time= fil_system.n_open_exceeded_time; @@ -493,7 +486,7 @@ void fil_node_t::prepare_to_close_or_detach() srv_operation == SRV_OPERATION_RESTORE_DELTA); ut_a(is_open()); ut_a(!being_extended); - ut_a(space->is_ready_to_close() || space->purpose == FIL_TYPE_TEMPORARY || + ut_a(space->is_ready_to_close() || space->is_temporary() || srv_fast_shutdown == 2 || !srv_was_started); ut_a(fil_system.n_open > 0); @@ -650,14 +643,13 @@ fil_space_extend_must_retry( mysql_mutex_lock(&fil_system.mutex); break; default: - ut_ad(space->purpose == FIL_TYPE_TABLESPACE - || space->purpose == FIL_TYPE_IMPORT); - if (space->purpose == FIL_TYPE_TABLESPACE) { + ut_ad(!space->is_temporary()); + if (!space->is_being_imported()) { goto do_flush; } break; case SRV_TMP_SPACE_ID: - ut_ad(space->purpose == FIL_TYPE_TEMPORARY); + ut_ad(space->is_temporary()); srv_tmp_space.set_last_file_size(pages_in_MiB); break; } @@ -671,8 +663,7 @@ ATTRIBUTE_COLD bool fil_space_t::prepare_acquired() ut_ad(referenced()); mysql_mutex_assert_owner(&fil_system.mutex); fil_node_t *node= UT_LIST_GET_LAST(chain); - ut_ad(!id || purpose == FIL_TYPE_TEMPORARY || - node == UT_LIST_GET_FIRST(chain)); + ut_ad(!id || is_temporary() || node == UT_LIST_GET_FIRST(chain)); const bool is_open= node && (node->is_open() || fil_node_open_file(node, nullptr, false)); @@ -734,7 +725,7 @@ ATTRIBUTE_COLD bool fil_space_t::acquire_and_prepare() @return whether the tablespace is at least as big as requested */ bool fil_space_extend(fil_space_t *space, uint32_t size) { - ut_ad(!srv_read_only_mode || space->purpose == FIL_TYPE_TEMPORARY); + ut_ad(!srv_read_only_mode || space->is_temporary()); bool success= false; const bool acquired= space->acquire(); mysql_mutex_lock(&fil_system.mutex); @@ -942,111 +933,87 @@ fil_space_free( return(space != NULL); } -/** Create a tablespace in fil_system. -@param name tablespace name -@param id tablespace identifier -@param flags tablespace flags -@param purpose tablespace purpose -@param crypt_data encryption information -@param mode encryption mode -@param opened true if space files are opened -@return pointer to created tablespace, to be filled in with add() -@retval nullptr on failure (such as when the same tablespace exists) */ -fil_space_t *fil_space_t::create(ulint id, ulint flags, - fil_type_t purpose, - fil_space_crypt_t *crypt_data, - fil_encryption_t mode, - bool opened) +fil_space_t::fil_space_t(uint32_t id, ulint flags, bool being_imported, + fil_space_crypt_t *crypt_data) noexcept : + id(id), crypt_data(crypt_data), being_imported(being_imported), flags(flags) { - fil_space_t* space; + UT_LIST_INIT(chain, &fil_node_t::chain); +#ifndef SUX_LOCK_GENERIC + memset((void*) &latch, 0, sizeof latch); +#endif + latch.SRW_LOCK_INIT(fil_space_latch_key); +} - mysql_mutex_assert_owner(&fil_system.mutex); - ut_ad(fil_system.is_initialised()); - ut_ad(fil_space_t::is_valid_flags(flags & ~FSP_FLAGS_MEM_MASK, id)); - ut_ad(srv_page_size == UNIV_PAGE_SIZE_ORIG || flags != 0); +fil_space_t *fil_space_t::create(uint32_t id, ulint flags, + bool being_imported, + fil_space_crypt_t *crypt_data, + fil_encryption_t mode, + bool opened) noexcept +{ + mysql_mutex_assert_owner(&fil_system.mutex); + ut_ad(fil_system.is_initialised()); + ut_ad(fil_space_t::is_valid_flags(flags & ~FSP_FLAGS_MEM_MASK, id)); + ut_ad(srv_page_size == UNIV_PAGE_SIZE_ORIG || flags != 0); - DBUG_EXECUTE_IF("fil_space_create_failure", return(NULL);); + DBUG_EXECUTE_IF("fil_space_create_failure", return nullptr;); - fil_space_t** after = reinterpret_cast( - &fil_system.spaces.cell_get(id)->node); - for (; *after; after = &(*after)->hash) { - ut_a((*after)->id != id); - } + fil_space_t** after= fil_system.spaces.cell_get(id)->search + (&fil_space_t::hash, [id](const fil_space_t *space) + { return !space || space->id == id; }); + ut_a(!*after); + fil_space_t *space= new (ut_malloc_nokey(sizeof(*space))) + fil_space_t(id, flags, being_imported, crypt_data); + *after= space; - /* FIXME: if calloc() is defined as an inline function that calls - memset() or bzero(), then GCC 6 -flifetime-dse can optimize it away */ - *after = space = new (ut_zalloc_nokey(sizeof(*space))) fil_space_t; + if (crypt_data) + DBUG_PRINT("crypt", ("Tablespace %" PRIu32 " encryption %d key id %" PRIu32 + ":%s %s", + id, crypt_data->encryption, crypt_data->key_id, + fil_crypt_get_mode(crypt_data), + fil_crypt_get_type(crypt_data))); - space->id = id; + if (opened) + fil_system.add_opened_last_to_space_list(space); + else + fil_system.space_list.push_back(*space); - UT_LIST_INIT(space->chain, &fil_node_t::chain); + switch (id) { + case 0: + ut_ad(!fil_system.sys_space); + fil_system.sys_space= space; + break; + case SRV_TMP_SPACE_ID: + ut_ad(!fil_system.temp_space); + fil_system.temp_space= space; + return space; + default: + if (UNIV_LIKELY(id <= fil_system.max_assigned_id)) + break; + if (UNIV_UNLIKELY(srv_operation == SRV_OPERATION_BACKUP)) + break; + if (!fil_system.space_id_reuse_warned) + sql_print_warning("InnoDB: Allocated tablespace ID %" PRIu32 + ", old maximum was %" PRIu32, + id, fil_system.max_assigned_id); + fil_system.max_assigned_id = id; + } - space->purpose = purpose; - space->flags = flags; + if ((mode == FIL_ENCRYPTION_ON || + (mode == FIL_ENCRYPTION_OFF || srv_encrypt_tables)) && + !space->is_being_imported() && fil_crypt_must_default_encrypt()) + { + fil_system.default_encrypt_tables.push_back(*space); + space->is_in_default_encrypt= true; - space->crypt_data = crypt_data; - space->n_pending.store(CLOSING, std::memory_order_relaxed); + if (srv_n_fil_crypt_threads_started) + { + mysql_mutex_unlock(&fil_system.mutex); + fil_crypt_threads_signal(); + mysql_mutex_lock(&fil_system.mutex); + } + } - DBUG_LOG("tablespace", "Created metadata for " << id); - if (crypt_data) { - DBUG_LOG("crypt", - "Tablespace " << id - << " encryption " << crypt_data->encryption - << " key id " << crypt_data->key_id - << ":" << fil_crypt_get_mode(crypt_data) - << " " << fil_crypt_get_type(crypt_data)); - } - - space->latch.SRW_LOCK_INIT(fil_space_latch_key); - - if (opened) - fil_system.add_opened_last_to_space_list(space); - else - fil_system.space_list.push_back(*space); - - switch (id) { - case 0: - ut_ad(!fil_system.sys_space); - fil_system.sys_space = space; - break; - case SRV_TMP_SPACE_ID: - ut_ad(!fil_system.temp_space); - fil_system.temp_space = space; - break; - default: - ut_ad(purpose != FIL_TYPE_TEMPORARY); - if (UNIV_LIKELY(id <= fil_system.max_assigned_id)) { - break; - } - if (UNIV_UNLIKELY(srv_operation == SRV_OPERATION_BACKUP)) { - break; - } - if (!fil_system.space_id_reuse_warned) { - ib::warn() << "Allocated tablespace ID " << id - << ", old maximum was " - << fil_system.max_assigned_id; - } - - fil_system.max_assigned_id = id; - } - - const bool rotate = purpose == FIL_TYPE_TABLESPACE - && (mode == FIL_ENCRYPTION_ON || mode == FIL_ENCRYPTION_OFF - || srv_encrypt_tables) - && fil_crypt_must_default_encrypt(); - - if (rotate) { - fil_system.default_encrypt_tables.push_back(*space); - space->is_in_default_encrypt = true; - - if (srv_n_fil_crypt_threads_started) { - mysql_mutex_unlock(&fil_system.mutex); - fil_crypt_threads_signal(); - mysql_mutex_lock(&fil_system.mutex); - } - } - - return(space); + return space; } /*******************************************************************//** @@ -1580,6 +1547,7 @@ fil_name_write( fil_space_t *fil_space_t::drop(ulint id, pfs_os_file_t *detached_handle) { ut_a(!is_system_tablespace(id)); + ut_ad(id != SRV_TMP_SPACE_ID); mysql_mutex_lock(&fil_system.mutex); fil_space_t *space= fil_space_get_by_id(id); @@ -1622,7 +1590,7 @@ fil_space_t *fil_space_t::drop(ulint id, pfs_os_file_t *detached_handle) if (space->crypt_data) fil_space_crypt_close_tablespace(space); - if (space->purpose == FIL_TYPE_TABLESPACE) + if (!space->is_being_imported()) { /* Before deleting the file, persistently write a log record. */ mtr_t mtr; @@ -1635,8 +1603,6 @@ fil_space_t *fil_space_t::drop(ulint id, pfs_os_file_t *detached_handle) os_file_delete(innodb_data_file_key, space->chain.start->name); } - else - ut_ad(space->purpose == FIL_TYPE_IMPORT); if (char *cfg_name= fil_make_filepath(space->chain.start->name, fil_space_t::name_type{}, CFG, false)) @@ -1935,7 +1901,7 @@ fil_ibd_create( uint32_t size, fil_encryption_t mode, uint32_t key_id, - dberr_t* err) + dberr_t* err) noexcept { pfs_os_file_t file; bool success; @@ -2055,8 +2021,8 @@ err_exit: log_make_checkpoint();); mysql_mutex_lock(&fil_system.mutex); - if (fil_space_t* space = fil_space_t::create(space_id, flags, - FIL_TYPE_TABLESPACE, + if (fil_space_t* space = fil_space_t::create(uint32_t(space_id), + flags, false, crypt_data, mode, true)) { fil_node_t* node = space->add(path, file, size, false, true); node->find_metadata(IF_WIN(,true)); @@ -2078,51 +2044,17 @@ err_exit: goto err_exit; } -/** Try to open a single-table tablespace and optionally check that the -space id in it is correct. If this does not succeed, print an error message -to the .err log. This function is used to open a tablespace when we start -mysqld after the dictionary has been booted, and also in IMPORT TABLESPACE. - -NOTE that we assume this operation is used either at the database startup -or under the protection of dict_sys.latch, so that two users cannot -race here. This operation does not leave the file associated with the -tablespace open, but closes it after we have looked at the space id in it. - -If the validate boolean is set, we read the first page of the file and -check that the space id in the file is what we expect. We assume that -this function runs much faster if no check is made, since accessing the -file inode probably is much faster (the OS caches them) than accessing -the first page of the file. This boolean may be initially false, but if -a remote tablespace is found it will be changed to true. - -If the fix_dict boolean is set, then it is safe to use an internal SQL -statement to update the dictionary tables if they are incorrect. - -@param[in] validate 0=maybe missing, 1=do not validate, 2=validate -@param[in] purpose FIL_TYPE_TABLESPACE or FIL_TYPE_TEMPORARY -@param[in] id tablespace ID -@param[in] flags expected FSP_SPACE_FLAGS -@param[in] name table name -If file-per-table, it is the table name in the databasename/tablename format -@param[in] path_in expected filepath, usually read from dictionary -@param[out] err DB_SUCCESS or error code -@return tablespace -@retval NULL if the tablespace could not be opened */ -fil_space_t* -fil_ibd_open( - unsigned validate, - fil_type_t purpose, - ulint id, - ulint flags, - fil_space_t::name_type name, - const char* path_in, - dberr_t* err) +fil_space_t *fil_ibd_open(ulint id, ulint flags, + fil_space_t::validate validate, + fil_space_t::name_type name, + const char *path_in, dberr_t *err) noexcept { mysql_mutex_lock(&fil_system.mutex); fil_space_t* space = fil_space_get_by_id(id); mysql_mutex_unlock(&fil_system.mutex); if (space) { - if (validate > 1 && !srv_read_only_mode) { + if (validate == fil_space_t::VALIDATE_SPACE_ID + && !srv_read_only_mode) { fsp_flags_try_adjust(space, flags & ~FSP_FLAGS_MEM_MASK); } @@ -2148,8 +2080,8 @@ func_exit: ulint tablespaces_found = 0; ulint valid_tablespaces_found = 0; - df_default.init(flags); - df_remote.init(flags); + df_default.init(uint32_t(flags)); + df_remote.init(uint32_t(flags)); /* Discover the correct file by looking in three possible locations while avoiding unecessary effort. */ @@ -2178,7 +2110,7 @@ func_exit: /* Dict path is not the default path. Always validate remote files. If default is opened, it was moved. */ must_validate = true; - } else if (validate > 1) { + } else if (validate >= fil_space_t::VALIDATE_SPACE_ID) { must_validate = true; } @@ -2195,7 +2127,8 @@ func_exit: the first server startup. The tables ought to be dropped by drop_garbage_tables_after_restore() a little later. */ - const bool strict = validate && !tablespaces_found + const bool strict = (validate != fil_space_t::MAYBE_MISSING) + && !tablespaces_found && operation_not_for_export && !(srv_operation == SRV_OPERATION_NORMAL && srv_start_after_restore @@ -2326,7 +2259,9 @@ skip_validate: : NULL; mysql_mutex_lock(&fil_system.mutex); - space = fil_space_t::create(id, flags, purpose, crypt_data); + space = fil_space_t::create(uint32_t(id), flags, + validate == fil_space_t::VALIDATE_IMPORT, + crypt_data); if (!space) { mysql_mutex_unlock(&fil_system.mutex); goto error; @@ -2344,7 +2279,7 @@ skip_validate: df_remote.close(); df_default.close(); if (space->acquire()) { - if (purpose != FIL_TYPE_IMPORT) { + if (validate < fil_space_t::VALIDATE_IMPORT) { fsp_flags_try_adjust(space, flags & ~FSP_FLAGS_MEM_MASK); } @@ -2632,8 +2567,8 @@ tablespace_check: mysql_mutex_lock(&fil_system.mutex); - space = fil_space_t::create( - space_id, flags, FIL_TYPE_TABLESPACE, crypt_data); + space = fil_space_t::create(uint32_t(space_id), flags, false, + crypt_data); if (space == NULL) { mysql_mutex_unlock(&fil_system.mutex); @@ -2661,16 +2596,14 @@ void fsp_flags_try_adjust(fil_space_t* space, ulint flags) { ut_ad(!srv_read_only_mode); ut_ad(fil_space_t::is_valid_flags(flags, space->id)); + ut_ad(!space->is_being_imported()); + ut_ad(!space->is_temporary()); if (space->full_crc32() || fil_space_t::full_crc32(flags)) { return; } - if (!space->size && (space->purpose != FIL_TYPE_TABLESPACE - || !space->get_size())) { + if (!space->size || !space->get_size()) { return; } - /* This code is executed during server startup while no - connections are allowed. We do not need to protect against - DROP TABLE by fil_space_acquire(). */ mtr_t mtr; mtr.start(); if (buf_block_t* b = buf_page_get( @@ -2760,7 +2693,7 @@ inline void fil_node_t::complete_write() { mysql_mutex_assert_not_owner(&fil_system.mutex); - if (space->purpose != FIL_TYPE_TEMPORARY && + if (!space->is_temporary() && srv_file_flush_method != SRV_O_DIRECT_NO_FSYNC && space->set_needs_flush()) { @@ -3074,8 +3007,8 @@ fil_space_validate_for_mtr_commit( { mysql_mutex_assert_not_owner(&fil_system.mutex); ut_ad(space != NULL); - ut_ad(space->purpose == FIL_TYPE_TABLESPACE); ut_ad(!is_predefined_tablespace(space->id)); + ut_ad(!space->is_being_imported()); /* We are serving mtr_commit(). While there is an active mini-transaction, we should have !space->is_stopping(). This is @@ -3290,7 +3223,7 @@ fil_space_t::name_type fil_space_t::name() const if (!UT_LIST_GET_FIRST(chain) || srv_is_undo_tablespace(id)) return name_type{}; - ut_ad(purpose != FIL_TYPE_TEMPORARY); + ut_ad(!is_temporary()); ut_ad(UT_LIST_GET_LEN(chain) == 1); const char *path= UT_LIST_GET_FIRST(chain)->name; diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index 3f94e8fb569..40bfca1388c 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -352,7 +352,7 @@ xdes_get_descriptor_with_space_hdr( ut_ad(limit == space->free_limit || (space->free_limit == 0 && (init_space - || space->purpose == FIL_TYPE_TEMPORARY + || space->is_temporary() || (srv_startup_is_before_trx_rollback_phase && (space->id == TRX_SYS_SPACE || srv_is_undo_tablespace(space->id)))))); @@ -490,14 +490,15 @@ void fil_space_t::modify_check(const mtr_t& mtr) const case MTR_LOG_NONE: /* These modes are only allowed within a non-bitmap page when there is a higher-level redo log record written. */ - ut_ad(purpose == FIL_TYPE_TABLESPACE || purpose == FIL_TYPE_TEMPORARY); + ut_ad(!is_being_imported()); break; case MTR_LOG_NO_REDO: - ut_ad(purpose == FIL_TYPE_TEMPORARY || purpose == FIL_TYPE_IMPORT); + ut_ad(is_temporary() || is_being_imported()); break; default: /* We may only write redo log for a persistent tablespace. */ - ut_ad(purpose == FIL_TYPE_TABLESPACE); + ut_ad(!is_temporary()); + ut_ad(!is_being_imported()); ut_ad(mtr.is_named_space(id)); } } @@ -857,7 +858,7 @@ fsp_fill_free_list( FIL_PAGE_TYPE_XDES); } - if (space->purpose != FIL_TYPE_TEMPORARY) + if (!space->is_temporary()) { buf_block_t *f= buf_LRU_get_free_block(false); buf_block_t *block= diff --git a/storage/innobase/fsp/fsp0space.cc b/storage/innobase/fsp/fsp0space.cc index 8c6344946a4..e72ddfef7ed 100644 --- a/storage/innobase/fsp/fsp0space.cc +++ b/storage/innobase/fsp/fsp0space.cc @@ -132,10 +132,8 @@ Tablespace::open_or_create(bool is_temp) mysql_mutex_lock(&fil_system.mutex); space = fil_space_t::create( - m_space_id, fsp_flags, - is_temp - ? FIL_TYPE_TEMPORARY : FIL_TYPE_TABLESPACE, - NULL); + uint32_t(m_space_id), fsp_flags, + false, nullptr); if (!space) { mysql_mutex_unlock(&fil_system.mutex); return DB_ERROR; diff --git a/storage/innobase/fsp/fsp0sysspace.cc b/storage/innobase/fsp/fsp0sysspace.cc index 2a60f60b43d..dbc5987b2e5 100644 --- a/storage/innobase/fsp/fsp0sysspace.cc +++ b/storage/innobase/fsp/fsp0sysspace.cc @@ -936,8 +936,7 @@ SysTablespace::open_or_create( } else if (is_temp) { ut_ad(space_id() == SRV_TMP_SPACE_ID); space = fil_space_t::create( - SRV_TMP_SPACE_ID, flags(), - FIL_TYPE_TEMPORARY, NULL); + SRV_TMP_SPACE_ID, flags(), false, nullptr); ut_ad(space == fil_system.temp_space); if (!space) { err = DB_ERROR; @@ -948,8 +947,7 @@ SysTablespace::open_or_create( } else { ut_ad(space_id() == TRX_SYS_SPACE); space = fil_space_t::create( - TRX_SYS_SPACE, it->flags(), - FIL_TYPE_TABLESPACE, NULL); + TRX_SYS_SPACE, it->flags(), false, nullptr); ut_ad(space == fil_system.sys_space); if (!space) { err = DB_ERROR; diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 604ce85e93e..c38ff61b0e4 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -6562,7 +6562,8 @@ static int i_s_sys_tablespaces_fill_table(THD *thd, TABLE_LIST *tables, Item*) for (fil_space_t &space : fil_system.space_list) { - if (space.purpose == FIL_TYPE_TABLESPACE && !space.is_stopping() && + if (!space.is_temporary() && !space.is_being_imported() && + !space.is_stopping() && space.chain.start) { space.reacquire(); @@ -6734,7 +6735,7 @@ i_s_dict_fill_tablespaces_encryption( } else if (srv_is_undo_tablespace(space->id)) { char undo_name[sizeof "innodb_undo000"]; snprintf(undo_name, sizeof(undo_name), - "innodb_undo%03zu",space->id); + "innodb_undo%03" PRIu32, space->id); OK(fields[TABLESPACES_ENCRYPTION_NAME]->store( undo_name, strlen(undo_name), system_charset_info)); @@ -6802,7 +6803,7 @@ i_s_tablespaces_encryption_fill_table( fil_system.freeze_space_list++; for (fil_space_t& space : fil_system.space_list) { - if (space.purpose == FIL_TYPE_TABLESPACE + if (!space.is_temporary() && !space.is_being_imported() && !space.is_stopping()) { space.reacquire(); mysql_mutex_unlock(&fil_system.mutex); diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index 750df18dc8d..3e8f7888959 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -738,13 +738,15 @@ ibuf_set_free_bits_func( mtr.start(); const page_id_t id(block->page.id()); const fil_space_t *space= mtr.set_named_space_id(id.space()); + /* all callers of ibuf_update_free_bits_if_full() or ibuf_reset_free_bits() + check this */ + ut_ad(!space->is_temporary()); if (buf_block_t *bitmap_page= ibuf_bitmap_get_map_page(id, block->zip_size(), &mtr)) { - if (space->purpose != FIL_TYPE_TABLESPACE) + if (space->is_being_imported()) /* IndexPurge may invoke this */ mtr.set_log_mode(MTR_LOG_NO_REDO); - #ifdef UNIV_IBUF_DEBUG if (max_val != ULINT_UNDEFINED) { @@ -925,8 +927,7 @@ ibuf_page_low( return(false); } - compile_time_assert(IBUF_SPACE_ID == 0); - ut_ad(fil_system.sys_space->purpose == FIL_TYPE_TABLESPACE); + static_assert(IBUF_SPACE_ID == 0, "compatiblity"); #ifdef UNIV_DEBUG if (x_latch) { @@ -4498,7 +4499,7 @@ ibuf_print( dberr_t ibuf_check_bitmap_on_import(const trx_t* trx, fil_space_t* space) { ut_ad(trx->mysql_thd); - ut_ad(space->purpose == FIL_TYPE_IMPORT); + ut_ad(space->is_being_imported()); const unsigned zip_size = space->zip_size(); const unsigned physical_size = space->physical_size(); diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 8e5357912d3..ff627e81eb2 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -100,16 +100,6 @@ class page_id_t; /** Structure containing encryption specification */ struct fil_space_crypt_t; -/** File types */ -enum fil_type_t { - /** temporary tablespace (temporary undo log or tables) */ - FIL_TYPE_TEMPORARY, - /** a tablespace that is being imported (no logging until finished) */ - FIL_TYPE_IMPORT, - /** persistent tablespace (for system, undo log or tables) */ - FIL_TYPE_TABLESPACE, -}; - struct fil_node_t; /** Structure to store first and last value of range */ @@ -344,42 +334,43 @@ struct fil_space_t final { #ifndef UNIV_INNOCHECKSUM friend fil_node_t; + + /** Constructor; see @fil_space_t::create() */ + inline explicit fil_space_t(uint32_t id, ulint flags, bool being_imported, + fil_space_crypt_t *crypt_data) noexcept; + ~fil_space_t() { ut_ad(!latch_owner); latch.destroy(); } - ulint id; /*!< space id */ + /** tablespace identifier */ + uint32_t id; /** fil_system.spaces chain node */ - fil_space_t *hash; - lsn_t max_lsn; - /*!< LSN of the most recent - fil_names_write_if_was_clean(). - Reset to 0 by fil_names_clear(). - Protected by log_sys.mutex. - If and only if this is nonzero, the - tablespace will be in named_spaces. */ - fil_type_t purpose;/*!< purpose */ - UT_LIST_BASE_NODE_T(fil_node_t) chain; - /*!< base node for the file chain */ - uint32_t size; /*!< tablespace file size in pages; - 0 if not known yet */ - uint32_t size_in_header; - /* FSP_SIZE in the tablespace header; - 0 if not known yet */ - uint32_t free_len; - /*!< length of the FSP_FREE list */ - uint32_t free_limit; - /*!< contents of FSP_FREE_LIMIT */ - uint32_t recv_size; - /*!< recovered tablespace size in pages; - 0 if no size change was read from the redo log, - or if the size change was implemented */ - uint32_t n_reserved_extents; - /*!< number of reserved free extents for - ongoing operations like B-tree page split */ + fil_space_t *hash= nullptr; + /** log_sys.get_lsn() of the most recent fil_names_write_if_was_clean(). + Reset to 0 by fil_names_clear(). Protected by log_sys.mutex. + If and only if this is nonzero, the tablespace will be in named_spaces. */ + lsn_t max_lsn= 0; + /** base node for the chain of data files; multiple entries are + only possible for is_temporary() or id==0 */ + UT_LIST_BASE_NODE_T(fil_node_t) chain; + /** tablespace size in pages; 0 if not determined yet */ + uint32_t size= 0; + /** FSP_SIZE in the tablespace header; 0 if not determined yet */ + uint32_t size_in_header= 0; + /** length of the FSP_FREE list */ + uint32_t free_len= 0; + /** contents of FSP_FREE_LIMIT */ + uint32_t free_limit= 0; + /** recovered tablespace size in pages; 0 if no size change was read + from the redo log, or if the size change was applied */ + uint32_t recv_size= 0; + /** number of reserved free extents for ongoing operations like + B-tree page split */ + uint32_t n_reserved_extents= 0; private: #ifdef UNIV_DEBUG fil_space_t *next_in_space_list(); @@ -390,10 +381,10 @@ private: #endif /** the committed size of the tablespace in pages */ - Atomic_relaxed committed_size; + Atomic_relaxed committed_size{0}; /** Number of pending operations on the file. The tablespace cannot be freed while (n_pending & PENDING) != 0. */ - std::atomic n_pending; + std::atomic n_pending{CLOSING}; /** Flag in n_pending that indicates that the tablespace is about to be deleted, and no further operations should be performed */ static constexpr uint32_t STOPPING_READS= 1U << 31; @@ -415,20 +406,23 @@ private: /** latch protecting all page allocation bitmap pages */ IF_DBUG(srw_lock_debug, srw_lock) latch; /** the thread that holds the exclusive latch, or 0 */ - pthread_t latch_owner; + pthread_t latch_owner= 0; public: /** MariaDB encryption data */ - fil_space_crypt_t *crypt_data; + fil_space_crypt_t *crypt_data= nullptr; /** Whether needs_flush(), or this is in fil_system.unflushed_spaces */ - bool is_in_unflushed_spaces; + bool is_in_unflushed_spaces= false; /** Whether this in fil_system.default_encrypt_tables (needs key rotation) */ - bool is_in_default_encrypt; + bool is_in_default_encrypt= false; private: + /** Whether the tablespace is being imported */ + bool being_imported= false; + /** Whether any corrupton of this tablespace has been reported */ - mutable std::atomic_flag is_corrupted; + mutable std::atomic_flag is_corrupted{false}; /** mutex to protect freed_ranges and last_freed_lsn */ std::mutex freed_range_mutex; @@ -437,11 +431,18 @@ private: range_set freed_ranges; /** LSN of freeing last page; protected by freed_range_mutex */ - lsn_t last_freed_lsn; + lsn_t last_freed_lsn= 0; /** LSN of undo tablespace creation or 0; protected by latch */ - lsn_t create_lsn; + lsn_t create_lsn= 0; public: + /** @return whether this is the temporary tablespace */ + bool is_temporary() const noexcept + { return UNIV_UNLIKELY(id == SRV_TMP_SPACE_ID); } + /** @return whether this tablespace is being imported */ + bool is_being_imported() const noexcept + { return UNIV_UNLIKELY(being_imported); } + /** @return whether doublewrite buffering is needed */ inline bool use_doublewrite() const; @@ -511,7 +512,7 @@ public: MY_ATTRIBUTE((nonnull)); /** Note that the tablespace has been imported. - Initially, purpose=FIL_TYPE_IMPORT so that no redo log is + Initially, purpose=IMPORT so that no redo log is written while the space ID is being updated in each page. */ inline void set_imported(); @@ -946,18 +947,18 @@ public: #ifndef UNIV_INNOCHECKSUM MY_ATTRIBUTE((warn_unused_result)) /** Create a tablespace in fil_system. - @param id tablespace identifier - @param flags tablespace flags - @param purpose tablespace purpose - @param crypt_data encryption information - @param mode encryption mode - @param opened true if space files are opened + @param id tablespace identifier + @param flags tablespace flags + @param being_imported whether this is IMPORT TABLESPACE + @param crypt_data encryption information + @param mode encryption mode + @param opened whether the tablespace files are open @return pointer to created tablespace, to be filled in with add() @retval nullptr on failure (such as when the same tablespace exists) */ - static fil_space_t *create(ulint id, ulint flags, - fil_type_t purpose, fil_space_crypt_t *crypt_data, + static fil_space_t *create(uint32_t id, ulint flags, bool being_imported, + fil_space_crypt_t *crypt_data, fil_encryption_t mode= FIL_ENCRYPTION_DEFAULT, - bool opened= false); + bool opened= false) noexcept; MY_ATTRIBUTE((warn_unused_result)) /** Acquire a tablespace reference. @@ -1079,6 +1080,18 @@ public: /** @return the tablespace name (databasename/tablename) */ name_type name() const; + /** How to validate tablespace files that are being opened */ + enum validate { + /** the file may be missing */ + MAYBE_MISSING= 0, + /** do not validate */ + VALIDATE_NOTHING, + /** validate the tablespace ID */ + VALIDATE_SPACE_ID, + /** opening a file for ALTER TABLE...IMPORT TABLESPACE */ + VALIDATE_IMPORT + }; + private: /** @return whether the file is usable for io() */ ATTRIBUTE_COLD bool prepare_acquired(); @@ -1163,8 +1176,8 @@ inline bool fil_space_t::use_doublewrite() const inline void fil_space_t::set_imported() { - ut_ad(purpose == FIL_TYPE_IMPORT); - purpose= FIL_TYPE_TABLESPACE; + ut_ad(being_imported); + being_imported= false; UT_LIST_GET_FIRST(chain)->find_metadata(); } @@ -1478,12 +1491,9 @@ public: ulint n_open; /** last time we noted n_open exceeding the limit; protected by mutex */ time_t n_open_exceeded_time; - ulint max_assigned_id;/*!< maximum space id in the existing - tables, or assigned during the time - mysqld has been up; at an InnoDB - startup we scan the data dictionary - and set here the maximum of the - space id's of the tables there */ + /** maximum space id in the existing tables; on InnoDB startup this is + initialized based on the data dictionary contents */ + ulint max_assigned_id; /** nonzero if fil_node_open_file_low() should avoid moving the tablespace to the end of space_list, for FIFO policy of try_to_close() */ ulint freeze_space_list; @@ -1588,7 +1598,7 @@ template inline void fil_space_t::flush() { mysql_mutex_assert_not_owner(&fil_system.mutex); ut_ad(!have_reference || (pending() & PENDING)); - ut_ad(purpose == FIL_TYPE_TABLESPACE || purpose == FIL_TYPE_IMPORT); + ut_ad(!is_temporary()); if (srv_file_flush_method == SRV_O_DIRECT_NO_FSYNC) { ut_ad(!is_in_unflushed_spaces); @@ -1729,7 +1739,7 @@ fil_ibd_create( uint32_t size, fil_encryption_t mode, uint32_t key_id, - dberr_t* err) + dberr_t* err) noexcept MY_ATTRIBUTE((nonnull, warn_unused_result)); /** Try to adjust FSP_SPACE_FLAGS if they differ from the expectations. @@ -1738,43 +1748,28 @@ fil_ibd_create( @param[in] flags desired tablespace flags */ void fsp_flags_try_adjust(fil_space_t* space, ulint flags); -/********************************************************************//** +/** Tries to open a single-table tablespace and optionally checks the space id is right in it. If does not succeed, prints an error message to the .err log. This function is used to open a tablespace when we start up mysqld, and also in IMPORT TABLESPACE. -NOTE that we assume this operation is used either at the database startup -or under the protection of dict_sys.latch, so that two users cannot -race here. This operation does not leave the file associated with the -tablespace open, but closes it after we have looked at the space id in it. -If the validate boolean is set, we read the first page of the file and -check that the space id in the file is what we expect. We assume that -this function runs much faster if no check is made, since accessing the -file inode probably is much faster (the OS caches them) than accessing -the first page of the file. This boolean may be initially false, but if -a remote tablespace is found it will be changed to true. +NOTE that we assume this operation is used either at the database +startup or under the protection of MDL, to prevent concurrent access +to the same tablespace. -@param[in] validate 0=maybe missing, 1=do not validate, 2=validate -@param[in] purpose FIL_TYPE_TABLESPACE or FIL_TYPE_TEMPORARY -@param[in] id tablespace ID -@param[in] flags expected FSP_SPACE_FLAGS -@param[in] name table name -If file-per-table, it is the table name in the databasename/tablename format -@param[in] path_in expected filepath, usually read from dictionary -@param[out] err DB_SUCCESS or error code +@param id tablespace identifier +@param flags expected FSP_SPACE_FLAGS +@param validate how to validate files +@param name the table name in databasename/tablename format +@param path_in expected filepath, usually read from dictionary +@param err DB_SUCCESS or error code @return tablespace -@retval NULL if the tablespace could not be opened */ -fil_space_t* -fil_ibd_open( - unsigned validate, - fil_type_t purpose, - ulint id, - ulint flags, - fil_space_t::name_type name, - const char* path_in, - dberr_t* err = NULL) - MY_ATTRIBUTE((warn_unused_result)); +@retval nullptr if the tablespace could not be opened */ +fil_space_t *fil_ibd_open(ulint id, ulint flags, + fil_space_t::validate validate, + fil_space_t::name_type name, + const char *path_in, dberr_t *err= nullptr) noexcept; enum fil_load_status { /** The tablespace file(s) were found and valid. */ diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index 773bd4c9f86..fb7028126c8 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -93,9 +93,9 @@ void recv_sys_justify_left_parsing_buf(); @param[in] len length of name, in bytes @param[in] new_name new file name (NULL if not rename) @param[in] new_len length of new_name, in bytes (0 if NULL) */ -extern void (*log_file_op)(ulint space_id, int type, - const byte* name, ulint len, - const byte* new_name, ulint new_len); +extern void (*log_file_op)(uint32_t space_id, int type, + const byte* name, size_t len, + const byte* new_name, size_t new_len); /** Report an operation which does undo log tablespace truncation during backup @@ -104,7 +104,7 @@ extern void (*undo_space_trunc)(uint32_t space_id); /** Report an operation which does INIT_PAGE for page0 during backup. @param space_id tablespace identifier */ -extern void (*first_page_init)(ulint space_id); +extern void (*first_page_init)(uint32_t space_id); /** Stored redo log record */ struct log_rec_t diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 2c9c93a42fa..cb408313279 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -598,10 +598,10 @@ struct file_name_t { /** Map of dirty tablespaces during recovery */ typedef std::map< - ulint, + uint32_t, file_name_t, std::less, - ut_allocator > > recv_spaces_t; + ut_allocator > > recv_spaces_t; static recv_spaces_t recv_spaces; @@ -820,8 +820,8 @@ processed: if (crypt_data && !fil_crypt_check(crypt_data, name.c_str())) return nullptr; mysql_mutex_lock(&fil_system.mutex); - fil_space_t *space= fil_space_t::create(it->first, flags, - FIL_TYPE_TABLESPACE, crypt_data); + fil_space_t *space= fil_space_t::create(it->first, flags, false, + crypt_data); ut_ad(space); const char *filename= name.c_str(); if (srv_operation == SRV_OPERATION_RESTORE) @@ -939,13 +939,13 @@ deferred_spaces; @param[in] len length of name, in bytes @param[in] new_name new file name (NULL if not rename) @param[in] new_len length of new_name, in bytes (0 if NULL) */ -void (*log_file_op)(ulint space_id, int type, - const byte* name, ulint len, - const byte* new_name, ulint new_len); +void (*log_file_op)(uint32_t space_id, int type, + const byte* name, size_t len, + const byte* new_name, size_t new_len); void (*undo_space_trunc)(uint32_t space_id); -void (*first_page_init)(ulint space_id); +void (*first_page_init)(uint32_t space_id); /** Information about initializing page contents during redo log processing. FIXME: Rely on recv_sys.pages! */ @@ -4203,7 +4203,7 @@ recv_validate_tablespace(bool rescan, bool& missing_tablespace) for (recv_sys_t::map::iterator p = recv_sys.pages.begin(); p != recv_sys.pages.end();) { ut_ad(!p->second.log.empty()); - const ulint space = p->first.space(); + const uint32_t space = p->first.space(); if (is_predefined_tablespace(space)) { next: p++; @@ -4213,7 +4213,7 @@ next: recv_spaces_t::iterator i = recv_spaces.find(space); ut_ad(i != recv_spaces.end()); - if (deferred_spaces.find(static_cast(space))) { + if (deferred_spaces.find(space)) { /* Skip redo logs belonging to incomplete tablespaces */ goto next; diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index d6306f7b1c1..834bceaa8e2 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -488,8 +488,7 @@ mtr_t::x_lock_space(ulint space_id) } else { space = fil_space_get(space_id); ut_ad(m_log_mode != MTR_LOG_NO_REDO - || space->purpose == FIL_TYPE_TEMPORARY - || space->purpose == FIL_TYPE_IMPORT); + || space->is_temporary() || space->is_being_imported()); } ut_ad(space); @@ -502,9 +501,6 @@ mtr_t::x_lock_space(ulint space_id) @param space tablespace */ void mtr_t::x_lock_space(fil_space_t *space) { - ut_ad(space->purpose == FIL_TYPE_TEMPORARY || - space->purpose == FIL_TYPE_IMPORT || - space->purpose == FIL_TYPE_TABLESPACE); if (!memo_contains(*space)) { memo_push(space, MTR_MEMO_SPACE_X_LOCK); diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index b73fe21216b..25f47cb032d 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -3947,13 +3947,19 @@ void fil_node_t::find_metadata(IF_WIN(,bool create)) noexcept punch_hole= 2; else punch_hole= IF_WIN(, !create ||) os_is_sparse_file_supported(file); - if (space->purpose != FIL_TYPE_TABLESPACE) + /* For temporary tablespace or during IMPORT TABLESPACE, we + disable neighbour flushing and do not care about atomicity. */ + if (space->is_temporary()) { - /* For temporary tablespace or during IMPORT TABLESPACE, we - disable neighbour flushing and do not care about atomicity. */ on_ssd= true; atomic_write= true; - if (space->purpose == FIL_TYPE_TEMPORARY || !space->is_compressed()) + return; + } + if (space->is_being_imported()) + { + on_ssd= true; + atomic_write= true; + if (!space->is_compressed()) return; } #ifdef _WIN32 diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 0be420147c0..a7557044056 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -4841,11 +4841,10 @@ import_error: we will not be writing any redo log for it before we have invoked fil_space_t::set_imported() to declare it a persistent tablespace. */ - ulint fsp_flags = dict_tf_to_fsp_flags(table->flags); - - table->space = fil_ibd_open( - 2, FIL_TYPE_IMPORT, table->space_id, - fsp_flags, name, filepath, &err); + table->space = fil_ibd_open(table->space_id, + dict_tf_to_fsp_flags(table->flags), + fil_space_t::VALIDATE_IMPORT, + name, filepath, &err); ut_ad((table->space == NULL) == (err != DB_SUCCESS)); DBUG_EXECUTE_IF("ib_import_open_tablespace_failure", @@ -4947,8 +4946,6 @@ import_error: } ib::info() << "Phase IV - Flush complete"; - /* Set tablespace purpose as FIL_TYPE_TABLESPACE, - so that rollback can go ahead smoothly */ table->space->set_imported(); err = lock_sys_tables(trx); diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 727a9f4d4fc..c3397c88336 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -575,9 +575,9 @@ err_exit: fil_set_max_space_id_if_bigger(space_id); mysql_mutex_lock(&fil_system.mutex); - fil_space_t *space= fil_space_t::create(space_id, fsp_flags, - FIL_TYPE_TABLESPACE, nullptr, - FIL_ENCRYPTION_DEFAULT, true); + fil_space_t *space= fil_space_t::create(uint32_t(space_id), + fsp_flags, false, nullptr, + FIL_ENCRYPTION_DEFAULT, true); ut_ad(space); fil_node_t *file= space->add(name, fh, 0, false, true); diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc index 614e34e5a8a..df3755f6c10 100644 --- a/storage/innobase/trx/trx0sys.cc +++ b/storage/innobase/trx/trx0sys.cc @@ -238,7 +238,8 @@ static trx_rseg_t *trx_rseg_create(ulint space_id) if (fil_space_t *space= mtr.x_lock_space(space_id)) { - ut_ad(space->purpose == FIL_TYPE_TABLESPACE); + ut_ad(!space->is_temporary()); + ut_ad(!space->is_being_imported()); if (buf_block_t *sys_header= trx_sysf_get(&mtr)) { ulint rseg_id= trx_sys_rseg_find_free(sys_header); From 7bcd6c610a5c7f7dd0884172acb128de22782a33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 11 Dec 2024 14:47:39 +0200 Subject: [PATCH 09/84] MDEV-35618 Bogus assertion failure 'recv_sys.scanned_lsn < max_lsn + 32 * 512U' during recovery buf_dblwr_t::recover(): Correct a debug assertion failure that had been added in commit bb47e575de2bdad06d04f74b65c2a22d07f83cc4 (MDEV-34830). The server may have been killed while a log write was in progress, and therefore recv_sys.scanned_lsn may be up to RECV_PARSING_BUF_SIZE bytes ahead of recv_sys.recovered_lsn. Thanks to Matthias Leich for providing "rr replay" traces and testing this. --- storage/innobase/buf/buf0dblwr.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index 0060ee29fd9..f53710caf1d 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -363,7 +363,7 @@ void buf_dblwr_t::recover() innodb_log_write_ahead_size. After MDEV-14425 eliminated OS_FILE_LOG_BLOCK_SIZE, these two LSN must be equal. */ ut_ad(recv_sys.scanned_lsn >= max_lsn); - ut_ad(recv_sys.scanned_lsn < max_lsn + 32 * OS_FILE_LOG_BLOCK_SIZE); + ut_ad(recv_sys.scanned_lsn < max_lsn + RECV_PARSING_BUF_SIZE); uint32_t page_no_dblwr= 0; byte *read_buf= static_cast(aligned_malloc(3 * srv_page_size, From ee287821e3980d4b08892757764f5d70c7dc2aa8 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 6 Dec 2024 11:34:58 +1100 Subject: [PATCH 10/84] MDEV-32561: WSREP FSM failure: (postfix) - enable galera.galera_sequences The MDEV is fixed, so enable the test case again. --- mysql-test/suite/galera/disabled.def | 1 - 1 file changed, 1 deletion(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index cbb42331792..5b92b282ece 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -10,6 +10,5 @@ # ############################################################################## -galera_sequences : MDEV-32561 WSREP FSM failure: no such a transition REPLICATING -> COMMITTED galera_as_slave_replay : MDEV-32780 galera_as_slave_replay: assertion in the wsrep::transaction::before_rollback() galera_slave_replay : MDEV-32780 galera_as_slave_replay: assertion in the wsrep::transaction::before_rollback() From 7181ea56630d4e397f30b1073c3c806a2d59a530 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 6 Dec 2024 11:35:58 +1100 Subject: [PATCH 11/84] MDEV-33245 SIGSEGV in wsrep_check_sequence The segfault in wsrep_check_sequence is due to a null pointer deference on: db_type= thd->lex->create_info.db_type->db_type; Where create_info.db_type is null. This occured under a used_engine==true condition which is set in the calling function based on create_info.used_fields==HA_CREATE_USED_ENGINE. However the create_info.used_fields was a left over from the parsing of the previous failed CREATE TABLE where because of its failure, db_type wasn't populated. This is corrected by cleaning the create_info when we start to parse ALTER SEQUENCE statements. Other paths to wsrep_check_sequence is via CREATE SEQUENCE and CREATE TABLE LIKE which both initialize the create_info correctly. --- mysql-test/suite/galera/r/galera_sequences.result | 11 +++++++++++ mysql-test/suite/galera/t/galera_sequences.test | 15 +++++++++++++++ sql/sql_yacc.yy | 1 + 3 files changed, 27 insertions(+) diff --git a/mysql-test/suite/galera/r/galera_sequences.result b/mysql-test/suite/galera/r/galera_sequences.result index 1a5219c2d45..1f6b2bd6637 100644 --- a/mysql-test/suite/galera/r/galera_sequences.result +++ b/mysql-test/suite/galera/r/galera_sequences.result @@ -314,3 +314,14 @@ NEXTVAL(t) connection node_1; DROP TABLE t1; DROP SEQUENCE t; + +MDEV-33245 SIGSEGV in wsrep_check_sequence | Sql_cmd_alter_sequence::execute + +CREATE TABLE t (a INT) ENGINE=InnoDB; +INSERT INTO t VALUES (0); +CREATE TABLE t1 (c VARCHAR) ENGINE=InnoDB; +ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') ENGINE=InnoDB' at line 1 +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; +End of 10.5 tests diff --git a/mysql-test/suite/galera/t/galera_sequences.test b/mysql-test/suite/galera/t/galera_sequences.test index 53417055d7d..75a31b224b9 100644 --- a/mysql-test/suite/galera/t/galera_sequences.test +++ b/mysql-test/suite/galera/t/galera_sequences.test @@ -341,3 +341,18 @@ SELECT NEXTVAL(t); --connection node_1 DROP TABLE t1; DROP SEQUENCE t; + +--echo +--echo MDEV-33245 SIGSEGV in wsrep_check_sequence | Sql_cmd_alter_sequence::execute +--echo + +CREATE TABLE t (a INT) ENGINE=InnoDB; +INSERT INTO t VALUES (0); + +--error ER_PARSE_ERROR +CREATE TABLE t1 (c VARCHAR) ENGINE=InnoDB; +--error ER_NOT_SUPPORTED_YET +ALTER SEQUENCE IF EXISTS t MINVALUE=1; + +DROP TABLE t; +--echo End of 10.5 tests diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 9aab9f97fe0..7c2060d0b9d 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -7472,6 +7472,7 @@ alter: { LEX *lex= Lex; lex->sql_command= SQLCOM_ALTER_SEQUENCE; + lex->create_info.init(); DBUG_ASSERT(!lex->m_sql_cmd); if (Lex->main_select_push()) MYSQL_YYABORT; From 801587c821290e707884f425a2da22fd88d32cf9 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 10 Nov 2023 11:22:46 +1100 Subject: [PATCH 12/84] MDEV-32686: minimise crash information Provide bug url in addition to how to report the bug. Remove obsolete information like key_buffers and used connections as they haven't meaningfully added value to a bug report for quite a while. Remove information that comes from long fixed interfaces in glibc/kernel. Encourage the use of a full backtrace from the core with debug symbols. Lets be realistic about the error messages, its the users we are addressing not developers so wording around getting the information communicated is the key aspect. All the user readable text and instructions are in on place, as non-understandable is the end of the reading process for the user. Remove the duplicate printing of the query. Use my_progname rather than "mysqld" to reflex the program name. So the signal handler output is now in the form: 1. User instructions 2. Server Information 3. Stacktrace 4. connection/query/optimizer_switch 5. Core information and resource limits 6. Kernel information --- sql/signal_handler.cc | 122 ++++++------------------------------------ 1 file changed, 17 insertions(+), 105 deletions(-) diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index 002a4c244d1..1200a5a1608 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -144,7 +144,6 @@ extern "C" sig_handler handle_fatal_signal(int sig) We will try and print the query at the end of the signal handler, in case we're wrong. */ - bool print_invalid_query_pointer= false; #endif if (segfaulted) @@ -173,57 +172,19 @@ extern "C" sig_handler handle_fatal_signal(int sig) goto end; } - my_safe_printf_stderr("[ERROR] mysqld got " SIGNAL_FMT " ;\n",sig); + my_safe_printf_stderr("[ERROR] %s got " SIGNAL_FMT " ;\n", my_progname, sig); my_safe_printf_stderr("%s", "Sorry, we probably made a mistake, and this is a bug.\n\n" "Your assistance in bug reporting will enable us to fix this for the next release.\n" - "To report this bug, see https://mariadb.com/kb/en/reporting-bugs\n\n"); - - my_safe_printf_stderr("%s", - "We will try our best to scrape up some info that will hopefully help\n" - "diagnose the problem, but since we have already crashed, \n" - "something is definitely wrong and this may fail.\n\n"); + "To report this bug, see https://mariadb.com/kb/en/reporting-bugs about how to report\n" + "a bug on https://jira.mariadb.org/.\n\n" + "Please include the information from the server start above, to the end of the\n" + "information below.\n\n"); set_server_version(server_version, sizeof(server_version)); - my_safe_printf_stderr("Server version: %s source revision: %s\n", - server_version, SOURCE_REVISION); - - if (dflt_key_cache) - my_safe_printf_stderr("key_buffer_size=%zu\n", - dflt_key_cache->key_cache_mem_size); - - my_safe_printf_stderr("read_buffer_size=%lu\n", - global_system_variables.read_buff_size); - - my_safe_printf_stderr("max_used_connections=%lu\n", - max_used_connections); - - if (thread_scheduler) - my_safe_printf_stderr("max_threads=%lu\n", - thread_scheduler->max_threads + - extra_max_connections); - - my_safe_printf_stderr("thread_count=%u\n", THD_count::value()); - - if (dflt_key_cache && thread_scheduler) - { - size_t used_mem= - (dflt_key_cache->key_cache_mem_size + - (global_system_variables.read_buff_size + - (size_t) global_system_variables.sortbuff_size) * - (thread_scheduler->max_threads + extra_max_connections) + - (max_connections + extra_max_connections) * sizeof(THD)) / 1024; - - my_safe_printf_stderr("It is possible that mysqld could use up to \n" - "key_buffer_size + " - "(read_buffer_size + sort_buffer_size)*max_threads = " - "%zu K bytes of memory\n", used_mem); - - my_safe_printf_stderr("%s", - "Hope that's ok; if not, decrease some variables in " - "the equation.\n\n"); - } + my_safe_printf_stderr("Server version: %s source revision: %s\n\n", + server_version, SOURCE_REVISION); #ifdef WITH_WSREP Wsrep_server_state::handle_fatal_signal(); @@ -234,12 +195,14 @@ extern "C" sig_handler handle_fatal_signal(int sig) if (opt_stack_trace) { - my_safe_printf_stderr("Thread pointer: %p\n", thd); my_safe_printf_stderr("%s", - "Attempting backtrace. You can use the following " - "information to find out\n" - "where mysqld died. If you see no messages after this, something went\n" - "terribly wrong...\n"); + "The information page at " + "https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mariadbd/\n" + "contains instructions to obtain a better version of the backtrace below.\n" + "Following these instructions will help MariaDB developers provide a fix quicker.\n\n" + "Attempting backtrace. Include this in the bug report.\n" + "(note: Retrieving this information may fail)\n\n"); + my_safe_printf_stderr("Thread pointer: %p\n", thd); my_print_stacktrace(thd ? (uchar*) thd->thread_stack : NULL, (ulong)my_thread_stack_size, 0); } @@ -287,20 +250,12 @@ extern "C" sig_handler handle_fatal_signal(int sig) kreason= "KILL_WAIT_TIMEOUT"; break; } - my_safe_printf_stderr("%s", "\n" - "Trying to get some variables.\n" - "Some pointers may be invalid and cause the dump to abort.\n"); - - my_safe_printf_stderr("Query (%p): ", thd->query()); - if (my_safe_print_str(thd->query(), MY_MIN(65536U, thd->query_length()))) - { - // Query was found invalid. We will try to print it at the end. - print_invalid_query_pointer= true; - } my_safe_printf_stderr("\nConnection ID (thread ID): %lu\n", (ulong) thd->thread_id); - my_safe_printf_stderr("Status: %s\n\n", kreason); + 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: "); ulonglong optsw= thd->variables.optimizer_switch; for (uint i= 0; optimizer_switch_names[i+1]; i++, optsw >>= 1) @@ -312,52 +267,9 @@ extern "C" sig_handler handle_fatal_signal(int sig) } my_safe_printf_stderr("%s", "\n\n"); } - my_safe_printf_stderr("%s", - "The manual page at " - "https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mariadbd/ contains\n" - "information that should help you find out what is causing the crash.\n"); #endif /* HAVE_STACKTRACE */ -#ifdef HAVE_INITGROUPS - if (calling_initgroups) - { - my_safe_printf_stderr("%s", "\n" - "This crash occurred while the server was calling initgroups(). This is\n" - "often due to the use of a mysqld that is statically linked against \n" - "glibc and configured to use LDAP in /etc/nsswitch.conf.\n" - "You will need to either upgrade to a version of glibc that does not\n" - "have this problem (2.3.4 or later when used with nscd),\n" - "disable LDAP in your nsswitch.conf, or use a " - "mysqld that is not statically linked.\n"); - } -#endif - - if (locked_in_memory) - { - my_safe_printf_stderr("%s", "\n" - "The \"--memlock\" argument, which was enabled, " - "uses system calls that are\n" - "unreliable and unstable on some operating systems and " - "operating-system versions (notably, some versions of Linux).\n" - "This crash could be due to use of those buggy OS calls.\n" - "You should consider whether you really need the " - "\"--memlock\" parameter and/or consult the OS distributer about " - "\"mlockall\" bugs.\n"); - } - -#ifdef HAVE_STACKTRACE - if (print_invalid_query_pointer) - { - my_safe_printf_stderr( - "\nWe think the query pointer is invalid, but we will try " - "to print it anyway. \n" - "Query: "); - my_write_stderr(thd->query(), MY_MIN(65536U, thd->query_length())); - my_safe_printf_stderr("\n\n"); - } -#endif - output_core_info(); #ifdef HAVE_WRITE_CORE if (test_flags & TEST_CORE_ON_SIGNAL) From 965e65d6bb5649f6301e777637e06b17117a40cd Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 10 Nov 2023 11:59:06 +1100 Subject: [PATCH 13/84] MDEV-32686: Signal hander- minimise resource limit output. Most resource limit information is excessive, particularly limits that aren't limited. We restructure the output by considering the Linux format of /proc/limits which had its soft limits beginning at offset 26. "u"limited lines are skipped. Example output: Resource Limits (excludes unlimited resources): Limit Soft Limit Hard Limit Units Max stack size 8388608 unlimited bytes Max processes 127235 127235 processes Max open files 32198 32198 files Max locked memory 8388608 8388608 bytes Max pending signals 127235 127235 signals Max msgqueue size 819200 819200 bytes Max nice priority 0 0 Max realtime priority 0 0 This is 8 lines less that what was before. The FreeBSD limits file was /proc/curproc/rlimit and a different format so a loss of non-Linux proc enabled OSes isn't expected. --- sql/signal_handler.cc | 36 ++++++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 8 deletions(-) diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index 1200a5a1608..20dcbb4fa89 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -71,20 +71,40 @@ static inline void output_core_info() (int) len, buff); } #ifdef __FreeBSD__ - if ((fd= open("/proc/curproc/rlimit", O_RDONLY, MYF(0))) >= 0) + if ((fd= open("/proc/curproc/rlimit", O_RDONLY)) >= 0) #else - if ((fd= open("/proc/self/limits", O_RDONLY, MYF(0))) >= 0) + if ((fd= open("/proc/self/limits", O_RDONLY)) >= 0) #endif { - my_safe_printf_stderr("Resource Limits:\n"); - while ((len= read(fd, (uchar*)buff, sizeof(buff))) > 0) - { - my_write_stderr(buff, len); - } + char *endline= buff; + ssize_t remain_len= len= read(fd, buff, sizeof(buff)); close(fd); + my_safe_printf_stderr("Resource Limits (excludes unlimited resources):\n"); + /* first line, header */ + endline= (char *) memchr(buff, '\n', remain_len); + if (endline) + { + endline++; + remain_len= buff + len - endline; + my_safe_printf_stderr("%.*s", (int) (endline - buff), buff); + + while (remain_len > 27) + { + char *newendline= (char *) memchr(endline, '\n', remain_len); + if (!newendline) + break; + *newendline= '\0'; + newendline++; + if (endline[26] != 'u') /* skip unlimited limits */ + my_safe_printf_stderr("%s\n", endline); + + remain_len-= newendline - endline; + endline= newendline; + } + } } #ifdef __linux__ - if ((fd= open("/proc/sys/kernel/core_pattern", O_RDONLY, MYF(0))) >= 0) + if ((fd= open("/proc/sys/kernel/core_pattern", O_RDONLY)) >= 0) { len= read(fd, (uchar*)buff, sizeof(buff)); my_safe_printf_stderr("Core pattern: %.*s\n", (int) len, buff); From 9aa84cf57f13a7cd78f6b81b1ae9136254d2d2b7 Mon Sep 17 00:00:00 2001 From: Dave Gosselin Date: Thu, 5 Dec 2024 14:53:48 -0500 Subject: [PATCH 14/84] MDEV-35587 unit.innodb_sync leaks memory on mac unit.innodb_sync calls my_end to cleanup its memory --- storage/innobase/unittest/innodb_sync-t.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/storage/innobase/unittest/innodb_sync-t.cc b/storage/innobase/unittest/innodb_sync-t.cc index 5ad726d8429..e12b5c25ba3 100644 --- a/storage/innobase/unittest/innodb_sync-t.cc +++ b/storage/innobase/unittest/innodb_sync-t.cc @@ -209,4 +209,7 @@ int main(int argc __attribute__((unused)), char **argv) ok(true, "sux_lock"); sux.free(); + + my_end(MY_CHECK_ERROR); + return exit_status(); } From 9a25f2a5bbc084df725538b8b3e9d2019cbacd31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 12 Dec 2024 11:58:11 +0200 Subject: [PATCH 15/84] MDEV-35632: HandlerSocket uses deprecated auto_ptr Let us suppress the deprecation warnings more specifically. This fixes up commit d76f5774fe70c51577cfbfdddcbfb3309d51f06e --- plugin/handler_socket/CMakeLists.txt | 2 -- plugin/handler_socket/handlersocket/database.hpp | 5 +++++ plugin/handler_socket/libhsclient/hstcpcli.hpp | 5 +++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/plugin/handler_socket/CMakeLists.txt b/plugin/handler_socket/CMakeLists.txt index 5a1925b40e0..1510dc839a4 100644 --- a/plugin/handler_socket/CMakeLists.txt +++ b/plugin/handler_socket/CMakeLists.txt @@ -6,8 +6,6 @@ IF(WIN32 OR WITHOUT_SERVER) RETURN() ENDIF() -MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-deprecated-declarations") - INCLUDE_DIRECTORIES(libhsclient) # Handlersocket client library. We do not distribute it, diff --git a/plugin/handler_socket/handlersocket/database.hpp b/plugin/handler_socket/handlersocket/database.hpp index ed5d00800d9..9e2aadf7380 100644 --- a/plugin/handler_socket/handlersocket/database.hpp +++ b/plugin/handler_socket/handlersocket/database.hpp @@ -9,6 +9,11 @@ #ifndef DENA_DATABASE_HPP #define DENA_DATABASE_HPP +#ifdef __GNUC__ +/* auto_ptr is deprecated */ +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + #include #include #include diff --git a/plugin/handler_socket/libhsclient/hstcpcli.hpp b/plugin/handler_socket/libhsclient/hstcpcli.hpp index fa0d4db1742..d078bdfd533 100644 --- a/plugin/handler_socket/libhsclient/hstcpcli.hpp +++ b/plugin/handler_socket/libhsclient/hstcpcli.hpp @@ -19,6 +19,11 @@ #include "string_ref.hpp" #include "string_buffer.hpp" +#ifdef __GNUC__ +/* auto_ptr is deprecated */ +# pragma GCC diagnostic ignored "-Wdeprecated-declarations" +#endif + namespace dena { struct hstcpcli_filter { From 95fdfb733d28e8e0d558d9ddd4d648830c46189f Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Thu, 12 Dec 2024 12:36:42 +0100 Subject: [PATCH 16/84] In allocate_dynamic() fixed return value on error. The previous value probably was copied from alloc_dynamic() where it means number of elements. --- mysys/array.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysys/array.c b/mysys/array.c index 29527ab5145..11e44d463ab 100644 --- a/mysys/array.c +++ b/mysys/array.c @@ -248,7 +248,7 @@ my_bool allocate_dynamic(DYNAMIC_ARRAY *array, uint max_elements) if (!(new_ptr= (uchar *) my_malloc(array->m_psi_key, size * array->size_of_element, MYF(array->malloc_flags | MY_WME)))) - DBUG_RETURN(0); + DBUG_RETURN(TRUE); memcpy(new_ptr, array->buffer, array->elements * array->size_of_element); array->malloc_flags&= ~MY_INIT_BUFFER_USED; From ddd7d5d8e34c3edd7ebf4790eec2c4e4d9141e94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 12 Dec 2024 18:02:00 +0200 Subject: [PATCH 17/84] MDEV-24035 Failing assertion: UT_LIST_GET_LEN(lock.trx_locks) == 0 causing disruption and replication failure Under unknown circumstances, the SQL layer may wrongly disregard an invocation of thd_mark_transaction_to_rollback() when an InnoDB transaction had been aborted (rolled back) due to one of the following errors: * HA_ERR_LOCK_DEADLOCK * HA_ERR_RECORD_CHANGED (if innodb_snapshot_isolation=ON) * HA_ERR_LOCK_WAIT_TIMEOUT (if innodb_rollback_on_timeout=ON) Such an error used to cause a crash of InnoDB during transaction commit. These changes aim to catch and report the error earlier, so that not only this crash can be avoided but also the original root cause be found and fixed more easily later. The idea of this fix is from Michael 'Monty' Widenius. HA_ERR_ROLLBACK: A new error code that will be translated into ER_ROLLBACK_ONLY, signalling that the current transaction has been aborted and the only allowed action is ROLLBACK. trx_t::state: Add TRX_STATE_ABORTED that is like TRX_STATE_NOT_STARTED, but noting that the transaction had been rolled back and aborted. trx_t::is_started(): Replaces trx_is_started(). ha_innobase: Check the transaction state in various places. Simplify the logic around SAVEPOINT. ha_innobase::is_valid_trx(): Replaces ha_innobase::is_read_only(). The InnoDB logic around transaction savepoints, commit, and rollback was unnecessarily complex and might have contributed to this inconsistency. So, we are simplifying that logic as well. trx_savept_t: Replace with const undo_no_t*. When we rollback to a savepoint, all we need to know is the number of undo log records that must survive. trx_named_savept_t, DB_NO_SAVEPOINT: Remove. We can store undo_no_t directly in the space allocated at innobase_hton->savepoint_offset. fts_trx_create(): Do not copy previous savepoints. fts_savepoint_rollback(): If a savepoint was not found, roll back everything after the default savepoint of fts_trx_create(). The test innodb_fts.savepoint is extended to cover this code. Reviewed by: Vladislav Lesin Tested by: Matthias Leich --- include/handler_ername.h | 4 +- include/my_base.h | 3 +- include/my_handler_errors.h | 3 +- .../include/innodb_rollback_on_timeout.inc | 4 + mysql-test/main/bug39022.test | 4 + mysql-test/main/innodb_mysql_lock.test | 4 + mysql-test/main/long_unique_bugs.test | 4 + mysql-test/main/partition_innodb_plugin.test | 3 + mysql-test/main/rowid_filter_innodb.test | 4 + mysql-test/main/xa.test | 5 +- .../suite/galera/r/galera_bf_kill.result | 2 + .../suite/galera/r/galera_bf_lock_wait.result | 2 + mysql-test/suite/galera/t/galera_bf_kill.test | 2 + .../suite/galera/t/galera_bf_lock_wait.test | 2 + .../suite/innodb/r/innodb-wl5522-debug.result | 2 +- mysql-test/suite/innodb/t/autoinc_debug.test | 4 + .../suite/innodb/t/deadlock_detect.test | 4 + .../innodb/t/deadlock_in_subqueries_join.test | 4 + .../suite/innodb/t/deadlock_victim_race.test | 4 + .../innodb/t/deadlock_wait_lock_race.test | 4 + .../innodb/t/deadlock_wait_thr_race.test | 4 + mysql-test/suite/innodb/t/foreign_key.test | 4 + mysql-test/suite/innodb/t/innodb-lock.test | 4 + .../suite/innodb/t/innodb_bug42419.test | 4 + .../suite/innodb/t/innodb_mysql_rbk.test | 4 + .../suite/innodb/t/innodb_trx_weight.test | 4 + .../suite/innodb/t/insert-before-delete.test | 4 + .../suite/innodb/t/lock_delete_updated.test | 4 + mysql-test/suite/innodb/t/lock_isolation.test | 4 + .../suite/innodb/t/lock_memory_debug.test | 3 + mysql-test/suite/innodb/t/mdev-14846.test | 4 + mysql-test/suite/innodb/t/row_lock.test | 4 + mysql-test/suite/innodb/t/stat_tables.test | 4 + .../suite/innodb_fts/r/savepoint.result | 24 + mysql-test/suite/innodb_fts/t/savepoint.test | 16 + .../innodb_zip/r/wl5522_debug_zip.result | 2 +- .../multi_source/gtid_ignore_duplicates.test | 3 + .../rpl/r/rpl_mark_optimize_tbl_ddl.result | 4 +- .../rpl/t/rpl_mark_optimize_tbl_ddl.test | 4 + .../rpl/t/rpl_parallel_deadlock_victim.test | 3 + .../rpl/t/rpl_parallel_deadlock_victim2.test | 4 + .../t/rpl_parallel_innodb_lock_conflict.test | 4 + .../suite/rpl/t/rpl_parallel_optimistic.test | 3 + .../t/rpl_parallel_optimistic_nobinlog.test | 4 + .../suite/rpl/t/rpl_parallel_xa_same_xid.test | 4 + .../suite/rpl/t/rpl_temporary_error2.test | 3 + mysql-test/suite/versioning/t/update.test | 4 + sql/handler.cc | 8 +- storage/innobase/buf/buf0buf.cc | 6 +- storage/innobase/fts/fts0fts.cc | 74 +- storage/innobase/handler/ha_innodb.cc | 930 +++++++++--------- storage/innobase/handler/ha_innodb.h | 18 +- storage/innobase/handler/handler0alter.cc | 8 +- storage/innobase/include/db0err.h | 2 - storage/innobase/include/fts0fts.h | 12 +- storage/innobase/include/row0mysql.h | 2 +- storage/innobase/include/trx0roll.h | 76 +- storage/innobase/include/trx0sys.h | 14 +- storage/innobase/include/trx0trx.h | 88 +- storage/innobase/include/trx0trx.inl | 2 + storage/innobase/include/trx0types.h | 10 +- storage/innobase/lock/lock0lock.cc | 26 +- storage/innobase/que/que0que.cc | 3 +- storage/innobase/row/row0mysql.cc | 16 +- storage/innobase/row/row0sel.cc | 5 +- storage/innobase/trx/trx0i_s.cc | 2 +- storage/innobase/trx/trx0roll.cc | 391 +------- storage/innobase/trx/trx0sys.cc | 26 + storage/innobase/trx/trx0trx.cc | 121 +-- storage/innobase/ut/ut0ut.cc | 2 - 70 files changed, 880 insertions(+), 1163 deletions(-) diff --git a/include/handler_ername.h b/include/handler_ername.h index e969daa7c77..32faa84b52d 100644 --- a/include/handler_ername.h +++ b/include/handler_ername.h @@ -78,5 +78,7 @@ { "HA_ERR_ABORTED_BY_USER", HA_ERR_ABORTED_BY_USER, "" }, { "HA_ERR_DISK_FULL", HA_ERR_DISK_FULL, "" }, { "HA_ERR_INCOMPATIBLE_DEFINITION", HA_ERR_INCOMPATIBLE_DEFINITION, "" }, -{ "HA_ERR_NO_ENCRYPTION", HA_ERR_NO_ENCRYPTION, "" }, { "HA_ERR_COMMIT_ERROR", HA_ERR_COMMIT_ERROR, "" }, +{ "HA_ERR_PARTITION_LIST", HA_ERR_PARTITION_LIST, ""}, +{ "HA_ERR_NO_ENCRYPTION", HA_ERR_NO_ENCRYPTION, ""}, +{ "HA_ERR_ROLLBACK", HA_ERR_ROLLBACK, "" }, diff --git a/include/my_base.h b/include/my_base.h index 44889c4ca96..2ae107c4799 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -535,7 +535,8 @@ enum ha_base_keytype { #define HA_ERR_COMMIT_ERROR 197 #define HA_ERR_PARTITION_LIST 198 #define HA_ERR_NO_ENCRYPTION 199 -#define HA_ERR_LAST 199 /* Copy of last error nr * */ +#define HA_ERR_ROLLBACK 200 /* Automatic rollback done */ +#define HA_ERR_LAST 200 /* Copy of last error nr * */ /* Number of different errors */ #define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1) diff --git a/include/my_handler_errors.h b/include/my_handler_errors.h index df414888907..4e96945e134 100644 --- a/include/my_handler_errors.h +++ b/include/my_handler_errors.h @@ -110,7 +110,8 @@ static const char *handler_error_messages[]= "Sequence values are conflicting", "Error during commit", "Cannot select partitions", - "Cannot initialize encryption. Check that all encryption parameters have been set" + "Cannot initialize encryption. Check that all encryption parameters have been set", + "Transaction was aborted", }; #endif /* MYSYS_MY_HANDLER_ERRORS_INCLUDED */ diff --git a/mysql-test/include/innodb_rollback_on_timeout.inc b/mysql-test/include/innodb_rollback_on_timeout.inc index d41e1f1ec9f..5fbdaa1c62a 100644 --- a/mysql-test/include/innodb_rollback_on_timeout.inc +++ b/mysql-test/include/innodb_rollback_on_timeout.inc @@ -2,6 +2,10 @@ # Bug #24200: Provide backwards compatibility mode for 4.x "rollback on # transaction timeout" # +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --disable_warnings drop table if exists t1; --enable_warnings diff --git a/mysql-test/main/bug39022.test b/mysql-test/main/bug39022.test index 211a40234b4..81dd6f14bed 100644 --- a/mysql-test/main/bug39022.test +++ b/mysql-test/main/bug39022.test @@ -2,6 +2,10 @@ -- source include/have_innodb.inc -- source include/not_binlog_format_row.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --echo # --echo # Bug #39022: Mysql randomly crashing in lock_sec_rec_cons_read_sees --echo # diff --git a/mysql-test/main/innodb_mysql_lock.test b/mysql-test/main/innodb_mysql_lock.test index 5ee688b1d6e..e61b2fde055 100644 --- a/mysql-test/main/innodb_mysql_lock.test +++ b/mysql-test/main/innodb_mysql_lock.test @@ -1,6 +1,10 @@ --source include/have_metadata_lock_info.inc -- source include/have_innodb.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + # Save the initial number of concurrent sessions. --source include/count_sessions.inc diff --git a/mysql-test/main/long_unique_bugs.test b/mysql-test/main/long_unique_bugs.test index 2f85328bda3..78cf072ed8b 100644 --- a/mysql-test/main/long_unique_bugs.test +++ b/mysql-test/main/long_unique_bugs.test @@ -2,6 +2,10 @@ --source include/have_partition.inc --source include/have_sequence.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --echo # --echo # MDEV-18707 Server crash in my_hash_sort_bin, ASAN heap-use-after-free in Field::is_null, server hang, corrupted double-linked list --echo # diff --git a/mysql-test/main/partition_innodb_plugin.test b/mysql-test/main/partition_innodb_plugin.test index c24945152b3..2699ca2ca1a 100644 --- a/mysql-test/main/partition_innodb_plugin.test +++ b/mysql-test/main/partition_innodb_plugin.test @@ -5,6 +5,9 @@ let $MYSQLD_DATADIR= `SELECT @@datadir`; call mtr.add_suppression("InnoDB: Table .* does not exist in the InnoDB internal data dictionary .*"); call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction"); +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log --echo # --echo # Bug#11766879/Bug#60106: DIFF BETWEEN # OF INDEXES IN MYSQL VS INNODB, diff --git a/mysql-test/main/rowid_filter_innodb.test b/mysql-test/main/rowid_filter_innodb.test index d82dccd0551..6b3f9c783e6 100644 --- a/mysql-test/main/rowid_filter_innodb.test +++ b/mysql-test/main/rowid_filter_innodb.test @@ -4,6 +4,10 @@ --source include/have_sequence.inc --source include/innodb_stable_estimates.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + SET SESSION DEFAULT_STORAGE_ENGINE='InnoDB'; SET @save_stats_persistent=@@GLOBAL.innodb_stats_persistent; diff --git a/mysql-test/main/xa.test b/mysql-test/main/xa.test index 77df6831355..a4c60ef316d 100644 --- a/mysql-test/main/xa.test +++ b/mysql-test/main/xa.test @@ -2,13 +2,16 @@ # WL#1756 # -- source include/have_innodb.inc - --source include/not_embedded.inc # Save the initial number of concurrent sessions --source include/count_sessions.inc call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction"); +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --disable_warnings drop table if exists t1, t2; 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/t/galera_bf_kill.test b/mysql-test/suite/galera/t/galera_bf_kill.test index 1cb2e866cb4..4655a35fde5 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 8ef2fee78ed..78a460eda09 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/innodb/r/innodb-wl5522-debug.result b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result index 6b7bb9b9584..aa8a683620f 100644 --- a/mysql-test/suite/innodb/r/innodb-wl5522-debug.result +++ b/mysql-test/suite/innodb/r/innodb-wl5522-debug.result @@ -456,7 +456,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug=@saved_debug_dbug; SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure"; ALTER TABLE t1 IMPORT TABLESPACE; -ERROR HY000: Got error 42 'Tablespace not found' from ./test/t1.ibd +ERROR HY000: Got error 41 'Tablespace not found' from ./test/t1.ibd SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure"; diff --git a/mysql-test/suite/innodb/t/autoinc_debug.test b/mysql-test/suite/innodb/t/autoinc_debug.test index d38a70b3376..f62cfd8afce 100644 --- a/mysql-test/suite/innodb/t/autoinc_debug.test +++ b/mysql-test/suite/innodb/t/autoinc_debug.test @@ -3,6 +3,10 @@ --source include/have_debug_sync.inc --source include/not_embedded.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + # Two parallel connection with autoinc column after restart. CREATE TABLE t1 (id INT AUTO_INCREMENT PRIMARY KEY)ENGINE=INNODB; diff --git a/mysql-test/suite/innodb/t/deadlock_detect.test b/mysql-test/suite/innodb/t/deadlock_detect.test index a84e6fc328f..39ea174a3ec 100644 --- a/mysql-test/suite/innodb/t/deadlock_detect.test +++ b/mysql-test/suite/innodb/t/deadlock_detect.test @@ -5,6 +5,10 @@ --source include/have_innodb.inc --source include/count_sessions.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + let $have_deadlock=`select @@GLOBAL.innodb_deadlock_detect`; connection default; diff --git a/mysql-test/suite/innodb/t/deadlock_in_subqueries_join.test b/mysql-test/suite/innodb/t/deadlock_in_subqueries_join.test index b3adfb3b02d..beded05198e 100644 --- a/mysql-test/suite/innodb/t/deadlock_in_subqueries_join.test +++ b/mysql-test/suite/innodb/t/deadlock_in_subqueries_join.test @@ -1,6 +1,10 @@ --source include/have_innodb.inc --source include/count_sessions.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + CREATE TABLE t1 ( pkey int NOT NULL PRIMARY KEY, c int diff --git a/mysql-test/suite/innodb/t/deadlock_victim_race.test b/mysql-test/suite/innodb/t/deadlock_victim_race.test index b9a442fc5b9..dac6be698fc 100644 --- a/mysql-test/suite/innodb/t/deadlock_victim_race.test +++ b/mysql-test/suite/innodb/t/deadlock_victim_race.test @@ -2,6 +2,10 @@ --source include/have_debug_sync.inc --source include/count_sessions.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --connect(cancel_purge,localhost,root,,) # Purge can cause deadlock in the test, requesting page's RW_X_LATCH for trx # ids reseting, after trx 2 acqured RW_S_LATCH and suspended in debug sync point diff --git a/mysql-test/suite/innodb/t/deadlock_wait_lock_race.test b/mysql-test/suite/innodb/t/deadlock_wait_lock_race.test index 79a62b098c9..27d02898b72 100644 --- a/mysql-test/suite/innodb/t/deadlock_wait_lock_race.test +++ b/mysql-test/suite/innodb/t/deadlock_wait_lock_race.test @@ -2,6 +2,10 @@ --source include/have_debug_sync.inc --source include/count_sessions.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + # Purge can cause deadlock in the test, requesting page's RW_X_LATCH for trx # ids reseting, after trx 2 acqured RW_S_LATCH and suspended in debug sync point # lock_trx_handle_wait_enter, waiting for upd_cont signal, which must be diff --git a/mysql-test/suite/innodb/t/deadlock_wait_thr_race.test b/mysql-test/suite/innodb/t/deadlock_wait_thr_race.test index 42576f35baf..318db88a470 100644 --- a/mysql-test/suite/innodb/t/deadlock_wait_thr_race.test +++ b/mysql-test/suite/innodb/t/deadlock_wait_thr_race.test @@ -2,6 +2,10 @@ --source include/have_debug_sync.inc --source include/count_sessions.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + # Purge can cause deadlock in the test, requesting page's RW_X_LATCH for trx # ids reseting, after trx 2 acqured RW_S_LATCH and suspended in debug sync point # lock_trx_handle_wait_enter, waiting for upd_cont signal, which must be diff --git a/mysql-test/suite/innodb/t/foreign_key.test b/mysql-test/suite/innodb/t/foreign_key.test index e793e261abd..506cca3245c 100644 --- a/mysql-test/suite/innodb/t/foreign_key.test +++ b/mysql-test/suite/innodb/t/foreign_key.test @@ -2,6 +2,10 @@ --source include/count_sessions.inc --source include/default_charset.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + SET GLOBAL innodb_stats_persistent = 0; --echo # diff --git a/mysql-test/suite/innodb/t/innodb-lock.test b/mysql-test/suite/innodb/t/innodb-lock.test index fbbb1035481..394681702c0 100644 --- a/mysql-test/suite/innodb/t/innodb-lock.test +++ b/mysql-test/suite/innodb/t/innodb-lock.test @@ -1,6 +1,10 @@ --source include/have_innodb.inc --source include/have_partition.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + # # Check and select innodb lock type # diff --git a/mysql-test/suite/innodb/t/innodb_bug42419.test b/mysql-test/suite/innodb/t/innodb_bug42419.test index ef350529604..2314a2b43ab 100644 --- a/mysql-test/suite/innodb/t/innodb_bug42419.test +++ b/mysql-test/suite/innodb/t/innodb_bug42419.test @@ -4,6 +4,10 @@ # Bug#42419 Server crash with "Pure virtual method called" on two concurrent connections # +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --source include/not_embedded.inc let $innodb_lock_wait_timeout= query_get_value(SHOW VARIABLES LIKE 'innodb_lock_wait_timeout%', Value, 1); diff --git a/mysql-test/suite/innodb/t/innodb_mysql_rbk.test b/mysql-test/suite/innodb/t/innodb_mysql_rbk.test index 85a9769732f..ffdfaf48ea6 100644 --- a/mysql-test/suite/innodb/t/innodb_mysql_rbk.test +++ b/mysql-test/suite/innodb/t/innodb_mysql_rbk.test @@ -1,5 +1,9 @@ --source include/have_innodb.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + # # Bug #41453: Assertion `m_status == DA_ERROR' failed in # Diagnostics_area::sql_errno diff --git a/mysql-test/suite/innodb/t/innodb_trx_weight.test b/mysql-test/suite/innodb/t/innodb_trx_weight.test index 819f05f331e..a8c29a1a8a8 100644 --- a/mysql-test/suite/innodb/t/innodb_trx_weight.test +++ b/mysql-test/suite/innodb/t/innodb_trx_weight.test @@ -6,6 +6,10 @@ # be heavier than ones that had not. # +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + -- source include/have_innodb.inc SET default_storage_engine=InnoDB; diff --git a/mysql-test/suite/innodb/t/insert-before-delete.test b/mysql-test/suite/innodb/t/insert-before-delete.test index 2547b94e5ea..1cadbf7c0c6 100644 --- a/mysql-test/suite/innodb/t/insert-before-delete.test +++ b/mysql-test/suite/innodb/t/insert-before-delete.test @@ -3,6 +3,10 @@ --source include/have_debug_sync.inc --source include/count_sessions.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --connect (pause_purge,localhost,root) START TRANSACTION WITH CONSISTENT SNAPSHOT; diff --git a/mysql-test/suite/innodb/t/lock_delete_updated.test b/mysql-test/suite/innodb/t/lock_delete_updated.test index 1f7b13144e4..8697ff595ab 100644 --- a/mysql-test/suite/innodb/t/lock_delete_updated.test +++ b/mysql-test/suite/innodb/t/lock_delete_updated.test @@ -3,6 +3,10 @@ --source include/have_debug.inc --source include/have_debug_sync.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t VALUES (3); diff --git a/mysql-test/suite/innodb/t/lock_isolation.test b/mysql-test/suite/innodb/t/lock_isolation.test index c9658c0a362..bac034a50e4 100644 --- a/mysql-test/suite/innodb/t/lock_isolation.test +++ b/mysql-test/suite/innodb/t/lock_isolation.test @@ -1,5 +1,9 @@ --source include/have_innodb.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --echo # --echo # MDEV-26642 Weird SELECT view when a record is --echo # modified to the same value by two transactions diff --git a/mysql-test/suite/innodb/t/lock_memory_debug.test b/mysql-test/suite/innodb/t/lock_memory_debug.test index 51e0e8fd57e..588356f7fa4 100644 --- a/mysql-test/suite/innodb/t/lock_memory_debug.test +++ b/mysql-test/suite/innodb/t/lock_memory_debug.test @@ -6,6 +6,9 @@ --echo # call mtr.add_suppression("\\[Warning\\] InnoDB: Over 67 percent of the buffer pool"); +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log CREATE TABLE t1 (col1 INT) ENGINE=InnoDB; INSERT INTO t1 VALUES (1),(2),(3),(4),(5); diff --git a/mysql-test/suite/innodb/t/mdev-14846.test b/mysql-test/suite/innodb/t/mdev-14846.test index e9698cc0594..75b634a0908 100644 --- a/mysql-test/suite/innodb/t/mdev-14846.test +++ b/mysql-test/suite/innodb/t/mdev-14846.test @@ -4,6 +4,10 @@ --source include/innodb_stable_estimates.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + CREATE TABLE t1 ( pk INT, f1 VARCHAR(10) NOT NULL, diff --git a/mysql-test/suite/innodb/t/row_lock.test b/mysql-test/suite/innodb/t/row_lock.test index 361bce461f7..2598189d0e2 100644 --- a/mysql-test/suite/innodb/t/row_lock.test +++ b/mysql-test/suite/innodb/t/row_lock.test @@ -4,6 +4,10 @@ # concurrent CREATE OR REPLACE and transactional UPDATE # +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --source include/have_innodb.inc CREATE TABLE t1 (a INT, b INT) ENGINE=InnoDB; diff --git a/mysql-test/suite/innodb/t/stat_tables.test b/mysql-test/suite/innodb/t/stat_tables.test index 602d05915a0..0aaabb26803 100644 --- a/mysql-test/suite/innodb/t/stat_tables.test +++ b/mysql-test/suite/innodb/t/stat_tables.test @@ -1,5 +1,9 @@ source include/have_innodb.inc; +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + # # MDEV-20354 All but last insert ignored in InnoDB tables when table locked # diff --git a/mysql-test/suite/innodb_fts/r/savepoint.result b/mysql-test/suite/innodb_fts/r/savepoint.result index 1abfc961d0a..b2d53c36fbe 100644 --- a/mysql-test/suite/innodb_fts/r/savepoint.result +++ b/mysql-test/suite/innodb_fts/r/savepoint.result @@ -249,9 +249,33 @@ id title 7 mysql TRUNCATE TABLE articles; INSERT INTO articles(id, title) VALUES(1, 'mysql'); +CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB; BEGIN; +INSERT INTO t SET a=1; +SAVEPOINT t; +INSERT INTO articles(id, title) VALUES(2, 'mysql'); +SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql'); +id title +1 mysql +ROLLBACK TO SAVEPOINT t; +SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql'); +id title +1 mysql +SELECT * FROM t; +a +1 +COMMIT; +SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql'); +id title +1 mysql +BEGIN; +INSERT INTO t SET a=2; INSERT INTO articles(id, title) VALUES(2, 'mysql'); ROLLBACK; +SELECT * FROM t; +a +1 +DROP TABLE t; INSERT INTO articles(id, title) VALUES(3, 'mysql'); SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql'); id title diff --git a/mysql-test/suite/innodb_fts/t/savepoint.test b/mysql-test/suite/innodb_fts/t/savepoint.test index 09ccb383bb9..ae83c23d20c 100644 --- a/mysql-test/suite/innodb_fts/t/savepoint.test +++ b/mysql-test/suite/innodb_fts/t/savepoint.test @@ -366,12 +366,28 @@ TRUNCATE TABLE articles; INSERT INTO articles(id, title) VALUES(1, 'mysql'); +CREATE TABLE t(a INT PRIMARY KEY) ENGINE=InnoDB; BEGIN; +INSERT INTO t SET a=1; +SAVEPOINT t; +INSERT INTO articles(id, title) VALUES(2, 'mysql'); +SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql'); +ROLLBACK TO SAVEPOINT t; +SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql'); +SELECT * FROM t; +COMMIT; +SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql'); + +BEGIN; +INSERT INTO t SET a=2; INSERT INTO articles(id, title) VALUES(2, 'mysql'); ROLLBACK; +SELECT * FROM t; +DROP TABLE t; + INSERT INTO articles(id, title) VALUES(3, 'mysql'); SELECT * FROM articles WHERE MATCH(title) AGAINST('mysql'); diff --git a/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result b/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result index 5ce6affeb0c..1f4d9e592ab 100644 --- a/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result +++ b/mysql-test/suite/innodb_zip/r/wl5522_debug_zip.result @@ -91,7 +91,7 @@ restore: t1 .ibd and .cfg files SET SESSION debug_dbug=@saved_debug_dbug; SET SESSION debug_dbug="+d,ib_import_open_tablespace_failure"; ALTER TABLE t1 IMPORT TABLESPACE; -ERROR HY000: Got error 42 'Tablespace not found' from ./test/t1.ibd +ERROR HY000: Got error 41 'Tablespace not found' from ./test/t1.ibd SET SESSION debug_dbug=@saved_debug_dbug; restore: t1 .ibd and .cfg files SET SESSION debug_dbug="+d,ib_import_check_bitmap_failure"; diff --git a/mysql-test/suite/multi_source/gtid_ignore_duplicates.test b/mysql-test/suite/multi_source/gtid_ignore_duplicates.test index cbc06920b41..634ff002cbc 100644 --- a/mysql-test/suite/multi_source/gtid_ignore_duplicates.test +++ b/mysql-test/suite/multi_source/gtid_ignore_duplicates.test @@ -2,6 +2,9 @@ --source include/have_innodb.inc --source include/have_debug.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log --echo *** Test all-to-all replication with --gtid-ignore-duplicates *** diff --git a/mysql-test/suite/rpl/r/rpl_mark_optimize_tbl_ddl.result b/mysql-test/suite/rpl/r/rpl_mark_optimize_tbl_ddl.result index 09edd28827b..6296196104b 100644 --- a/mysql-test/suite/rpl/r/rpl_mark_optimize_tbl_ddl.result +++ b/mysql-test/suite/rpl/r/rpl_mark_optimize_tbl_ddl.result @@ -36,9 +36,9 @@ Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK FLUSH LOGS; -FOUND 1 /GTID 0-1-8 ddl/ in mysqlbinlog.out FOUND 1 /GTID 0-1-9 ddl/ in mysqlbinlog.out FOUND 1 /GTID 0-1-10 ddl/ in mysqlbinlog.out +FOUND 1 /GTID 0-1-11 ddl/ in mysqlbinlog.out # # Clean up # @@ -63,9 +63,9 @@ ALTER TABLE t1 REPAIR PARTITION p0; Table Op Msg_type Msg_text test.t1 repair status OK FLUSH LOGS; -FOUND 1 /GTID 0-1-14 ddl/ in mysqlbinlog.out FOUND 1 /GTID 0-1-15 ddl/ in mysqlbinlog.out FOUND 1 /GTID 0-1-16 ddl/ in mysqlbinlog.out +FOUND 1 /GTID 0-1-17 ddl/ in mysqlbinlog.out # # Clean up # diff --git a/mysql-test/suite/rpl/t/rpl_mark_optimize_tbl_ddl.test b/mysql-test/suite/rpl/t/rpl_mark_optimize_tbl_ddl.test index 6d66e3fd088..4c9b57e4bda 100644 --- a/mysql-test/suite/rpl/t/rpl_mark_optimize_tbl_ddl.test +++ b/mysql-test/suite/rpl/t/rpl_mark_optimize_tbl_ddl.test @@ -22,6 +22,10 @@ --let $rpl_topology=1->2 --source include/rpl_init.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --connection server_1 FLUSH TABLES; ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; diff --git a/mysql-test/suite/rpl/t/rpl_parallel_deadlock_victim.test b/mysql-test/suite/rpl/t/rpl_parallel_deadlock_victim.test index ab634d2953e..c1876a43dca 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_deadlock_victim.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_deadlock_victim.test @@ -2,6 +2,9 @@ --source include/have_debug.inc --source include/master-slave.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log --echo MDEV-31655: Parallel replication deadlock victim preference code erroneously removed # The problem was that InnoDB would choose the wrong deadlock victim. diff --git a/mysql-test/suite/rpl/t/rpl_parallel_deadlock_victim2.test b/mysql-test/suite/rpl/t/rpl_parallel_deadlock_victim2.test index 522cec18bbc..68d5ad6a481 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_deadlock_victim2.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_deadlock_victim2.test @@ -3,6 +3,10 @@ --source include/have_debug.inc --source include/have_binlog_format_statement.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --connection master ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; CREATE TABLE t1(a INT) ENGINE=INNODB; diff --git a/mysql-test/suite/rpl/t/rpl_parallel_innodb_lock_conflict.test b/mysql-test/suite/rpl/t/rpl_parallel_innodb_lock_conflict.test index 90304937445..532eb58571c 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_innodb_lock_conflict.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_innodb_lock_conflict.test @@ -5,6 +5,10 @@ --source include/have_debug_sync.inc --source include/master-slave.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --connection server_2 SET sql_log_bin=0; CALL mtr.add_suppression("Commit failed due to failure of an earlier commit on which this one depends"); diff --git a/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test b/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test index 09da8c2df15..988221d4c18 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_optimistic.test @@ -7,6 +7,9 @@ call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction"); call mtr.add_suppression("Can't find record in 't1'"); call mtr.add_suppression("Can't find record in 't2'"); +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log --connection server_1 ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; diff --git a/mysql-test/suite/rpl/t/rpl_parallel_optimistic_nobinlog.test b/mysql-test/suite/rpl/t/rpl_parallel_optimistic_nobinlog.test index ee0de499edf..0b7a76aa78b 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_optimistic_nobinlog.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_optimistic_nobinlog.test @@ -3,6 +3,10 @@ --let $rpl_topology=1->2 --source include/rpl_init.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --connection server_1 ALTER TABLE mysql.gtid_slave_pos ENGINE=InnoDB; CREATE TABLE t1 (a int PRIMARY KEY, b INT) ENGINE=InnoDB; diff --git a/mysql-test/suite/rpl/t/rpl_parallel_xa_same_xid.test b/mysql-test/suite/rpl/t/rpl_parallel_xa_same_xid.test index 888dd2f177b..17c404adef8 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_xa_same_xid.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_xa_same_xid.test @@ -9,6 +9,10 @@ --source include/have_perfschema.inc --source include/master-slave.inc +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + --let $xid_num = 19 --let $repeat = 17 --let $workers = 7 diff --git a/mysql-test/suite/rpl/t/rpl_temporary_error2.test b/mysql-test/suite/rpl/t/rpl_temporary_error2.test index 3537499d562..23a84a02760 100644 --- a/mysql-test/suite/rpl/t/rpl_temporary_error2.test +++ b/mysql-test/suite/rpl/t/rpl_temporary_error2.test @@ -2,6 +2,9 @@ --source include/master-slave.inc call mtr.add_suppression("Deadlock found when trying to get lock; try restarting transaction"); +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log --echo *** Provoke a deadlock on the slave, check that transaction retry succeeds. *** --connection master diff --git a/mysql-test/suite/versioning/t/update.test b/mysql-test/suite/versioning/t/update.test index e7a57b393ad..e3b07bfe47a 100644 --- a/mysql-test/suite/versioning/t/update.test +++ b/mysql-test/suite/versioning/t/update.test @@ -1,6 +1,10 @@ source suite/versioning/engines.inc; source suite/versioning/common.inc; +--disable_query_log +call mtr.add_suppression("InnoDB: Transaction was aborted due to "); +--enable_query_log + replace_result $sys_datatype_expl SYS_DATATYPE; eval create table t1( x int unsigned, diff --git a/sql/handler.cc b/sql/handler.cc index 09f5131626b..286f65db1ae 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -4676,6 +4676,12 @@ void handler::print_error(int error, myf errflag) case HA_ERR_PARTITION_LIST: my_error(ER_VERS_NOT_ALLOWED, errflag, table->s->db.str, table->s->table_name.str); DBUG_VOID_RETURN; + case HA_ERR_ROLLBACK: + /* Crash if we run with --debug-assert-on-error */ + DBUG_ASSERT(!debug_assert_if_crashed_table); + SET_FATAL_ERROR; + textno= ER_ROLLBACK_ONLY; + break; default: { /* The error was "unknown" to this function. @@ -4710,7 +4716,7 @@ void handler::print_error(int error, myf errflag) /* Ensure this becomes a true error */ errflag&= ~(ME_WARNING | ME_NOTE); if ((debug_assert_if_crashed_table || - global_system_variables.log_warnings > 1)) + global_system_variables.log_warnings > 1)) { /* Log error to log before we crash or if extended warnings are requested diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 4cc3cdf38c4..69e3032a2db 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1541,7 +1541,7 @@ struct find_interesting_trx { void operator()(const trx_t &trx) { - if (trx.state == TRX_STATE_NOT_STARTED) + if (!trx.is_started()) return; if (trx.mysql_thd == nullptr) return; @@ -1550,12 +1550,12 @@ struct find_interesting_trx if (!found) { - ib::warn() << "The following trx might hold " + 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."; + "below release the blocks."); found= true; } diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index 4ff034e0e3c..df2cb568d4d 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -2211,7 +2211,7 @@ fts_savepoint_t* fts_savepoint_create( /*=================*/ ib_vector_t* savepoints, /*!< out: InnoDB transaction */ - const char* name, /*!< in: savepoint name */ + const void* name, /*!< in: savepoint */ mem_heap_t* heap) /*!< in: heap */ { fts_savepoint_t* savepoint; @@ -2220,11 +2220,7 @@ fts_savepoint_create( ib_vector_push(savepoints, NULL)); memset(savepoint, 0x0, sizeof(*savepoint)); - - if (name) { - savepoint->name = mem_heap_strdup(heap, name); - } - + savepoint->name = name; static_assert(!offsetof(fts_trx_table_t, table), "ABI"); savepoint->tables = rbt_create(sizeof(fts_trx_table_t*), fts_ptr2_cmp); @@ -2243,7 +2239,6 @@ fts_trx_create( fts_trx_t* ftt; ib_alloc_t* heap_alloc; mem_heap_t* heap = mem_heap_create(1024); - trx_named_savept_t* savep; ut_a(trx->fts_trx == NULL); @@ -2263,14 +2258,6 @@ fts_trx_create( fts_savepoint_create(ftt->savepoints, NULL, NULL); fts_savepoint_create(ftt->last_stmt, NULL, NULL); - /* Copy savepoints that already set before. */ - for (savep = UT_LIST_GET_FIRST(trx->trx_savepoints); - savep != NULL; - savep = UT_LIST_GET_NEXT(trx_savepoints, savep)) { - - fts_savepoint_take(ftt, savep->name); - } - return(ftt); } @@ -5410,7 +5397,7 @@ void fts_savepoint_take( /*===============*/ fts_trx_t* fts_trx, /*!< in: fts transaction */ - const char* name) /*!< in: savepoint name */ + const void* name) /*!< in: savepoint */ { mem_heap_t* heap; fts_savepoint_t* savepoint; @@ -5433,31 +5420,21 @@ fts_savepoint_take( } /*********************************************************************//** -Lookup a savepoint instance by name. -@return ULINT_UNDEFINED if not found */ -UNIV_INLINE +Lookup a savepoint instance. +@return 0 if not found */ +static ulint fts_savepoint_lookup( /*==================*/ ib_vector_t* savepoints, /*!< in: savepoints */ - const char* name) /*!< in: savepoint name */ + const void* name) /*!< in: savepoint */ { - ulint i; - - ut_a(ib_vector_size(savepoints) > 0); - - for (i = 1; i < ib_vector_size(savepoints); ++i) { - fts_savepoint_t* savepoint; - - savepoint = static_cast( - ib_vector_get(savepoints, i)); - - if (strcmp(name, savepoint->name) == 0) { - return(i); - } - } - - return(ULINT_UNDEFINED); + ut_a(ib_vector_size(savepoints) > 0); + for (ulint i= 1; i < ib_vector_size(savepoints); ++i) + if (name == static_cast + (ib_vector_get(savepoints, i))->name) + return i; + return 0; } /*********************************************************************//** @@ -5468,7 +5445,7 @@ void fts_savepoint_release( /*==================*/ trx_t* trx, /*!< in: transaction */ - const char* name) /*!< in: savepoint name */ + const void* name) /*!< in: savepoint name */ { ut_a(name != NULL); @@ -5476,10 +5453,7 @@ fts_savepoint_release( ut_a(ib_vector_size(savepoints) > 0); - ulint i = fts_savepoint_lookup(savepoints, name); - if (i != ULINT_UNDEFINED) { - ut_a(i >= 1); - + if (ulint i = fts_savepoint_lookup(savepoints, name)) { fts_savepoint_t* savepoint; savepoint = static_cast( ib_vector_get(savepoints, i)); @@ -5634,9 +5608,8 @@ void fts_savepoint_rollback( /*===================*/ trx_t* trx, /*!< in: transaction */ - const char* name) /*!< in: savepoint name */ + const void* name) /*!< in: savepoint */ { - ulint i; ib_vector_t* savepoints; ut_a(name != NULL); @@ -5645,16 +5618,19 @@ fts_savepoint_rollback( /* We pop all savepoints from the the top of the stack up to and including the instance that was found. */ - i = fts_savepoint_lookup(savepoints, name); + ulint i = fts_savepoint_lookup(savepoints, name); - if (i != ULINT_UNDEFINED) { + if (i == 0) { + /* fts_trx_create() must have been invoked after + this savepoint had been created, and we must roll back + everything. */ + i = 1; + } + + { fts_savepoint_t* savepoint; - ut_a(i > 0); - while (ib_vector_size(savepoints) > i) { - fts_savepoint_t* savepoint; - savepoint = static_cast( ib_vector_pop(savepoints)); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 4005b9345fa..ffed80b1341 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -1115,17 +1115,6 @@ static SHOW_VAR innodb_status_variables[]= { {NullS, NullS, SHOW_LONG} }; -/*****************************************************************//** -Frees a possible InnoDB trx object associated with the current THD. -@return 0 or error number */ -static -int -innobase_close_connection( -/*======================*/ - handlerton* hton, /*!< in/out: InnoDB handlerton */ - THD* thd); /*!< in: MySQL thread handle for - which to close the connection */ - /** Cancel any pending lock request associated with the current THD. @sa THD::awake() @sa ha_kill_query() */ static void innobase_kill_query(handlerton*, THD* thd, enum thd_kill_levels); @@ -1190,33 +1179,6 @@ innobase_rollback_to_savepoint_can_release_mdl( the user whose XA transaction should be rolled back to savepoint */ -/*****************************************************************//** -Sets a transaction savepoint. -@return always 0, that is, always succeeds */ -static -int -innobase_savepoint( -/*===============*/ - handlerton* hton, /*!< in/out: InnoDB handlerton */ - THD* thd, /*!< in: handle to the MySQL thread of - the user's XA transaction for which - we need to take a savepoint */ - void* savepoint); /*!< in: savepoint data */ - -/*****************************************************************//** -Release transaction savepoint name. -@return 0 if success, HA_ERR_NO_SAVEPOINT if no savepoint with the -given name */ -static -int -innobase_release_savepoint( -/*=======================*/ - handlerton* hton, /*!< in/out: handlerton for InnoDB */ - THD* thd, /*!< in: handle to the MySQL thread - of the user whose transaction's - savepoint should be released */ - void* savepoint); /*!< in: savepoint data */ - /** Request notification of log writes */ static void innodb_log_flush_request(void *cookie); @@ -2179,6 +2141,25 @@ static int innodb_ddl_recovery_done(handlerton*) return 0; } +/** Report an aborted transaction or statement. +@param thd execution context +@param all true=transaction, false=statement +@param err InnoDB error code */ +static void innodb_transaction_abort(THD *thd, bool all, dberr_t err) noexcept +{ + if (!thd) + return; + if (!all); + else if (trx_t *trx = thd_to_trx(thd)) + { + ut_ad(trx->state == TRX_STATE_NOT_STARTED); + trx->state= TRX_STATE_ABORTED; + sql_print_error("InnoDB: Transaction was aborted due to %s", + ut_strerr(err)); + } + thd_mark_transaction_to_rollback(thd, all); +} + /********************************************************************//** Converts an InnoDB error code to a MySQL error code and also tells to MySQL about a possible transaction rollback inside InnoDB caused by a lock wait @@ -2241,14 +2222,9 @@ convert_error_code_to_mysql( case DB_DEADLOCK: case DB_RECORD_CHANGED: - /* Since we rolled back the whole transaction, we must - tell it also to MySQL so that MySQL knows to empty the - cached binlog for this transaction */ - - if (thd != NULL) { - thd_mark_transaction_to_rollback(thd, 1); - } - + /* Since we rolled back the whole transaction, the + cached binlog must be emptied. */ + innodb_transaction_abort(thd, true, error); return error == DB_DEADLOCK ? HA_ERR_LOCK_DEADLOCK : HA_ERR_RECORD_CHANGED; @@ -2257,11 +2233,8 @@ convert_error_code_to_mysql( latest SQL statement in a lock wait timeout. Previously, we rolled back the whole transaction. */ - if (thd) { - thd_mark_transaction_to_rollback( - thd, innobase_rollback_on_timeout); - } - + innodb_transaction_abort(thd, innobase_rollback_on_timeout, + error); return(HA_ERR_LOCK_WAIT_TIMEOUT); case DB_NO_REFERENCED_ROW: @@ -2340,9 +2313,6 @@ convert_error_code_to_mysql( (ulong) DICT_MAX_FIELD_LEN_BY_FORMAT_FLAG(flags)); return(HA_ERR_INDEX_COL_TOO_LONG); - case DB_NO_SAVEPOINT: - return(HA_ERR_NO_SAVEPOINT); - case DB_LOCK_TABLE_FULL: /* Since we rolled back the whole transaction, we must tell it also to MySQL so that MySQL knows to empty the @@ -2928,7 +2898,7 @@ Gets the InnoDB transaction handle for a MySQL handler object, creates an InnoDB transaction struct if the corresponding MySQL thread struct still lacks one. @return InnoDB transaction handle */ -static inline +static trx_t* check_trx_exists( /*=============*/ @@ -2986,6 +2956,137 @@ trx_deregister_from_2pc( trx->active_commit_ordered= false; } +/** + Set a transaction savepoint. + + @param thd server thread descriptor + @param savepoint transaction savepoint storage area + + @retval 0 on success + @retval HA_ERR_NO_SAVEPOINT if the transaction is in an inconsistent state +*/ +static int innobase_savepoint(handlerton*, THD *thd, void *savepoint) noexcept +{ + DBUG_ENTER("innobase_savepoint"); + + /* In the autocommit mode there is no sense to set a savepoint + (unless we are in sub-statement), so SQL layer ensures that + this method is never called in such situation. */ + trx_t *trx= check_trx_exists(thd); + + /* Cannot happen outside of transaction */ + DBUG_ASSERT(trx_is_registered_for_2pc(trx)); + + switch (UNIV_EXPECT(trx->state, TRX_STATE_ACTIVE)) { + default: + ut_ad("invalid state" == 0); + DBUG_RETURN(HA_ERR_NO_SAVEPOINT); + case TRX_STATE_NOT_STARTED: + trx_start_if_not_started_xa(trx, false); + /* fall through */ + case TRX_STATE_ACTIVE: + const undo_no_t savept{trx->undo_no}; + *static_cast(savepoint)= savept; + trx->last_stmt_start= savept; + trx->end_bulk_insert(); + + if (trx->fts_trx) + fts_savepoint_take(trx->fts_trx, savepoint); + + DBUG_RETURN(0); + } +} + +/** + Releases a transaction savepoint. + + @param thd server thread descriptor + @param savepoint transaction savepoint to be released + + @return 0 always +*/ +static int innobase_release_savepoint(handlerton*, THD *thd, void *savepoint) + noexcept +{ + DBUG_ENTER("innobase_release_savepoint"); + trx_t *trx= check_trx_exists(thd); + ut_ad(trx->mysql_thd == thd); + if (trx->fts_trx) + fts_savepoint_release(trx, savepoint); + DBUG_RETURN(0); +} + +/** + Frees a possible InnoDB trx object associated with the current THD. + + @param thd server thread descriptor, which resources should be free'd + + @return 0 always +*/ +static int innobase_close_connection(handlerton *, THD *thd) noexcept +{ + if (auto trx= thd_to_trx(thd)) + { + thd_set_ha_data(thd, innodb_hton_ptr, nullptr); + switch (trx->state) { + case TRX_STATE_ABORTED: + trx->state= TRX_STATE_NOT_STARTED; + /* fall through */ + case TRX_STATE_NOT_STARTED: + ut_ad(!trx->id); + trx->will_lock= false; + break; + default: + ut_ad("invalid state" == 0); + return 0; + case TRX_STATE_PREPARED: + if (trx->has_logged_persistent()) + { + trx_disconnect_prepared(trx); + return 0; + } + /* fall through */ + case TRX_STATE_ACTIVE: + /* If we had reserved the auto-inc lock for some table (if + we come here to roll back the latest SQL statement) we + release it now before a possibly lengthy rollback */ + lock_unlock_table_autoinc(trx); + trx_rollback_for_mysql(trx); + } + trx_deregister_from_2pc(trx); + trx->free(); + DEBUG_SYNC(thd, "innobase_connection_closed"); + } + return 0; +} + +/** + XA ROLLBACK after XA PREPARE + + @param xid X/Open XA transaction identification + + @retval 0 if the transaction was found and rolled back + @retval XAER_NOTA if no such transaction exists + @retval XAER_RMFAIL if InnoDB is in read-only mode +*/ +static int innobase_rollback_by_xid(handlerton*, XID *xid) noexcept +{ + DBUG_EXECUTE_IF("innobase_xa_fail", return XAER_RMFAIL;); + if (high_level_read_only) + return XAER_RMFAIL; + if (trx_t *trx= trx_get_trx_by_xid(xid)) + { + ut_ad(trx->xid.is_null()); /* should have been cleared by the lookup */ + trx_deregister_from_2pc(trx); + THD* thd= trx->mysql_thd; + dberr_t err= trx_rollback_for_mysql(trx); + ut_ad(!trx->will_lock); + trx->free(); + return convert_error_code_to_mysql(err, 0, thd); + } + return XAER_NOTA; +} + /*********************************************************************//** Copy table flags from MySQL's HA_CREATE_INFO into an InnoDB table object. Those flags are stored in .frm file and end up in the MySQL table object, @@ -4190,7 +4291,7 @@ static int innodb_init(void* p) innodb_hton_ptr = innobase_hton; innobase_hton->db_type = DB_TYPE_INNODB; - innobase_hton->savepoint_offset = sizeof(trx_named_savept_t); + innobase_hton->savepoint_offset = sizeof(undo_no_t); innobase_hton->close_connection = innobase_close_connection; innobase_hton->kill_query = innobase_kill_query; innobase_hton->savepoint_set = innobase_savepoint; @@ -4409,12 +4510,7 @@ innobase_commit_low( tmp = thd_proc_info(trx->mysql_thd, "innobase_commit_low()"); } #endif /* WITH_WSREP */ - if (trx_is_started(trx)) { - trx_commit_for_mysql(trx); - } else { - trx->will_lock = false; - } - + trx_commit_for_mysql(trx); #ifdef WITH_WSREP if (is_wsrep) { thd_proc_info(trx->mysql_thd, tmp); @@ -4445,7 +4541,7 @@ innobase_start_trx_and_assign_read_view( /* The transaction should not be active yet, start it */ - ut_ad(!trx_is_started(trx)); + ut_ad(!trx->is_started()); trx_start_if_not_started_xa(trx, false); @@ -4468,7 +4564,7 @@ innobase_start_trx_and_assign_read_view( /* Set the MySQL flag to mark that there is an active transaction */ - innobase_register_trx(hton, current_thd, trx); + innobase_register_trx(hton, thd, trx); DBUG_RETURN(0); } @@ -4546,7 +4642,7 @@ innobase_commit_ordered( trx = check_trx_exists(thd); - if (!trx_is_registered_for_2pc(trx) && trx_is_started(trx)) { + if (!trx_is_registered_for_2pc(trx) && trx->is_started()) { /* We cannot throw error here; instead we will catch this error again in innobase_commit() and report it from there. */ DBUG_VOID_RETURN; @@ -4563,6 +4659,23 @@ innobase_commit_ordered( DBUG_VOID_RETURN; } +/** Marks the latest SQL statement ended. */ +static void trx_mark_stmt_end(trx_t *trx) noexcept +{ + ut_d(const trx_state_t trx_state{trx->state}); + ut_ad(trx_state == TRX_STATE_ACTIVE || trx_state == TRX_STATE_NOT_STARTED); + if (trx->fts_trx) + fts_savepoint_laststmt_refresh(trx); + if (trx->is_bulk_insert()) + /* Allow a subsequent INSERT into an empty table + if !unique_checks && !foreign_key_checks. */; + else + { + trx->last_stmt_start= trx->undo_no; + trx->end_bulk_insert(); + } +} + /*****************************************************************//** Commits a transaction in an InnoDB database or marks an SQL statement ended. @@ -4590,20 +4703,36 @@ innobase_commit( ut_ad(!trx->dict_operation_lock_mode); ut_ad(!trx->dict_operation); - /* Transaction is deregistered only in a commit or a rollback. If - it is deregistered we know there cannot be resources to be freed - and we could return immediately. For the time being, we play safe - and do the cleanup though there should be nothing to clean up. */ - - if (!trx_is_registered_for_2pc(trx) && trx_is_started(trx)) { - - sql_print_error("Transaction not registered for MariaDB 2PC," - " but transaction is active"); + switch (UNIV_EXPECT(trx->state, TRX_STATE_ACTIVE)) { + case TRX_STATE_ABORTED: + trx->state = TRX_STATE_NOT_STARTED; + /* fall through */ + case TRX_STATE_NOT_STARTED: + break; + default: + case TRX_STATE_COMMITTED_IN_MEMORY: + case TRX_STATE_PREPARED_RECOVERED: + ut_ad("invalid state" == 0); + /* fall through */ + case TRX_STATE_PREPARED: + ut_ad(commit_trx); + ut_ad(thd_test_options(thd, OPTION_NOT_AUTOCOMMIT + | OPTION_BEGIN)); + /* fall through */ + case TRX_STATE_ACTIVE: + /* Transaction is deregistered only in a commit or a + rollback. If it is deregistered we know there cannot + be resources to be freed and we could return + immediately. For the time being, we play safe and do + the cleanup though there should be nothing to clean + up. */ + if (!trx_is_registered_for_2pc(trx)) { + sql_print_error("Transaction not registered" + " for MariaDB 2PC," + " but transaction is active"); + } } - bool read_only = trx->read_only || trx->id == 0; - DBUG_PRINT("info", ("readonly: %d", read_only)); - if (commit_trx || (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) { @@ -4631,19 +4760,8 @@ innobase_commit( } else { /* We just mark the SQL statement ended and do not do a transaction commit */ - - /* If we had reserved the auto-inc lock for some - table in this SQL statement we release it now */ - - if (!read_only) { - lock_unlock_table_autoinc(trx); - } - - /* Store the current undo_no of the transaction so that we - know where to roll back if we have to roll back the next - SQL statement */ - - trx_mark_sql_stat_end(trx); + lock_unlock_table_autoinc(trx); + trx_mark_stmt_end(trx); } /* Reset the number AUTO-INC rows required */ @@ -4662,7 +4780,7 @@ static int innobase_rollback( /*==============*/ - handlerton* hton, /*!< in: InnoDB handlerton */ + handlerton*, THD* thd, /*!< in: handle to the MySQL thread of the user whose transaction should be rolled back */ @@ -4670,74 +4788,79 @@ innobase_rollback( transaction FALSE - rollback the current statement only */ { - DBUG_ENTER("innobase_rollback"); - DBUG_ASSERT(hton == innodb_hton_ptr); - DBUG_PRINT("trans", ("aborting transaction")); + DBUG_ENTER("innobase_rollback"); + DBUG_PRINT("trans", ("aborting transaction")); - trx_t* trx = check_trx_exists(thd); + if (!rollback_trx) + rollback_trx= !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN); - ut_ad(!trx->dict_operation_lock_mode); - ut_ad(!trx->dict_operation); + trx_t *trx= check_trx_exists(thd); - /* Reset the number AUTO-INC rows required */ + ut_ad(trx->mysql_thd == thd); + ut_ad(!trx->is_recovered); + ut_ad(!trx->dict_operation_lock_mode); + ut_ad(!trx->dict_operation); - trx->n_autoinc_rows = 0; + /* Reset the number AUTO-INC rows required */ + trx->n_autoinc_rows= 0; + /* This is a statement level variable. */ + trx->fts_next_doc_id= 0; - /* If we had reserved the auto-inc lock for some table (if - we come here to roll back the latest SQL statement) we - release it now before a possibly lengthy rollback */ - lock_unlock_table_autoinc(trx); - - /* This is a statement level variable. */ - - trx->fts_next_doc_id = 0; - - dberr_t error; + const trx_state_t trx_state{trx->state}; + switch (UNIV_EXPECT(trx_state, TRX_STATE_ACTIVE)) { + case TRX_STATE_ABORTED: + if (rollback_trx) + trx->state= TRX_STATE_NOT_STARTED; + /* fall through */ + case TRX_STATE_NOT_STARTED: + ut_ad(!trx->id); + trx->will_lock= false; + if (rollback_trx) + trx_deregister_from_2pc(trx); + DBUG_RETURN(0); + default: + case TRX_STATE_COMMITTED_IN_MEMORY: + case TRX_STATE_PREPARED_RECOVERED: + ut_ad("invalid state" == 0); + /* fall through */ + case TRX_STATE_PREPARED: + ut_ad(rollback_trx); + /* fall through */ + case TRX_STATE_ACTIVE: + /* If we had reserved the auto-inc lock for some table (if + we come here to roll back the latest SQL statement) we + release it now before a possibly lengthy rollback */ + lock_unlock_table_autoinc(trx); #ifdef WITH_WSREP - /* If trx was assigned wsrep XID in prepare phase and the - trx is being rolled back due to BF abort, clear XID in order - to avoid writing it to rollback segment out of order. The XID - will be reassigned when the transaction is replayed. */ - if (trx->state != TRX_STATE_NOT_STARTED - && wsrep_is_wsrep_xid(&trx->xid)) { - trx->xid.null(); - } + /* If trx was assigned wsrep XID in prepare phase and the + trx is being rolled back due to BF abort, clear XID in order + to avoid writing it to rollback segment out of order. The XID + will be reassigned when the transaction is replayed. */ + if (rollback_trx || wsrep_is_wsrep_xid(&trx->xid)) + trx->xid.null(); #endif /* WITH_WSREP */ - if (rollback_trx - || !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) { - - error = trx_rollback_for_mysql(trx); - - trx_deregister_from_2pc(trx); - } else { - - error = trx_rollback_last_sql_stat_for_mysql(trx); - } - - DBUG_RETURN(convert_error_code_to_mysql(error, 0, trx->mysql_thd)); -} - -/*****************************************************************//** -Rolls back a transaction -@return 0 or error number */ -static -int -innobase_rollback_trx( -/*==================*/ - trx_t* trx) /*!< in: transaction */ -{ - DBUG_ENTER("innobase_rollback_trx"); - DBUG_PRINT("trans", ("aborting transaction")); - - /* If we had reserved the auto-inc lock for some table (if - we come here to roll back the latest SQL statement) we - release it now before a possibly lengthy rollback */ - lock_unlock_table_autoinc(trx); - trx_deregister_from_2pc(trx); - - DBUG_RETURN(convert_error_code_to_mysql(trx_rollback_for_mysql(trx), - 0, trx->mysql_thd)); + dberr_t error; + if (rollback_trx) + { + error= trx_rollback_for_mysql(trx); + trx_deregister_from_2pc(trx); + } + else + { + ut_a(trx_state == TRX_STATE_ACTIVE); + ut_ad(!trx->is_autocommit_non_locking() || trx->read_only); + error= trx->rollback(&trx->last_stmt_start); + if (trx->fts_trx) + { + fts_savepoint_rollback_last_stmt(trx); + fts_savepoint_laststmt_refresh(trx); + } + trx->last_stmt_start= trx->undo_no; + trx->end_bulk_insert(); + } + DBUG_RETURN(convert_error_code_to_mysql(error, 0, trx->mysql_thd)); + } } /** Invoke commit_checkpoint_notify_ha() on completed log flush requests. @@ -4874,34 +4997,43 @@ static int innobase_rollback_to_savepoint( /*===========================*/ - handlerton* hton, /*!< in: InnoDB handlerton */ + handlerton*, THD* thd, /*!< in: handle to the MySQL thread of the user whose transaction should be rolled back to savepoint */ void* savepoint) /*!< in: savepoint data */ { + DBUG_ENTER("innobase_rollback_to_savepoint"); + trx_t *trx= check_trx_exists(thd); - DBUG_ENTER("innobase_rollback_to_savepoint"); - DBUG_ASSERT(hton == innodb_hton_ptr); + /* We are reading trx->state without holding trx->mutex here, + because the savepoint rollback should be invoked for a running + active transaction that is associated with the current thread. */ + ut_ad(trx->mysql_thd); - trx_t* trx = check_trx_exists(thd); + if (UNIV_UNLIKELY(trx->state != TRX_STATE_ACTIVE)) + { + ut_ad("invalid state" == 0); + DBUG_RETURN(HA_ERR_NO_SAVEPOINT); + } - /* TODO: use provided savepoint data area to store savepoint data */ + const undo_no_t *savept= static_cast(savepoint); - char name[64]; + if (UNIV_UNLIKELY(*savept > trx->undo_no)) + /* row_mysql_handle_errors() should have invoked rollback during + a bulk insert into an empty table. */ + DBUG_RETURN(HA_ERR_NO_SAVEPOINT); - longlong2str(longlong(savepoint), name, 36); - - int64_t mysql_binlog_cache_pos; - - dberr_t error = trx_rollback_to_savepoint_for_mysql( - trx, name, &mysql_binlog_cache_pos); - - if (error == DB_SUCCESS && trx->fts_trx != NULL) { - fts_savepoint_rollback(trx, name); - } - - DBUG_RETURN(convert_error_code_to_mysql(error, 0, NULL)); + dberr_t error= trx->rollback(savept); + /* Store the position for rolling back the next SQL statement */ + if (trx->fts_trx) + { + fts_savepoint_laststmt_refresh(trx); + fts_savepoint_rollback(trx, savept); + } + trx->last_stmt_start= trx->undo_no; + trx->end_bulk_insert(); + DBUG_RETURN(convert_error_code_to_mysql(error, 0, nullptr)); } /*****************************************************************//** @@ -4934,106 +5066,6 @@ innobase_rollback_to_savepoint_can_release_mdl( DBUG_RETURN(false); } -/*****************************************************************//** -Release transaction savepoint name. -@return 0 if success, HA_ERR_NO_SAVEPOINT if no savepoint with the -given name */ -static -int -innobase_release_savepoint( -/*=======================*/ - handlerton* hton, /*!< in: handlerton for InnoDB */ - THD* thd, /*!< in: handle to the MySQL thread - of the user whose transaction's - savepoint should be released */ - void* savepoint) /*!< in: savepoint data */ -{ - dberr_t error; - trx_t* trx; - char name[64]; - - DBUG_ENTER("innobase_release_savepoint"); - DBUG_ASSERT(hton == innodb_hton_ptr); - - trx = check_trx_exists(thd); - - /* TODO: use provided savepoint data area to store savepoint data */ - - longlong2str(longlong(savepoint), name, 36); - - error = trx_release_savepoint_for_mysql(trx, name); - - if (error == DB_SUCCESS && trx->fts_trx != NULL) { - fts_savepoint_release(trx, name); - } - - DBUG_RETURN(convert_error_code_to_mysql(error, 0, NULL)); -} - -/*****************************************************************//** -Sets a transaction savepoint. -@return always 0, that is, always succeeds */ -static -int -innobase_savepoint( -/*===============*/ - handlerton* hton, /*!< in: handle to the InnoDB handlerton */ - THD* thd, /*!< in: handle to the MySQL thread */ - void* savepoint)/*!< in: savepoint data */ -{ - DBUG_ENTER("innobase_savepoint"); - DBUG_ASSERT(hton == innodb_hton_ptr); - - /* In the autocommit mode there is no sense to set a savepoint - (unless we are in sub-statement), so SQL layer ensures that - this method is never called in such situation. */ - - trx_t* trx = check_trx_exists(thd); - - /* Cannot happen outside of transaction */ - DBUG_ASSERT(trx_is_registered_for_2pc(trx)); - - /* TODO: use provided savepoint data area to store savepoint data */ - char name[64]; - - longlong2str(longlong(savepoint), name, 36); - - dberr_t error = trx_savepoint_for_mysql(trx, name, 0); - - if (error == DB_SUCCESS && trx->fts_trx != NULL) { - fts_savepoint_take(trx->fts_trx, name); - } - - DBUG_RETURN(convert_error_code_to_mysql(error, 0, NULL)); -} - - -/** - Frees a possible InnoDB trx object associated with the current THD. - - @param hton innobase handlerton - @param thd server thread descriptor, which resources should be free'd - - @return 0 always -*/ -static int innobase_close_connection(handlerton *hton, THD *thd) -{ - DBUG_ASSERT(hton == innodb_hton_ptr); - if (auto trx= thd_to_trx(thd)) - { - thd_set_ha_data(thd, innodb_hton_ptr, NULL); - if (trx->state == TRX_STATE_PREPARED && trx->has_logged_persistent()) - { - trx_disconnect_prepared(trx); - return 0; - } - innobase_rollback_trx(trx); - trx->free(); - DEBUG_SYNC(thd, "innobase_connection_closed"); - } - return 0; -} - /** Cancel any pending lock request associated with the current THD. @sa THD::awake() @sa ha_kill_query() */ static void innobase_kill_query(handlerton*, THD *thd, enum thd_kill_levels) @@ -7794,26 +7826,35 @@ ha_innobase::innobase_set_max_autoinc( return(error); } -/** @return whether the table is read-only */ -bool ha_innobase::is_read_only(bool altering_to_supported) const +int ha_innobase::is_valid_trx(bool altering_to_supported) const noexcept { ut_ad(m_prebuilt->trx == thd_to_trx(m_user_thd)); if (high_level_read_only) { ib_senderrf(m_user_thd, IB_LOG_LEVEL_WARN, ER_READ_ONLY_MODE); - return true; + return HA_ERR_TABLE_READONLY; } - if (altering_to_supported) - return false; + switch (UNIV_EXPECT(m_prebuilt->trx->state, TRX_STATE_ACTIVE)) { + default: + ut_ad("invalid state" == 0); + /* fall through */ + case TRX_STATE_ABORTED: + break; + case TRX_STATE_NOT_STARTED: + m_prebuilt->trx->will_lock= true; + /* fall through */ + case TRX_STATE_ACTIVE: + if (altering_to_supported || + !DICT_TF_GET_ZIP_SSIZE(m_prebuilt->table->flags) || + !innodb_read_only_compressed) + return 0; - if (!DICT_TF_GET_ZIP_SSIZE(m_prebuilt->table->flags) || - !innodb_read_only_compressed) - return false; - - ib_senderrf(m_user_thd, IB_LOG_LEVEL_WARN, ER_UNSUPPORTED_COMPRESSED_TABLE); - return true; + ib_senderrf(m_user_thd, IB_LOG_LEVEL_WARN, ER_UNSUPPORTED_COMPRESSED_TABLE); + return HA_ERR_TABLE_READONLY; + } + return HA_ERR_ROLLBACK; } /********************************************************************//** @@ -7839,12 +7880,8 @@ ha_innobase::write_row( trx_t* trx = thd_to_trx(m_user_thd); /* Validation checks before we commence write_row operation. */ - if (is_read_only()) { - DBUG_RETURN(HA_ERR_TABLE_READONLY); - } - - if (!trx_is_started(trx)) { - trx->will_lock = true; + if (int err = is_valid_trx()) { + DBUG_RETURN(err); } ins_mode_t vers_set_fields; @@ -8613,10 +8650,8 @@ ha_innobase::update_row( DBUG_ENTER("ha_innobase::update_row"); - if (is_read_only()) { - DBUG_RETURN(HA_ERR_TABLE_READONLY); - } else if (!trx_is_started(trx)) { - trx->will_lock = true; + if (int err = is_valid_trx()) { + DBUG_RETURN(err); } if (m_upd_buf == NULL) { @@ -8734,7 +8769,8 @@ func_exit: if (error == DB_SUCCESS && /* For sequences, InnoDB transaction may not have been started yet. Check THD-level wsrep state in that case. */ - (trx->is_wsrep() || (!trx_is_started(trx) && wsrep_on(m_user_thd))) + (trx->is_wsrep() + || (trx->state == TRX_STATE_NOT_STARTED && wsrep_on(m_user_thd))) && wsrep_thd_is_local(m_user_thd) && !wsrep_thd_ignore_table(m_user_thd) && (thd_sql_command(m_user_thd) != SQLCOM_CREATE_TABLE) @@ -8778,12 +8814,9 @@ ha_innobase::delete_row( DBUG_ENTER("ha_innobase::delete_row"); - if (is_read_only()) { - DBUG_RETURN(HA_ERR_TABLE_READONLY); - } else if (!trx_is_started(trx)) { - trx->will_lock = true; + if (int err = is_valid_trx()) { + DBUG_RETURN(err); } - if (!m_prebuilt->upd_node) { row_get_prebuilt_update_vector(m_prebuilt); } @@ -9060,10 +9093,15 @@ ha_innobase::index_read( DBUG_RETURN(HA_ERR_KEY_NOT_FOUND); } + const trx_state_t trx_state{m_prebuilt->trx->state}; + if (trx_state == TRX_STATE_ABORTED) { + DBUG_RETURN(HA_ERR_ROLLBACK); + } + /* For R-Tree index, we will always place the page lock to pages being searched */ if (index->is_spatial() && !m_prebuilt->trx->will_lock) { - if (trx_is_started(m_prebuilt->trx)) { + if (trx_state != TRX_STATE_NOT_STARTED) { DBUG_RETURN(HA_ERR_READ_ONLY_TRANSACTION); } else { m_prebuilt->trx->will_lock = true; @@ -9344,6 +9382,17 @@ ha_innobase::general_fetch( ut_ad(trx == thd_to_trx(m_user_thd)); + switch (UNIV_EXPECT(trx->state, TRX_STATE_ACTIVE)) { + default: + ut_ad("invalid state" == 0); + /* fall through */ + case TRX_STATE_ABORTED: + DBUG_RETURN(HA_ERR_ROLLBACK); + case TRX_STATE_ACTIVE: + case TRX_STATE_NOT_STARTED: + break; + } + if (m_prebuilt->table->is_readable()) { } else if (m_prebuilt->table->corrupted) { DBUG_RETURN(HA_ERR_CRASHED); @@ -9596,9 +9645,7 @@ ha_innobase::rnd_pos( Initialize FT index scan @return 0 or error number */ -int -ha_innobase::ft_init() -/*==================*/ +int ha_innobase::ft_init() { DBUG_ENTER("ft_init"); @@ -9608,9 +9655,14 @@ ha_innobase::ft_init() This is because the FTS implementation can acquire locks behind the scenes. This has not been verified but it is safer to treat them as regular read only transactions for now. */ - - if (!trx_is_started(trx)) { + switch (trx->state) { + default: + DBUG_RETURN(HA_ERR_ROLLBACK); + case TRX_STATE_ACTIVE: + break; + case TRX_STATE_NOT_STARTED: trx->will_lock = true; + break; } DBUG_RETURN(rnd_init(false)); @@ -9644,11 +9696,9 @@ ha_innobase::ft_init_ext( out.write(key->ptr(), key->length()); } - if (flags & FT_BOOL) { - ib::info() << "BOOL search"; - } else { - ib::info() << "NL search"; - } + sql_print_information((flags & FT_BOOL) + ? "InnoDB: BOOL search" + : "InnoDB: NL search"); } /* Multi byte character sets like utf32 and utf16 are not @@ -9673,8 +9723,17 @@ ha_innobase::ft_init_ext( the scenes. This has not been verified but it is safer to treat them as regular read only transactions for now. */ - if (!trx_is_started(trx)) { + switch (trx->state) { + default: + ut_ad("invalid state" == 0); + my_printf_error(HA_ERR_ROLLBACK, "Invalid tansaction state", + ME_ERROR_LOG); + return nullptr; + case TRX_STATE_ACTIVE: + break; + case TRX_STATE_NOT_STARTED: trx->will_lock = true; + break; } dict_table_t* ft_table = m_prebuilt->table; @@ -13354,12 +13413,8 @@ ha_innobase::discard_or_import_tablespace( DBUG_ENTER("ha_innobase::discard_or_import_tablespace"); - ut_a(m_prebuilt->trx != NULL); - ut_a(m_prebuilt->trx->magic_n == TRX_MAGIC_N); - ut_a(m_prebuilt->trx == thd_to_trx(ha_thd())); - - if (is_read_only()) { - DBUG_RETURN(HA_ERR_TABLE_READONLY); + if (int err = is_valid_trx()) { + DBUG_RETURN(err); } if (m_prebuilt->table->is_temporary()) { @@ -13907,8 +13962,8 @@ int ha_innobase::truncate() } #endif - if (is_read_only()) - DBUG_RETURN(HA_ERR_TABLE_READONLY); + if (int err= is_valid_trx()) + DBUG_RETURN(err); HA_CREATE_INFO info; dict_table_t *ib_table= m_prebuilt->table; @@ -15940,6 +15995,16 @@ ha_innobase::start_stmt( trx = m_prebuilt->trx; + switch (trx->state) { + default: + DBUG_RETURN(HA_ERR_ROLLBACK); + case TRX_STATE_ACTIVE: + break; + case TRX_STATE_NOT_STARTED: + trx->will_lock = true; + break; + } + /* Reset the AUTOINC statement level counter for multi-row INSERTs. */ trx->n_autoinc_rows = 0; @@ -15963,7 +16028,7 @@ ha_innobase::start_stmt( break; } trx->bulk_insert = false; - trx->last_sql_stat_start.least_undo_no = trx->undo_no; + trx->last_stmt_start = trx->undo_no; } m_prebuilt->sql_stat_start = TRUE; @@ -16021,10 +16086,6 @@ ha_innobase::start_stmt( innobase_register_trx(ht, thd, trx); - if (!trx_is_started(trx)) { - trx->will_lock = true; - } - DBUG_RETURN(0); } @@ -16076,6 +16137,28 @@ ha_innobase::external_lock( trx_t* trx = m_prebuilt->trx; ut_ad(m_prebuilt->table); + const bool not_autocommit = thd_test_options(thd, OPTION_NOT_AUTOCOMMIT + | OPTION_BEGIN); + bool not_started = false; + switch (trx->state) { + default: + case TRX_STATE_PREPARED: + ut_ad("invalid state" == 0); + DBUG_RETURN(HA_ERR_WRONG_COMMAND); + case TRX_STATE_ABORTED: + if (lock_type != F_UNLCK && not_autocommit) { + DBUG_RETURN(HA_ERR_WRONG_COMMAND); + } + /* Reset the state if the transaction had been aborted. */ + trx->state = TRX_STATE_NOT_STARTED; + /* fall through */ + case TRX_STATE_NOT_STARTED: + not_started = true; + break; + case TRX_STATE_ACTIVE: + break; + } + /* Statement based binlogging does not work in isolation level READ UNCOMMITTED and READ COMMITTED since the necessary locks cannot be taken. In this case, we print an @@ -16151,7 +16234,7 @@ ha_innobase::external_lock( break; } trx->bulk_insert = false; - trx->last_sql_stat_start.least_undo_no = trx->undo_no; + trx->last_stmt_start = trx->undo_no; } switch (m_prebuilt->table->quiesce) { @@ -16197,25 +16280,47 @@ ha_innobase::external_lock( break; } - if (lock_type == F_WRLCK) { + switch (lock_type) { + case F_UNLCK: + DEBUG_SYNC_C("ha_innobase_end_statement"); + m_mysql_has_locked = false; + if (--trx->n_mysql_tables_in_use) { + break; + } + + /* If the lock count drops to zero we know that the + current SQL statement has ended */ + trx->mysql_n_tables_locked = 0; + m_prebuilt->used_in_HANDLER = FALSE; + + if (!not_autocommit) { + if (!not_started) { + innobase_commit(ht, thd, TRUE); + } + } else if (trx->isolation_level <= TRX_ISO_READ_COMMITTED) { + trx->read_view.close(); + } + break; + case F_WRLCK: /* If this is a SELECT, then it is in UPDATE TABLE ... or SELECT ... FOR UPDATE */ m_prebuilt->select_lock_type = LOCK_X; m_prebuilt->stored_select_lock_type = LOCK_X; - } - - if (lock_type != F_UNLCK) { - /* MySQL is setting a new table lock */ - + goto set_lock; + case F_RDLCK: + /* Ensure that trx->lock.trx_locks is empty for read-only + autocommit transactions */ + ut_ad(not_autocommit || trx->n_mysql_tables_in_use + || UT_LIST_GET_LEN(trx->lock.trx_locks) == 0); +set_lock: *trx->detailed_error = 0; innobase_register_trx(ht, thd, trx); - if (trx->isolation_level == TRX_ISO_SERIALIZABLE - && m_prebuilt->select_lock_type == LOCK_NONE - && thd_test_options( - thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) { + if (not_autocommit + && trx->isolation_level == TRX_ISO_SERIALIZABLE + && m_prebuilt->select_lock_type == LOCK_NONE) { /* To get serializable execution, we let InnoDB conceptually add 'LOCK IN SHARE MODE' to all SELECTs @@ -16263,42 +16368,12 @@ ha_innobase::external_lock( trx->n_mysql_tables_in_use++; m_mysql_has_locked = true; - if (!trx_is_started(trx) + if (not_started && (m_prebuilt->select_lock_type != LOCK_NONE || m_prebuilt->stored_select_lock_type != LOCK_NONE)) { trx->will_lock = true; } - - DBUG_RETURN(0); - } - - DEBUG_SYNC_C("ha_innobase_end_statement"); - - /* MySQL is releasing a table lock */ - - trx->n_mysql_tables_in_use--; - m_mysql_has_locked = false; - - /* If the MySQL lock count drops to zero we know that the current SQL - statement has ended */ - - if (trx->n_mysql_tables_in_use == 0) { - - trx->mysql_n_tables_locked = 0; - m_prebuilt->used_in_HANDLER = FALSE; - - if (!thd_test_options( - thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN)) { - - if (trx_is_started(trx)) { - - innobase_commit(ht, thd, TRUE); - } - - } else if (trx->isolation_level <= TRX_ISO_READ_COMMITTED) { - trx->read_view.close(); - } } DBUG_RETURN(0); @@ -16639,14 +16714,6 @@ ha_innobase::store_lock( } m_prebuilt->skip_locked= (lock_type == TL_WRITE_SKIP_LOCKED || lock_type == TL_READ_SKIP_LOCKED); - - if (!trx_is_started(trx) - && (m_prebuilt->select_lock_type != LOCK_NONE - || m_prebuilt->stored_select_lock_type != LOCK_NONE)) { - - trx->will_lock = true; - } - return(to); } @@ -17120,7 +17187,7 @@ static int innobase_xa_prepare( /*================*/ - handlerton* hton, /*!< in: InnoDB handlerton */ + handlerton*, THD* thd, /*!< in: handle to the MySQL thread of the user whose XA transaction should be prepared */ @@ -17128,62 +17195,30 @@ innobase_xa_prepare( false - the current SQL statement ended */ { - trx_t* trx = check_trx_exists(thd); + trx_t *trx= check_trx_exists(thd); + ut_ad(trx_is_registered_for_2pc(trx)); + if (!prepare_trx) + prepare_trx= !thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN); - DBUG_ASSERT(hton == innodb_hton_ptr); - - thd_get_xid(thd, &reinterpret_cast(trx->xid)); - - if (!trx_is_registered_for_2pc(trx) && trx_is_started(trx)) { - - sql_print_error("Transaction not registered for MariaDB 2PC," - " but transaction is active"); - } - - if (prepare_trx - || (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) { - - /* We were instructed to prepare the whole transaction, or - this is an SQL statement end and autocommit is on */ - - ut_ad(trx_is_registered_for_2pc(trx)); - - trx_prepare_for_mysql(trx); - } else { - /* We just mark the SQL statement ended and do not do a - transaction prepare */ - - /* If we had reserved the auto-inc lock for some - table in this SQL statement we release it now */ - - lock_unlock_table_autoinc(trx); - - /* Store the current undo_no of the transaction so that we - know where to roll back if we have to roll back the next - SQL statement */ - - trx_mark_sql_stat_end(trx); - } - - if (thd_sql_command(thd) != SQLCOM_XA_PREPARE - && (prepare_trx - || !thd_test_options( - thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) { - - /* For mysqlbackup to work the order of transactions in binlog - and InnoDB must be the same. Consider the situation - - thread1> prepare; write to binlog; ... - - thread2> prepare; write to binlog; commit - thread1> ... commit - - The server guarantees that writes to the binary log - and commits are in the same order, so we do not have - to handle this case. */ - } - - return(0); + switch (UNIV_EXPECT(trx->state, TRX_STATE_ACTIVE)) { + default: + ut_ad("invalid state" == 0); + return HA_ERR_GENERIC; + case TRX_STATE_NOT_STARTED: + if (prepare_trx) + trx_start_if_not_started_xa(trx, false);; + /* fall through */ + case TRX_STATE_ACTIVE: + thd_get_xid(thd, &reinterpret_cast(trx->xid)); + if (prepare_trx) + trx_prepare_for_mysql(trx); + else + { + lock_unlock_table_autoinc(trx); + trx_mark_stmt_end(trx); + } + return 0; + } } /*******************************************************************//** @@ -17193,12 +17228,10 @@ static int innobase_xa_recover( /*================*/ - handlerton* hton, /*!< in: InnoDB handlerton */ + handlerton*, XID* xid_list,/*!< in/out: prepared transactions */ uint len) /*!< in: number of slots in xid_list */ { - DBUG_ASSERT(hton == innodb_hton_ptr); - if (len == 0 || xid_list == NULL) { return(0); @@ -17241,43 +17274,6 @@ innobase_commit_by_xid( } } -/** This function is used to rollback one X/Open XA distributed transaction -which is in the prepared state - -@param[in] hton InnoDB handlerton -@param[in] xid X/Open XA transaction identification - -@return 0 or error number */ -int innobase_rollback_by_xid(handlerton* hton, XID* xid) -{ - DBUG_ASSERT(hton == innodb_hton_ptr); - - DBUG_EXECUTE_IF("innobase_xa_fail", - return XAER_RMFAIL;); - - if (high_level_read_only) { - return(XAER_RMFAIL); - } - - if (trx_t* trx = trx_get_trx_by_xid(xid)) { -#ifdef WITH_WSREP - /* If a wsrep transaction is being rolled back during - the recovery, we must clear the xid in order to avoid - writing serialisation history for rolled back transaction. */ - if (wsrep_is_wsrep_xid(&trx->xid)) { - trx->xid.null(); - } -#endif /* WITH_WSREP */ - int ret = innobase_rollback_trx(trx); - ut_ad(!trx->will_lock); - trx->free(); - - return(ret); - } else { - return(XAER_NOTA); - } -} - bool ha_innobase::check_if_incompatible_data( /*====================================*/ diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 671acc3b3ca..534936f8fae 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -465,8 +465,13 @@ protected: @see build_template() */ void reset_template(); - /** @return whether the table is read-only */ - bool is_read_only(bool altering_to_supported= false) const; + /** Check the transaction is valid. + @param altering_to_supported whether an ALTER TABLE is being run + to something else than ROW_FORMAT=COMPRESSED + @retval 0 if the transaction is valid for the current operation + @retval HA_ERR_TABLE_READONLY if the table is read-only + @retval HA_ERR_ROLLBACK if the transaction has been aborted */ + int is_valid_trx(bool altering_to_supported= false) const noexcept; inline void update_thd(THD* thd); void update_thd(); @@ -937,12 +942,3 @@ ib_push_frm_error( @return true if index column length exceeds limit */ MY_ATTRIBUTE((warn_unused_result)) bool too_big_key_part_length(size_t max_field_len, const KEY& key); - -/** This function is used to rollback one X/Open XA distributed transaction -which is in the prepared state - -@param[in] hton InnoDB handlerton -@param[in] xid X/Open XA transaction identification - -@return 0 or error number */ -int innobase_rollback_by_xid(handlerton* hton, XID* xid); diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index c164956d9a0..ff427297375 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -2249,7 +2249,7 @@ ha_innobase::check_if_supported_inplace_alter( table->s->table_name.str); } - if (is_read_only(!high_level_read_only + if (is_valid_trx(!high_level_read_only && (ha_alter_info->handler_flags & ALTER_OPTIONS) && ha_alter_info->create_info->key_block_size == 0 && ha_alter_info->create_info->row_type @@ -9154,7 +9154,7 @@ inline bool rollback_inplace_alter_table(Alter_inplace_info *ha_alter_info, /* If we have not started a transaction yet, (almost) nothing has been or needs to be done. */ dict_sys.lock(SRW_LOCK_CALL); - else if (ctx->trx->state == TRX_STATE_NOT_STARTED) + else if (!ctx->trx->is_started()) goto free_and_exit; else if (ctx->new_table) { @@ -11382,7 +11382,7 @@ lock_fail: to remove the newly created table or index from data dictionary and table cache in rollback_inplace_alter_table() */ - if (trx->state == TRX_STATE_NOT_STARTED) { + if (!trx->is_started()) { trx_start_for_ddl(trx); } @@ -11549,7 +11549,7 @@ err_index: purge_sys.resume_FTS(); } - if (trx->state == TRX_STATE_NOT_STARTED) { + if (!trx->is_started()) { /* Transaction may have been rolled back due to a lock wait timeout, deadlock, or a KILL statement. So restart the diff --git a/storage/innobase/include/db0err.h b/storage/innobase/include/db0err.h index 960ec3905eb..921cc977e2e 100644 --- a/storage/innobase/include/db0err.h +++ b/storage/innobase/include/db0err.h @@ -68,8 +68,6 @@ enum dberr_t { noticed */ DB_CANNOT_DROP_CONSTRAINT, /*!< dropping a foreign key constraint from a table failed */ - DB_NO_SAVEPOINT, /*!< no savepoint exists with the given - name */ DB_TABLESPACE_EXISTS, /*!< we cannot create a new single-table tablespace because a file of the same name already exists */ diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h index 1d2b409be01..810bfe6966b 100644 --- a/storage/innobase/include/fts0fts.h +++ b/storage/innobase/include/fts0fts.h @@ -201,9 +201,9 @@ struct fts_trx_t { /** Information required for transaction savepoint handling. */ struct fts_savepoint_t { - char* name; /*!< First entry is always NULL, the - default instance. Otherwise the name - of the savepoint */ + const void* name; /*!< First entry is always NULL, the + default instance. Otherwise the + savepoint */ ib_rbt_t* tables; /*!< Modified FTS tables */ }; @@ -666,7 +666,7 @@ void fts_savepoint_take( /*===============*/ fts_trx_t* fts_trx, /*!< in: fts transaction */ - const char* name); /*!< in: savepoint name */ + const void* name); /*!< in: savepoint */ /**********************************************************************//** Refresh last statement savepoint. */ @@ -681,7 +681,7 @@ void fts_savepoint_release( /*==================*/ trx_t* trx, /*!< in: transaction */ - const char* name); /*!< in: savepoint name */ + const void* name); /*!< in: savepoint */ /** Clear cache. @param[in,out] cache fts cache */ @@ -702,7 +702,7 @@ void fts_savepoint_rollback( /*===================*/ trx_t* trx, /*!< in: transaction */ - const char* name); /*!< in: savepoint name */ + const void* name); /*!< in: savepoint */ /*********************************************************************//** Rollback to and including savepoint indentified by name. */ diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index 878d9c9f1a2..8cbeed7d297 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -172,7 +172,7 @@ row_mysql_handle_errors( during the function entry */ trx_t* trx, /*!< in: transaction */ que_thr_t* thr, /*!< in: query thread, or NULL */ - trx_savept_t* savept) /*!< in: savepoint, or NULL */ + const undo_no_t*savept) /*!< in: pointer to savepoint, or nullptr */ MY_ATTRIBUTE((nonnull(1,2))); /********************************************************************//** Create a prebuilt struct for a MySQL table handle. diff --git a/storage/innobase/include/trx0roll.h b/storage/innobase/include/trx0roll.h index 9ef9ebe93b2..dd21597b270 100644 --- a/storage/innobase/include/trx0roll.h +++ b/storage/innobase/include/trx0roll.h @@ -74,62 +74,6 @@ trx_rollback_for_mysql( /*===================*/ trx_t* trx) /*!< in/out: transaction */ MY_ATTRIBUTE((nonnull)); -/*******************************************************************//** -Rollback the latest SQL statement for MySQL. -@return error code or DB_SUCCESS */ -dberr_t -trx_rollback_last_sql_stat_for_mysql( -/*=================================*/ - trx_t* trx) /*!< in/out: transaction */ - MY_ATTRIBUTE((nonnull)); -/*******************************************************************//** -Rolls back a transaction back to a named savepoint. Modifications after the -savepoint are undone but InnoDB does NOT release the corresponding locks -which are stored in memory. If a lock is 'implicit', that is, a new inserted -row holds a lock where the lock information is carried by the trx id stored in -the row, these locks are naturally released in the rollback. Savepoints which -were set after this savepoint are deleted. -@return if no savepoint of the name found then DB_NO_SAVEPOINT, -otherwise DB_SUCCESS */ -dberr_t -trx_rollback_to_savepoint_for_mysql( -/*================================*/ - trx_t* trx, /*!< in: transaction handle */ - const char* savepoint_name, /*!< in: savepoint name */ - int64_t* mysql_binlog_cache_pos) /*!< out: the MySQL binlog cache - position corresponding to this - savepoint; MySQL needs this - information to remove the - binlog entries of the queries - executed after the savepoint */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); -/*******************************************************************//** -Creates a named savepoint. If the transaction is not yet started, starts it. -If there is already a savepoint of the same name, this call erases that old -savepoint and replaces it with a new. Savepoints are deleted in a transaction -commit or rollback. -@return always DB_SUCCESS */ -dberr_t -trx_savepoint_for_mysql( -/*====================*/ - trx_t* trx, /*!< in: transaction handle */ - const char* savepoint_name, /*!< in: savepoint name */ - int64_t binlog_cache_pos) /*!< in: MySQL binlog cache - position corresponding to this - connection at the time of the - savepoint */ - MY_ATTRIBUTE((nonnull)); -/*******************************************************************//** -Releases a named savepoint. Savepoints which -were set after this savepoint are deleted. -@return if no savepoint of the name found then DB_NO_SAVEPOINT, -otherwise DB_SUCCESS */ -dberr_t -trx_release_savepoint_for_mysql( -/*============================*/ - trx_t* trx, /*!< in: transaction handle */ - const char* savepoint_name) /*!< in: savepoint name */ - MY_ATTRIBUTE((nonnull, warn_unused_result)); /** Rollback node states */ enum roll_node_state { @@ -144,25 +88,9 @@ enum roll_node_state { struct roll_node_t{ que_common_t common; /*!< node type: QUE_NODE_ROLLBACK */ enum roll_node_state state; /*!< node execution state */ - const trx_savept_t* savept; /*!< savepoint to which to - roll back, in the case of a - partial rollback */ + undo_no_t savept; /*!< savepoint to which to + roll back; 0=entire transaction */ que_thr_t* undo_thr;/*!< undo query graph */ }; -/** A savepoint set with SQL's "SAVEPOINT savepoint_id" command */ -struct trx_named_savept_t{ - char* name; /*!< savepoint name */ - trx_savept_t savept; /*!< the undo number corresponding to - the savepoint */ - int64_t mysql_binlog_cache_pos; - /*!< the MySQL binlog cache position - corresponding to this savepoint, not - defined if the MySQL binlogging is not - enabled */ - UT_LIST_NODE_T(trx_named_savept_t) - trx_savepoints; /*!< the list of savepoints of a - transaction */ -}; - #endif diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h index f76bdea33a4..f411e8420a9 100644 --- a/storage/innobase/include/trx0sys.h +++ b/storage/innobase/include/trx0sys.h @@ -495,19 +495,7 @@ class rw_trx_hash_t #ifdef UNIV_DEBUG - static void validate_element(trx_t *trx) - { - ut_ad(!trx->read_only || !trx->rsegs.m_redo.rseg); - ut_ad(!trx->is_autocommit_non_locking()); - /* trx->state can be anything except TRX_STATE_NOT_STARTED */ - ut_d(bool acquire_trx_mutex = !trx->mutex_is_owner()); - ut_d(if (acquire_trx_mutex) trx->mutex_lock()); - ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE) || - trx_state_eq(trx, TRX_STATE_COMMITTED_IN_MEMORY) || - trx_state_eq(trx, TRX_STATE_PREPARED_RECOVERED) || - trx_state_eq(trx, TRX_STATE_PREPARED)); - ut_d(if (acquire_trx_mutex) trx->mutex_unlock()); - } + static void validate_element(trx_t *trx); struct debug_iterator_arg diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index 79d5b7be5da..e55c6f506ce 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -149,19 +149,15 @@ void trx_start_for_ddl_low(trx_t *trx); ut_ad((t)->start_file == 0); \ (t)->start_line = __LINE__; \ (t)->start_file = __FILE__; \ + t->state= TRX_STATE_NOT_STARTED; \ trx_start_for_ddl_low(t); \ } while (0) #else # define trx_start_for_ddl(t) trx_start_for_ddl_low(t) #endif /* UNIV_DEBUG */ -/**********************************************************************//** -Does the transaction commit for MySQL. -@return DB_SUCCESS or error number */ -dberr_t -trx_commit_for_mysql( -/*=================*/ - trx_t* trx); /*!< in/out: transaction */ +/** Commit a transaction */ +void trx_commit_for_mysql(trx_t *trx) noexcept; /** XA PREPARE a transaction. @param[in,out] trx transaction to prepare */ void trx_prepare_for_mysql(trx_t* trx); @@ -184,12 +180,6 @@ trx_t* trx_get_trx_by_xid(const XID* xid); /** Durably write log until trx->commit_lsn (if trx_t::commit_in_memory() was invoked with flush_log_later=true). */ void trx_commit_complete_for_mysql(trx_t *trx); -/**********************************************************************//** -Marks the latest SQL statement ended. */ -void -trx_mark_sql_stat_end( -/*==================*/ - trx_t* trx); /*!< in: trx handle */ /****************************************************************//** Prepares a transaction for commit/rollback. */ void @@ -663,6 +653,7 @@ public: Possible states: TRX_STATE_NOT_STARTED + TRX_STATE_ABORTED TRX_STATE_ACTIVE TRX_STATE_PREPARED TRX_STATE_PREPARED_RECOVERED (special case of TRX_STATE_PREPARED) @@ -672,6 +663,8 @@ public: Regular transactions: * NOT_STARTED -> ACTIVE -> COMMITTED -> NOT_STARTED + * NOT_STARTED -> ABORTED (when thd_mark_transaction_to_rollback() is called) + * ABORTED -> NOT_STARTED (acknowledging the rollback of a transaction) Auto-commit non-locking read-only: * NOT_STARTED -> ACTIVE -> NOT_STARTED @@ -708,16 +701,18 @@ public: do we remove it from the read-only list and put it on the read-write list. During this switch we assign it a rollback segment. - When a transaction is NOT_STARTED, it can be in trx_list. It cannot be - in rw_trx_hash. + When a transaction is NOT_STARTED or ABORTED, it can be in trx_list. + It cannot be in rw_trx_hash. - ACTIVE->PREPARED->COMMITTED is only possible when trx is in rw_trx_hash. - The transition ACTIVE->PREPARED is protected by trx->mutex. + ACTIVE->PREPARED->COMMITTED and ACTIVE->COMMITTED is only possible when + trx is in rw_trx_hash. These transitions are protected by trx_t::mutex. - ACTIVE->COMMITTED is possible when the transaction is in - rw_trx_hash. + COMMITTED->NOT_STARTED is possible when trx_t::mutex is being held. + The transaction would already have been removed from rw_trx_hash by + trx_sys_t::deregister_rw() on the transition to COMMITTED. - Transitions to COMMITTED are protected by trx_t::mutex. */ + Transitions between NOT_STARTED and ABORTED can be performed at any time by + the thread that is associated with the transaction. */ Atomic_relaxed state; /** The locks of the transaction. Protected by lock_sys.latch @@ -733,6 +728,14 @@ public: bool is_wsrep() const { return false; } #endif /* WITH_WSREP */ + /** @return whether the transaction has been started */ + bool is_started() const noexcept + { + static_assert(TRX_STATE_NOT_STARTED == 0, ""); + static_assert(TRX_STATE_ABORTED == 1, ""); + return state > TRX_STATE_ABORTED; + } + /** Consistent read view of the transaction */ ReadView read_view; @@ -839,10 +842,6 @@ public: it is a stored procedure with a COMMIT WORK statement, for instance */ /*------------------------------*/ - UT_LIST_BASE_NODE_T(trx_named_savept_t) - trx_savepoints; /*!< savepoints set with SAVEPOINT ..., - oldest first */ - /*------------------------------*/ undo_no_t undo_no; /*!< next undo log record number to assign; since the undo log is private for a transaction, this @@ -850,7 +849,7 @@ public: with no gaps; thus it represents the number of modified/inserted rows in a transaction */ - trx_savept_t last_sql_stat_start; + undo_no_t last_stmt_start; /*!< undo_no when the last sql statement was started: in case of an error, trx is rolled back down to this number */ @@ -949,16 +948,17 @@ public: void evict_table(table_id_t table_id, bool reset_only= false); /** Initiate rollback. - @param savept savepoint to which to roll back + @param savept pointer to savepoint; nullptr=entire transaction @return error code or DB_SUCCESS */ - dberr_t rollback(trx_savept_t *savept= nullptr); + dberr_t rollback(const undo_no_t *savept= nullptr) noexcept; /** Roll back an active transaction. - @param savept savepoint to which to roll back */ - inline void rollback_low(trx_savept_t *savept= nullptr); + @param savept pointer to savepoint; nullptr=entire transaction + @return error code or DB_SUCCESS */ + dberr_t rollback_low(const undo_no_t *savept= nullptr) noexcept; /** Finish rollback. @return whether the rollback was completed normally @retval false if the rollback was aborted by shutdown */ - inline bool rollback_finish(); + bool rollback_finish() noexcept; private: /** Apply any changes to tables for which online DDL is in progress. */ ATTRIBUTE_COLD void apply_log(); @@ -968,9 +968,10 @@ private: @param mtr mini-transaction (if there are any persistent modifications) */ inline void commit_in_memory(const mtr_t *mtr); /** Write log for committing the transaction. */ - void commit_persist(); - /** Clean up the transaction after commit_in_memory() */ - void commit_cleanup(); + void commit_persist() noexcept; + /** Clean up the transaction after commit_in_memory() + @return false (always) */ + bool commit_cleanup() noexcept; /** Commit the transaction in a mini-transaction. @param mtr mini-transaction (if there are any persistent modifications) */ void commit_low(mtr_t *mtr= nullptr); @@ -985,7 +986,7 @@ private: inline void write_serialisation_history(mtr_t *mtr); public: /** Commit the transaction. */ - void commit(); + void commit() noexcept; /** Try to drop a persistent table. @param table persistent table @@ -1005,16 +1006,6 @@ public: void commit(std::vector &deleted); - /** Discard all savepoints */ - void savepoints_discard() - { savepoints_discard(UT_LIST_GET_FIRST(trx_savepoints)); } - - - /** Discard all savepoints starting from a particular savepoint. - @param savept first savepoint to discard */ - void savepoints_discard(trx_named_savept_t *savept); - - bool is_referenced() const { return (skip_lock_inheritance_and_n_ref & ~(1U << 31)) > 0; @@ -1128,15 +1119,6 @@ private: trx_rseg_t *assign_temp_rseg(); }; -/** -Check if transaction is started. -@param[in] trx Transaction whose state we need to check -@reutrn true if transaction is in state started */ -inline bool trx_is_started(const trx_t* trx) -{ - return trx->state != TRX_STATE_NOT_STARTED; -} - /* Transaction isolation levels (trx->isolation_level) */ #define TRX_ISO_READ_UNCOMMITTED 0 /* dirty read: non-locking SELECTs are performed so that diff --git a/storage/innobase/include/trx0trx.inl b/storage/innobase/include/trx0trx.inl index b063c920e2f..317f1f5cd0d 100644 --- a/storage/innobase/include/trx0trx.inl +++ b/storage/innobase/include/trx0trx.inl @@ -67,6 +67,8 @@ trx_state_eq( && thd_get_error_number(trx->mysql_thd))); return(true); + case TRX_STATE_ABORTED: + break; } ut_error; #endif /* UNIV_DEBUG */ diff --git a/storage/innobase/include/trx0types.h b/storage/innobase/include/trx0types.h index 86e1f67bc02..d0a3c1d7892 100644 --- a/storage/innobase/include/trx0types.h +++ b/storage/innobase/include/trx0types.h @@ -52,6 +52,8 @@ constexpr uint innodb_purge_batch_size_MAX= 5000; /** Transaction states (trx_t::state) */ enum trx_state_t { TRX_STATE_NOT_STARTED, + /** The transaction was aborted (rolled back) due to an error */ + TRX_STATE_ABORTED, TRX_STATE_ACTIVE, /** XA PREPARE has been executed; only XA COMMIT or XA ROLLBACK @@ -59,6 +61,7 @@ enum trx_state_t { TRX_STATE_PREPARED, /** XA PREPARE transaction that was returned to ha_recover() */ TRX_STATE_PREPARED_RECOVERED, + /** The transaction has been committed (or completely rolled back) */ TRX_STATE_COMMITTED_IN_MEMORY }; @@ -76,8 +79,6 @@ struct trx_undo_t; struct roll_node_t; /** Commit command node in a query graph */ struct commit_node_t; -/** SAVEPOINT command node in a query graph */ -struct trx_named_savept_t; /* @} */ /** Row identifier (DB_ROW_ID, DATA_ROW_ID) */ @@ -89,11 +90,6 @@ typedef ib_id_t roll_ptr_t; /** Undo number */ typedef ib_id_t undo_no_t; -/** Transaction savepoint */ -struct trx_savept_t{ - undo_no_t least_undo_no; /*!< least undo number to undo */ -}; - /** File objects */ /* @{ */ /** Undo segment header */ diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 2392d67bb04..1795852ec94 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -6692,23 +6692,19 @@ lock_unlock_table_autoinc( /*======================*/ trx_t* trx) /*!< in/out: transaction */ { - lock_sys.assert_unlocked(); - ut_ad(!trx->mutex_is_owner()); - ut_ad(!trx->lock.wait_lock); + /* This function is invoked for a running transaction by the thread + that is serving the transaction. Therefore it is not necessary to + hold trx->mutex here. */ - /* This can be invoked on NOT_STARTED, ACTIVE, PREPARED, - but not COMMITTED transactions. */ + lock_sys.assert_unlocked(); + ut_ad(!trx->mutex_is_owner()); + ut_ad(!trx->lock.wait_lock); + ut_d(trx_state_t trx_state{trx->state}); + ut_ad(trx_state == TRX_STATE_ACTIVE || trx_state == TRX_STATE_PREPARED || + trx_state == TRX_STATE_NOT_STARTED); - ut_ad(trx_state_eq(trx, TRX_STATE_NOT_STARTED) - || !trx_state_eq(trx, TRX_STATE_COMMITTED_IN_MEMORY)); - - /* This function is invoked for a running transaction by the - thread that is serving the transaction. Therefore it is not - necessary to hold trx->mutex here. */ - - if (lock_trx_holds_autoinc_locks(trx)) { - lock_release_autoinc_locks(trx); - } + if (lock_trx_holds_autoinc_locks(trx)) + lock_release_autoinc_locks(trx); } /** Handle a pending lock wait (DB_LOCK_WAIT) in a semi-consistent read diff --git a/storage/innobase/que/que0que.cc b/storage/innobase/que/que0que.cc index 5e1e0686c97..81d93505d70 100644 --- a/storage/innobase/que/que0que.cc +++ b/storage/innobase/que/que0que.cc @@ -514,8 +514,7 @@ que_thr_step( for_step(thr); } else if (type == QUE_NODE_PROC) { if (thr->prev_node == que_node_get_parent(node)) { - trx->last_sql_stat_start.least_undo_no - = trx->undo_no; + trx->last_stmt_start = trx->undo_no; } proc_step(thr); diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index 30d186b4863..bb3b03aef14 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -625,7 +625,7 @@ row_mysql_handle_errors( function */ trx_t* trx, /*!< in: transaction */ que_thr_t* thr, /*!< in: query thread, or NULL */ - trx_savept_t* savept) /*!< in: savepoint, or NULL */ + const undo_no_t*savept) /*!< in: pointer to savepoint, or nullptr */ { dberr_t err; @@ -681,8 +681,7 @@ handle_new_error: } /* MariaDB will roll back the entire transaction. */ trx->bulk_insert = false; - trx->last_sql_stat_start.least_undo_no = 0; - trx->savepoints_discard(); + trx->last_stmt_start = 0; break; case DB_LOCK_WAIT: err = lock_wait(thr); @@ -700,7 +699,6 @@ handle_new_error: rollback: /* Roll back the whole transaction; this resolution was added to version 3.23.43 */ - trx->rollback(); break; @@ -1137,7 +1135,7 @@ row_lock_table_autoinc_for_mysql( trx->error_state = err; } while (err != DB_SUCCESS - && row_mysql_handle_errors(&err, trx, thr, NULL)); + && row_mysql_handle_errors(&err, trx, thr, nullptr)); trx->op_info = ""; @@ -1179,7 +1177,7 @@ row_lock_table(row_prebuilt_t* prebuilt) prebuilt->select_lock_type), thr); trx->error_state = err; } while (err != DB_SUCCESS - && row_mysql_handle_errors(&err, trx, thr, NULL)); + && row_mysql_handle_errors(&err, trx, thr, nullptr)); trx->op_info = ""; @@ -1218,7 +1216,6 @@ row_insert_for_mysql( row_prebuilt_t* prebuilt, ins_mode_t ins_mode) { - trx_savept_t savept; que_thr_t* thr; dberr_t err; ibool was_lock_wait; @@ -1272,7 +1269,7 @@ row_insert_for_mysql( roll back to the start of the transaction. For correctness, it would suffice to roll back to the start of the first insert into this empty table, but we will keep it simple and efficient. */ - savept.least_undo_no = trx->bulk_insert ? 0 : trx->undo_no; + const undo_no_t savept{trx->bulk_insert ? 0 : trx->undo_no}; thr = que_fork_get_first_thr(prebuilt->ins_graph); @@ -1586,7 +1583,6 @@ init_fts_doc_id_for_ref( dberr_t row_update_for_mysql(row_prebuilt_t* prebuilt) { - trx_savept_t savept; dberr_t err; que_thr_t* thr; dict_index_t* clust_index; @@ -1643,7 +1639,7 @@ row_update_for_mysql(row_prebuilt_t* prebuilt) generated for the table: MySQL does not know anything about the row id used as the clustered index key */ - savept.least_undo_no = trx->undo_no; + undo_no_t savept = trx->undo_no; thr = que_fork_get_first_thr(prebuilt->upd_graph); diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc index a6340ccbc08..38b79af8da4 100644 --- a/storage/innobase/row/row0sel.cc +++ b/storage/innobase/row/row0sel.cc @@ -1208,8 +1208,7 @@ re_scan: mtr->commit(); trx->error_state = err; thr->lock_state = QUE_THR_LOCK_ROW; - if (row_mysql_handle_errors( - &err, trx, thr, NULL)) { + if (row_mysql_handle_errors(&err, trx, thr, 0)) { thr->lock_state = QUE_THR_LOCK_NOLOCK; mtr->start(); @@ -5873,7 +5872,7 @@ lock_table_wait: trx->error_state = err; thr->lock_state = QUE_THR_LOCK_ROW; - if (row_mysql_handle_errors(&err, trx, thr, NULL)) { + if (row_mysql_handle_errors(&err, trx, thr, nullptr)) { /* It was a lock wait, and it ended */ thr->lock_state = QUE_THR_LOCK_NOLOCK; diff --git a/storage/innobase/trx/trx0i_s.cc b/storage/innobase/trx/trx0i_s.cc index 4a661c51183..c1784b94bb1 100644 --- a/storage/innobase/trx/trx0i_s.cc +++ b/storage/innobase/trx/trx0i_s.cc @@ -1054,7 +1054,7 @@ static void fetch_data_into_cache(trx_i_s_cache_t *cache) &trx != (purge_sys.query ? purge_sys.query->trx : nullptr)) { trx.mutex_lock(); - if (trx.state != TRX_STATE_NOT_STARTED) + if (trx.is_started()) fetch_data_into_cache_low(cache, &trx); trx.mutex_unlock(); } diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc index d1baab9e684..a59a07b35a9 100644 --- a/storage/innobase/trx/trx0roll.cc +++ b/storage/innobase/trx/trx0roll.cc @@ -43,6 +43,7 @@ Created 3/26/1996 Heikki Tuuri #include "trx0sys.h" #include "trx0trx.h" #include "trx0undo.h" +#include "log.h" #ifdef UNIV_PFS_THREAD mysql_pfs_key_t trx_rollback_clean_thread_key; @@ -54,10 +55,7 @@ bool trx_rollback_is_active; /** In crash recovery, the current trx to be rolled back; NULL otherwise */ const trx_t* trx_roll_crash_recv_trx; -/** Finish transaction rollback. -@return whether the rollback was completed normally -@retval false if the rollback was aborted by shutdown */ -inline bool trx_t::rollback_finish() +bool trx_t::rollback_finish() noexcept { mod_tables.clear(); apply_online_log= false; @@ -85,34 +83,28 @@ inline bool trx_t::rollback_finish() undo= nullptr; } commit_low(); - commit_cleanup(); - return false; + return commit_cleanup(); } -/** Roll back an active transaction. */ -inline void trx_t::rollback_low(trx_savept_t *savept) +dberr_t trx_t::rollback_low(const undo_no_t *savept) noexcept { + op_info= "rollback"; mem_heap_t *heap= mem_heap_create(512); roll_node_t *roll_node= roll_node_create(heap); - roll_node->savept= savept; + + roll_node->savept= savept ? *savept : 0; ut_ad(!in_rollback); #ifdef UNIV_DEBUG + if (savept) { - const auto s= state; - ut_ad(s == TRX_STATE_ACTIVE || - s == TRX_STATE_PREPARED || - s == TRX_STATE_PREPARED_RECOVERED); - if (savept) - { - ut_ad(s == TRX_STATE_ACTIVE); - ut_ad(mysql_thd); - ut_ad(!is_recovered); - } + ut_ad(state == TRX_STATE_ACTIVE); + ut_ad(mysql_thd); + ut_ad(!is_recovered); } #endif - error_state = DB_SUCCESS; + error_state= DB_SUCCESS; if (has_logged()) { @@ -139,7 +131,7 @@ inline void trx_t::rollback_low(trx_savept_t *savept) victim. Galera transaction abort can be invoked during partial rollback. */ ut_ad(!(lock.was_chosen_as_deadlock_victim & 1)); ut_a(error_state == DB_SUCCESS); - const undo_no_t limit= savept->least_undo_no; + const undo_no_t limit{*savept}; apply_online_log= false; for (trx_mod_tables_t::iterator i= mod_tables.begin(); i != mod_tables.end(); ) @@ -155,49 +147,34 @@ inline void trx_t::rollback_low(trx_savept_t *savept) } mem_heap_free(heap); + op_info= ""; + return error_state; } -/** Initiate rollback. -@param savept savepoint -@return error code or DB_SUCCESS */ -dberr_t trx_t::rollback(trx_savept_t *savept) +dberr_t trx_t::rollback(const undo_no_t *savept) noexcept { ut_ad(!mutex_is_owner()); - if (state == TRX_STATE_NOT_STARTED) - { + switch (state) { + case TRX_STATE_ABORTED: + ut_ad(!savept); + state= TRX_STATE_NOT_STARTED; + /* fall through */ + case TRX_STATE_NOT_STARTED: error_state= DB_SUCCESS; return DB_SUCCESS; + case TRX_STATE_PREPARED: + case TRX_STATE_PREPARED_RECOVERED: + case TRX_STATE_COMMITTED_IN_MEMORY: + ut_ad("invalid state" == 0); + /* fall through */ + case TRX_STATE_ACTIVE: + break; } - ut_ad(state == TRX_STATE_ACTIVE); #ifdef WITH_WSREP if (!savept && is_wsrep() && wsrep_thd_is_SR(mysql_thd)) wsrep_handle_SR_rollback(nullptr, mysql_thd); #endif /* WITH_WSREP */ - rollback_low(savept); - return error_state; -} - -/*******************************************************************//** -Rollback a transaction used in MySQL. -@return error code or DB_SUCCESS */ -static -dberr_t -trx_rollback_for_mysql_low( -/*=======================*/ - trx_t* trx) /*!< in/out: transaction */ -{ - trx->op_info = "rollback"; - - /* If we are doing the XA recovery of prepared transactions, - then the transaction object does not have an InnoDB session - object, and we set a dummy session that we use for all MySQL - transactions. */ - - trx->rollback_low(); - - trx->op_info = ""; - - return(trx->error_state); + return rollback_low(savept); } /** Rollback a transaction used in MySQL @@ -211,6 +188,9 @@ dberr_t trx_rollback_for_mysql(trx_t* trx) that is associated with the current thread. */ switch (trx->state) { + case TRX_STATE_ABORTED: + trx->state = TRX_STATE_NOT_STARTED; + /* fall through */ case TRX_STATE_NOT_STARTED: trx->will_lock = false; ut_ad(trx->mysql_thd); @@ -222,13 +202,13 @@ dberr_t trx_rollback_for_mysql(trx_t* trx) ut_ad(!trx->is_wsrep()); trx->lock.was_chosen_as_deadlock_victim= false; #endif + ut_a(UT_LIST_GET_LEN(trx->lock.trx_locks) == 0); return(DB_SUCCESS); - case TRX_STATE_ACTIVE: ut_ad(trx->mysql_thd); ut_ad(!trx->is_recovered); ut_ad(!trx->is_autocommit_non_locking() || trx->read_only); - return(trx_rollback_for_mysql_low(trx)); + return trx->rollback_low(); case TRX_STATE_PREPARED: case TRX_STATE_PREPARED_RECOVERED: @@ -266,7 +246,7 @@ dberr_t trx_rollback_for_mysql(trx_t* trx) mtr.commit(); ut_ad(mtr.commit_lsn() > 0); } - return(trx_rollback_for_mysql_low(trx)); + return trx->rollback_low(); case TRX_STATE_COMMITTED_IN_MEMORY: ut_ad(!trx->is_autocommit_non_locking()); @@ -277,296 +257,6 @@ dberr_t trx_rollback_for_mysql(trx_t* trx) return(DB_CORRUPTION); } -/*******************************************************************//** -Rollback the latest SQL statement for MySQL. -@return error code or DB_SUCCESS */ -dberr_t -trx_rollback_last_sql_stat_for_mysql( -/*=================================*/ - trx_t* trx) /*!< in/out: transaction */ -{ - dberr_t err; - - /* We are reading trx->state without holding trx->mutex - here, because the statement rollback should be invoked for a - running active MySQL transaction that is associated with the - current thread. */ - ut_ad(trx->mysql_thd); - - switch (trx->state) { - case TRX_STATE_NOT_STARTED: - return(DB_SUCCESS); - - case TRX_STATE_ACTIVE: - ut_ad(trx->mysql_thd); - ut_ad(!trx->is_recovered); - ut_ad(!trx->is_autocommit_non_locking() || trx->read_only); - - trx->op_info = "rollback of SQL statement"; - - err = trx->rollback(&trx->last_sql_stat_start); - - if (trx->fts_trx != NULL) { - fts_savepoint_rollback_last_stmt(trx); - fts_savepoint_laststmt_refresh(trx); - } - - trx->last_sql_stat_start.least_undo_no = trx->undo_no; - trx->end_bulk_insert(); - - trx->op_info = ""; - - return(err); - - case TRX_STATE_PREPARED: - case TRX_STATE_PREPARED_RECOVERED: - case TRX_STATE_COMMITTED_IN_MEMORY: - /* The statement rollback is only allowed on an ACTIVE - transaction, not a PREPARED or COMMITTED one. */ - break; - } - - ut_error; - return(DB_CORRUPTION); -} - -/*******************************************************************//** -Search for a savepoint using name. -@return savepoint if found else NULL */ -static -trx_named_savept_t* -trx_savepoint_find( -/*===============*/ - trx_t* trx, /*!< in: transaction */ - const char* name) /*!< in: savepoint name */ -{ - trx_named_savept_t* savep; - - for (savep = UT_LIST_GET_FIRST(trx->trx_savepoints); - savep != NULL; - savep = UT_LIST_GET_NEXT(trx_savepoints, savep)) { - if (!strcmp(savep->name, name)) { - return(savep); - } - } - - return(NULL); -} - -/*******************************************************************//** -Frees a single savepoint struct. */ -static -void -trx_roll_savepoint_free( -/*=====================*/ - trx_t* trx, /*!< in: transaction handle */ - trx_named_savept_t* savep) /*!< in: savepoint to free */ -{ - UT_LIST_REMOVE(trx->trx_savepoints, savep); - - ut_free(savep->name); - ut_free(savep); -} - -/** Discard all savepoints starting from a particular savepoint. -@param savept first savepoint to discard */ -void trx_t::savepoints_discard(trx_named_savept_t *savept) -{ - while (savept) - { - auto next= UT_LIST_GET_NEXT(trx_savepoints, savept); - trx_roll_savepoint_free(this, savept); - savept= next; - } -} - -/*******************************************************************//** -Rolls back a transaction back to a named savepoint. Modifications after the -savepoint are undone but InnoDB does NOT release the corresponding locks -which are stored in memory. If a lock is 'implicit', that is, a new inserted -row holds a lock where the lock information is carried by the trx id stored in -the row, these locks are naturally released in the rollback. Savepoints which -were set after this savepoint are deleted. -@return if no savepoint of the name found then DB_NO_SAVEPOINT, -otherwise DB_SUCCESS */ -static MY_ATTRIBUTE((nonnull, warn_unused_result)) -dberr_t -trx_rollback_to_savepoint_for_mysql_low( -/*====================================*/ - trx_t* trx, /*!< in/out: transaction */ - trx_named_savept_t* savep, /*!< in/out: savepoint */ - int64_t* mysql_binlog_cache_pos) - /*!< out: the MySQL binlog - cache position corresponding - to this savepoint; MySQL needs - this information to remove the - binlog entries of the queries - executed after the savepoint */ -{ - dberr_t err; - - ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE)); - ut_ad(trx->mysql_thd); - - /* Free all savepoints strictly later than savep. */ - - trx->savepoints_discard(UT_LIST_GET_NEXT(trx_savepoints, savep)); - - *mysql_binlog_cache_pos = savep->mysql_binlog_cache_pos; - - trx->op_info = "rollback to a savepoint"; - - err = trx->rollback(&savep->savept); - - /* Store the current undo_no of the transaction so that - we know where to roll back if we have to roll back the - next SQL statement: */ - - trx_mark_sql_stat_end(trx); - - trx->op_info = ""; - return(err); -} - -/*******************************************************************//** -Rolls back a transaction back to a named savepoint. Modifications after the -savepoint are undone but InnoDB does NOT release the corresponding locks -which are stored in memory. If a lock is 'implicit', that is, a new inserted -row holds a lock where the lock information is carried by the trx id stored in -the row, these locks are naturally released in the rollback. Savepoints which -were set after this savepoint are deleted. -@return if no savepoint of the name found then DB_NO_SAVEPOINT, -otherwise DB_SUCCESS */ -dberr_t -trx_rollback_to_savepoint_for_mysql( -/*================================*/ - trx_t* trx, /*!< in: transaction handle */ - const char* savepoint_name, /*!< in: savepoint name */ - int64_t* mysql_binlog_cache_pos) /*!< out: the MySQL binlog cache - position corresponding to this - savepoint; MySQL needs this - information to remove the - binlog entries of the queries - executed after the savepoint */ -{ - trx_named_savept_t* savep; - - /* We are reading trx->state without holding trx->mutex - here, because the savepoint rollback should be invoked for a - running active MySQL transaction that is associated with the - current thread. */ - ut_ad(trx->mysql_thd); - - savep = trx_savepoint_find(trx, savepoint_name); - - if (savep == NULL) { - return(DB_NO_SAVEPOINT); - } - - switch (trx->state) { - case TRX_STATE_NOT_STARTED: - ib::error() << "Transaction has a savepoint " - << savep->name - << " though it is not started"; - return(DB_ERROR); - - case TRX_STATE_ACTIVE: - - return(trx_rollback_to_savepoint_for_mysql_low( - trx, savep, mysql_binlog_cache_pos)); - - case TRX_STATE_PREPARED: - case TRX_STATE_PREPARED_RECOVERED: - case TRX_STATE_COMMITTED_IN_MEMORY: - /* The savepoint rollback is only allowed on an ACTIVE - transaction, not a PREPARED or COMMITTED one. */ - break; - } - - ut_error; - return(DB_CORRUPTION); -} - -/*******************************************************************//** -Creates a named savepoint. If the transaction is not yet started, starts it. -If there is already a savepoint of the same name, this call erases that old -savepoint and replaces it with a new. Savepoints are deleted in a transaction -commit or rollback. -@return always DB_SUCCESS */ -dberr_t -trx_savepoint_for_mysql( -/*====================*/ - trx_t* trx, /*!< in: transaction handle */ - const char* savepoint_name, /*!< in: savepoint name */ - int64_t binlog_cache_pos) /*!< in: MySQL binlog cache - position corresponding to this - connection at the time of the - savepoint */ -{ - trx_named_savept_t* savep; - - trx_start_if_not_started_xa(trx, false); - - savep = trx_savepoint_find(trx, savepoint_name); - - if (savep) { - /* There is a savepoint with the same name: free that */ - - UT_LIST_REMOVE(trx->trx_savepoints, savep); - - ut_free(savep->name); - ut_free(savep); - } - - /* Create a new savepoint and add it as the last in the list */ - - savep = static_cast( - ut_malloc_nokey(sizeof(*savep))); - - savep->name = mem_strdup(savepoint_name); - - savep->savept.least_undo_no = trx->undo_no; - trx->last_sql_stat_start.least_undo_no = trx->undo_no; - - savep->mysql_binlog_cache_pos = binlog_cache_pos; - - UT_LIST_ADD_LAST(trx->trx_savepoints, savep); - - trx->end_bulk_insert(); - - return(DB_SUCCESS); -} - -/*******************************************************************//** -Releases only the named savepoint. Savepoints which were set after this -savepoint are left as is. -@return if no savepoint of the name found then DB_NO_SAVEPOINT, -otherwise DB_SUCCESS */ -dberr_t -trx_release_savepoint_for_mysql( -/*============================*/ - trx_t* trx, /*!< in: transaction handle */ - const char* savepoint_name) /*!< in: savepoint name */ -{ - trx_named_savept_t* savep; - - ut_ad(trx_state_eq(trx, TRX_STATE_ACTIVE, true) - || trx_state_eq(trx, TRX_STATE_PREPARED, true)); - ut_ad(trx->mysql_thd); - - savep = trx_savepoint_find(trx, savepoint_name); - - if (savep != NULL) { - trx_roll_savepoint_free(trx, savep); - return DB_SUCCESS; - } else if (trx->last_sql_stat_start.least_undo_no == 0) { - /* Bulk insert could have discarded savepoints */ - return DB_SUCCESS; - } - - return DB_NO_SAVEPOINT; -} - /*******************************************************************//** Roll back an active transaction. */ static @@ -618,7 +308,9 @@ trx_rollback_active( if (UNIV_UNLIKELY(!trx->rollback_finish())) { ut_ad(!dictionary_locked); } else { - ib::info() << "Rolled back recovered transaction " << trx_id; + sql_print_information( + "InnoDB: Rolled back recovered transaction " + TRX_ID_FMT, trx_id); } if (dictionary_locked) { @@ -904,7 +596,6 @@ trx_rollback_step( if (node->state == ROLL_NODE_SEND) { trx_t* trx; - ib_id_t roll_limit; trx = thr_get_trx(thr); @@ -912,13 +603,11 @@ trx_rollback_step( ut_a(node->undo_thr == NULL); - roll_limit = node->savept ? node->savept->least_undo_no : 0; - trx->mutex_lock(); trx_commit_or_rollback_prepare(trx); - node->undo_thr = trx_rollback_start(trx, roll_limit); + node->undo_thr = trx_rollback_start(trx, node->savept); trx->mutex_unlock(); } else { diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc index df3755f6c10..68c3e79a3d1 100644 --- a/storage/innobase/trx/trx0sys.cc +++ b/storage/innobase/trx/trx0sys.cc @@ -47,6 +47,31 @@ trx_sys_t trx_sys; #ifdef UNIV_DEBUG /* Flag to control TRX_RSEG_N_SLOTS behavior debugging. */ uint trx_rseg_n_slots_debug = 0; + +void rw_trx_hash_t::validate_element(trx_t *trx) +{ + ut_ad(!trx->read_only || !trx->rsegs.m_redo.rseg); + ut_ad(!trx->is_autocommit_non_locking()); + ut_d(bool acquire_trx_mutex= !trx->mutex_is_owner()); + ut_d(if (acquire_trx_mutex) trx->mutex_lock()); + switch (trx->state) { + case TRX_STATE_NOT_STARTED: + case TRX_STATE_ABORTED: + ut_error; + case TRX_STATE_PREPARED: + case TRX_STATE_PREPARED_RECOVERED: + case TRX_STATE_COMMITTED_IN_MEMORY: + ut_ad(!trx->is_autocommit_non_locking()); + break; + case TRX_STATE_ACTIVE: + if (!trx->is_autocommit_non_locking()) + break; + ut_ad(!trx->is_recovered); + ut_ad(trx->read_only); + ut_ad(trx->mysql_thd); + } + ut_d(if (acquire_trx_mutex) trx->mutex_unlock()); +} #endif /** Display the MySQL binlog offset info if it is present in the trx @@ -364,6 +389,7 @@ size_t trx_sys_t::any_active_transactions(size_t *prepared) trx_sys.trx_list.for_each([&](const trx_t &trx) { switch (trx.state) { case TRX_STATE_NOT_STARTED: + case TRX_STATE_ABORTED: break; case TRX_STATE_ACTIVE: if (!trx.id) diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index baa2694c179..94ed416eb60 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -144,7 +144,7 @@ trx_init( trx->magic_n = TRX_MAGIC_N; - trx->last_sql_stat_start.least_undo_no = 0; + trx->last_stmt_start = 0; ut_ad(!trx->read_view.is_open()); @@ -192,10 +192,6 @@ struct TrxFactory { UT_LIST_INIT(trx->lock.evicted_tables, &dict_table_t::table_LRU); - UT_LIST_INIT( - trx->trx_savepoints, - &trx_named_savept_t::trx_savepoints); - trx->mutex_init(); } @@ -437,9 +433,8 @@ void trx_t::free() MEM_NOACCESS(&error_info, sizeof error_info); MEM_NOACCESS(&error_key_num, sizeof error_key_num); MEM_NOACCESS(&graph, sizeof graph); - MEM_NOACCESS(&trx_savepoints, sizeof trx_savepoints); MEM_NOACCESS(&undo_no, sizeof undo_no); - MEM_NOACCESS(&last_sql_stat_start, sizeof last_sql_stat_start); + MEM_NOACCESS(&last_stmt_start, sizeof last_stmt_start); MEM_NOACCESS(&rsegs, sizeof rsegs); MEM_NOACCESS(&roll_limit, sizeof roll_limit); MEM_NOACCESS(&in_rollback, sizeof in_rollback); @@ -467,9 +462,10 @@ void trx_t::free() /** Transition to committed state, to release implicit locks. */ TRANSACTIONAL_INLINE inline void trx_t::commit_state() { - ut_ad(state == TRX_STATE_PREPARED - || state == TRX_STATE_PREPARED_RECOVERED - || state == TRX_STATE_ACTIVE); + ut_d(auto trx_state{state}); + ut_ad(trx_state == TRX_STATE_PREPARED || + trx_state == TRX_STATE_PREPARED_RECOVERED || + trx_state == TRX_STATE_ACTIVE); /* This makes the transaction committed in memory and makes its changes to data visible to other transactions. NOTE that there is a small discrepancy from the strict formal visibility rules here: a @@ -1490,8 +1486,6 @@ TRANSACTIONAL_INLINE inline void trx_t::commit_in_memory(const mtr_t *mtr) } } - savepoints_discard(); - if (fts_trx) trx_finalize_for_fts(this, undo_no != 0); @@ -1510,7 +1504,7 @@ TRANSACTIONAL_INLINE inline void trx_t::commit_in_memory(const mtr_t *mtr) lock.was_chosen_as_deadlock_victim= false; } -void trx_t::commit_cleanup() +bool trx_t::commit_cleanup() noexcept { ut_ad(!dict_operation); ut_ad(!was_dict_operation); @@ -1527,6 +1521,7 @@ void trx_t::commit_cleanup() mutex.wr_unlock(); ut_a(error_state == DB_SUCCESS); + return false; } /** Commit the transaction in a mini-transaction. @@ -1591,7 +1586,7 @@ TRANSACTIONAL_TARGET void trx_t::commit_low(mtr_t *mtr) } -void trx_t::commit_persist() +void trx_t::commit_persist() noexcept { mtr_t *mtr= nullptr; mtr_t local_mtr; @@ -1605,7 +1600,7 @@ void trx_t::commit_persist() } -void trx_t::commit() +void trx_t::commit() noexcept { ut_ad(!was_dict_operation); ut_d(was_dict_operation= dict_operation); @@ -1641,6 +1636,7 @@ trx_commit_or_rollback_prepare( return; case TRX_STATE_COMMITTED_IN_MEMORY: + case TRX_STATE_ABORTED: break; } @@ -1708,33 +1704,26 @@ trx_commit_step( return(thr); } -/**********************************************************************//** -Does the transaction commit for MySQL. -@return DB_SUCCESS or error number */ -dberr_t -trx_commit_for_mysql( -/*=================*/ - trx_t* trx) /*!< in/out: transaction */ +void trx_commit_for_mysql(trx_t *trx) noexcept { - /* Because we do not do the commit by sending an Innobase - sig to the transaction, we must here make sure that trx has been - started. */ - - switch (trx->state) { - case TRX_STATE_NOT_STARTED: - return DB_SUCCESS; - case TRX_STATE_ACTIVE: - case TRX_STATE_PREPARED: - case TRX_STATE_PREPARED_RECOVERED: - trx->op_info = "committing"; - trx->commit(); - trx->op_info = ""; - return(DB_SUCCESS); - case TRX_STATE_COMMITTED_IN_MEMORY: - break; - } - ut_error; - return(DB_CORRUPTION); + switch (trx->state) { + case TRX_STATE_ABORTED: + trx->state= TRX_STATE_NOT_STARTED; + /* fall through */ + case TRX_STATE_NOT_STARTED: + trx->will_lock= false; + break; + case TRX_STATE_ACTIVE: + case TRX_STATE_PREPARED: + case TRX_STATE_PREPARED_RECOVERED: + trx->op_info= "committing"; + trx->commit(); + trx->op_info= ""; + break; + case TRX_STATE_COMMITTED_IN_MEMORY: + ut_error; + break; + } } /** Durably write log until trx->commit_lsn @@ -1754,42 +1743,6 @@ void trx_commit_complete_for_mysql(trx_t *trx) trx_flush_log_if_needed(lsn, trx); } -/**********************************************************************//** -Marks the latest SQL statement ended. */ -void -trx_mark_sql_stat_end( -/*==================*/ - trx_t* trx) /*!< in: trx handle */ -{ - ut_a(trx); - - switch (trx->state) { - case TRX_STATE_PREPARED: - case TRX_STATE_PREPARED_RECOVERED: - case TRX_STATE_COMMITTED_IN_MEMORY: - break; - case TRX_STATE_NOT_STARTED: - trx->undo_no = 0; - /* fall through */ - case TRX_STATE_ACTIVE: - if (trx->fts_trx != NULL) { - fts_savepoint_laststmt_refresh(trx); - } - - if (trx->is_bulk_insert()) { - /* Allow a subsequent INSERT into an empty table - if !unique_checks && !foreign_key_checks. */ - return; - } - - trx->last_sql_stat_start.least_undo_no = trx->undo_no; - trx->end_bulk_insert(); - return; - } - - ut_error; -} - /**********************************************************************//** Prints info about a transaction. */ void @@ -1815,9 +1768,16 @@ trx_print_low( fprintf(f, "TRANSACTION (%p)", trx); } + THD* thd = trx->mysql_thd; + switch (trx->state) { case TRX_STATE_NOT_STARTED: fputs(", not started", f); + thd = nullptr; + goto state_ok; + case TRX_STATE_ABORTED: + fputs(", forced rollback done", f); + thd = nullptr; goto state_ok; case TRX_STATE_ACTIVE: fprintf(f, ", ACTIVE %lu sec", @@ -1883,9 +1843,8 @@ state_ok: putc('\n', f); } - if (trx->state != TRX_STATE_NOT_STARTED && trx->mysql_thd != NULL) { - innobase_mysql_print_thd( - f, trx->mysql_thd, static_cast(max_query_len)); + if (thd) { + innobase_mysql_print_thd(f, thd, uint(max_query_len)); } } @@ -2201,6 +2160,7 @@ trx_start_if_not_started_xa_low( bool read_write) /*!< in: true if read write transaction */ { switch (trx->state) { + case TRX_STATE_ABORTED: case TRX_STATE_NOT_STARTED: trx_start_low(trx, read_write); return; @@ -2244,6 +2204,7 @@ trx_start_if_not_started_low( } return; + case TRX_STATE_ABORTED: case TRX_STATE_PREPARED: case TRX_STATE_PREPARED_RECOVERED: case TRX_STATE_COMMITTED_IN_MEMORY: diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc index 3cdc49c4b32..55ace7b12f6 100644 --- a/storage/innobase/ut/ut0ut.cc +++ b/storage/innobase/ut/ut0ut.cc @@ -340,8 +340,6 @@ ut_strerr( return("Data structure corruption"); case DB_CANNOT_DROP_CONSTRAINT: return("Cannot drop constraint"); - case DB_NO_SAVEPOINT: - return("No such savepoint"); case DB_TABLESPACE_EXISTS: return("Tablespace already exists"); case DB_TABLESPACE_DELETED: From ab9182470dd4f0ddeb28ae7dfa11979e83f9abe3 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 20 Nov 2024 13:46:43 +0400 Subject: [PATCH 18/84] MDEV-31366 Assertion `thd->start_time' failed in bool LOGGER::slow_log_print(THD*, const char*, size_t, ulonglong) Fixing a wrong DBUG_ASSERT. thd->start_time and thd->start_time_sec_part cannot be 0 at the same time. But thd->start_time can be 0 when thd->start_time_sec_part is not 0, e.g. after: SET timestamp=0.99; --- mysql-test/main/log_slow.result | 17 +++++++++++++++++ mysql-test/main/log_slow.test | 15 +++++++++++++++ sql/log.cc | 2 +- 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/mysql-test/main/log_slow.result b/mysql-test/main/log_slow.result index 81ef7f9af72..131542075a1 100644 --- a/mysql-test/main/log_slow.result +++ b/mysql-test/main/log_slow.result @@ -207,4 +207,21 @@ use `a b`; SET timestamp=1234567890; select count(*) from mysql.global_priv where length(priv)>2 +# +# MDEV-31366 Assertion `thd->start_time' failed in bool LOGGER::slow_log_print(THD*, const char*, size_t, ulonglong) +# +TRUNCATE mysql.slow_log; +SET global log_output='TABLE'; +SET timestamp=0.99; +SET long_query_time=0.00001; +SELECT SLEEP(0.1); +SLEEP(0.1) +0 +SELECT COUNT(*)>0 AS c1 FROM mysql.slow_log; +c1 +1 +SET global log_output=default; +SET timestamp=default; +SET long_query_time=default; +TRUNCATE mysql.slow_log; # End of 10.5 tests diff --git a/mysql-test/main/log_slow.test b/mysql-test/main/log_slow.test index 1f33cff9f25..8fb7fd1826b 100644 --- a/mysql-test/main/log_slow.test +++ b/mysql-test/main/log_slow.test @@ -221,4 +221,19 @@ let SEARCH_PATTERN= use \`a\n.*2; let SEARCH_OUTPUT=matches; source include/search_pattern_in_file.inc; +--echo # +--echo # MDEV-31366 Assertion `thd->start_time' failed in bool LOGGER::slow_log_print(THD*, const char*, size_t, ulonglong) +--echo # + +TRUNCATE mysql.slow_log; +SET global log_output='TABLE'; +SET timestamp=0.99; +SET long_query_time=0.00001; +SELECT SLEEP(0.1); +SELECT COUNT(*)>0 AS c1 FROM mysql.slow_log; +SET global log_output=default; +SET timestamp=default; +SET long_query_time=default; +TRUNCATE mysql.slow_log; + --echo # End of 10.5 tests diff --git a/sql/log.cc b/sql/log.cc index a0f865dc7e0..32a1436f9a6 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -1330,7 +1330,7 @@ bool LOGGER::slow_log_print(THD *thd, const char *query, size_t query_length, user_host_buff); DBUG_ASSERT(thd->start_utime); - DBUG_ASSERT(thd->start_time); + DBUG_ASSERT(thd->start_time || thd->start_time_sec_part); query_utime= (current_utime - thd->start_utime); lock_utime= (thd->utime_after_lock - thd->start_utime); my_hrtime_t current_time= { hrtime_from_time(thd->start_time) + From 6dcd9de2a993409ce31df2a9eb0898e83436daff Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Tue, 30 Jul 2024 13:20:39 +1000 Subject: [PATCH 19/84] MDEV-34669: ER_NEED_REPREPARE on SELECT DEFAULT(name) FROM table1_containing_sequence A prepared SELECT statement because of CF_REEXECUTION_FRAGILE needs to check the table is the same definition as previously otherwise a re-prepare of the statement can occur. When running many 'SELECT DEFAULT(name) FROM table1_containing_sequence' in parallel the TABLE_LIST::is_the_same_definition may be called when m_table_ref_type is TABLE_REF_NULL because it hasn't been checked yet. In this case populate the TABLE_LIST with the values determined by the TABLE_SHARE and allow the execution to continue. As a result of this, the main.ps_ddl test doesn't need to reprepare as the defination hasn't changed. This is another case where TABLE_LIST::is_the_same_definition is called when m_table_ref_type is TABLE_REF_NULL, but that doesn't mean that the defination is different. --- mysql-test/main/ps_ddl.result | 2 +- mysql-test/main/ps_ddl.test | 2 +- sql/table.cc | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/mysql-test/main/ps_ddl.result b/mysql-test/main/ps_ddl.result index ace2682b637..e91e5c47351 100644 --- a/mysql-test/main/ps_ddl.result +++ b/mysql-test/main/ps_ddl.result @@ -2037,7 +2037,7 @@ SUCCESS execute stmt; Warnings: Note 1050 Table 't2' already exists -call p_verify_reprepare_count(1); +call p_verify_reprepare_count(0); SUCCESS select * from t2; diff --git a/mysql-test/main/ps_ddl.test b/mysql-test/main/ps_ddl.test index 21f2b715e86..bbcba398fe7 100644 --- a/mysql-test/main/ps_ddl.test +++ b/mysql-test/main/ps_ddl.test @@ -1680,7 +1680,7 @@ drop table t2; execute stmt; call p_verify_reprepare_count(0); execute stmt; -call p_verify_reprepare_count(1); +call p_verify_reprepare_count(0); select * from t2; execute stmt; call p_verify_reprepare_count(0); diff --git a/sql/table.cc b/sql/table.cc index b333cd040f6..1333cbff397 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -9727,7 +9727,14 @@ bool TABLE_LIST::is_the_same_definition(THD* thd, TABLE_SHARE *s) tabledef_version.length= 0; } else + { set_tabledef_version(s); + if (m_table_ref_type == TABLE_REF_NULL) + { + set_table_ref_id(s); + return TRUE; + } + } return FALSE; } From 71a9b3bf1636d27e3f314469588c82df0c99f33a Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 10 Dec 2024 17:16:53 +0100 Subject: [PATCH 20/84] galera sst scripts: fix for error hangling code Fixed some issues in the script code, mainly related to handling situations when a failure occurs: 1) the signal handler in the mariadb-backup SST script was using an uninitialized variable when trying to kill a hung streaming process; 2) inaccurate error messages were being logged sometime; 3) after completing SST, temporary or old (extra) files could remain in database directories. --- scripts/wsrep_sst_common.sh | 2 +- scripts/wsrep_sst_mariabackup.sh | 14 ++++++++------ 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index f9e563c2a95..2921dde8503 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -1556,7 +1556,7 @@ cleanup_pid() fi done elif ps -p $pid >/dev/null 2>&1; then - wsrep_log_warning "Unable to kill PID=$pid ($pid_file)" + wsrep_log_warning "Unable to kill PID=$pid${pid_file:+ ($pid_file)}" return 1 fi fi diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index d32a24da547..cfae27d388c 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -676,24 +676,25 @@ cleanup_at_exit() [ "$(pwd)" != "$OLD_PWD" ] && cd "$OLD_PWD" - if [ $estatus -ne 0 ]; then - wsrep_log_error "Removing $MAGIC_FILE file due to signal" + if [ "$WSREP_SST_OPT_ROLE" = 'donor' -o $estatus -ne 0 ]; then + if [ $estatus -ne 0 ]; then + wsrep_log_error "Removing $MAGIC_FILE file due to signal" + fi [ -f "$MAGIC_FILE" ] && rm -f "$MAGIC_FILE" || : [ -f "$DONOR_MAGIC_FILE" ] && rm -f "$DONOR_MAGIC_FILE" || : + [ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE" || : fi if [ "$WSREP_SST_OPT_ROLE" = 'joiner' ]; then if [ -n "$BACKUP_PID" ]; then if ps -p $BACKUP_PID >/dev/null 2>&1; then wsrep_log_error \ - "mariadb-backup process is still running. Killing..." - cleanup_pid $CHECK_PID + "SST streaming process is still running. Killing..." + cleanup_pid $BACKUP_PID fi fi wsrep_log_info "Removing the sst_in_progress file" wsrep_cleanup_progress_file - else - [ -f "$DATA/$IST_FILE" ] && rm -f "$DATA/$IST_FILE" || : fi if [ -n "$progress" -a -p "$progress" ]; then @@ -1346,6 +1347,7 @@ else # joiner [ -f "$DATA/xtrabackup_checkpoints" ] && rm -f "$DATA/xtrabackup_checkpoints" [ -f "$DATA/xtrabackup_info" ] && rm -f "$DATA/xtrabackup_info" [ -f "$DATA/xtrabackup_slave_info" ] && rm -f "$DATA/xtrabackup_slave_info" + [ -f "$DATA/xtrabackup_binlog_info" ] && rm -f "$DATA/xtrabackup_binlog_info" [ -f "$DATA/xtrabackup_binlog_pos_innodb" ] && rm -f "$DATA/xtrabackup_binlog_pos_innodb" TDATA="$DATA" From b52f88edf8b4660311c47fc0ffe05675ac06a5a9 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Thu, 12 Dec 2024 10:15:26 +0100 Subject: [PATCH 21/84] MDEV-35387: wsrep_sst_rsync crash if aria_log_dir_path is defined This commit fixes some functions in wsrep_sst_common to ensure that now and in the future return codes from a number of helper functions will be zero on success. --- scripts/wsrep_sst_common.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index 2921dde8503..ff4befa6680 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -1117,7 +1117,7 @@ get_openssl() { # If the OPENSSL_BINARY variable is already defined, just return: if [ -n "${OPENSSL_BINARY+x}" ]; then - return + return 0 fi # Let's look for openssl: OPENSSL_BINARY=$(commandex 'openssl') @@ -1863,6 +1863,8 @@ create_dirs() cd "$OLD_PWD" [ $simplify -ne 0 -a "$ar_log_dir" = "$DATA_DIR" ] && ar_log_dir="" fi + + return 0 } wait_previous_sst() From 3e34e4c161477bd56d0cf2fff377051253500880 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Thu, 12 Dec 2024 10:56:36 +0100 Subject: [PATCH 22/84] MDEV-34820: wsrep_sst_mariabackup get_footprint() portability and accuracy fix Added get_footprint() implementation for FreeBSD (and for other non-Linux systems), and added "apparent file size" mode for Linux to take into account the real file size (without compression) when used with filesystems like ZFS. --- scripts/wsrep_sst_mariabackup.sh | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index cfae27d388c..e50704b7cdc 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -439,17 +439,30 @@ get_transfer() get_footprint() { cd "$DATA_DIR" - local payload_data=$(find $findopt . \ - -regex '.*undo[0-9]+$\|.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' \ - -type f -print0 | du --files0-from=- --block-size=1 -c -s | \ - awk 'END { print $1 }') + local payload_data + if [ "$OS" = 'Linux' ]; then + payload_data=$(find $findopt . \ + -regex '.*undo[0-9]+$\|.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' \ + -type f -print0 | du --files0-from=- --bytes -c -s | \ + awk 'END { print $1 }') + else + payload_data=$(find $findopt . \ + -regex '.*undo[0-9]+$|.*\.ibd$|.*\.MYI$\.*\.MYD$|.*ibdata1$' \ + -type f -print0 | xargs -0 stat -f '%z' | \ + awk '{ sum += $1 } END { print sum }') + fi local payload_undo=0 if [ -n "$ib_undo_dir" -a "$ib_undo_dir" != '.' -a \ "$ib_undo_dir" != "$DATA_DIR" -a -d "$ib_undo_dir" ] then cd "$ib_undo_dir" - payload_undo=$(find . -regex '.*undo[0-9]+$' -type f -print0 | \ - du --files0-from=- --block-size=1 -c -s | awk 'END { print $1 }') + if [ "$OS" = 'Linux' ]; then + payload_undo=$(find . -regex '.*undo[0-9]+$' -type f -print0 | \ + du --files0-from=- --bytes -c -s | awk 'END { print $1 }') + else + payload_undo=$(find . -regex '.*undo[0-9]+$' -type f -print0 | \ + xargs -0 stat -f '%z' | awk '{ sum += $1 } END { print sum }') + fi fi cd "$OLD_PWD" From 432856c473feb92ddd69442a4c164ee88a0d28d7 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Mon, 9 Dec 2024 19:27:53 +1100 Subject: [PATCH 23/84] MDEV-35571 Check for LIMIT ROWS EXAMINED exceeded in UNION ALL When UNION ALL is used with LIMIT ROWS EXAMINED, and when the limit is exceeded for a SELECT that is not the last in the UNION, interrupt the execution and call end_eof on the result. This makes sure that the results are sent, and the query result status is conclusive rather than empty, which would cause an assertion failure. --- mysql-test/main/limit_rows_examined.result | 43 ++++++++++++++++++++++ mysql-test/main/limit_rows_examined.test | 41 +++++++++++++++++++++ sql/sql_union.cc | 3 +- 3 files changed, 86 insertions(+), 1 deletion(-) diff --git a/mysql-test/main/limit_rows_examined.result b/mysql-test/main/limit_rows_examined.result index 50b542fa5fe..7bea8862c18 100644 --- a/mysql-test/main/limit_rows_examined.result +++ b/mysql-test/main/limit_rows_examined.result @@ -895,3 +895,46 @@ Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t2`.`c2` AS `c2` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`c2` = `test`.`t1`.`c1` drop table t1,t2; # End of 10.4 tests +# +# MDEV-35571: Connection hangs after query on a partitioned table with UNION and LIMIT ROWS EXAMINED +# +create table t1 (a int); +insert into t1 values (1), (2); +select * from t1 UNION ALL select * from t1 LIMIT ROWS EXAMINED 1; +a +1 +Warnings: +Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 1. The query result may be incomplete +select * from t1 UNION DISTINCT select * from t1 LIMIT ROWS EXAMINED 1; +a +1 +Warnings: +Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 1. The query result may be incomplete +DROP TABLE t1; +create table t1 (a int); +insert into t1 values (1), (2); +(select a from t1 UNION ALL select a from t1) order by a desc LIMIT ROWS EXAMINED 2; +a +1 +Warnings: +Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 2. The query result may be incomplete +(select a from t1 UNION DISTINCT select a from t1) order by a desc LIMIT ROWS EXAMINED 2; +a +1 +Warnings: +Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 2. The query result may be incomplete +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT INTO t1 SELECT seq%25 FROM seq_1_to_100; +CREATE TABLE t2 (b INT, c INT, KEY(b)) PARTITION BY HASH(c) PARTITIONS 12; +INSERT INTO t2 SELECT seq, seq FROM seq_1_to_10; +SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) UNION ALL SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) LIMIT ROWS EXAMINED 100; +COUNT(*) +Warnings: +Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 100. The query result may be incomplete +SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) UNION DISTINCT SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) LIMIT ROWS EXAMINED 100; +COUNT(*) +Warnings: +Warning 1931 Query execution was interrupted. The query exceeded LIMIT ROWS EXAMINED 100. The query result may be incomplete +DROP TABLE t1, t2; +# End of 10.5 tests diff --git a/mysql-test/main/limit_rows_examined.test b/mysql-test/main/limit_rows_examined.test index 94bbf8e819a..12c75121dfb 100644 --- a/mysql-test/main/limit_rows_examined.test +++ b/mysql-test/main/limit_rows_examined.test @@ -617,3 +617,44 @@ select * from t1, t2 where c1 = c2 LIMIT ROWS EXAMINED 2; drop table t1,t2; --echo # End of 10.4 tests + +--echo # +--echo # MDEV-35571: Connection hangs after query on a partitioned table with UNION and LIMIT ROWS EXAMINED +--echo # + +--source include/have_partition.inc +--source include/have_sequence.inc + +# Simplified test +create table t1 (a int); +insert into t1 values (1), (2); +select * from t1 UNION ALL select * from t1 LIMIT ROWS EXAMINED 1; +# UNION DISTINCT produces the same result here. Note that this is not +# affected by the MDEV-35571 patch +select * from t1 UNION DISTINCT select * from t1 LIMIT ROWS EXAMINED 1; +DROP TABLE t1; + +# Simplified test with order by +create table t1 (a int); +insert into t1 values (1), (2); +(select a from t1 UNION ALL select a from t1) order by a desc LIMIT ROWS EXAMINED 2; +# UNION DISTINCT produces the same result with order by desc. Note +# that this is not affected by the MDEV-35571 patch +(select a from t1 UNION DISTINCT select a from t1) order by a desc LIMIT ROWS EXAMINED 2; +DROP TABLE t1; + +# Original test +CREATE TABLE t1 (a INT); +INSERT INTO t1 SELECT seq%25 FROM seq_1_to_100; + +CREATE TABLE t2 (b INT, c INT, KEY(b)) PARTITION BY HASH(c) PARTITIONS 12; +INSERT INTO t2 SELECT seq, seq FROM seq_1_to_10; + +SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) UNION ALL SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) LIMIT ROWS EXAMINED 100; +# UNION DISTINCT produces the same result here. Note that this is not +# affected by the MDEV-35571 patch +SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) UNION DISTINCT SELECT COUNT(*) FROM t1 JOIN t2 ON (b = a) LIMIT ROWS EXAMINED 100; + +DROP TABLE t1, t2; + +--echo # End of 10.5 tests diff --git a/sql/sql_union.cc b/sql/sql_union.cc index 8cbb35fc9a4..53e604bfa92 100644 --- a/sql/sql_union.cc +++ b/sql/sql_union.cc @@ -1026,7 +1026,8 @@ bool select_union_direct::send_eof() // Reset for each SELECT_LEX, so accumulate here limit_found_rows+= thd->limit_found_rows; - if (unit->thd->lex->current_select == last_select_lex) + if (unit->thd->lex->current_select == last_select_lex || + thd->killed == ABORT_QUERY) { thd->limit_found_rows= limit_found_rows; From 0b7fa4c267cb7eee4a84a696170266f10397f266 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 29 Nov 2024 21:03:16 +0400 Subject: [PATCH 24/84] MDEV-31219 Assertion `fixed' failed in Item_func_hybrid_field_type / Frame_positional_cursor add_special_frame_cursors() did not check the return value offset_func->fix_fields(). It can return an error if the data type does not support the operator "minus". --- mysql-test/main/gis.result | 8 ++++++++ mysql-test/main/gis.test | 10 ++++++++++ sql/sql_window.cc | 18 ++++++++++++------ 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/mysql-test/main/gis.result b/mysql-test/main/gis.result index c4918809e4d..196758b1e94 100644 --- a/mysql-test/main/gis.result +++ b/mysql-test/main/gis.result @@ -5466,4 +5466,12 @@ CREATE TABLE t (f POINT, KEY(f)); DELETE FROM t WHERE f NOT IN (NULL,'x'); ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field DROP TABLE t; +# +# MDEV-31219 Assertion `fixed' failed in Item_func_hybrid_field_type / Frame_positional_cursor +# +CREATE TABLE t (a INT, b POINT); +INSERT INTO t VALUES (1,POINT(0,0)),(2,POINT(0,0)); +SELECT NTH_VALUE(a,b) OVER () FROM t; +ERROR HY000: Illegal parameter data types point and bigint for operation '-' +DROP TABLE t; # End of 10.5 tests diff --git a/mysql-test/main/gis.test b/mysql-test/main/gis.test index 8e392e6b2f4..6dc932b4f8d 100644 --- a/mysql-test/main/gis.test +++ b/mysql-test/main/gis.test @@ -3472,4 +3472,14 @@ CREATE TABLE t (f POINT, KEY(f)); DELETE FROM t WHERE f NOT IN (NULL,'x'); DROP TABLE t; +--echo # +--echo # MDEV-31219 Assertion `fixed' failed in Item_func_hybrid_field_type / Frame_positional_cursor +--echo # + +CREATE TABLE t (a INT, b POINT); +INSERT INTO t VALUES (1,POINT(0,0)),(2,POINT(0,0)); +--error ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION +SELECT NTH_VALUE(a,b) OVER () FROM t; +DROP TABLE t; + --echo # End of 10.5 tests diff --git a/sql/sql_window.cc b/sql/sql_window.cc index fd8e188a76b..565a1b964b5 100644 --- a/sql/sql_window.cc +++ b/sql/sql_window.cc @@ -2528,7 +2528,7 @@ Frame_cursor *get_frame_cursor(THD *thd, Window_spec *spec, bool is_top_bound) } static -void add_special_frame_cursors(THD *thd, Cursor_manager *cursor_manager, +bool add_special_frame_cursors(THD *thd, Cursor_manager *cursor_manager, Item_window_func *window_func) { Window_spec *spec= window_func->window_spec; @@ -2615,7 +2615,9 @@ void add_special_frame_cursors(THD *thd, Cursor_manager *cursor_manager, Item *offset_func= new (thd->mem_root) Item_func_minus(thd, item_sum->get_arg(1), int_item); - offset_func->fix_fields(thd, &offset_func); + if (offset_func->fix_fields(thd, &offset_func)) + return true; + fc= new Frame_positional_cursor(*top_bound, *top_bound, *bottom_bound, *offset_func, false); @@ -2648,6 +2650,7 @@ void add_special_frame_cursors(THD *thd, Cursor_manager *cursor_manager, fc->add_sum_func(item_sum); cursor_manager->add_cursor(fc); } + return false; } @@ -2675,7 +2678,7 @@ static bool is_computed_with_remove(Item_sum::Sumfunctype sum_func) If the window functions share the same frame specification, those window functions will be registered to the same cursor. */ -void get_window_functions_required_cursors( +bool get_window_functions_required_cursors( THD *thd, List& window_functions, List *cursor_managers) @@ -2726,7 +2729,8 @@ void get_window_functions_required_cursors( if (item_win_func->is_frame_prohibited() || item_win_func->requires_special_cursors()) { - add_special_frame_cursors(thd, cursor_manager, item_win_func); + if (add_special_frame_cursors(thd, cursor_manager, item_win_func)) + return true; cursor_managers->push_back(cursor_manager); continue; } @@ -2760,6 +2764,7 @@ void get_window_functions_required_cursors( } cursor_managers->push_back(cursor_manager); } + return false; } /** @@ -3034,8 +3039,9 @@ bool Window_func_runner::exec(THD *thd, TABLE *tbl, SORT_INFO *filesort_result) it.rewind(); List cursor_managers; - get_window_functions_required_cursors(thd, window_functions, - &cursor_managers); + if (get_window_functions_required_cursors(thd, window_functions, + &cursor_managers)) + return true; /* Go through the sorted array and compute the window function */ bool is_error= compute_window_func(thd, From 54c1031b74e88300103aeeef2e8990204a8584f5 Mon Sep 17 00:00:00 2001 From: Dmitry Shulga Date: Fri, 13 Dec 2024 09:29:23 +0700 Subject: [PATCH 25/84] MDEV-34958: after Trigger doesn't work correctly with bulk insert This bug has the same nature as the issues MDEV-34718: Trigger doesn't work correctly with bulk update MDEV-24411: Trigger doesn't work correctly with bulk insert To fix the issue covering all use cases, resetting the thd->bulk_param temporary to the value nullptr before invoking triggers and restoring its original value on finishing execution of a trigger is moved to the method Table_triggers_list::process_triggers that be invoked ultimately for any kind of triggers. --- sql/sql_base.cc | 9 --- sql/sql_delete.cc | 7 --- sql/sql_insert.cc | 10 --- sql/sql_trigger.cc | 9 +++ sql/sql_update.cc | 5 -- tests/mysql_client_test.c | 124 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 133 insertions(+), 31 deletions(-) diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 0bfae16b23e..de744edfbae 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -8784,22 +8784,13 @@ fill_record_n_invoke_before_triggers(THD *thd, TABLE *table, if (!result && triggers) { - void *save_bulk_param= thd->bulk_param; - /* - Reset the sentinel thd->bulk_param in order not to consume the next - values of a bound array in case one of statement executed by - the trigger's body is INSERT statement. - */ - thd->bulk_param= nullptr; if (triggers->process_triggers(thd, event, TRG_ACTION_BEFORE, TRUE) || not_null_fields_have_null_values(table)) { - thd->bulk_param= save_bulk_param; return TRUE; } - thd->bulk_param= save_bulk_param; /* Re-calculate virtual fields to cater for cases when base columns are diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 7823350d7a3..25b3aef3ebe 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -812,17 +812,13 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, delete_history); if (delete_record) { - void *save_bulk_param= thd->bulk_param; - thd->bulk_param= nullptr; if (!delete_history && table->triggers && table->triggers->process_triggers(thd, TRG_EVENT_DELETE, TRG_ACTION_BEFORE, FALSE)) { error= 1; - thd->bulk_param= save_bulk_param; break; } - thd->bulk_param= save_bulk_param; // no LIMIT / OFFSET if (returning && result->send_data(returning->item_list) < 0) @@ -853,16 +849,13 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, if (likely(!error)) { deleted++; - thd->bulk_param= nullptr; if (!delete_history && table->triggers && table->triggers->process_triggers(thd, TRG_EVENT_DELETE, TRG_ACTION_AFTER, FALSE)) { error= 1; - thd->bulk_param= save_bulk_param; break; } - thd->bulk_param= save_bulk_param; if (!--limit && using_limit) { error= -1; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 2dccf7af587..18c364c7fea 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1069,21 +1069,12 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, } table->reset_default_fields(); - /* - Reset the sentinel thd->bulk_param in order not to consume the next - values of a bound array in case one of statement executed by - the trigger's body is INSERT statement. - */ - void *save_bulk_param= thd->bulk_param; - thd->bulk_param= nullptr; - if (unlikely(fill_record_n_invoke_before_triggers(thd, table, table-> field_to_fill(), *values, 0, TRG_EVENT_INSERT))) { - thd->bulk_param= save_bulk_param; if (values_list.elements != 1 && ! thd->is_error()) { info.records++; @@ -1092,7 +1083,6 @@ bool mysql_insert(THD *thd, TABLE_LIST *table_list, error=1; break; } - thd->bulk_param= save_bulk_param; } /* diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index c788d66744a..f35a07347fe 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -2288,6 +2288,14 @@ bool Table_triggers_list::process_triggers(THD *thd, */ save_current_select= thd->lex->current_select; + /* + Reset the sentinel thd->bulk_param in order not to consume the next + values of a bound array in case one of statement executed by + the trigger's body is a DML statement. + */ + void *save_bulk_param= thd->bulk_param; + thd->bulk_param= nullptr; + do { thd->lex->current_select= NULL; err_status= @@ -2297,6 +2305,7 @@ bool Table_triggers_list::process_triggers(THD *thd, &trigger->subject_table_grants); status_var_increment(thd->status_var.executed_triggers); } while (!err_status && (trigger= trigger->next)); + thd->bulk_param= save_bulk_param; thd->lex->current_select= save_current_select; thd->restore_sub_statement_state(&statement_state); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index 7bc7041e161..4a13d83d52f 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -1161,19 +1161,14 @@ error: rows_inserted++; } - void *save_bulk_param= thd->bulk_param; - thd->bulk_param= nullptr; - if (table->triggers && unlikely(table->triggers->process_triggers(thd, TRG_EVENT_UPDATE, TRG_ACTION_AFTER, TRUE))) { error= 1; - thd->bulk_param= save_bulk_param; break; } - thd->bulk_param= save_bulk_param; if (!--limit && using_limit) { diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 138eae10ab1..f06566cf208 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -22503,6 +22503,129 @@ static void test_mdev_34718_ad() rc= mysql_query(mysql, "DROP TABLE t1, t2"); myquery(rc); } + +/* Test case for bulk INSERT in presence of AFTER INSERT trigger */ +static void test_mdev_34958() +{ + int rc; + MYSQL_STMT *stmt_insert; + MYSQL_BIND bind[2]; + MYSQL_RES *result; + MYSQL_ROW row; + my_ulonglong row_count; + unsigned int vals[] = { 1, 2, 3}; + unsigned int vals_array_len = 3; + const char *insert_stmt= "INSERT INTO t1 VALUES (?)"; + + /* Set up test's environment */ + rc= mysql_query(mysql, "CREATE TABLE t1 (a INT)"); + myquery(rc); + + rc= mysql_query(mysql, "CREATE TABLE t2 (a INT)"); + myquery(rc); + + rc= mysql_query(mysql, "CREATE TRIGGER t1_ai AFTER INSERT ON t1 " + "FOR EACH ROW INSERT INTO t2 VALUES (NEW.a);"); + + stmt_insert = mysql_stmt_init(mysql); + if (!stmt_insert) + { + fprintf(stderr, "mysql_stmt_init failed: Error: %s\n", + mysql_error(mysql)); + exit(1); + } + + rc= mysql_stmt_prepare(stmt_insert, insert_stmt, strlen(insert_stmt)); + if (rc) + { + fprintf(stderr, "mysql_stmt_prepare failed: %s\n", + mysql_stmt_error(stmt_insert)); + exit(1); + } + + memset(&bind[0], 0, sizeof(MYSQL_BIND)); + + bind[0].buffer_type= MYSQL_TYPE_LONG; + bind[0].buffer= vals; + + rc= mysql_stmt_attr_set(stmt_insert, STMT_ATTR_ARRAY_SIZE, &vals_array_len); + if (rc) + { + fprintf(stderr, "mysql_stmt_prepare failed: %s\n", + mysql_stmt_error(stmt_insert)); + exit(1); + } + + rc= mysql_stmt_bind_param(stmt_insert, bind); + if (rc) + { + fprintf(stderr, "mysql_stmt_bind_param failed: %s\n", + mysql_stmt_error(stmt_insert)); + exit(1); + } + + rc= mysql_stmt_execute(stmt_insert); + if (rc) + { + fprintf(stderr, "mysql_stmt_execute failed: %s\n", + mysql_stmt_error(stmt_insert)); + exit(1); + } + + /* + It's expected that the INSERT statement adds three rows into + the table t1 + */ + row_count = mysql_stmt_affected_rows(stmt_insert); + if (row_count != 3) + { + fprintf(stderr, "Wrong number of affected rows (%llu), expected 3\n", + row_count); + exit(1); + } + + /* + * Check that the AFTER INSERT trigger of the table t1 does work correct + * and inserted the rows (1), (2), (3) into the table t2. + */ + rc= mysql_query(mysql, "SELECT 't1' tname, a FROM t1 " + "UNION SELECT 't2' tname, a FROM t2 ORDER BY tname, a"); + if (rc) + { + fprintf(stderr, "Query failed: %s\n", mysql_error(mysql)); + } + + result= mysql_store_result(mysql); + + row= mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t1") == 0 && atoi(row[1]) == 1); + + row= mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t1") == 0 && atoi(row[1]) == 2); + + row= mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t1") == 0 && atoi(row[1]) == 3); + + row= mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t2") == 0 && atoi(row[1]) == 1); + + row= mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t2") == 0 && atoi(row[1]) == 2); + + row= mysql_fetch_row(result); + DIE_UNLESS(strcmp(row[0], "t2") == 0 && atoi(row[1]) == 3); + + row= mysql_fetch_row(result); + DIE_UNLESS(row == NULL); + + mysql_free_result(result); + + mysql_stmt_close(stmt_insert); + + /* Clean up */ + rc= mysql_query(mysql, "DROP TABLE t1, t2"); + myquery(rc); +} #endif // EMBEDDED_LIBRARY /* @@ -22856,6 +22979,7 @@ static struct my_tests_st my_tests[]= { { "test_mdev_34718_au", test_mdev_34718_au }, { "test_mdev_34718_bd", test_mdev_34718_bd }, { "test_mdev_34718_ad", test_mdev_34718_ad }, + { "test_mdev_34958", test_mdev_34958 }, #endif { 0, 0 } }; From 1097164d3feaade13171cd8b70ce5310b7df6f22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 13 Dec 2024 11:41:47 +0200 Subject: [PATCH 26/84] MDEV-35619 Assertion failure in row_purge_del_mark_error trx_sys_t::find_same_or_older_in_purge(): Correct a mistake that was made in commit 19acb0257eec0956e3a0dd3b11bbb701fa7ea648 (MDEV-35508) and make the caching logic correspond to the one in trx_sys_t::find_same_or_older(). In the more common code path for 64-bit systems, the condition !hot was inadvertently inverted, making us wrongly skip calls to find_same_or_older_low() when the transaction may still be active. Furthermore, the call should have been to find_same_or_older_low() and not the wrapper find_same_or_older(). --- storage/innobase/include/trx0sys.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h index f411e8420a9..3ae2e0b5305 100644 --- a/storage/innobase/include/trx0sys.h +++ b/storage/innobase/include/trx0sys.h @@ -971,18 +971,23 @@ public: Our IA-32 target is not "i386" but at least "i686", that is, at least Pentium MMX, which has a 64-bit data bus and 64-bit XMM registers. */ + bool hot= false; trx->mutex_lock(); trx_id_t &max_inactive_id= trx->max_inactive_id; - const bool hot{max_inactive_id < id && find_same_or_older(trx, id)}; + if (max_inactive_id >= id); + else if (!find_same_or_older_low(trx, id)) + max_inactive_id= id; + else + hot= true; #else Atomic_relaxed &max_inactive_id= trx->max_inactive_id_atomic; if (max_inactive_id >= id) return false; trx->mutex_lock(); - const bool hot{find_same_or_older(trx, id)}; -#endif - if (hot) + const bool hot{find_same_or_older_low(trx, id)}; + if (!hot) max_inactive_id= id; +#endif trx->mutex_unlock(); return hot; } From d1f42fc80ff81e39fc2443c40776f57253c02dd4 Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Tue, 3 Dec 2024 14:03:17 +0400 Subject: [PATCH 27/84] MDEV-21589 AddressSanitizer: memcpy-param-overlap in Static_binary_string::q_append or String::append Item_func_concat_ws::val_str(): - collects the result into the string "str" passed as a parameter. - calls val_str(&tmp_buffer) to get arguments. At some point due to heuristic it decides to swap the buffers: - collect the result into &tmp_buffer - call val_str(str) to get arguments Item_func_password::val_str_ascii() returns a String pointing to its member tmp_value[SCRAMBLED_PASSWORD_CHAR_LENGTH+1]. As a result, it's possible that both str and tmp_buffer in Item_func_concat_ws::val_str() point to Item_func_password::tmp_value. Then, memcmp() called on overlapping memory fragrments. Fixing Item_func_password::val_str_ascii() to use Item::copy() instead of Item::set(). --- mysql-test/main/func_concat.result | 17 +++++++++++++++++ mysql-test/main/func_concat.test | 16 ++++++++++++++++ sql/item_strfunc.cc | 4 ++-- 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/mysql-test/main/func_concat.result b/mysql-test/main/func_concat.result index 4303c97d35c..4b91fb97c6c 100644 --- a/mysql-test/main/func_concat.result +++ b/mysql-test/main/func_concat.result @@ -287,3 +287,20 @@ SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT MAKE_SET(3,t,t) t2 FROM t1) sub; c2 abcdefghi,abcdefghi-abcdefghi,abcdefghi DROP TABLE t1; +# Start of 10.5 tests +# +# MDEV-13120 Wrong results with MAKE_SET() and subquery +# +CREATE TABLE t1 (a DATE, b DATETIME, c VARCHAR(8)); +INSERT INTO t1 VALUES +('1996-03-06','1985-11-16 08:00:46','foo'), +('2028-08-26','1900-01-01 00:00:00','bar'), +('1973-05-04','1900-01-01 00:00:00','qux'); +SELECT CONCAT_WS(' ', a, b, PASSWORD(c)) AS f FROM t1 GROUP BY f WITH ROLLUP; +f +1973-05-04 1900-01-01 00:00:00 *6D720C5AAB5096E70AA751206B45B484E5E0121F +1996-03-06 1985-11-16 08:00:46 *F3A2A51A9B0F2BE2468926B4132313728C250DBF +2028-08-26 1900-01-01 00:00:00 *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB +NULL +DROP TABLE t1; +# End of 10.5 tests diff --git a/mysql-test/main/func_concat.test b/mysql-test/main/func_concat.test index 44dea7e35b1..f93b150f88f 100644 --- a/mysql-test/main/func_concat.test +++ b/mysql-test/main/func_concat.test @@ -265,3 +265,19 @@ CREATE TABLE t1 (t VARCHAR(10) CHARSET latin1); INSERT INTO t1 VALUES('abcdefghi'); SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT MAKE_SET(3,t,t) t2 FROM t1) sub; DROP TABLE t1; + +--echo # Start of 10.5 tests + +--echo # +--echo # MDEV-13120 Wrong results with MAKE_SET() and subquery +--echo # + +CREATE TABLE t1 (a DATE, b DATETIME, c VARCHAR(8)); +INSERT INTO t1 VALUES +('1996-03-06','1985-11-16 08:00:46','foo'), +('2028-08-26','1900-01-01 00:00:00','bar'), +('1973-05-04','1900-01-01 00:00:00','qux'); +SELECT CONCAT_WS(' ', a, b, PASSWORD(c)) AS f FROM t1 GROUP BY f WITH ROLLUP; +DROP TABLE t1; + +--echo # End of 10.5 tests diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 7e4ba259261..0e9c01c7a7e 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -2241,7 +2241,7 @@ String *Item_func_password::val_str_ascii(String *str) if (args[0]->null_value || res->length() == 0) return make_empty_result(str); my_make_scrambled_password(tmp_value, res->ptr(), res->length()); - str->set(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH, &my_charset_latin1); + str->copy(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH, &my_charset_latin1); break; case OLD: if ((null_value=args[0]->null_value)) @@ -2249,7 +2249,7 @@ String *Item_func_password::val_str_ascii(String *str) if (res->length() == 0) return make_empty_result(str); my_make_scrambled_password_323(tmp_value, res->ptr(), res->length()); - str->set(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH_323, &my_charset_latin1); + str->copy(tmp_value, SCRAMBLED_PASSWORD_CHAR_LENGTH_323, &my_charset_latin1); break; default: DBUG_ASSERT(0); From c7698a0b709fe1ee15002333675383a2fd49ab29 Mon Sep 17 00:00:00 2001 From: mariadb-DebarunBanerjee Date: Wed, 11 Dec 2024 18:36:15 +0530 Subject: [PATCH 28/84] MDEV-35626 Race condition between buf_page_create_low() and read completion This regression is introduced in 10.6 by following commit. commit 35d477dd1dff464bd80dff9efe83884ce1c38e4c MDEV-34453 Trying to read 16384 bytes at 70368744161280 The page state could change after being buffer-fixed and needs to be read again after locking the page. --- storage/innobase/buf/buf0buf.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 69e3032a2db..c6adcb675f7 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -3322,6 +3322,8 @@ retry: ut_ad(!bpage->is_io_fixed(state)); ut_ad(bpage->buf_fix_count(state)); } + else + state= bpage->state(); ut_ad(state >= buf_page_t::FREED); ut_ad(state < buf_page_t::READ_FIX); From 271b73770cd5bd13bb52bfa4dd91c8d275920467 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Fri, 13 Dec 2024 16:27:14 +0100 Subject: [PATCH 29/84] MDEV-30263 Assertion failure in Protocol::end_statement upon HANDLER READ with invalid timestamp Process save_in_field() return codes as in other places (<0 is real error) --- mysql-test/suite/handler/handler_warnings.result | 14 ++++++++++++++ mysql-test/suite/handler/handler_warnings.test | 15 +++++++++++++++ sql/sql_handler.cc | 2 +- 3 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/handler/handler_warnings.result create mode 100644 mysql-test/suite/handler/handler_warnings.test diff --git a/mysql-test/suite/handler/handler_warnings.result b/mysql-test/suite/handler/handler_warnings.result new file mode 100644 index 00000000000..f64f7cad76f --- /dev/null +++ b/mysql-test/suite/handler/handler_warnings.result @@ -0,0 +1,14 @@ +# +# MDEV-30263: --echo # Assertion failure in Protocol::end_statement +# upon HANDLER READ with invalid timestamp +# +CREATE TABLE t (a TIMESTAMP, KEY(a)); +HANDLER t OPEN; +HANDLER t READ a > ('2022-12'); +a +# above should issue the same warnings/errors as following +SELECT * from t WHERE t.a > ('2022-12'); +a +HANDLER t CLOSE; +DROP TABLE t; +End of 10.5 tests diff --git a/mysql-test/suite/handler/handler_warnings.test b/mysql-test/suite/handler/handler_warnings.test new file mode 100644 index 00000000000..b632381c1c0 --- /dev/null +++ b/mysql-test/suite/handler/handler_warnings.test @@ -0,0 +1,15 @@ +--echo # +--echo # MDEV-30263: --echo # Assertion failure in Protocol::end_statement +--echo # upon HANDLER READ with invalid timestamp +--echo # + +CREATE TABLE t (a TIMESTAMP, KEY(a)); +HANDLER t OPEN; +HANDLER t READ a > ('2022-12'); +--echo # above should issue the same warnings/errors as following +SELECT * from t WHERE t.a > ('2022-12'); +# Cleanup +HANDLER t CLOSE; +DROP TABLE t; + +--echo End of 10.5 tests diff --git a/sql/sql_handler.cc b/sql/sql_handler.cc index b1899e9969e..5938537b460 100644 --- a/sql/sql_handler.cc +++ b/sql/sql_handler.cc @@ -700,7 +700,7 @@ mysql_ha_fix_cond_and_key(SQL_HANDLER *handler, MY_BITMAP *old_map= dbug_tmp_use_all_columns(table, &table->write_set); int res= item->save_in_field(key_part->field, 1); dbug_tmp_restore_column_map(&table->write_set, old_map); - if (res) + if (res < 0 || thd->is_error()) return 1; } key_len+= key_part->store_length; From e6403733897483bed249875f0f3e5e9937ca2b38 Mon Sep 17 00:00:00 2001 From: Oleg Smirnov Date: Fri, 25 Oct 2024 14:35:22 +0700 Subject: [PATCH 30/84] Revert "MDEV-26427 MariaDB Server SEGV on INSERT .. SELECT" This reverts commit 49e14000eeb245ea27e9207d2f63cb0a28be1ca9 as it introduces regression MDEV-29935 and has to be reconsidered in general --- mysql-test/main/insert_select.result | 70 ----------- mysql-test/main/insert_select.test | 54 -------- mysql-test/main/view.result | 10 -- mysql-test/main/view.test | 2 - sql/sql_base.cc | 178 ++++++++------------------- sql/sql_insert.cc | 4 +- sql/sql_select.cc | 4 + sql/sql_select.h | 1 + 8 files changed, 59 insertions(+), 264 deletions(-) diff --git a/mysql-test/main/insert_select.result b/mysql-test/main/insert_select.result index 463f571b096..1f8c1f69b4b 100644 --- a/mysql-test/main/insert_select.result +++ b/mysql-test/main/insert_select.result @@ -883,76 +883,6 @@ INSERT INTO t1 SELECT a*2 FROM t1 ORDER BY a; Warnings: Warning 1264 Out of range value for column 'a' at row 4 DROP TABLE t1; -CREATE TABLE t1 (a INT, b INT); -INSERT INTO t1 (a) SELECT SUM(1); -INSERT INTO t1 (a, b) SELECT AVG(2), MIN(3); -INSERT INTO t1 (b) SELECT AVG('x') OVER (); -ERROR 22007: Truncated incorrect DOUBLE value: 'x' -INSERT INTO t1 SELECT MIN(7) OVER (), MAX(8) OVER(); -SELECT * FROM t1; -a b -1 NULL -2 3 -7 8 -PREPARE stmt FROM 'INSERT INTO t1 (a) SELECT AVG(?)'; -EXECUTE stmt USING 9; -EXECUTE stmt USING 10; -PREPARE stmt FROM 'INSERT INTO t1 SELECT MIN(?), MAX(?)'; -EXECUTE stmt USING 11, 12; -EXECUTE stmt USING 13, 14; -DEALLOCATE PREPARE stmt; -SELECT * FROM t1; -a b -1 NULL -2 3 -7 8 -9 NULL -10 NULL -11 12 -13 14 -CREATE PROCEDURE p1(param_a INT, param_b INT) -BEGIN -INSERT INTO t1 SELECT MIN(param_a) OVER (), MAX(param_b); -END// -CALL p1(21, 22); -CALL p1(23, 24); -SELECT * FROM t1; -a b -1 NULL -2 3 -7 8 -9 NULL -10 NULL -11 12 -13 14 -21 22 -23 24 -CREATE TABLE t2 ( -a DECIMAL UNIQUE CHECK (CASE 0 * 27302337.000000 WHEN 34 THEN -+ 'x' LIKE 'x' OR a NOT IN (-1 / TRUE ^ 2) ELSE 7105743.000000 END)); -INSERT INTO t2 VALUES (90),( -1),(31152443.000000),(-32768),(NULL),(NULL); -INSERT INTO t2 SELECT AVG('x') OVER ( -PARTITION BY ((NOT AVG(76698761.000000))) IS NOT NULL); -ERROR 22007: Truncated incorrect DOUBLE value: 'x' -INSERT IGNORE INTO t2 () VALUES (0),('x'),(3751286.000000), -('x'),((a = 'x' AND 0 AND 0)); -Warnings: -Warning 1366 Incorrect decimal value: 'x' for column `test`.`t2`.`a` at row 2 -Warning 1062 Duplicate entry '0' for key 'a' -Warning 1366 Incorrect decimal value: 'x' for column `test`.`t2`.`a` at row 4 -Warning 1062 Duplicate entry '0' for key 'a' -Warning 1062 Duplicate entry '0' for key 'a' -INSERT INTO t2 VALUES (127); -INSERT INTO t2 SELECT -2147483648 END FROM t2 AS TEXT JOIN t2 JOIN t2 TABLES; -ERROR 23000: Duplicate entry '-2147483648' for key 'a' -ALTER TABLE t2 ADD ( -b INT UNIQUE CHECK ((a = 'x' AND ((-(+(BINARY 49730460.000000)))) = 'x' -BETWEEN 'x' AND 'x'))); -ERROR 22007: Truncated incorrect DECIMAL value: 'x' -UPDATE t2 SET a = -128 WHERE a IS NULL ORDER BY 78 IN ('x','x'),a; -ERROR 23000: Duplicate entry '-128' for key 'a' -DROP TABLE t1, t2; -DROP PROCEDURE p1; # End of 10.2 test # # MDEV-28617: INSERT ... SELECT with redundant IN subquery in GROUP BY diff --git a/mysql-test/main/insert_select.test b/mysql-test/main/insert_select.test index a3604e38f34..7417bab9a61 100644 --- a/mysql-test/main/insert_select.test +++ b/mysql-test/main/insert_select.test @@ -459,60 +459,6 @@ INSERT INTO t1 SELECT a*2 FROM t1 ORDER BY a; DROP TABLE t1; -# -# MDEV-26427 MariaDB Server SEGV on INSERT .. SELECT -# -CREATE TABLE t1 (a INT, b INT); -INSERT INTO t1 (a) SELECT SUM(1); -INSERT INTO t1 (a, b) SELECT AVG(2), MIN(3); - ---error ER_TRUNCATED_WRONG_VALUE -INSERT INTO t1 (b) SELECT AVG('x') OVER (); -INSERT INTO t1 SELECT MIN(7) OVER (), MAX(8) OVER(); -SELECT * FROM t1; - -PREPARE stmt FROM 'INSERT INTO t1 (a) SELECT AVG(?)'; -EXECUTE stmt USING 9; -EXECUTE stmt USING 10; - -PREPARE stmt FROM 'INSERT INTO t1 SELECT MIN(?), MAX(?)'; -EXECUTE stmt USING 11, 12; -EXECUTE stmt USING 13, 14; -DEALLOCATE PREPARE stmt; -SELECT * FROM t1; - -DELIMITER //; -CREATE PROCEDURE p1(param_a INT, param_b INT) -BEGIN -INSERT INTO t1 SELECT MIN(param_a) OVER (), MAX(param_b); -END// -DELIMITER ;// -CALL p1(21, 22); -CALL p1(23, 24); -SELECT * FROM t1; - -CREATE TABLE t2 ( - a DECIMAL UNIQUE CHECK (CASE 0 * 27302337.000000 WHEN 34 THEN - + 'x' LIKE 'x' OR a NOT IN (-1 / TRUE ^ 2) ELSE 7105743.000000 END)); -INSERT INTO t2 VALUES (90),( -1),(31152443.000000),(-32768),(NULL),(NULL); ---error ER_TRUNCATED_WRONG_VALUE -INSERT INTO t2 SELECT AVG('x') OVER ( - PARTITION BY ((NOT AVG(76698761.000000))) IS NOT NULL); -INSERT IGNORE INTO t2 () VALUES (0),('x'),(3751286.000000), - ('x'),((a = 'x' AND 0 AND 0)); -INSERT INTO t2 VALUES (127); ---error ER_DUP_ENTRY -INSERT INTO t2 SELECT -2147483648 END FROM t2 AS TEXT JOIN t2 JOIN t2 TABLES; ---error ER_TRUNCATED_WRONG_VALUE -ALTER TABLE t2 ADD ( - b INT UNIQUE CHECK ((a = 'x' AND ((-(+(BINARY 49730460.000000)))) = 'x' - BETWEEN 'x' AND 'x'))); ---error ER_DUP_ENTRY -UPDATE t2 SET a = -128 WHERE a IS NULL ORDER BY 78 IN ('x','x'),a; - -DROP TABLE t1, t2; -DROP PROCEDURE p1; - --echo # End of 10.2 test --echo # diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result index 74f64388b4a..3d3efd041c3 100644 --- a/mysql-test/main/view.result +++ b/mysql-test/main/view.result @@ -1503,8 +1503,6 @@ execute stmt1 using @a; set @a= 301; execute stmt1 using @a; deallocate prepare stmt1; -insert into v3(a) select sum(302); -insert into v3(a) select sum(303) over (); select * from v3; a b 100 0 @@ -1523,14 +1521,6 @@ a b 301 10 301 1000 301 2000 -302 0 -302 10 -302 1000 -302 2000 -303 0 -303 10 -303 1000 -303 2000 drop view v3; drop tables t1,t2; create table t1(f1 int); diff --git a/mysql-test/main/view.test b/mysql-test/main/view.test index 229fedddb5c..20aaba8e52a 100644 --- a/mysql-test/main/view.test +++ b/mysql-test/main/view.test @@ -1334,8 +1334,6 @@ execute stmt1 using @a; set @a= 301; execute stmt1 using @a; deallocate prepare stmt1; -insert into v3(a) select sum(302); -insert into v3(a) select sum(303) over (); --sorted_result select * from v3; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index de744edfbae..4f151d397d4 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -7708,39 +7708,6 @@ bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array, DBUG_RETURN(MY_TEST(thd->is_error())); } -/* - make list of leaves for a single TABLE_LIST - - SYNOPSIS - make_leaves_for_single_table() - thd Thread handler - leaves List of leaf tables to be filled - table TABLE_LIST object to process - full_table_list Whether to include tables from mergeable derived table/view -*/ -void make_leaves_for_single_table(THD *thd, List &leaves, - TABLE_LIST *table, bool& full_table_list, - TABLE_LIST *boundary) -{ - if (table == boundary) - full_table_list= !full_table_list; - if (full_table_list && table->is_merged_derived()) - { - SELECT_LEX *select_lex= table->get_single_select(); - /* - It's safe to use select_lex->leaf_tables because all derived - tables/views were already prepared and has their leaf_tables - set properly. - */ - make_leaves_list(thd, leaves, select_lex->get_table_list(), - full_table_list, boundary); - } - else - { - leaves.push_back(table, thd->mem_root); - } -} - /* Perform checks like all given fields exists, if exists fill struct with @@ -7767,79 +7734,40 @@ int setup_returning_fields(THD* thd, TABLE_LIST* table_list) SYNOPSIS make_leaves_list() - leaves List of leaf tables to be filled - tables Table list - full_table_list Whether to include tables from mergeable derived table/view. - We need them for checks for INSERT/UPDATE statements only. + list pointer to pointer on list first element + tables table list + full_table_list whether to include tables from mergeable derived table/view. + we need them for checks for INSERT/UPDATE statements only. + + RETURN pointer on pointer to next_leaf of last element */ -void make_leaves_list(THD *thd, List &leaves, TABLE_LIST *tables, +void make_leaves_list(THD *thd, List &list, TABLE_LIST *tables, bool full_table_list, TABLE_LIST *boundary) { for (TABLE_LIST *table= tables; table; table= table->next_local) { - make_leaves_for_single_table(thd, leaves, table, full_table_list, - boundary); + if (table == boundary) + full_table_list= !full_table_list; + if (full_table_list && table->is_merged_derived()) + { + SELECT_LEX *select_lex= table->get_single_select(); + /* + It's safe to use select_lex->leaf_tables because all derived + tables/views were already prepared and has their leaf_tables + set properly. + */ + make_leaves_list(thd, list, select_lex->get_table_list(), + full_table_list, boundary); + } + else + { + list.push_back(table, thd->mem_root); + } } } - -/* - Setup the map and other attributes for a single TABLE_LIST object - - SYNOPSIS - setup_table_attributes() - thd Thread handler - table_list TABLE_LIST object to process - first_select_table First table participating in SELECT for INSERT..SELECT - statements, NULL for other cases - tablenr Serial number of the table in the SQL statement - - RETURN - false Success - true Failure -*/ -bool setup_table_attributes(THD *thd, TABLE_LIST *table_list, - TABLE_LIST *first_select_table, - uint &tablenr) -{ - TABLE *table= table_list->table; - if (table) - table->pos_in_table_list= table_list; - if (first_select_table && table_list->top_table() == first_select_table) - { - /* new counting for SELECT of INSERT ... SELECT command */ - first_select_table= 0; - thd->lex->first_select_lex()->insert_tables= tablenr; - tablenr= 0; - } - if (table_list->jtbm_subselect) - { - table_list->jtbm_table_no= tablenr; - } - else if (table) - { - table->pos_in_table_list= table_list; - setup_table_map(table, table_list, tablenr); - - if (table_list->process_index_hints(table)) - return true; - } - tablenr++; - /* - We test the max tables here as we setup_table_map() should not be called - with tablenr >= 64 - */ - if (tablenr > MAX_TABLES) - { - my_error(ER_TOO_MANY_TABLES, MYF(0), static_cast(MAX_TABLES)); - return true; - } - return false; -} - - /* prepare tables @@ -7896,14 +7824,7 @@ bool setup_tables(THD *thd, Name_resolution_context *context, leaves.empty(); if (select_lex->prep_leaf_list_state != SELECT_LEX::SAVED) { - /* - For INSERT ... SELECT statements we must not include the first table - (where the data is being inserted into) in the list of leaves - */ - TABLE_LIST *tables_for_leaves= - select_insert ? first_select_table : tables; - make_leaves_list(thd, leaves, tables_for_leaves, full_table_list, - first_select_table); + make_leaves_list(thd, leaves, tables, full_table_list, first_select_table); select_lex->prep_leaf_list_state= SELECT_LEX::READY; select_lex->leaf_tables_exec.empty(); } @@ -7914,34 +7835,37 @@ bool setup_tables(THD *thd, Name_resolution_context *context, leaves.push_back(table_list, thd->mem_root); } - List_iterator ti(leaves); while ((table_list= ti++)) { - if (setup_table_attributes(thd, table_list, first_select_table, tablenr)) - DBUG_RETURN(1); - } - - if (select_insert) - { - /* - The table/view in which the data is inserted must not be included into - the leaf_tables list. But we need this table/view to setup attributes - for it. So build a temporary list of leaves and setup attributes for - the tables included - */ - List leaves; - TABLE_LIST *table= tables; - - make_leaves_for_single_table(thd, leaves, table, full_table_list, - first_select_table); - - List_iterator ti(leaves); - while ((table_list= ti++)) + TABLE *table= table_list->table; + if (table) + table->pos_in_table_list= table_list; + if (first_select_table && + table_list->top_table() == first_select_table) { - if (setup_table_attributes(thd, table_list, first_select_table, - tablenr)) + /* new counting for SELECT of INSERT ... SELECT command */ + first_select_table= 0; + thd->lex->select_lex.insert_tables= tablenr; + tablenr= 0; + } + if(table_list->jtbm_subselect) + { + table_list->jtbm_table_no= tablenr; + } + else if (table) + { + table->pos_in_table_list= table_list; + setup_table_map(table, table_list, tablenr); + + if (table_list->process_index_hints(table)) DBUG_RETURN(1); } + tablenr++; + } + if (tablenr > MAX_TABLES) + { + my_error(ER_TOO_MANY_TABLES,MYF(0), static_cast(MAX_TABLES)); + DBUG_RETURN(1); } } else diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 18c364c7fea..0a08866c5fa 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1570,7 +1570,8 @@ static bool mysql_prepare_insert_check_table(THD *thd, TABLE_LIST *table_list, if (insert_into_view && !fields.elements) { thd->lex->empty_field_list_on_rset= 1; - if (!table_list->table || table_list->is_multitable()) + if (!thd->lex->select_lex.leaf_tables.head()->table || + table_list->is_multitable()) { my_error(ER_VIEW_NO_INSERT_FIELD_LIST, MYF(0), table_list->view_db.str, table_list->view_name.str); @@ -3855,6 +3856,7 @@ int mysql_insert_select_prepare(THD *thd, select_result *sel_res) if (sel_res) sel_res->prepare(lex->returning()->item_list, NULL); + DBUG_ASSERT(select_lex->leaf_tables.elements != 0); List_iterator ti(select_lex->leaf_tables); TABLE_LIST *table; uint insert_tables; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index d75a3bbcd4c..f0da265f86b 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1957,6 +1957,7 @@ JOIN::optimize_inner() /* Merge all mergeable derived tables/views in this SELECT. */ if (select_lex->handle_derived(thd->lex, DT_MERGE)) DBUG_RETURN(TRUE); + table_count= select_lex->leaf_tables.elements; } if (select_lex->first_cond_optimization && @@ -1999,6 +2000,8 @@ JOIN::optimize_inner() eval_select_list_used_tables(); + table_count= select_lex->leaf_tables.elements; + if (select_lex->options & OPTION_SCHEMA_TABLE && optimize_schema_tables_memory_usage(select_lex->leaf_tables)) DBUG_RETURN(1); @@ -14320,6 +14323,7 @@ void JOIN::cleanup(bool full) /* Free the original optimized join created for the group_by_handler */ join_tab= original_join_tab; original_join_tab= 0; + table_count= original_table_count; } if (join_tab) diff --git a/sql/sql_select.h b/sql/sql_select.h index ca34e4a0261..314cac452f2 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -1306,6 +1306,7 @@ public: Pushdown_query *pushdown_query; JOIN_TAB *original_join_tab; + uint original_table_count; /******* Join optimization state members start *******/ /* From d98ac8511e39770ef3d8b42937c84e876d1459e7 Mon Sep 17 00:00:00 2001 From: Oleg Smirnov Date: Sat, 26 Oct 2024 20:29:56 +0700 Subject: [PATCH 31/84] MDEV-26247 MariaDB Server SEGV on INSERT .. SELECT This problem occured for statements like `INSERT INTO t1 SELECT 1`, which do not have tables in the SELECT part. In such scenarios SELECT_LEX::insert_tables was not properly set at `setup_tables()`, and this led to either incorrect execution or a crash Reviewer: Oleksandr Byelkin --- mysql-test/main/insert_select.result | 49 ++++++++++++++++++++++++++++ mysql-test/main/insert_select.test | 35 ++++++++++++++++++++ sql/sql_base.cc | 18 +++++++--- sql/sql_insert.cc | 2 +- 4 files changed, 99 insertions(+), 5 deletions(-) diff --git a/mysql-test/main/insert_select.result b/mysql-test/main/insert_select.result index 1f8c1f69b4b..35c7880fa5f 100644 --- a/mysql-test/main/insert_select.result +++ b/mysql-test/main/insert_select.result @@ -984,3 +984,52 @@ drop table t1, t2; # # End of 10.3 test # +# +# MDEV-26427 MariaDB Server SEGV on INSERT .. SELECT +# +CREATE TABLE t1 (a int); +INSERT INTO t1 SELECT AVG(1); +SELECT * FROM t1; +a +1 +INSERT INTO t1 SELECT MIN(2) OVER (); +SELECT * FROM t1; +a +1 +2 +CREATE VIEW v1 AS SELECT * FROM t1 ORDER BY a; +INSERT INTO v1 SELECT SUM(3); +SELECT * FROM v1; +a +1 +2 +3 +INSERT INTO v1 SELECT * FROM v1; +SELECT * FROM t1; +a +1 +1 +2 +2 +3 +3 +INSERT INTO t1 SELECT * FROM v1; +SELECT * FROM t1; +a +1 +1 +1 +1 +2 +2 +2 +2 +3 +3 +3 +3 +DROP VIEW v1; +DROP TABLE t1; +# +# End of 10.5 test +# diff --git a/mysql-test/main/insert_select.test b/mysql-test/main/insert_select.test index 7417bab9a61..0e9bd05a93e 100644 --- a/mysql-test/main/insert_select.test +++ b/mysql-test/main/insert_select.test @@ -559,3 +559,38 @@ drop table t1, t2; --echo # --echo # End of 10.3 test --echo # + +--echo # +--echo # MDEV-26427 MariaDB Server SEGV on INSERT .. SELECT +--echo # + +CREATE TABLE t1 (a int); + +INSERT INTO t1 SELECT AVG(1); +--sorted_result +SELECT * FROM t1; + +INSERT INTO t1 SELECT MIN(2) OVER (); +--sorted_result +SELECT * FROM t1; + +CREATE VIEW v1 AS SELECT * FROM t1 ORDER BY a; + +INSERT INTO v1 SELECT SUM(3); +--sorted_result +SELECT * FROM v1; + +INSERT INTO v1 SELECT * FROM v1; +--sorted_result +SELECT * FROM t1; + +INSERT INTO t1 SELECT * FROM v1; +--sorted_result +SELECT * FROM t1; + +DROP VIEW v1; +DROP TABLE t1; + +--echo # +--echo # End of 10.5 test +--echo # diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 4f151d397d4..bcab54ac1ec 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -7834,18 +7834,19 @@ bool setup_tables(THD *thd, Name_resolution_context *context, while ((table_list= ti++)) leaves.push_back(table_list, thd->mem_root); } - + + bool is_insert_tables_num_set= false; while ((table_list= ti++)) { TABLE *table= table_list->table; if (table) table->pos_in_table_list= table_list; - if (first_select_table && + if (select_insert && !is_insert_tables_num_set && table_list->top_table() == first_select_table) { /* new counting for SELECT of INSERT ... SELECT command */ - first_select_table= 0; - thd->lex->select_lex.insert_tables= tablenr; + thd->lex->first_select_lex()->insert_tables= tablenr; + is_insert_tables_num_set= true; tablenr= 0; } if(table_list->jtbm_subselect) @@ -7867,6 +7868,15 @@ bool setup_tables(THD *thd, Name_resolution_context *context, my_error(ER_TOO_MANY_TABLES,MYF(0), static_cast(MAX_TABLES)); DBUG_RETURN(1); } + if (select_insert && !is_insert_tables_num_set) + { + /* + This happens for statements like `INSERT INTO t1 SELECT 1`, + when there are no tables in the SELECT part. + In this case all leaf tables belong to the INSERT part + */ + thd->lex->first_select_lex()->insert_tables= tablenr; + } } else { diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 0a08866c5fa..e1d87e29869 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1570,7 +1570,7 @@ static bool mysql_prepare_insert_check_table(THD *thd, TABLE_LIST *table_list, if (insert_into_view && !fields.elements) { thd->lex->empty_field_list_on_rset= 1; - if (!thd->lex->select_lex.leaf_tables.head()->table || + if (!thd->lex->first_select_lex()->leaf_tables.head()->table || table_list->is_multitable()) { my_error(ER_VIEW_NO_INSERT_FIELD_LIST, MYF(0), From 17cb65593ae4b5c606aee8525c5ff46ffabff630 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 20 Apr 2024 00:17:30 +0200 Subject: [PATCH 32/84] MDEV-22964: archive.archive and main.mysqlbinlog_{row,stmt}_compressed) zlib-ng results in different compression length. The compression length isn't that important as the test output examines the uncompressed results. fixes for zlib-ng backport of 75488a57f23b99f5d531366c4717e2ce63cebd7e --- .../main/mysqlbinlog_row_compressed.result | 192 +++++++++--------- .../main/mysqlbinlog_row_compressed.test | 3 +- .../main/mysqlbinlog_stmt_compressed.result | 128 ++++++------ .../main/mysqlbinlog_stmt_compressed.test | 3 +- mysql-test/suite/archive/archive.test | 2 +- 5 files changed, 163 insertions(+), 165 deletions(-) diff --git a/mysql-test/main/mysqlbinlog_row_compressed.result b/mysql-test/main/mysqlbinlog_row_compressed.result index 39be61ba916..193036de2b4 100644 --- a/mysql-test/main/mysqlbinlog_row_compressed.result +++ b/mysql-test/main/mysqlbinlog_row_compressed.result @@ -15,21 +15,21 @@ FLUSH BINARY LOGS; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; -# at 4 -# server id 1 end_log_pos 256 CRC32 XXX Start: xxx +# at +# server id 1 end_log_pos CRC32 XXX Start: xxx ROLLBACK/*!*/; -# at 256 -# server id 1 end_log_pos 285 CRC32 XXX Gtid list [] -# at 285 -# server id 1 end_log_pos 329 CRC32 XXX Binlog checkpoint master-bin.000001 -# at 329 -# server id 1 end_log_pos 371 CRC32 XXX GTID 0-1-1 ddl +# at +# server id 1 end_log_pos CRC32 XXX Gtid list [] +# at +# server id 1 end_log_pos CRC32 XXX Binlog checkpoint master-bin.000001 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-1 ddl /*M!100101 SET @@session.skip_parallel_replication=0*//*!*/; /*M!100001 SET @@session.gtid_domain_id=0*//*!*/; /*M!100001 SET @@session.server_id=1*//*!*/; /*M!100001 SET @@session.gtid_seq_no=1*//*!*/; -# at 371 -# server id 1 end_log_pos 533 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 use `test`/*!*/; SET TIMESTAMP=X/*!*/; SET @@session.pseudo_thread_id=5/*!*/; @@ -42,26 +42,26 @@ SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1)) /*!*/; -# at 533 -# server id 1 end_log_pos 575 CRC32 XXX GTID 0-1-2 ddl +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-2 ddl /*M!100001 SET @@session.gtid_seq_no=2*//*!*/; -# at 575 -# server id 1 end_log_pos 727 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1)) /*!*/; -# at 727 -# server id 1 end_log_pos 769 CRC32 XXX GTID 0-1-3 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-3 /*M!100001 SET @@session.gtid_seq_no=3*//*!*/; START TRANSACTION /*!*/; -# at 769 -# at 843 -# server id 1 end_log_pos 843 CRC32 XXX Annotate_rows: +# at +# at +# server id 1 end_log_pos CRC32 XXX Annotate_rows: #Q> INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "") -# server id 1 end_log_pos 899 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 899 -# server id 1 end_log_pos 967 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F +# server id 1 end_log_pos CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at +# server id 1 end_log_pos CRC32 XXX Write_compressed_rows: table id flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -74,23 +74,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 1 -# at 967 -# server id 1 end_log_pos 1040 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1040 -# server id 1 end_log_pos 1082 CRC32 XXX GTID 0-1-4 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-4 /*M!100001 SET @@session.gtid_seq_no=4*//*!*/; START TRANSACTION /*!*/; -# at 1082 -# at 1158 -# server id 1 end_log_pos 1158 CRC32 XXX Annotate_rows: +# at +# at +# server id 1 end_log_pos CRC32 XXX Annotate_rows: #Q> INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL) -# server id 1 end_log_pos 1214 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 1214 -# server id 1 end_log_pos 1281 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F +# server id 1 end_log_pos CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at +# server id 1 end_log_pos CRC32 XXX Write_compressed_rows: table id flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=11 /* INT meta=0 nullable=0 is_null=0 */ @@ -103,23 +103,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9=NULL /* STRING(1) meta=65025 nullable=1 is_null=1 */ # Number of rows: 1 -# at 1281 -# server id 1 end_log_pos 1354 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1354 -# server id 1 end_log_pos 1396 CRC32 XXX GTID 0-1-5 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-5 /*M!100001 SET @@session.gtid_seq_no=5*//*!*/; START TRANSACTION /*!*/; -# at 1396 -# at 1474 -# server id 1 end_log_pos 1474 CRC32 XXX Annotate_rows: +# at +# at +# server id 1 end_log_pos CRC32 XXX Annotate_rows: #Q> INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A") -# server id 1 end_log_pos 1530 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 1530 -# server id 1 end_log_pos 1596 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F +# server id 1 end_log_pos CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at +# server id 1 end_log_pos CRC32 XXX Write_compressed_rows: table id flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=12 /* INT meta=0 nullable=0 is_null=0 */ @@ -132,23 +132,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 1 -# at 1596 -# server id 1 end_log_pos 1669 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1669 -# server id 1 end_log_pos 1711 CRC32 XXX GTID 0-1-6 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-6 /*M!100001 SET @@session.gtid_seq_no=6*//*!*/; START TRANSACTION /*!*/; -# at 1711 -# at 1786 -# server id 1 end_log_pos 1786 CRC32 XXX Annotate_rows: +# at +# at +# server id 1 end_log_pos CRC32 XXX Annotate_rows: #Q> INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A") -# server id 1 end_log_pos 1842 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 1842 -# server id 1 end_log_pos 1909 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F +# server id 1 end_log_pos CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at +# server id 1 end_log_pos CRC32 XXX Write_compressed_rows: table id flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=13 /* INT meta=0 nullable=0 is_null=0 */ @@ -161,23 +161,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 1 -# at 1909 -# server id 1 end_log_pos 1982 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1982 -# server id 1 end_log_pos 2024 CRC32 XXX GTID 0-1-7 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-7 /*M!100001 SET @@session.gtid_seq_no=7*//*!*/; START TRANSACTION /*!*/; -# at 2024 -# at 2078 -# server id 1 end_log_pos 2078 CRC32 XXX Annotate_rows: +# at +# at +# server id 1 end_log_pos CRC32 XXX Annotate_rows: #Q> INSERT INTO t2 SELECT * FROM t1 -# server id 1 end_log_pos 2134 CRC32 XXX Table_map: `test`.`t2` mapped to number num -# at 2134 -# server id 1 end_log_pos 2225 CRC32 XXX Write_compressed_rows: table id 33 flags: STMT_END_F +# server id 1 end_log_pos CRC32 XXX Table_map: `test`.`t2` mapped to number num +# at +# server id 1 end_log_pos CRC32 XXX Write_compressed_rows: table id flags: STMT_END_F ### INSERT INTO `test`.`t2` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -223,23 +223,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 4 -# at 2225 -# server id 1 end_log_pos 2298 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2298 -# server id 1 end_log_pos 2340 CRC32 XXX GTID 0-1-8 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-8 /*M!100001 SET @@session.gtid_seq_no=8*//*!*/; START TRANSACTION /*!*/; -# at 2340 -# at 2406 -# server id 1 end_log_pos 2406 CRC32 XXX Annotate_rows: +# at +# at +# server id 1 end_log_pos CRC32 XXX Annotate_rows: #Q> UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL -# server id 1 end_log_pos 2462 CRC32 XXX Table_map: `test`.`t2` mapped to number num -# at 2462 -# server id 1 end_log_pos 2561 CRC32 XXX Update_compressed_rows: table id 33 flags: STMT_END_F +# server id 1 end_log_pos CRC32 XXX Table_map: `test`.`t2` mapped to number num +# at +# server id 1 end_log_pos CRC32 XXX Update_compressed_rows: table id flags: STMT_END_F ### UPDATE `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -304,23 +304,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 3 -# at 2561 -# server id 1 end_log_pos 2634 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2634 -# server id 1 end_log_pos 2676 CRC32 XXX GTID 0-1-9 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-9 /*M!100001 SET @@session.gtid_seq_no=9*//*!*/; START TRANSACTION /*!*/; -# at 2676 -# at 2713 -# server id 1 end_log_pos 2713 CRC32 XXX Annotate_rows: +# at +# at +# server id 1 end_log_pos CRC32 XXX Annotate_rows: #Q> DELETE FROM t1 -# server id 1 end_log_pos 2769 CRC32 XXX Table_map: `test`.`t1` mapped to number num -# at 2769 -# server id 1 end_log_pos 2861 CRC32 XXX Delete_compressed_rows: table id 32 flags: STMT_END_F +# server id 1 end_log_pos CRC32 XXX Table_map: `test`.`t1` mapped to number num +# at +# server id 1 end_log_pos CRC32 XXX Delete_compressed_rows: table id flags: STMT_END_F ### DELETE FROM `test`.`t1` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -366,23 +366,23 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 4 -# at 2861 -# server id 1 end_log_pos 2934 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2934 -# server id 1 end_log_pos 2976 CRC32 XXX GTID 0-1-10 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-10 /*M!100001 SET @@session.gtid_seq_no=10*//*!*/; START TRANSACTION /*!*/; -# at 2976 -# at 3013 -# server id 1 end_log_pos 3013 CRC32 XXX Annotate_rows: +# at +# at +# server id 1 end_log_pos CRC32 XXX Annotate_rows: #Q> DELETE FROM t2 -# server id 1 end_log_pos 3069 CRC32 XXX Table_map: `test`.`t2` mapped to number num -# at 3069 -# server id 1 end_log_pos 3154 CRC32 XXX Delete_compressed_rows: table id 33 flags: STMT_END_F +# server id 1 end_log_pos CRC32 XXX Table_map: `test`.`t2` mapped to number num +# at +# server id 1 end_log_pos CRC32 XXX Delete_compressed_rows: table id flags: STMT_END_F ### DELETE FROM `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -428,13 +428,13 @@ START TRANSACTION ### @8=7 /* INT meta=0 nullable=1 is_null=0 */ ### @9='A' /* STRING(1) meta=65025 nullable=1 is_null=0 */ # Number of rows: 4 -# at 3154 -# server id 1 end_log_pos 3227 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 3227 -# server id 1 end_log_pos 3275 CRC32 XXX Rotate to master-bin.000002 pos: 4 +# at +# server id 1 end_log_pos CRC32 XXX Rotate to master-bin.000002 pos: 4 DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; diff --git a/mysql-test/main/mysqlbinlog_row_compressed.test b/mysql-test/main/mysqlbinlog_row_compressed.test index f493c4db2cd..5abed1a7e77 100644 --- a/mysql-test/main/mysqlbinlog_row_compressed.test +++ b/mysql-test/main/mysqlbinlog_row_compressed.test @@ -4,7 +4,6 @@ --source include/have_log_bin.inc --source include/have_binlog_format_row.inc ---source include/have_normal_zlib.inc # # @@ -30,7 +29,7 @@ DELETE FROM t2; FLUSH BINARY LOGS; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---replace_regex /\d{6} *\d*:\d\d:\d\d// /Start:.*at startup/Start: xxx/ /SET TIMESTAMP=\d*/SET TIMESTAMP=X/ /exec_time=\d*/exec_time=x/ /mapped to number \d*/mapped to number num/ /CRC32 0x[0-9a-f]+/CRC32 XXX/ /@@session.sql_mode=\d+/@@session.sql_mode=#/ /collation_server=\d+/collation_server=#/ +--replace_regex /\d{6} *\d*:\d\d:\d\d// /Start:.*at startup/Start: xxx/ /SET TIMESTAMP=\d*/SET TIMESTAMP=X/ /exec_time=\d*/exec_time=x/ /mapped to number \d*/mapped to number num/ /CRC32 0x[0-9a-f]+/CRC32 XXX/ /@@session.sql_mode=\d+/@@session.sql_mode=#/ /collation_server=\d+/collation_server=#/ /xid=\d*/xid=/ /table id \d+/table id / /end_log_pos \d+/end_log_pos / /# at \d+/# at / --exec $MYSQL_BINLOG --verbose --verbose --base64-output=DECODE-ROWS $datadir/$binlog --echo diff --git a/mysql-test/main/mysqlbinlog_stmt_compressed.result b/mysql-test/main/mysqlbinlog_stmt_compressed.result index cb9f2c63ca1..be0c1400700 100644 --- a/mysql-test/main/mysqlbinlog_stmt_compressed.result +++ b/mysql-test/main/mysqlbinlog_stmt_compressed.result @@ -15,21 +15,21 @@ FLUSH BINARY LOGS; /*!40019 SET @@session.max_insert_delayed_threads=0*/; /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/; DELIMITER /*!*/; -# at 4 -# server id 1 end_log_pos 256 CRC32 XXX Start: xxx +# at +# server id 1 end_log_pos CRC32 XXX Start: xxx ROLLBACK/*!*/; -# at 256 -# server id 1 end_log_pos 285 CRC32 XXX Gtid list [] -# at 285 -# server id 1 end_log_pos 329 CRC32 XXX Binlog checkpoint master-bin.000001 -# at 329 -# server id 1 end_log_pos 371 CRC32 XXX GTID 0-1-1 ddl +# at +# server id 1 end_log_pos CRC32 XXX Gtid list [] +# at +# server id 1 end_log_pos CRC32 XXX Binlog checkpoint master-bin.000001 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-1 ddl /*M!100101 SET @@session.skip_parallel_replication=0*//*!*/; /*M!100001 SET @@session.gtid_domain_id=0*//*!*/; /*M!100001 SET @@session.server_id=1*//*!*/; /*M!100001 SET @@session.gtid_seq_no=1*//*!*/; -# at 371 -# server id 1 end_log_pos 533 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 use `test`/*!*/; SET TIMESTAMP=X/*!*/; SET @@session.pseudo_thread_id=5/*!*/; @@ -42,136 +42,136 @@ SET @@session.lc_time_names=0/*!*/; SET @@session.collation_database=DEFAULT/*!*/; CREATE TABLE t1 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 TINYINT, f4 MEDIUMINT, f5 BIGINT, f6 INT, f7 INT, f8 char(1)) /*!*/; -# at 533 -# server id 1 end_log_pos 575 CRC32 XXX GTID 0-1-2 ddl +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-2 ddl /*M!100001 SET @@session.gtid_seq_no=2*//*!*/; -# at 575 -# server id 1 end_log_pos 727 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; CREATE TABLE t2 (pk INT PRIMARY KEY, f1 INT, f2 INT, f3 INT, f4 INT, f5 MEDIUMINT, f6 INT, f7 INT, f8 char(1)) /*!*/; -# at 727 -# server id 1 end_log_pos 769 CRC32 XXX GTID 0-1-3 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-3 /*M!100001 SET @@session.gtid_seq_no=3*//*!*/; START TRANSACTION /*!*/; -# at 769 -# server id 1 end_log_pos 897 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "") /*!*/; -# at 897 -# server id 1 end_log_pos 970 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 970 -# server id 1 end_log_pos 1012 CRC32 XXX GTID 0-1-4 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-4 /*M!100001 SET @@session.gtid_seq_no=4*//*!*/; START TRANSACTION /*!*/; -# at 1012 -# server id 1 end_log_pos 1140 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL) /*!*/; -# at 1140 -# server id 1 end_log_pos 1213 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1213 -# server id 1 end_log_pos 1255 CRC32 XXX GTID 0-1-5 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-5 /*M!100001 SET @@session.gtid_seq_no=5*//*!*/; START TRANSACTION /*!*/; -# at 1255 -# server id 1 end_log_pos 1385 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A") /*!*/; -# at 1385 -# server id 1 end_log_pos 1458 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1458 -# server id 1 end_log_pos 1500 CRC32 XXX GTID 0-1-6 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-6 /*M!100001 SET @@session.gtid_seq_no=6*//*!*/; START TRANSACTION /*!*/; -# at 1500 -# server id 1 end_log_pos 1627 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A") /*!*/; -# at 1627 -# server id 1 end_log_pos 1700 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1700 -# server id 1 end_log_pos 1742 CRC32 XXX GTID 0-1-7 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-7 /*M!100001 SET @@session.gtid_seq_no=7*//*!*/; START TRANSACTION /*!*/; -# at 1742 -# server id 1 end_log_pos 1850 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; INSERT INTO t2 SELECT * FROM t1 /*!*/; -# at 1850 -# server id 1 end_log_pos 1923 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 1923 -# server id 1 end_log_pos 1965 CRC32 XXX GTID 0-1-8 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-8 /*M!100001 SET @@session.gtid_seq_no=8*//*!*/; START TRANSACTION /*!*/; -# at 1965 -# server id 1 end_log_pos 2082 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL /*!*/; -# at 2082 -# server id 1 end_log_pos 2155 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2155 -# server id 1 end_log_pos 2197 CRC32 XXX GTID 0-1-9 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-9 /*M!100001 SET @@session.gtid_seq_no=9*//*!*/; START TRANSACTION /*!*/; -# at 2197 -# server id 1 end_log_pos 2288 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; DELETE FROM t1 /*!*/; -# at 2288 -# server id 1 end_log_pos 2361 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2361 -# server id 1 end_log_pos 2403 CRC32 XXX GTID 0-1-10 +# at +# server id 1 end_log_pos CRC32 XXX GTID 0-1-10 /*M!100001 SET @@session.gtid_seq_no=10*//*!*/; START TRANSACTION /*!*/; -# at 2403 -# server id 1 end_log_pos 2494 CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query_compressed thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; DELETE FROM t2 /*!*/; -# at 2494 -# server id 1 end_log_pos 2567 CRC32 XXX Query thread_id=5 exec_time=x error_code=0 +# at +# server id 1 end_log_pos CRC32 XXX Query thread_id=5 exec_time=x error_code=0 SET TIMESTAMP=X/*!*/; COMMIT /*!*/; -# at 2567 -# server id 1 end_log_pos 2615 CRC32 XXX Rotate to master-bin.000002 pos: 4 +# at +# server id 1 end_log_pos CRC32 XXX Rotate to master-bin.000002 pos: 4 DELIMITER ; # End of log file ROLLBACK /* added by mysqlbinlog */; diff --git a/mysql-test/main/mysqlbinlog_stmt_compressed.test b/mysql-test/main/mysqlbinlog_stmt_compressed.test index 1f1591e7a00..5c3fb58c50c 100644 --- a/mysql-test/main/mysqlbinlog_stmt_compressed.test +++ b/mysql-test/main/mysqlbinlog_stmt_compressed.test @@ -4,7 +4,6 @@ --source include/have_log_bin.inc --source include/have_binlog_format_statement.inc ---source include/have_normal_zlib.inc # # # mysqlbinlog: compressed query event @@ -29,7 +28,7 @@ DELETE FROM t2; FLUSH BINARY LOGS; --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR ---replace_regex /\d{6} *\d*:\d\d:\d\d// /Start:.*at startup/Start: xxx/ /SET TIMESTAMP=\d*/SET TIMESTAMP=X/ /exec_time=\d*/exec_time=x/ /mapped to number \d*/mapped to number num/ /CRC32 0x[0-9a-f]+/CRC32 XXX/ /@@session.sql_mode=\d+/@@session.sql_mode=#/ /collation_server=\d+/collation_server=#/ +--replace_regex /\d{6} *\d*:\d\d:\d\d// /Start:.*at startup/Start: xxx/ /SET TIMESTAMP=\d*/SET TIMESTAMP=X/ /exec_time=\d*/exec_time=x/ /mapped to number \d*/mapped to number num/ /CRC32 0x[0-9a-f]+/CRC32 XXX/ /@@session.sql_mode=\d+/@@session.sql_mode=#/ /collation_server=\d+/collation_server=#/ /xid=\d*/xid=/ /table id \d+/table id / /end_log_pos \d+/end_log_pos / /# at \d+/# at / --exec $MYSQL_BINLOG --verbose --verbose --base64-output=DECODE-ROWS $datadir/$binlog --echo diff --git a/mysql-test/suite/archive/archive.test b/mysql-test/suite/archive/archive.test index 38bee206ef2..94a6e0c48bd 100644 --- a/mysql-test/suite/archive/archive.test +++ b/mysql-test/suite/archive/archive.test @@ -1613,7 +1613,7 @@ SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test'; INSERT INTO t1 VALUES(1, 'sampleblob1'),(2, 'sampleblob2'); # Compression length depends on zip library ---replace_result 583 584 291 292 +--replace_result 583 584 585 584 291 292 SELECT DATA_LENGTH, AVG_ROW_LENGTH FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1' AND TABLE_SCHEMA='test'; DROP TABLE t1; From c391fb1ff122adbfb9a7f98d3239aa08311918d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 16 Dec 2024 11:50:00 +0200 Subject: [PATCH 33/84] MDEV-35577 Broken recovery after SET GLOBAL innodb_log_file_size If InnoDB is killed in such a way that there had been no writes to a newly resized ib_logfile101 after it replaced ib_logfile0 in log_t::write_checkpoint(), it is possible that recovery will accidentally interpret some garbage at the end of the log as valid. log_t::write_buf(): To prevent the corruption, write an extra NUL byte at the end of log_sys.resize_buf, like we always did for the main log_sys.buf. To remove some conditional branches from a time critical code path, we instantiate a separate template for the rare case that the log is being resized. Define as __attribute__((always_inline)) so that this will be inlined also in the rare case the log is being resized. log_t::writer: Pointer to the current implementation of log_t::write_buf(). For quick access, this is located in the same cache line with log_sys.latch, which protects it. log_t::writer_update(): Update log_sys.writer. log_t::resize_write_buf(): Remove ATTRIBUTE_NOINLINE ATTRIBUTE_COLD. Now that log_t::write_buf() will be instantiated separately for the rare case of log resizing being in progress, there is no need to forbid this code from being inlined. Thanks to Thirunarayanan Balathandayuthapani for finding the root cause of this bug and suggesting the fix of writing an extra NUL byte. Reviewed by: Debarun Banerjee --- storage/innobase/buf/buf0flu.cc | 2 + storage/innobase/include/log0log.h | 30 ++++++++--- storage/innobase/log/log0log.cc | 86 +++++++++++++++++++++--------- 3 files changed, 87 insertions(+), 31 deletions(-) diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index c8588d1cf19..cbff57c1157 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -1840,6 +1840,7 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept if (resizing > 1 && resizing <= checkpoint_lsn) { ut_ad(is_mmap() == !resize_flush_buf); + ut_ad(is_mmap() == !resize_log.is_opened()); if (!is_mmap()) { @@ -1905,6 +1906,7 @@ inline void log_t::write_checkpoint(lsn_t end_lsn) noexcept resize_flush_buf= nullptr; resize_target= 0; resize_lsn.store(0, std::memory_order_relaxed); + writer_update(); } log_resize_release(); diff --git a/storage/innobase/include/log0log.h b/storage/innobase/include/log0log.h index 90261050017..cfde0472e78 100644 --- a/storage/innobase/include/log0log.h +++ b/storage/innobase/include/log0log.h @@ -60,7 +60,7 @@ wait and check if an already running write is covering the request. @param durable whether the write needs to be durable @param callback log write completion callback */ void log_write_up_to(lsn_t lsn, bool durable, - const completion_callback *callback= nullptr); + const completion_callback *callback= nullptr) noexcept; /** Write to the log file up to the last log entry. @param durable whether to wait for a durable write to complete */ @@ -249,6 +249,8 @@ public: /** latest completed checkpoint (protected by latch.wr_lock()) */ Atomic_relaxed last_checkpoint_lsn; + /** The log writer (protected by latch.wr_lock()) */ + lsn_t (*writer)() noexcept; /** next checkpoint LSN (protected by latch.wr_lock()) */ lsn_t next_checkpoint_lsn; @@ -270,7 +272,8 @@ private: @return the value of buf_free */ size_t lock_lsn() noexcept; - /** log sequence number when log resizing was initiated, or 0 */ + /** log sequence number when log resizing was initiated; + 0 if the log is not being resized, 1 if resize_start() is in progress */ std::atomic resize_lsn; /** the log sequence number at the start of the log file */ lsn_t first_lsn; @@ -358,7 +361,8 @@ public: inline lsn_t get_write_target() const; /** @return LSN at which log resizing was started and is still in progress - @retval 0 if no log resizing is in progress */ + @retval 0 if no log resizing is in progress + @retval 1 if resize_start() is in progress */ lsn_t resize_in_progress() const noexcept { return resize_lsn.load(std::memory_order_relaxed); } @@ -387,7 +391,6 @@ private: /** Write resize_buf to resize_log. @param b resize_buf or resize_flush_buf @param length the used length of b */ - ATTRIBUTE_COLD ATTRIBUTE_NOINLINE void resize_write_buf(const byte *b, size_t length) noexcept; public: @@ -489,6 +492,9 @@ public: #endif private: + /** Update writer and mtr_t::finisher */ + void writer_update() noexcept; + /** Wait in append_prepare() for buffer to become available @tparam spin whether to use the spin-only lock_lsn() @param b the value of buf_free @@ -551,10 +557,20 @@ public: @param end_lsn start LSN of the FILE_CHECKPOINT mini-transaction */ inline void write_checkpoint(lsn_t end_lsn) noexcept; - /** Write buf to ib_logfile0. - @tparam release_latch whether to invoke latch.wr_unlock() + /** Variations of write_buf() */ + enum resizing_and_latch { + /** skip latch.wr_unlock(); log resizing may or may not be in progress */ + RETAIN_LATCH, + /** invoke latch.wr_unlock(); !(resize_in_progress() > 1) */ + NOT_RESIZING, + /** invoke latch.wr_unlock(); resize_in_progress() > 1 */ + RESIZING + }; + + /** Write buf to ib_logfile0 and possibly ib_logfile101. + @tparam resizing whether to release latch and whether resize_in_progress()>1 @return the current log sequence number */ - template inline lsn_t write_buf() noexcept; + template inline lsn_t write_buf() noexcept; /** Create the log. */ void create(lsn_t lsn) noexcept; diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 82f9e1ffe19..10928c66b20 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -101,6 +101,7 @@ void log_t::create() ut_ad(!checkpoint_buf); ut_ad(!buf); ut_ad(!flush_buf); + ut_ad(!writer); max_buf_free= 1; latch.SRW_LOCK_INIT(log_latch_key); @@ -330,6 +331,7 @@ bool log_t::attach(log_file_t file, os_offset_t size) ut_ad(!buf); ut_ad(!flush_buf); + ut_ad(!writer); #ifdef HAVE_INNODB_MMAP if (size) { @@ -352,7 +354,7 @@ bool log_t::attach(log_file_t file, os_offset_t size) # endif buf= static_cast(ptr); max_buf_free= 1; - mtr_t::finisher_update(); + writer_update(); # ifdef HAVE_PMEM if (is_pmem) return true; @@ -395,7 +397,7 @@ bool log_t::attach(log_file_t file, os_offset_t size) TRASH_ALLOC(buf, buf_size); TRASH_ALLOC(flush_buf, buf_size); max_buf_free= buf_size / LOG_BUF_FLUSH_RATIO - LOG_BUF_FLUSH_MARGIN; - mtr_t::finisher_update(); + writer_update(); memset_aligned<512>(checkpoint_buf, 0, write_size); #ifdef HAVE_INNODB_MMAP @@ -508,6 +510,8 @@ void log_t::close_file() checkpoint_buf= nullptr; } + writer= nullptr; + #ifdef HAVE_INNODB_MMAP if (really_close) #endif @@ -671,6 +675,8 @@ log_t::resize_start_status log_t::resize_start(os_offset_t size) noexcept (lsn_t{write_size - 1} + start_lsn - first_lsn)); else if (!is_opened()) resize_log.close(); + + writer_update(); } resize_lsn.store(start_lsn, std::memory_order_relaxed); status= success ? RESIZE_STARTED : RESIZE_FAILED; @@ -721,6 +727,7 @@ void log_t::resize_abort() noexcept resize_lsn.store(0, std::memory_order_relaxed); } + writer_update(); log_resize_release(); } @@ -924,7 +931,6 @@ void log_t::persist(lsn_t lsn, bool holding_latch) noexcept } #endif -ATTRIBUTE_COLD ATTRIBUTE_NOINLINE void log_t::resize_write_buf(const byte *b, size_t length) noexcept { const size_t block_size_1= write_size - 1; @@ -959,20 +965,24 @@ void log_t::resize_write_buf(const byte *b, size_t length) noexcept b, offset, length) == DB_SUCCESS); } -/** Write buf to ib_logfile0. -@tparam release_latch whether to invoke latch.wr_unlock() +/** Write buf to ib_logfile0 and possibly ib_logfile101. +@tparam resizing whether to release latch and whether resize_in_progress()>1 @return the current log sequence number */ -template inline lsn_t log_t::write_buf() noexcept +template +inline __attribute__((always_inline)) +lsn_t log_t::write_buf() noexcept { ut_ad(latch_have_wr()); ut_ad(!is_mmap()); ut_ad(!srv_read_only_mode); + ut_ad(resizing == RETAIN_LATCH || + (resizing == RESIZING) == (resize_in_progress() > 1)); const lsn_t lsn{get_lsn(std::memory_order_relaxed)}; if (write_lsn >= lsn) { - if (release_latch) + if (resizing != RETAIN_LATCH) latch.wr_unlock(); ut_ad(write_lsn == lsn); } @@ -990,7 +1000,16 @@ template inline lsn_t log_t::write_buf() noexcept ut_ad(write_size_1 >= 511); const byte *const write_buf{buf}; - const byte *const re_write_buf{resize_buf}; + byte *const re_write_buf{resizing == NOT_RESIZING ? nullptr : resize_buf}; + ut_ad(resizing == RETAIN_LATCH || + (resizing == NOT_RESIZING) == !re_write_buf); + ut_ad(!re_write_buf == !resize_flush_buf); + if (resizing == RESIZING) +#ifdef _MSC_VER + __assume(re_write_buf != nullptr); +#else + if (!re_write_buf) __builtin_unreachable(); +#endif offset&= ~lsn_t{write_size_1}; if (length <= write_size_1) @@ -1002,13 +1021,14 @@ template inline lsn_t log_t::write_buf() noexcept buf + length, flush_buf); ... /* TODO: Update the LSN and adjust other code. */ #else -# ifdef HAVE_valgrind MEM_MAKE_DEFINED(buf + length, (write_size_1 + 1) - length); - if (UNIV_LIKELY_NULL(re_write_buf)) - MEM_MAKE_DEFINED(re_write_buf + length, (write_size_1 + 1) - length); -# endif - buf[length]= 0; /* allow recovery to catch EOF faster */ + buf[length]= 0; /* ensure that recovery catches EOF */ #endif + if (UNIV_LIKELY_NULL(re_write_buf)) + { + MEM_MAKE_DEFINED(re_write_buf + length, (write_size_1 + 1) - length); + re_write_buf[length]= 0; + } length= write_size_1 + 1; } else @@ -1023,27 +1043,28 @@ template inline lsn_t log_t::write_buf() noexcept (We want to avoid memset() while holding exclusive log_sys.latch) This block will be overwritten later, once records beyond the current LSN are generated. */ -#ifdef HAVE_valgrind - MEM_MAKE_DEFINED(buf + length, (write_size_1 + 1) - new_buf_free); - if (UNIV_LIKELY_NULL(re_write_buf)) - MEM_MAKE_DEFINED(re_write_buf + length, (write_size_1 + 1) - - new_buf_free); -#endif + MEM_MAKE_DEFINED(buf + length, (write_size_1 + 1) - new_buf_free); buf[length]= 0; /* allow recovery to catch EOF faster */ length&= ~write_size_1; memcpy_aligned<16>(flush_buf, buf + length, (new_buf_free + 15) & ~15); if (UNIV_LIKELY_NULL(re_write_buf)) + { + MEM_MAKE_DEFINED(re_write_buf + length, (write_size_1 + 1) - + new_buf_free); memcpy_aligned<16>(resize_flush_buf, re_write_buf + length, (new_buf_free + 15) & ~15); + re_write_buf[length + new_buf_free]= 0; + } length+= write_size_1 + 1; } std::swap(buf, flush_buf); - std::swap(resize_buf, resize_flush_buf); + if (UNIV_LIKELY_NULL(re_write_buf)) + std::swap(resize_buf, resize_flush_buf); } write_to_log++; - if (release_latch) + if (resizing != RETAIN_LATCH) latch.wr_unlock(); DBUG_PRINT("ib_log", ("write " LSN_PF " to " LSN_PF " at " LSN_PF, @@ -1103,7 +1124,7 @@ wait and check if an already running write is covering the request. @param durable whether the write needs to be durable @param callback log write completion callback */ void log_write_up_to(lsn_t lsn, bool durable, - const completion_callback *callback) + const completion_callback *callback) noexcept { ut_ad(!srv_read_only_mode || log_sys.buf_free_ok()); ut_ad(lsn != LSN_MAX); @@ -1148,7 +1169,7 @@ repeat: group_commit_lock::ACQUIRED) { log_sys.latch.wr_lock(SRW_LOCK_CALL); - pending_write_lsn= write_lock.release(log_sys.write_buf()); + pending_write_lsn= write_lock.release(log_sys.writer()); } if (durable) @@ -1165,6 +1186,23 @@ repeat: } } +static lsn_t log_writer() noexcept +{ + return log_sys.write_buf(); +} + +ATTRIBUTE_COLD static lsn_t log_writer_resizing() noexcept +{ + return log_sys.write_buf(); +} + +void log_t::writer_update() noexcept +{ + ut_ad(latch_have_wr()); + writer= resize_in_progress() ? log_writer_resizing : log_writer; + mtr_t::finisher_update(); +} + /** Write to the log file up to the last log entry. @param durable whether to wait for a durable write to complete */ void log_buffer_flush_to_disk(bool durable) @@ -1232,7 +1270,7 @@ ATTRIBUTE_COLD void log_write_and_flush() else #endif { - const lsn_t lsn{log_sys.write_buf()}; + const lsn_t lsn{log_sys.write_buf()}; write_lock.release(lsn); log_flush(lsn); } From aa49770d795af9f1848aabf737443c227b991ed4 Mon Sep 17 00:00:00 2001 From: Lena Startseva Date: Mon, 21 Oct 2024 12:21:51 +0700 Subject: [PATCH 34/84] MDEV-31005: Make working cursor-protocol Excluded cases in main./secure_file_priv_win Fix for v.10.5 --- mysql-test/main/secure_file_priv_win.test | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mysql-test/main/secure_file_priv_win.test b/mysql-test/main/secure_file_priv_win.test index 60fc8e29b6e..2130b1f84e9 100644 --- a/mysql-test/main/secure_file_priv_win.test +++ b/mysql-test/main/secure_file_priv_win.test @@ -13,10 +13,11 @@ LET $MYSQL_TMP_DIR_UCASE= `SELECT upper('$MYSQL_TMP_DIR')`; LET $MYSQL_TMP_DIR_LCASE= `SELECT lower('$MYSQL_TMP_DIR')`; --disable_ps2_protocol - +--disable_cursor_protocol #create the file --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR/B11764517.tmp'; +--enable_cursor_protocol --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR show global variables like 'secure_file_priv'; @@ -52,6 +53,7 @@ eval LOAD DATA INFILE '$MYSQL_TMP_DIR_LCASE/B11764517.tmp' INTO TABLE t1; --error ER_OPTION_PREVENTS_STATEMENT eval LOAD DATA INFILE "$MYSQL_TMP_DIR\\\\..a..\\\\..\\\\..\\\\B11764517.tmp" into table t1; +--disable_cursor_protocol --replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR --error ER_OPTION_PREVENTS_STATEMENT eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR\\\\..a..\\\\..\\\\..\\\\B11764517-2.tmp'; @@ -67,6 +69,7 @@ eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR_UCASE/B11764517-4.tmp'; --replace_result $MYSQL_TMP_DIR_LCASE MYSQL_TMP_DIR_LCASE eval SELECT * FROM t1 INTO OUTFILE '$MYSQL_TMP_DIR_LCASE/B11764517-5.tmp'; +--enable_cursor_protocol --error 0,1 --remove_file $MYSQL_TMP_DIR/B11764517.tmp; From c982a143fccdc198b0ffb2177582b33a52dec5bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 16 Dec 2024 13:23:13 +0200 Subject: [PATCH 35/84] MDEV-35494 fixup: Always initialize latch It turns out that init() always checks in debug builds that some fields of the latch had been filled with zero. --- storage/innobase/fil/fil0fil.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 1f72c2bbd1f..6403485ab3d 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -938,9 +938,7 @@ fil_space_t::fil_space_t(uint32_t id, ulint flags, bool being_imported, id(id), crypt_data(crypt_data), being_imported(being_imported), flags(flags) { UT_LIST_INIT(chain, &fil_node_t::chain); -#ifndef SUX_LOCK_GENERIC memset((void*) &latch, 0, sizeof latch); -#endif latch.SRW_LOCK_INIT(fil_space_latch_key); } From bc6121819cf648237d0c2c63e48d53acf816db76 Mon Sep 17 00:00:00 2001 From: Andrei Elkin Date: Mon, 16 Dec 2024 19:34:09 +0200 Subject: [PATCH 36/84] MDEV-35098 rpl.rpl_mysqldump_gtid_slave_pos fails in buildbot The test turns out to be senstive to @@global.gtid_cleanup_batch_size. With a rather small default value of the latter SELECTing from mysql.gtid_slave_pos may not be deterministic: tests that run before may increase a pending for automitic deletion batch. The test is refined to set its own value for the batch size which is virtually unreachable. Thanks to Kristian Nielsen for the analysis. --- .../suite/rpl/r/rpl_mysqldump_gtid_slave_pos.result | 4 ++++ mysql-test/suite/rpl/t/rpl_mysqldump_gtid_slave_pos.test | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/mysql-test/suite/rpl/r/rpl_mysqldump_gtid_slave_pos.result b/mysql-test/suite/rpl/r/rpl_mysqldump_gtid_slave_pos.result index 1849f896758..9340498c537 100644 --- a/mysql-test/suite/rpl/r/rpl_mysqldump_gtid_slave_pos.result +++ b/mysql-test/suite/rpl/r/rpl_mysqldump_gtid_slave_pos.result @@ -32,6 +32,7 @@ insert into t1 set a = 2; insert into t1 set a = 1; include/save_master_gtid.inc connection slave; +SET @@global.gtid_cleanup_batch_size = $val; include/start_slave.inc include/sync_with_master_gtid.inc select * from mysql.gtid_slave_pos; @@ -55,6 +56,7 @@ set statement sql_log_bin=0 for delete from mysql.gtid_slave_pos; insert into mysql.gtid_slave_pos values (99 + 2, 1, 1, 1); # 5. include/rpl_restart_server.inc [server_number=2] +SET @@global.gtid_cleanup_batch_size = $val; select * from mysql.gtid_slave_pos; domain_id sub_id server_id seq_no 101 1 1 1 @@ -99,6 +101,7 @@ set statement sql_log_bin=0 for delete from mysql.gtid_slave_pos; insert into mysql.gtid_slave_pos values (99 + 1, 1, 1, 1); # 5. include/rpl_restart_server.inc [server_number=2] +SET @@global.gtid_cleanup_batch_size = $val; select * from mysql.gtid_slave_pos; domain_id sub_id server_id seq_no 100 1 1 1 @@ -145,5 +148,6 @@ connection master; DROP TABLE t1; include/save_master_gtid.inc connection slave; +SET @@global.gtid_cleanup_batch_size= $old_gtid_cleanup_batch_size; include/sync_with_master_gtid.inc include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_mysqldump_gtid_slave_pos.test b/mysql-test/suite/rpl/t/rpl_mysqldump_gtid_slave_pos.test index e66a92a6153..820fc56134b 100644 --- a/mysql-test/suite/rpl/t/rpl_mysqldump_gtid_slave_pos.test +++ b/mysql-test/suite/rpl/t/rpl_mysqldump_gtid_slave_pos.test @@ -47,6 +47,12 @@ while ($i) --source include/save_master_gtid.inc --connection slave +# enforce determistic SELECT * from mysql.gtid_slave_pos +--let $old_gtid_cleanup_batch_size = `select @@GLOBAL.gtid_cleanup_batch_size` +# the number of generated transactions on master must not exceed this value: +--let $val= 2147483647 +--evalp SET @@global.gtid_cleanup_batch_size = $val + --source include/start_slave.inc --source include/sync_with_master_gtid.inc # Prior tests in a mtr batch could leave the min value of sub_id column with @@ -85,6 +91,7 @@ while ($i) --echo # 5. --let $rpl_server_number= 2 --source include/rpl_restart_server.inc + --evalp SET @@global.gtid_cleanup_batch_size = $val select * from mysql.gtid_slave_pos; select @@global.gtid_slave_pos as "before dump restore"; --let $dump=dump_$i.sql @@ -130,6 +137,7 @@ DROP TABLE t1; --source include/save_master_gtid.inc --connection slave +--evalp SET @@global.gtid_cleanup_batch_size= $old_gtid_cleanup_batch_size --remove_files_wildcard $MYSQLTEST_VARDIR/tmp dump_*.sql --source include/sync_with_master_gtid.inc From 77c991766330ac995666afe25e5d03cdca6fe004 Mon Sep 17 00:00:00 2001 From: Yuchen Pei Date: Tue, 17 Dec 2024 10:40:57 +1100 Subject: [PATCH 37/84] MDEV-34716 Fix mysql.servers socket max length too short The limit of socket length on unix according to libc is 108, see sockaddr_un::sun_path, but in the table it is a string of max length 64, which results in truncation of socket and failure to connect by plugins using servers such as spider. --- mysql-test/main/mysqldump-system,win.rdiff | 4 +-- mysql-test/main/mysqldump-system.result | 4 +-- mysql-test/main/servers.result | 5 ++++ mysql-test/main/servers.test | 4 +++ mysql-test/main/system_mysql_db.result | 2 +- .../main/system_mysql_db_fix40123.result | 2 +- .../main/system_mysql_db_fix50030.result | 2 +- .../main/system_mysql_db_fix50117.result | 2 +- .../main/system_mysql_db_fix50568.result | 2 +- .../suite/funcs_1/r/is_columns_mysql.result | 4 +-- .../r/is_columns_mysql_embedded.result | 4 +-- scripts/mysql_system_tables.sql | 2 +- scripts/mysql_system_tables_fix.sql | 4 +++ .../mysql-test/spider/r/alter_server.result | 29 +++++++++++++++++++ .../mysql-test/spider/t/alter_server.cnf | 5 ++++ .../mysql-test/spider/t/alter_server.test | 27 +++++++++++++++++ 16 files changed, 88 insertions(+), 14 deletions(-) create mode 100644 storage/spider/mysql-test/spider/r/alter_server.result create mode 100644 storage/spider/mysql-test/spider/t/alter_server.cnf create mode 100644 storage/spider/mysql-test/spider/t/alter_server.test diff --git a/mysql-test/main/mysqldump-system,win.rdiff b/mysql-test/main/mysqldump-system,win.rdiff index a46b422e95f..26ed7d9f17d 100644 --- a/mysql-test/main/mysqldump-system,win.rdiff +++ b/mysql-test/main/mysqldump-system,win.rdiff @@ -3,7 +3,7 @@ @@ -442,7 +442,7 @@ mysql.time_zone_transition 3895294076 mysql.plugin 0 - mysql.servers 2783974349 + mysql.servers 4154392229 -mysql.func 3241572444 +mysql.func 310494789 mysql.innodb_table_stats 347867921 @@ -12,7 +12,7 @@ @@ -477,7 +477,7 @@ mysql.time_zone_transition 3895294076 mysql.plugin 0 - mysql.servers 2783974349 + mysql.servers 4154392229 -mysql.func 3241572444 +mysql.func 310494789 mysql.innodb_table_stats 347867921 diff --git a/mysql-test/main/mysqldump-system.result b/mysql-test/main/mysqldump-system.result index 5bfe363d694..e011132b0f9 100644 --- a/mysql-test/main/mysqldump-system.result +++ b/mysql-test/main/mysqldump-system.result @@ -444,7 +444,7 @@ Table Checksum mysql.roles_mapping 3150178430 mysql.time_zone_transition 3895294076 mysql.plugin 0 -mysql.servers 2783974349 +mysql.servers 4154392229 mysql.func 3241572444 mysql.innodb_table_stats 347867921 mysql.table_stats 664320059 @@ -479,7 +479,7 @@ Table Checksum mysql.roles_mapping 3150178430 mysql.time_zone_transition 3895294076 mysql.plugin 0 -mysql.servers 2783974349 +mysql.servers 4154392229 mysql.func 3241572444 mysql.innodb_table_stats 347867921 mysql.table_stats 664320059 diff --git a/mysql-test/main/servers.result b/mysql-test/main/servers.result index c466967a0db..d660aff1bd2 100644 --- a/mysql-test/main/servers.result +++ b/mysql-test/main/servers.result @@ -24,6 +24,11 @@ SELECT * FROM mysql.servers; Server_name Host Db Username Password Port Socket Wrapper Owner s1 3306 bar mysql DROP SERVER s1; +CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(SOCKET '/tmp/1234567890_1234567890_1234567890_1234567890_1234567890_1234567890.sock'); +SELECT Socket FROM mysql.servers where Server_name = 's1'; +Socket +/tmp/1234567890_1234567890_1234567890_1234567890_1234567890_1234567890.sock +DROP SERVER s1; # # MDEV-33783 CREATE SERVER segfaults on wrong mysql.servers # diff --git a/mysql-test/main/servers.test b/mysql-test/main/servers.test index 6aaaa356c1d..1a58d5849f8 100644 --- a/mysql-test/main/servers.test +++ b/mysql-test/main/servers.test @@ -23,6 +23,10 @@ CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(SOCKET 'bar'); SELECT * FROM mysql.servers; DROP SERVER s1; +CREATE SERVER s1 FOREIGN DATA WRAPPER mysql OPTIONS(SOCKET '/tmp/1234567890_1234567890_1234567890_1234567890_1234567890_1234567890.sock'); +SELECT Socket FROM mysql.servers where Server_name = 's1'; +DROP SERVER s1; + --echo # --echo # MDEV-33783 CREATE SERVER segfaults on wrong mysql.servers --echo # diff --git a/mysql-test/main/system_mysql_db.result b/mysql-test/main/system_mysql_db.result index 455d276d037..9900fd877cb 100644 --- a/mysql-test/main/system_mysql_db.result +++ b/mysql-test/main/system_mysql_db.result @@ -129,7 +129,7 @@ servers CREATE TABLE `servers` ( `Username` char(80) NOT NULL DEFAULT '', `Password` char(64) NOT NULL DEFAULT '', `Port` int(4) NOT NULL DEFAULT 0, - `Socket` char(64) NOT NULL DEFAULT '', + `Socket` char(108) NOT NULL DEFAULT '', `Wrapper` char(64) NOT NULL DEFAULT '', `Owner` varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (`Server_name`) diff --git a/mysql-test/main/system_mysql_db_fix40123.result b/mysql-test/main/system_mysql_db_fix40123.result index ff5f34225e9..2dc89622783 100644 --- a/mysql-test/main/system_mysql_db_fix40123.result +++ b/mysql-test/main/system_mysql_db_fix40123.result @@ -167,7 +167,7 @@ servers CREATE TABLE `servers` ( `Username` char(80) NOT NULL DEFAULT '', `Password` char(64) NOT NULL DEFAULT '', `Port` int(4) NOT NULL DEFAULT 0, - `Socket` char(64) NOT NULL DEFAULT '', + `Socket` char(108) NOT NULL DEFAULT '', `Wrapper` char(64) NOT NULL DEFAULT '', `Owner` varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (`Server_name`) diff --git a/mysql-test/main/system_mysql_db_fix50030.result b/mysql-test/main/system_mysql_db_fix50030.result index 17e245bf70f..9116429dc21 100644 --- a/mysql-test/main/system_mysql_db_fix50030.result +++ b/mysql-test/main/system_mysql_db_fix50030.result @@ -171,7 +171,7 @@ servers CREATE TABLE `servers` ( `Username` char(80) NOT NULL DEFAULT '', `Password` char(64) NOT NULL DEFAULT '', `Port` int(4) NOT NULL DEFAULT 0, - `Socket` char(64) NOT NULL DEFAULT '', + `Socket` char(108) NOT NULL DEFAULT '', `Wrapper` char(64) NOT NULL DEFAULT '', `Owner` varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (`Server_name`) diff --git a/mysql-test/main/system_mysql_db_fix50117.result b/mysql-test/main/system_mysql_db_fix50117.result index 0332524c43f..2ae70d00945 100644 --- a/mysql-test/main/system_mysql_db_fix50117.result +++ b/mysql-test/main/system_mysql_db_fix50117.result @@ -151,7 +151,7 @@ servers CREATE TABLE `servers` ( `Username` char(80) NOT NULL DEFAULT '', `Password` char(64) NOT NULL DEFAULT '', `Port` int(4) NOT NULL DEFAULT 0, - `Socket` char(64) NOT NULL DEFAULT '', + `Socket` char(108) NOT NULL DEFAULT '', `Wrapper` char(64) NOT NULL DEFAULT '', `Owner` varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (`Server_name`) diff --git a/mysql-test/main/system_mysql_db_fix50568.result b/mysql-test/main/system_mysql_db_fix50568.result index 0feea2ba896..f520fa3d80b 100644 --- a/mysql-test/main/system_mysql_db_fix50568.result +++ b/mysql-test/main/system_mysql_db_fix50568.result @@ -172,7 +172,7 @@ servers CREATE TABLE `servers` ( `Username` char(80) NOT NULL DEFAULT '', `Password` char(64) NOT NULL DEFAULT '', `Port` int(4) NOT NULL DEFAULT 0, - `Socket` char(64) NOT NULL DEFAULT '', + `Socket` char(108) NOT NULL DEFAULT '', `Wrapper` char(64) NOT NULL DEFAULT '', `Owner` varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (`Server_name`) diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql.result b/mysql-test/suite/funcs_1/r/is_columns_mysql.result index e707c46e726..62ff9f4e7a6 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result @@ -163,7 +163,7 @@ def mysql servers Owner 9 '' NO varchar 512 1536 NULL NULL NULL utf8 utf8_genera def mysql servers Password 5 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references NEVER NULL def mysql servers Port 6 0 NO int NULL NULL 10 0 NULL NULL NULL int(4) select,insert,update,references NEVER NULL def mysql servers Server_name 1 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) PRI select,insert,update,references NEVER NULL -def mysql servers Socket 7 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references NEVER NULL +def mysql servers Socket 7 '' NO char 108 324 NULL NULL NULL utf8 utf8_general_ci char(108) select,insert,update,references NEVER NULL def mysql servers Username 4 '' NO char 80 240 NULL NULL NULL utf8 utf8_general_ci char(80) select,insert,update,references NEVER NULL def mysql servers Wrapper 8 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references NEVER NULL def mysql slow_log db 7 NULL NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) select,insert,update,references NEVER NULL @@ -490,7 +490,7 @@ NULL mysql proxies_priv Timestamp timestamp NULL NULL NULL NULL timestamp 3.0000 mysql servers Username char 80 240 utf8 utf8_general_ci char(80) 3.0000 mysql servers Password char 64 192 utf8 utf8_general_ci char(64) NULL mysql servers Port int NULL NULL NULL NULL int(4) -3.0000 mysql servers Socket char 64 192 utf8 utf8_general_ci char(64) +3.0000 mysql servers Socket char 108 324 utf8 utf8_general_ci char(108) 3.0000 mysql servers Wrapper char 64 192 utf8 utf8_general_ci char(64) 3.0000 mysql servers Owner varchar 512 1536 utf8 utf8_general_ci varchar(512) NULL mysql slow_log start_time timestamp NULL NULL NULL NULL timestamp(6) diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result index 606a555a5e4..858d587d1a1 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result @@ -149,7 +149,7 @@ def mysql servers Owner 9 '' NO varchar 512 1536 NULL NULL NULL utf8 utf8_genera def mysql servers Password 5 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) NEVER NULL def mysql servers Port 6 0 NO int NULL NULL 10 0 NULL NULL NULL int(4) NEVER NULL def mysql servers Server_name 1 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) PRI NEVER NULL -def mysql servers Socket 7 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) NEVER NULL +def mysql servers Socket 7 '' NO char 108 324 NULL NULL NULL utf8 utf8_general_ci char(108) NEVER NULL def mysql servers Username 4 '' NO char 80 240 NULL NULL NULL utf8 utf8_general_ci char(80) NEVER NULL def mysql servers Wrapper 8 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) NEVER NULL def mysql slow_log db 7 NULL NO varchar 512 1536 NULL NULL NULL utf8 utf8_general_ci varchar(512) NEVER NULL @@ -473,7 +473,7 @@ NULL mysql proxies_priv Timestamp timestamp NULL NULL NULL NULL timestamp 3.0000 mysql servers Username char 80 240 utf8 utf8_general_ci char(80) 3.0000 mysql servers Password char 64 192 utf8 utf8_general_ci char(64) NULL mysql servers Port int NULL NULL NULL NULL int(4) -3.0000 mysql servers Socket char 64 192 utf8 utf8_general_ci char(64) +3.0000 mysql servers Socket char 108 324 utf8 utf8_general_ci char(108) 3.0000 mysql servers Wrapper char 64 192 utf8 utf8_general_ci char(64) 3.0000 mysql servers Owner varchar 512 1536 utf8 utf8_general_ci varchar(512) NULL mysql slow_log start_time timestamp NULL NULL NULL NULL timestamp(6) diff --git a/scripts/mysql_system_tables.sql b/scripts/mysql_system_tables.sql index 5a00356d409..a6631690a00 100644 --- a/scripts/mysql_system_tables.sql +++ b/scripts/mysql_system_tables.sql @@ -108,7 +108,7 @@ CREATE TABLE IF NOT EXISTS func ( name char(64) binary DEFAULT '' NOT NULL, ret CREATE TABLE IF NOT EXISTS plugin ( name varchar(64) DEFAULT '' NOT NULL, dl varchar(128) DEFAULT '' NOT NULL, PRIMARY KEY (name) ) engine=Aria transactional=1 CHARACTER SET utf8 COLLATE utf8_general_ci comment='MySQL plugins'; -CREATE TABLE IF NOT EXISTS servers ( Server_name char(64) NOT NULL DEFAULT '', Host varchar(2048) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(80) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(64) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) engine=Aria transactional=1 CHARACTER SET utf8 comment='MySQL Foreign Servers table'; +CREATE TABLE IF NOT EXISTS servers ( Server_name char(64) NOT NULL DEFAULT '', Host varchar(2048) NOT NULL DEFAULT '', Db char(64) NOT NULL DEFAULT '', Username char(80) NOT NULL DEFAULT '', Password char(64) NOT NULL DEFAULT '', Port INT(4) NOT NULL DEFAULT '0', Socket char(108) NOT NULL DEFAULT '', Wrapper char(64) NOT NULL DEFAULT '', Owner varchar(512) NOT NULL DEFAULT '', PRIMARY KEY (Server_name)) engine=Aria transactional=1 CHARACTER SET utf8 comment='MySQL Foreign Servers table'; CREATE TABLE IF NOT EXISTS tables_priv ( Host char(60) binary DEFAULT '' NOT NULL, Db char(64) binary DEFAULT '' NOT NULL, User char(80) binary DEFAULT '' NOT NULL, Table_name char(64) binary DEFAULT '' NOT NULL, Grantor char(141) DEFAULT '' NOT NULL, Timestamp timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, Table_priv set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger','Delete versioning rows') COLLATE utf8_general_ci DEFAULT '' NOT NULL, Column_priv set('Select','Insert','Update','References') COLLATE utf8_general_ci DEFAULT '' NOT NULL, PRIMARY KEY (Host,Db,User,Table_name), KEY Grantor (Grantor) ) engine=Aria transactional=1 CHARACTER SET utf8 COLLATE utf8_bin comment='Table privileges'; diff --git a/scripts/mysql_system_tables_fix.sql b/scripts/mysql_system_tables_fix.sql index e5bdc4314f7..f0b5cac46fe 100644 --- a/scripts/mysql_system_tables_fix.sql +++ b/scripts/mysql_system_tables_fix.sql @@ -851,3 +851,7 @@ DELIMITER ; ALTER TABLE servers MODIFY Host varchar(2048) NOT NULL DEFAULT '', MODIFY Owner varchar(512) NOT NULL DEFAULT ''; + +# MDEV-34716 Fix mysql.servers socket max length too short +ALTER TABLE servers + MODIFY Socket char(108) NOT NULL DEFAULT ''; diff --git a/storage/spider/mysql-test/spider/r/alter_server.result b/storage/spider/mysql-test/spider/r/alter_server.result new file mode 100644 index 00000000000..19255f3cdf8 --- /dev/null +++ b/storage/spider/mysql-test/spider/r/alter_server.result @@ -0,0 +1,29 @@ +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 Socket from mysql.servers where Server_name = "srv"; +Socket +/tmp/1234567890_1234567890_1234567890_1234567890_1234567890_1234567890.sock +create table t2 (c int); +alter SERVER srv OPTIONS (DATABASE 'test'); +create table t1 (c int) ENGINE=Spider +COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +insert into t1 values (1), (2), (3); +select * from t1; +c +1 +2 +3 +select * from t2; +c +1 +2 +3 +drop table t1, t2; +drop server srv; +for master_1 +for child2 +for child3 diff --git a/storage/spider/mysql-test/spider/t/alter_server.cnf b/storage/spider/mysql-test/spider/t/alter_server.cnf new file mode 100644 index 00000000000..69672af4ef6 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/alter_server.cnf @@ -0,0 +1,5 @@ +[mysqld.1.1] +socket= /tmp/1234567890_1234567890_1234567890_1234567890_1234567890_1234567890.sock + +[ENV] +MASTER_1_MYSOCK= @mysqld.1.1.socket diff --git a/storage/spider/mysql-test/spider/t/alter_server.test b/storage/spider/mysql-test/spider/t/alter_server.test new file mode 100644 index 00000000000..10228e785cb --- /dev/null +++ b/storage/spider/mysql-test/spider/t/alter_server.test @@ -0,0 +1,27 @@ +--disable_query_log +--disable_result_log +--source test_init.inc +--enable_result_log +--enable_query_log +set spider_same_server_link= 1; + +# Test long socket length +evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql +OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root'); +select Socket from mysql.servers where Server_name = "srv"; +create table t2 (c int); +# triggers a table read into the server object +alter SERVER srv OPTIONS (DATABASE 'test'); +create table t1 (c int) ENGINE=Spider +COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"'; +insert into t1 values (1), (2), (3); +select * from t1; +select * from t2; +drop table t1, t2; +drop server srv; + +--disable_query_log +--disable_result_log +--source test_deinit.inc +--enable_result_log +--enable_query_log From 7c9cbe684b5b62d7215f5d6d833ea29b7d5da56c Mon Sep 17 00:00:00 2001 From: Dave Gosselin Date: Fri, 13 Dec 2024 14:42:40 -0500 Subject: [PATCH 38/84] MDEV-35648 Update partition lc2 tests for mac Partition tests requiring lower_case_table_names = 2 (default on macOS) fail on mac because the product has changed over time but the tests were not run regularly enough to observe their breakage. --- .../parts/r/partition_mgm_lc2_innodb.result | 49 +++++++++---------- .../parts/r/partition_mgm_lc2_memory.result | 49 +++++++++---------- .../parts/r/partition_mgm_lc2_myisam.result | 49 +++++++++---------- 3 files changed, 72 insertions(+), 75 deletions(-) diff --git a/mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result b/mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result index 6cd4c4991b7..84265955dc6 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc2_innodb.result @@ -55,7 +55,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -83,7 +83,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -111,7 +111,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -126,7 +126,7 @@ SHOW CREATE TABLE TableB; Table Create Table TableB CREATE TABLE `TableB` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT PARTITION_NAME, IF(TABLE_ROWS, 'YES', 'NO') AS HAVE_TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME HAVE_TABLE_ROWS parta NO @@ -155,7 +155,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -191,7 +191,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB, @@ -263,7 +263,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB, @@ -288,7 +288,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after KEY PARTITIONING test DROP TABLE TableA; # 2.0 HASH partitioning mgm @@ -354,7 +354,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -382,7 +382,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = InnoDB, PARTITION `partB` ENGINE = InnoDB, @@ -418,7 +418,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB, @@ -490,7 +490,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = InnoDB, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = InnoDB, @@ -515,7 +515,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after HASH PARTITIONING test DROP TABLE TableA; # 3.0 RANGE partitioning mgm @@ -570,7 +570,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION `partB` VALUES LESS THAN (7) ENGINE = InnoDB, @@ -601,7 +601,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION `partB` VALUES LESS THAN (7) ENGINE = InnoDB, @@ -639,7 +639,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = InnoDB, @@ -712,7 +712,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = InnoDB, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = InnoDB, @@ -738,7 +738,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after RANGE PARTITIONING test DROP TABLE TableA; # 4.0 LIST partitioning mgm @@ -793,7 +793,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = InnoDB, PARTITION `partB` VALUES IN (2,10,11) ENGINE = InnoDB, @@ -824,7 +824,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = InnoDB, PARTITION `partB` VALUES IN (2,10,11) ENGINE = InnoDB, @@ -862,7 +862,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = InnoDB, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = InnoDB, @@ -927,7 +927,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = InnoDB, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = InnoDB, @@ -951,7 +951,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=latin1 +) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after LIST PARTITIONING test DROP TABLE TableA; # Testing TRUNCATE PARTITION @@ -970,7 +970,7 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL AUTO_INCREMENT, `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=InnoDB AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 +) ENGINE=InnoDB AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `LT1000` VALUES LESS THAN (1000) ENGINE = InnoDB, PARTITION `LT2000` VALUES LESS THAN (2000) ENGINE = InnoDB, @@ -987,7 +987,6 @@ a b 2001 Second in MAX ALTER TABLE t1 ANALYZE PARTITION MAX; Table Op Msg_type Msg_text -mysql_test_db.t1 analyze status Engine-independent statistics collected mysql_test_db.t1 analyze status OK # Truncate without FLUSH ALTER TABLE t1 TRUNCATE PARTITION MAX; diff --git a/mysql-test/suite/parts/r/partition_mgm_lc2_memory.result b/mysql-test/suite/parts/r/partition_mgm_lc2_memory.result index d1b7a599923..5e089f2d2b5 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc2_memory.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc2_memory.result @@ -55,7 +55,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -83,7 +83,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -111,7 +111,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -126,7 +126,7 @@ SHOW CREATE TABLE TableB; Table Create Table TableB CREATE TABLE `TableB` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT PARTITION_NAME, IF(TABLE_ROWS, 'YES', 'NO') AS HAVE_TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME HAVE_TABLE_ROWS parta NO @@ -155,7 +155,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -191,7 +191,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY, @@ -263,7 +263,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY, @@ -288,7 +288,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after KEY PARTITIONING test DROP TABLE TableA; # 2.0 HASH partitioning mgm @@ -354,7 +354,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -382,7 +382,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = MEMORY, PARTITION `partB` ENGINE = MEMORY, @@ -418,7 +418,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY, @@ -490,7 +490,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MEMORY, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MEMORY, @@ -515,7 +515,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after HASH PARTITIONING test DROP TABLE TableA; # 3.0 RANGE partitioning mgm @@ -570,7 +570,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MEMORY, @@ -601,7 +601,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MEMORY, @@ -639,7 +639,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MEMORY, @@ -712,7 +712,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MEMORY, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MEMORY, @@ -738,7 +738,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after RANGE PARTITIONING test DROP TABLE TableA; # 4.0 LIST partitioning mgm @@ -793,7 +793,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MEMORY, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MEMORY, @@ -824,7 +824,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MEMORY, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MEMORY, @@ -862,7 +862,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MEMORY, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MEMORY, @@ -927,7 +927,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MEMORY, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MEMORY, @@ -951,7 +951,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MEMORY DEFAULT CHARSET=latin1 +) ENGINE=MEMORY DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after LIST PARTITIONING test DROP TABLE TableA; # Testing TRUNCATE PARTITION @@ -970,7 +970,7 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL AUTO_INCREMENT, `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MEMORY AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 +) ENGINE=MEMORY AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `LT1000` VALUES LESS THAN (1000) ENGINE = MEMORY, PARTITION `LT2000` VALUES LESS THAN (2000) ENGINE = MEMORY, @@ -987,7 +987,6 @@ a b 2001 Second in MAX ALTER TABLE t1 ANALYZE PARTITION MAX; Table Op Msg_type Msg_text -mysql_test_db.t1 analyze status Engine-independent statistics collected mysql_test_db.t1 analyze note The storage engine for the table doesn't support analyze # Truncate without FLUSH ALTER TABLE t1 TRUNCATE PARTITION MAX; diff --git a/mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result b/mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result index ad83e95929a..26f168e3734 100644 --- a/mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result +++ b/mysql-test/suite/parts/r/partition_mgm_lc2_myisam.result @@ -55,7 +55,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -83,7 +83,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -111,7 +111,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -126,7 +126,7 @@ SHOW CREATE TABLE TableB; Table Create Table TableB CREATE TABLE `TableB` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci SELECT PARTITION_NAME, IF(TABLE_ROWS, 'YES', 'NO') AS HAVE_TABLE_ROWS FROM INFORMATION_SCHEMA.PARTITIONS WHERE TABLE_SCHEMA ='MySQL_Test_DB' AND TABLE_NAME = 'TableA'; PARTITION_NAME HAVE_TABLE_ROWS parta NO @@ -155,7 +155,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -191,7 +191,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM, @@ -263,7 +263,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY KEY (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM, @@ -288,7 +288,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after KEY PARTITIONING test DROP TABLE TableA; # 2.0 HASH partitioning mgm @@ -354,7 +354,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -382,7 +382,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `parta` ENGINE = MyISAM, PARTITION `partB` ENGINE = MyISAM, @@ -418,7 +418,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM, @@ -490,7 +490,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY HASH (`a`) (PARTITION `partB` COMMENT = 'Previusly named parta' ENGINE = MyISAM, PARTITION `parta` COMMENT = 'Previusly named partB' ENGINE = MyISAM, @@ -515,7 +515,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after HASH PARTITIONING test DROP TABLE TableA; # 3.0 RANGE partitioning mgm @@ -570,7 +570,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MyISAM, @@ -601,7 +601,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION `partB` VALUES LESS THAN (7) ENGINE = MyISAM, @@ -639,7 +639,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MyISAM, @@ -712,7 +712,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `parta` VALUES LESS THAN (4) ENGINE = MyISAM, PARTITION `partD` VALUES LESS THAN (8) COMMENT = 'Previously partB and partly Partc' ENGINE = MyISAM, @@ -738,7 +738,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after RANGE PARTITIONING test DROP TABLE TableA; # 4.0 LIST partitioning mgm @@ -793,7 +793,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MyISAM, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MyISAM, @@ -824,7 +824,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `parta` VALUES IN (1,8,9) ENGINE = MyISAM, PARTITION `partB` VALUES IN (2,10,11) ENGINE = MyISAM, @@ -862,7 +862,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MyISAM, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MyISAM, @@ -927,7 +927,7 @@ SHOW CREATE TABLE tablea; Table Create Table tablea CREATE TABLE `tablea` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY LIST (`a`) (PARTITION `Partc` VALUES IN (1,7) COMMENT = 'Mix 1 of old parta and Partc' ENGINE = MyISAM, PARTITION `parta` VALUES IN (3,9) COMMENT = 'Mix 2 of old parta and Partc' ENGINE = MyISAM, @@ -951,7 +951,7 @@ SHOW CREATE TABLE TableA; Table Create Table TableA CREATE TABLE `TableA` ( `a` int(11) DEFAULT NULL -) ENGINE=MyISAM DEFAULT CHARSET=latin1 +) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci # Cleaning up after LIST PARTITIONING test DROP TABLE TableA; # Testing TRUNCATE PARTITION @@ -970,7 +970,7 @@ t1 CREATE TABLE `t1` ( `a` bigint(20) NOT NULL AUTO_INCREMENT, `b` varchar(255) DEFAULT NULL, PRIMARY KEY (`a`) -) ENGINE=MyISAM AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 +) ENGINE=MyISAM AUTO_INCREMENT=2002 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci PARTITION BY RANGE (`a`) (PARTITION `LT1000` VALUES LESS THAN (1000) ENGINE = MyISAM, PARTITION `LT2000` VALUES LESS THAN (2000) ENGINE = MyISAM, @@ -987,7 +987,6 @@ a b 2001 Second in MAX ALTER TABLE t1 ANALYZE PARTITION MAX; Table Op Msg_type Msg_text -mysql_test_db.t1 analyze status Engine-independent statistics collected mysql_test_db.t1 analyze status OK # Truncate without FLUSH ALTER TABLE t1 TRUNCATE PARTITION MAX; From 28463b2824eadca343d1951b956366b44793384f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 12 Dec 2024 09:28:49 +0200 Subject: [PATCH 39/84] TODO-5067 : Add test case for Galera library protocol versions This version of test requires Galera library 26.4.21 to work. Signed-off-by: Julius Goryavsky --- .../suite/wsrep/r/wsrep_protocol_versions.result | 7 +++++++ .../suite/wsrep/t/wsrep_protocol_versions.cnf | 13 +++++++++++++ 2 files changed, 20 insertions(+) create mode 100644 mysql-test/suite/wsrep/r/wsrep_protocol_versions.result create mode 100644 mysql-test/suite/wsrep/t/wsrep_protocol_versions.cnf diff --git a/mysql-test/suite/wsrep/r/wsrep_protocol_versions.result b/mysql-test/suite/wsrep/r/wsrep_protocol_versions.result new file mode 100644 index 00000000000..35139f5b9cf --- /dev/null +++ b/mysql-test/suite/wsrep/r/wsrep_protocol_versions.result @@ -0,0 +1,7 @@ +# Correct Galera library found +show status like 'wsrep_protocol%'; +Variable_name Value +wsrep_protocol_application 4 +wsrep_protocol_gcs 5 +wsrep_protocol_replicator 11 +wsrep_protocol_version 11 diff --git a/mysql-test/suite/wsrep/t/wsrep_protocol_versions.cnf b/mysql-test/suite/wsrep/t/wsrep_protocol_versions.cnf new file mode 100644 index 00000000000..f4d5689404c --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep_protocol_versions.cnf @@ -0,0 +1,13 @@ +# Use default setting for mysqld processes +!include include/default_mysqld.cnf + +[mysqld.1] +wsrep-on=ON +binlog-format=ROW +innodb-flush-log-at-trx-commit=1 +wsrep-cluster-address=gcomm:// +wsrep-provider=@ENV.WSREP_PROVIDER +innodb-autoinc-lock-mode=2 +#galera_port=@OPT.port +#ist_port=@OPT.port +#sst_port=@OPT.port From ee2dc336d7e22df6feec96481dd075ab1d16359b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Thu, 12 Dec 2024 12:22:53 +0200 Subject: [PATCH 40/84] TODO-5067 addendum : Add test case for Galera library protocol versions Add missing file Signed-off-by: Julius Goryavsky --- mysql-test/suite/wsrep/t/wsrep_protocol_versions.test | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 mysql-test/suite/wsrep/t/wsrep_protocol_versions.test diff --git a/mysql-test/suite/wsrep/t/wsrep_protocol_versions.test b/mysql-test/suite/wsrep/t/wsrep_protocol_versions.test new file mode 100644 index 00000000000..f8979050686 --- /dev/null +++ b/mysql-test/suite/wsrep/t/wsrep_protocol_versions.test @@ -0,0 +1,9 @@ +--source include/have_wsrep.inc +--source include/force_restart.inc +--source include/have_innodb.inc + +--let $galera_version=26.4.21 +source include/check_galera_version.inc; + +--sorted_result +show status like 'wsrep_protocol%'; From d72c5d1ace69b4506b8761508bf03bed48ade5a5 Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Tue, 10 Dec 2024 15:08:38 +0100 Subject: [PATCH 41/84] Fixup for MDEV-35446 The previous commit for fixing MDEV-35446 disabled setting Galera errors on COM_STMT_PREPARE commands. As a side effect, a number of tests were started to fail due to the client receiving different error codes from the ones expected in the test dependending on whether --ps-protocol was used. Also, in the case of test galera_ftwrl, it was found that it is expected that during COM_STMT_PREPARE command, we may perform a sync wait operation, which can fail with LOCK_WAIT_TIMEOUT error. The revised fix consists in anticipating the call to wsrep_after_command_before_result(), so that we check for BF aborts or errors during statement prepare, before sending back the statement metadata message to client. Signed-off-by: Julius Goryavsky --- sql/sql_parse.cc | 25 +++++++++++++++++-------- sql/sql_prepare.cc | 10 ++++++++++ 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index e7699a3f464..319d5e6535b 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1165,8 +1165,7 @@ static bool wsrep_command_no_result(char command) { return (command == COM_STMT_FETCH || command == COM_STMT_SEND_LONG_DATA || - command == COM_STMT_CLOSE || - command == COM_STMT_PREPARE); + command == COM_STMT_CLOSE); } #endif /* WITH_WSREP */ #ifndef EMBEDDED_LIBRARY @@ -2444,13 +2443,23 @@ dispatch_end: { DEBUG_SYNC(thd, "wsrep_at_dispatch_end_before_result"); } - wsrep_after_command_before_result(thd); - if (wsrep_current_error(thd) && !wsrep_command_no_result(command)) + if (thd->wsrep_cs().state() == wsrep::client_state::s_exec) { - /* todo: Pass wsrep client state current error to override */ - wsrep_override_error(thd, wsrep_current_error(thd), - wsrep_current_error_status(thd)); - WSREP_LOG_THD(thd, "leave"); + wsrep_after_command_before_result(thd); + if (wsrep_current_error(thd) && !wsrep_command_no_result(command)) + { + /* todo: Pass wsrep client state current error to override */ + wsrep_override_error(thd, wsrep_current_error(thd), + wsrep_current_error_status(thd)); + WSREP_LOG_THD(thd, "leave"); + } + } + else + { + /* wsrep_after_command_before_result() already called elsewhere + or not necessary to call it */ + assert(thd->wsrep_cs().state() == wsrep::client_state::s_none || + thd->wsrep_cs().state() == wsrep::client_state::s_result); } if (WSREP(thd)) { diff --git a/sql/sql_prepare.cc b/sql/sql_prepare.cc index 3d7dda16643..93e81b2025d 100644 --- a/sql/sql_prepare.cc +++ b/sql/sql_prepare.cc @@ -2355,6 +2355,16 @@ static bool check_prepared_statement(Prepared_statement *stmt) #ifdef WITH_WSREP if (wsrep_sync_wait(thd, sql_command)) goto error; + if (!stmt->is_sql_prepare()) + { + wsrep_after_command_before_result(thd); + if (wsrep_current_error(thd)) + { + wsrep_override_error(thd, wsrep_current_error(thd), + wsrep_current_error_status(thd)); + goto error; + } + } #endif switch (sql_command) { case SQLCOM_REPLACE: From 75dd0246f8b0b7c1d7d7762415089a74c433cb1d Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Wed, 11 Dec 2024 17:35:53 +0100 Subject: [PATCH 42/84] Remove error handling from wsrep_sync_wait() Let the wsrep-lib error be set/overriden at the end of dispatch_command(). Signed-off-by: Julius Goryavsky --- sql/wsrep_mysqld.cc | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 4a2c439cb43..6c4fd8c950a 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -1231,35 +1231,7 @@ bool wsrep_sync_wait (THD* thd, uint mask) This allows autocommit SELECTs and a first SELECT after SET AUTOCOMMIT=0 TODO: modify to check if thd has locked any rows. */ - if (thd->wsrep_cs().sync_wait(-1)) - { - const char* msg; - int err; - - /* - Possibly relevant error codes: - ER_CHECKREAD, ER_ERROR_ON_READ, ER_INVALID_DEFAULT, ER_EMPTY_QUERY, - ER_FUNCTION_NOT_DEFINED, ER_NOT_ALLOWED_COMMAND, ER_NOT_SUPPORTED_YET, - ER_FEATURE_DISABLED, ER_QUERY_INTERRUPTED - */ - - switch (thd->wsrep_cs().current_error()) - { - case wsrep::e_not_supported_error: - msg= "synchronous reads by wsrep backend. " - "Please unset wsrep_causal_reads variable."; - err= ER_NOT_SUPPORTED_YET; - break; - default: - msg= "Synchronous wait failed."; - err= ER_LOCK_WAIT_TIMEOUT; // NOTE: the above msg won't be displayed - // with ER_LOCK_WAIT_TIMEOUT - } - - my_error(err, MYF(0), msg); - - return true; - } + return thd->wsrep_cs().sync_wait(-1); } return false; From eadf96cea4a572807bf46d179ab13ee69518b0e1 Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Thu, 10 Oct 2024 14:28:49 +0200 Subject: [PATCH 43/84] MDEV-26266 Update wsrep-lib Update wsrep-lib to fix the issue and add the MTR test case from the ticket. Signed-off-by: Julius Goryavsky --- mysql-test/suite/galera/r/MDEV-26266.result | 23 ++++++++++++++ mysql-test/suite/galera/t/MDEV-26266.test | 35 +++++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 mysql-test/suite/galera/r/MDEV-26266.result create mode 100644 mysql-test/suite/galera/t/MDEV-26266.test diff --git a/mysql-test/suite/galera/r/MDEV-26266.result b/mysql-test/suite/galera/r/MDEV-26266.result new file mode 100644 index 00000000000..01171d4bb83 --- /dev/null +++ b/mysql-test/suite/galera/r/MDEV-26266.result @@ -0,0 +1,23 @@ +connection node_2; +connection node_1; +SET SESSION query_prealloc_size=8192; +SET max_session_mem_used=50000; +CREATE TABLE t1 (c1 INT NOT NULL) ENGINE=InnoDB ; +UPDATE t1 SET c1='1'; +ERROR HY000: The MariaDB server is running with the --max-session-mem-used=50000 option so it cannot execute this statement +SET wsrep_trx_fragment_size=1; +SET SESSION AUTOCOMMIT=0; +INSERT INTO t1 VALUES (1); +SET @inserted_value=REPEAT ('z', 257); +CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB ; +SELECT * FROM t1 WHERE c1='two'; +ERROR HY000: The MariaDB server is running with the --max-session-mem-used=50000 option so it cannot execute this statement +UPDATE t1 SET c1='2'; +INSERT INTO t2 VALUES (2); +ERROR HY000: The MariaDB server is running with the --max-session-mem-used=50000 option so it cannot execute this statement +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 TABLE t1,t2; diff --git a/mysql-test/suite/galera/t/MDEV-26266.test b/mysql-test/suite/galera/t/MDEV-26266.test new file mode 100644 index 00000000000..7167e029cb5 --- /dev/null +++ b/mysql-test/suite/galera/t/MDEV-26266.test @@ -0,0 +1,35 @@ +# +# MDEV-26266 - Assertion +# state() == s_preparing || +# (is_xa() && state() == s_replaying) || +# (ret && (state() == s_must_abort || +# state() == s_must_replay || +# state() == s_cert_failed || +# state() == s_aborted)) +# failed. +# + +--source include/galera_cluster.inc + +SET SESSION query_prealloc_size=8192; +SET max_session_mem_used=50000; +CREATE TABLE t1 (c1 INT NOT NULL) ENGINE=InnoDB ; +--error ER_OPTION_PREVENTS_STATEMENT +UPDATE t1 SET c1='1'; +SET wsrep_trx_fragment_size=1; +SET SESSION AUTOCOMMIT=0; +INSERT INTO t1 VALUES (1); +SET @inserted_value=REPEAT ('z', 257); +CREATE TABLE t2 (a INT PRIMARY KEY) ENGINE=InnoDB ; +--error ER_OPTION_PREVENTS_STATEMENT +SELECT * FROM t1 WHERE c1='two'; +UPDATE t1 SET c1='2'; +--error ER_OPTION_PREVENTS_STATEMENT +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 TABLE t1,t2; From c93ffd5e583d7f15b095106eba0306f9f65e3f54 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 17 Dec 2024 09:53:19 +0100 Subject: [PATCH 44/84] galera: wsrep-lib submodule update --- wsrep-lib | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wsrep-lib b/wsrep-lib index 1c61b809d1e..70cd967f5e2 160000 --- a/wsrep-lib +++ b/wsrep-lib @@ -1 +1 @@ -Subproject commit 1c61b809d1e1d03771dcad689d3a084e17c6b6c3 +Subproject commit 70cd967f5e249b53d6cce90e2e4198641c564381 From 7b0f59da43b4967e49333d0bf7b793ee66fe16cd Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Tue, 17 Dec 2024 09:56:54 +0100 Subject: [PATCH 45/84] wsrep mtr suite: update for galera library 26.4.21 --- mysql-test/suite/wsrep/r/variables.result | 3 +++ mysql-test/suite/wsrep/r/variables_debug.result | 3 +++ mysql-test/suite/wsrep/t/variables.test | 2 +- mysql-test/suite/wsrep/t/variables_debug.test | 2 +- 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result index c21e4dc0323..73cc5afc559 100644 --- a/mysql-test/suite/wsrep/r/variables.result +++ b/mysql-test/suite/wsrep/r/variables.result @@ -3,6 +3,9 @@ SHOW GLOBAL STATUS LIKE 'wsrep%'; Variable_name Value wsrep_local_state_uuid # wsrep_protocol_version # +wsrep_protocol_application # +wsrep_protocol_replicator # +wsrep_protocol_gcs # wsrep_last_committed # wsrep_replicated # wsrep_replicated_bytes # diff --git a/mysql-test/suite/wsrep/r/variables_debug.result b/mysql-test/suite/wsrep/r/variables_debug.result index 65f5b0ee274..f9f8a736d8d 100644 --- a/mysql-test/suite/wsrep/r/variables_debug.result +++ b/mysql-test/suite/wsrep/r/variables_debug.result @@ -3,6 +3,9 @@ SHOW GLOBAL STATUS LIKE 'wsrep%'; Variable_name Value wsrep_local_state_uuid # wsrep_protocol_version # +wsrep_protocol_application # +wsrep_protocol_replicator # +wsrep_protocol_gcs # wsrep_last_committed # wsrep_replicated # wsrep_replicated_bytes # diff --git a/mysql-test/suite/wsrep/t/variables.test b/mysql-test/suite/wsrep/t/variables.test index e40ac7b8772..3f3363d8f26 100644 --- a/mysql-test/suite/wsrep/t/variables.test +++ b/mysql-test/suite/wsrep/t/variables.test @@ -3,7 +3,7 @@ --source include/have_innodb.inc --source include/galera_no_debug_sync.inc ---let $galera_version=26.4.9 +--let $galera_version=26.4.21 source include/check_galera_version.inc; source include/galera_variables_ok.inc; diff --git a/mysql-test/suite/wsrep/t/variables_debug.test b/mysql-test/suite/wsrep/t/variables_debug.test index 29747e48f18..4d0de10ed0a 100644 --- a/mysql-test/suite/wsrep/t/variables_debug.test +++ b/mysql-test/suite/wsrep/t/variables_debug.test @@ -5,7 +5,7 @@ --source include/have_debug_sync.inc --source include/galera_have_debug_sync.inc ---let $galera_version=26.4.9 +--let $galera_version=26.4.21 source include/check_galera_version.inc; source include/galera_variables_ok.inc; From a226f12675c6312ca7632b90261397e313e6a7ae Mon Sep 17 00:00:00 2001 From: Dave Gosselin Date: Thu, 5 Dec 2024 09:36:52 -0500 Subject: [PATCH 46/84] MDEV-35578 innodb_gis.rtree_debug fails on mac strerror_s on Linux will, for unknown error codes, display 'Unknown error ' and our tests are written with this assumption. However, on macOS, sterror_s returns 'Unknown error: ' in the same case, which breaks tests. Make my_strerror consistent across the platforms by removing the ':' when present. --- strings/my_vsnprintf.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/strings/my_vsnprintf.c b/strings/my_vsnprintf.c index 8b4dc5da561..e072ff880f5 100644 --- a/strings/my_vsnprintf.c +++ b/strings/my_vsnprintf.c @@ -860,6 +860,27 @@ int my_fprintf(FILE *stream, const char* format, ...) } +#ifdef __APPLE__ +/* Delete the ':' character added by Apple's implementation of strerror_r */ +static void delete_colon_char(char *buf) +{ + static const char *unknown_err= "Unknown error"; + static const size_t unknown_err_len= 13; + char *ptr= strstr(buf, unknown_err); + char *src= NULL; + if (ptr) { + ptr+= unknown_err_len; + if (*ptr == ':') { + // just overwrite the colon by shifting everything down by one, + // e.g. "Unknown error: 1000" becomes "Unknown error 1000" + src= ptr + 1; + memmove(ptr, src, strlen(src) + 1); // include null + } + } +} +#endif + + /* Return system error text for given error number @@ -913,6 +934,10 @@ const char* my_strerror(char *buf, size_t len, int nr) #else strerror_r(nr, buf, len); #endif + +#ifdef __APPLE__ + delete_colon_char(buf); +#endif } /* From 3f22f5f2fe76cb95378b57c0095aebe5e0ae5e11 Mon Sep 17 00:00:00 2001 From: mariadb-DebarunBanerjee Date: Wed, 18 Dec 2024 14:20:30 +0530 Subject: [PATCH 47/84] MDEV-35679 Potential issue in Secondary Index with ROW_FORMAT=COMPRESSED and Change buffering enabled In function buf_page_create_low(), remove duplicate code that over-write the ibuf_exist variable incorrectly when only compressed page is loaded in buffer pool. This would help removing any old change buffer record immediately before re-using the page. --- storage/innobase/buf/buf0buf.cc | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index c6adcb675f7..9387a146aee 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -3347,24 +3347,12 @@ retry: } else { - auto state= bpage->state(); - ut_ad(state >= buf_page_t::FREED); - ut_ad(state < buf_page_t::READ_FIX); - page_hash_latch &hash_lock= buf_pool.page_hash.lock_get(chain); /* It does not make sense to use transactional_lock_guard here, because buf_relocate() would likely make the memory transaction too large. */ hash_lock.lock(); - if (state < buf_page_t::UNFIXED) - bpage->set_reinit(buf_page_t::FREED); - else - { - bpage->set_reinit(state & buf_page_t::LRU_MASK); - ibuf_exist= (state & buf_page_t::LRU_MASK) == buf_page_t::IBUF_EXIST; - } - mysql_mutex_lock(&buf_pool.flush_list_mutex); buf_relocate(bpage, &free_block->page); free_block->page.lock.x_lock(); From 07b77e862cd36a055a319458fef218eb58467599 Mon Sep 17 00:00:00 2001 From: Daniele Sciascia Date: Tue, 17 Dec 2024 13:34:02 +0100 Subject: [PATCH 48/84] MDEV-35660 Assertion `trx->xid.is_null()' failed The assertion fails during wsrep recovery step, in function innobase_rollback_by_xid(). The transaction's xid is normally cleared as part of lookup by xid, unless the transaction has a wsrep specific xid. This is a regression from MDEV-24035 (commit ddd7d5d8e34c3edd) which removed the part clears xid before rollback for transaction with a wsrep specific xid. --- storage/innobase/handler/ha_innodb.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index ffed80b1341..ee18adbf909 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3076,7 +3076,10 @@ static int innobase_rollback_by_xid(handlerton*, XID *xid) noexcept return XAER_RMFAIL; if (trx_t *trx= trx_get_trx_by_xid(xid)) { - ut_ad(trx->xid.is_null()); /* should have been cleared by the lookup */ + /* Lookup by xid clears the transaction xid. + For wsrep we clear it below. */ + ut_ad(trx->xid.is_null() || wsrep_is_wsrep_xid(&trx->xid)); + trx->xid.null(); trx_deregister_from_2pc(trx); THD* thd= trx->mysql_thd; dberr_t err= trx_rollback_for_mysql(trx); From e5c4c0842d0a11b9919efcda09377083a4a0d69a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 19 Dec 2024 14:05:16 +0200 Subject: [PATCH 49/84] MDEV-35443: opt_search_plan_for_table() may degrade to full table scan MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit opt_calc_index_goodness(): Correct an inaccurate condition. We can very well use a clustered index of a table that is subject to online rebuild. But we must not choose an index that has not been committed (it is a secondary index that was not fully created) or that is corrupted or not a normal B-tree index. opt_search_plan_for_table(): Remove some redundant code, now that opt_calc_index_goodness() checks against corrupted indexes. The test case allows this code to be exercised. The main observation in the following: ./mtr --rr innodb.stats_persistent rr replay var/log/mysqld.1.rr/latest-trace should be that when opt_search_plan_for_table() is being invoked by dict_stats_update_persistent() on the being-altered statistics table in the 2nd call after ha_innobase::inplace_alter_table(), and the fix in opt_calc_index_goodness() is absent, it would choose the code path if (n_fields == 0), that is, a full table scan, instead of searching for the record. The GDB commands to execute in "rr replay" would be as follows: break ha_innobase::inplace_alter_table continue break opt_search_plan_for_table continue continue next next … Reviewed by: Vladislav Lesin --- mysql-test/suite/innodb/r/stats_persistent.result | 9 +++++++++ mysql-test/suite/innodb/t/stats_persistent.test | 11 +++++++++++ storage/innobase/include/dict0mem.h | 8 ++++++++ storage/innobase/pars/pars0opt.cc | 13 +++++-------- 4 files changed, 33 insertions(+), 8 deletions(-) diff --git a/mysql-test/suite/innodb/r/stats_persistent.result b/mysql-test/suite/innodb/r/stats_persistent.result index 7e9c038d6f7..2752811a07c 100644 --- a/mysql-test/suite/innodb/r/stats_persistent.result +++ b/mysql-test/suite/innodb/r/stats_persistent.result @@ -6,14 +6,23 @@ SET DEBUG_SYNC='dict_stats_update_persistent SIGNAL stop WAIT_FOR go'; ANALYZE TABLE t1; connect con1, localhost, root; SET DEBUG_SYNC='now WAIT_FOR stop'; +connect con2, localhost, root; +SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL astop WAIT_FOR ago'; +ALTER TABLE mysql.innodb_index_stats FORCE; +connection con1; SELECT SUM(DATA_LENGTH+INDEX_LENGTH) FROM information_schema.TABLES WHERE ENGINE='InnoDB'; SUM(DATA_LENGTH+INDEX_LENGTH) SUM +SET DEBUG_SYNC='now WAIT_FOR astop'; SET DEBUG_SYNC='now SIGNAL go'; disconnect con1; connection default; Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +SET DEBUG_SYNC='now SIGNAL ago'; +connection con2; +disconnect con2; +connection default; SET DEBUG_SYNC= 'RESET'; DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/stats_persistent.test b/mysql-test/suite/innodb/t/stats_persistent.test index 8561298c4d3..870808993f4 100644 --- a/mysql-test/suite/innodb/t/stats_persistent.test +++ b/mysql-test/suite/innodb/t/stats_persistent.test @@ -14,14 +14,25 @@ SET DEBUG_SYNC='dict_stats_update_persistent SIGNAL stop WAIT_FOR go'; --connect(con1, localhost, root) SET DEBUG_SYNC='now WAIT_FOR stop'; +--connect(con2, localhost, root) +SET DEBUG_SYNC='innodb_inplace_alter_table_enter SIGNAL astop WAIT_FOR ago'; +send ALTER TABLE mysql.innodb_index_stats FORCE; + +--connection con1 --replace_column 1 SUM SELECT SUM(DATA_LENGTH+INDEX_LENGTH) FROM information_schema.TABLES WHERE ENGINE='InnoDB'; +SET DEBUG_SYNC='now WAIT_FOR astop'; SET DEBUG_SYNC='now SIGNAL go'; --disconnect con1 --connection default --reap +SET DEBUG_SYNC='now SIGNAL ago'; +--connection con2 +reap; +--disconnect con2 +--connection default SET DEBUG_SYNC= 'RESET'; DROP TABLE t1; diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 5cebfe6710d..5ec2273ef65 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -1203,6 +1203,14 @@ public: /** @return whether this is the change buffer */ bool is_ibuf() const { return UNIV_UNLIKELY(type & DICT_IBUF); } + /** @return whether this is a normal, non-virtual B-tree index + (not the change buffer, not SPATIAL or FULLTEXT) */ + bool is_normal_btree() const noexcept { + return UNIV_LIKELY(!(type & (DICT_IBUF | DICT_SPATIAL + | DICT_FTS | DICT_CORRUPT + | DICT_VIRTUAL))); + } + /** @return whether the index includes virtual columns */ bool has_virtual() const { return type & DICT_VIRTUAL; } diff --git a/storage/innobase/pars/pars0opt.cc b/storage/innobase/pars/pars0opt.cc index e1a913b0179..a5ab15b74d4 100644 --- a/storage/innobase/pars/pars0opt.cc +++ b/storage/innobase/pars/pars0opt.cc @@ -340,9 +340,7 @@ opt_calc_index_goodness( ulint op; ulint j; - /* At least for now we don't support using FTS indexes for queries - done through InnoDB's own SQL parser. */ - if (dict_index_is_online_ddl(index) || (index->type & DICT_FTS)) { + if (!index->is_normal_btree() || !index->is_committed()) { return(0); } @@ -572,11 +570,10 @@ opt_search_plan_for_table( /* Calculate goodness for each index of the table */ index = dict_table_get_first_index(table); - best_index = index; /* Eliminate compiler warning */ + best_index = index; best_goodness = 0; - /* should be do ... until ? comment by Jani */ - while (index) { + do { goodness = opt_calc_index_goodness(index, sel_node, i, index_plan, &last_op); if (goodness > best_goodness) { @@ -590,8 +587,8 @@ opt_search_plan_for_table( best_last_op = last_op; } - dict_table_next_uncorrupted_index(index); - } + index = dict_table_get_next_index(index); + } while (index); plan->index = best_index; From f2ffcd949b797dd04c6277e5a8939279dd0a107c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 19 Dec 2024 14:18:55 +0200 Subject: [PATCH 50/84] MDEV-35657: Add work-arounds for clang 11 --- extra/mariabackup/fil_cur.cc | 1 + extra/mariabackup/xtrabackup.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc index 2383e3a03a7..4d0e99332a2 100644 --- a/extra/mariabackup/fil_cur.cc +++ b/extra/mariabackup/fil_cur.cc @@ -187,6 +187,7 @@ xb_fil_cur_open( } #else err = fstat(cursor->file.m_file, &cursor->statinfo); + MSAN_STAT_WORKAROUND(&cursor->statinfo); #endif if (max_file_size < (ulonglong)cursor->statinfo.st_size) { cursor->statinfo.st_size = (ulonglong)max_file_size; diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index d8015a0e331..a59e8f0858f 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -3648,6 +3648,7 @@ next_file: return(-1); } + MSAN_STAT_WORKAROUND(&statinfo); info->size = statinfo.st_size; if (S_ISDIR(statinfo.st_mode)) { From d878d80bc4a3ee6f044c0dd68601d86cd435332e Mon Sep 17 00:00:00 2001 From: Eric Herman Date: Thu, 19 Dec 2024 16:40:18 +0100 Subject: [PATCH 51/84] MDEV-35695: mtr failure suggests wrong url When running the ./mtr tests and getting failures, rather than provide a dead-link to mysql.com, this points developers to the Jira instance. Signed-off-by: Eric Herman --- mysql-test/lib/mtr_report.pm | 5 ++--- mysql-test/lib/v1/mtr_report.pl | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/mysql-test/lib/mtr_report.pm b/mysql-test/lib/mtr_report.pm index 308dbb77a3e..ff239d676a9 100644 --- a/mysql-test/lib/mtr_report.pm +++ b/mysql-test/lib/mtr_report.pm @@ -454,9 +454,8 @@ sub mtr_report_stats ($$$$) { # Print info about reporting the error print "The log files in var/log may give you some hint of what went wrong.\n\n", - "If you want to report this error, please read first ", - "the documentation\n", - "at http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html\n\n"; + "If you want to report this error, MariaDB's bug tracker is found at\n", + "https://jira.mariadb.org\n\n"; } else diff --git a/mysql-test/lib/v1/mtr_report.pl b/mysql-test/lib/v1/mtr_report.pl index 8964b0f8077..6f8677110ba 100644 --- a/mysql-test/lib/v1/mtr_report.pl +++ b/mysql-test/lib/v1/mtr_report.pl @@ -198,9 +198,8 @@ sub mtr_report_stats ($) { print "The log files in var/log may give you some hint\n", "of what went wrong.\n", - "If you want to report this error, please read first ", - "the documentation at\n", - "http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html\n"; + "If you want to report this error, MariaDB's bug tracker is found at\n", + "https://jira.mariadb.org\n" } if (!$::opt_extern) { From 24e5d564005904bc589fc869ea2f913eec8e6c3a Mon Sep 17 00:00:00 2001 From: Oleg Smirnov Date: Fri, 20 Dec 2024 14:58:33 +0700 Subject: [PATCH 52/84] MDEV-35680 Table number > MAX_TABLES causes overflow of table_map at main.join test Fix a regression introduced by commit d98ac851 (MDEV-29935, MDEV-26247) causing MAX_TABLES overflow in `setup_table_map()`. The check for MAX_TABLES was moved outside of the loop that increments table numbers, allowing overflows during loop iterations. Since setup_table_map() operates on a 64-bit bitmap, table numbers exceeding 64 triggered the UBSAN check. This commit returns the overflow check within the loop and adds a debug assertion to `setup_table_map()` to ensure no bitmap overrun occurs. --- sql/sql_base.cc | 14 +++++++++----- sql/sql_base.h | 1 + 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/sql/sql_base.cc b/sql/sql_base.cc index bcab54ac1ec..5c03ba3d42d 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -7862,11 +7862,15 @@ bool setup_tables(THD *thd, Name_resolution_context *context, DBUG_RETURN(1); } tablenr++; - } - if (tablenr > MAX_TABLES) - { - my_error(ER_TOO_MANY_TABLES,MYF(0), static_cast(MAX_TABLES)); - DBUG_RETURN(1); + /* + Test MAX_TABLES overflow here inside the loop as setup_table_map() + called in each iteration is sensitive for this + */ + if (tablenr > MAX_TABLES) + { + my_error(ER_TOO_MANY_TABLES, MYF(0), static_cast(MAX_TABLES)); + DBUG_RETURN(1); + } } if (select_insert && !is_insert_tables_num_set) { diff --git a/sql/sql_base.h b/sql/sql_base.h index 894c8213e66..90c47e69d94 100644 --- a/sql/sql_base.h +++ b/sql/sql_base.h @@ -353,6 +353,7 @@ inline void setup_table_map(TABLE *table, TABLE_LIST *table_list, uint tablenr) table->maybe_null= embedding->outer_join; embedding= embedding->embedding; } + DBUG_ASSERT(tablenr <= MAX_TABLES); table->tablenr= tablenr; table->map= (table_map) 1 << tablenr; table->force_index= table_list->force_index; From ed5bba8a327c5f29f1960dde6d63912c4c44c9d9 Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 27 Dec 2024 16:14:51 +0200 Subject: [PATCH 53/84] Fixed failing test case innodb.log_file_size_online --- mysql-test/suite/innodb/r/log_file_size_online.result | 2 +- mysql-test/suite/innodb/t/log_file_size_online.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/innodb/r/log_file_size_online.result b/mysql-test/suite/innodb/r/log_file_size_online.result index 197e1145b77..7b2b23bd776 100644 --- a/mysql-test/suite/innodb/r/log_file_size_online.result +++ b/mysql-test/suite/innodb/r/log_file_size_online.result @@ -19,7 +19,7 @@ SHOW VARIABLES LIKE 'innodb_log_file_size'; Variable_name Value innodb_log_file_size 4194304 FOUND 1 /InnoDB: Resized log to 4\.000MiB/ in mysqld.1.err -SET @save=@@GLOBAL.innodb_log_file_buffering; +SET @save=@@global.innodb_log_file_buffering; SET GLOBAL innodb_log_file_buffering=OFF; SET GLOBAL innodb_log_file_buffering=ON; SET GLOBAL innodb_log_file_buffering=@save; diff --git a/mysql-test/suite/innodb/t/log_file_size_online.test b/mysql-test/suite/innodb/t/log_file_size_online.test index 0435e288cbc..bf9f3510592 100644 --- a/mysql-test/suite/innodb/t/log_file_size_online.test +++ b/mysql-test/suite/innodb/t/log_file_size_online.test @@ -26,7 +26,7 @@ let SEARCH_PATTERN = InnoDB: Resized log to 4\\.000MiB; --source include/search_pattern_in_file.inc --error 0,ER_UNKNOWN_SYSTEM_VARIABLE -SET @save=@@GLOBAL.innodb_log_file_buffering; +SET @save=@@global.innodb_log_file_buffering; --error 0,ER_UNKNOWN_SYSTEM_VARIABLE SET GLOBAL innodb_log_file_buffering=OFF; --error 0,ER_UNKNOWN_SYSTEM_VARIABLE From 95975b921e900551240ac28457e28efb6d02c1bb Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 27 Dec 2024 19:26:55 +0200 Subject: [PATCH 54/84] MDEV-35720 Add query_time to statistics Added Query_time (total time spent running queries) to status_variables. Other things: - Added SHOW_MICROSECOND_STATUS type that shows an ulonglong variable in microseconds converted to a double (in seconds). - Changed Busy_time and Cpu_time to use SHOW_MICROSECOND_STATUS, which simplified the code and avoids some double divisions for each query. Reviewed-by: Sergei Golubchik --- mysql-test/main/log_state.result | 36 +++++++++++++++++++++++++++++ mysql-test/main/log_state.test | 39 ++++++++++++++++++++++++++++++++ sql/mysqld.cc | 6 ++--- sql/sql_class.cc | 13 +++++++---- sql/sql_class.h | 2 +- sql/sql_plugin.h | 2 +- sql/sql_show.cc | 10 ++++++++ 7 files changed, 99 insertions(+), 9 deletions(-) diff --git a/mysql-test/main/log_state.result b/mysql-test/main/log_state.result index 5e7aac81b0c..af8d7d98455 100644 --- a/mysql-test/main/log_state.result +++ b/mysql-test/main/log_state.result @@ -275,6 +275,42 @@ SELECT @@general_log_file = @my_glf; @@general_log_file = @my_glf 1 SET GLOBAL general_log_file = @old_general_log_file; +# +# MDEV-35720 Add query_time to statistics +# +connect con2,localhost,root,,; +set @s1=(select variable_value from information_schema.session_status where +variable_name='query_time'); +select sleep(3) into @a; +set @s2=(select variable_value from information_schema.session_status where +variable_name='query_time'); +set @s3=(select variable_value from information_schema.global_status where +variable_name='query_time'); +select @s1 >= 0.00 and @s1 <= 2.00 as "should be true"; +should be true +1 +select @s2 >= 2.00 and @s2 < 10.00 as "should be true"; +should be true +1 +select @s3 >= 3.00 as "should be true"; +should be true +1 +disconnect con2; +connection default; +create procedure p1() +begin +select sleep(1) into @a; +select sleep(2) into @a; +end| +connect con2,localhost,root,,; +call p1(); +set @s1=(select variable_value from information_schema.session_status where +variable_name='query_time'); +select @s1 > 2.00 and @s1 < 10.00 as "should be true"; +should be true +1 +disconnect con2; +connection default; disconnect con1; connection default; SET GLOBAL long_query_time = @save_long_query_time; diff --git a/mysql-test/main/log_state.test b/mysql-test/main/log_state.test index 44a844a67b0..93e35854355 100644 --- a/mysql-test/main/log_state.test +++ b/mysql-test/main/log_state.test @@ -321,6 +321,45 @@ SET GLOBAL general_log_file = @old_general_log_file; --enable_ps_protocol +--echo # +--echo # MDEV-35720 Add query_time to statistics +--echo # + +connect (con2,localhost,root,,); +set @s1=(select variable_value from information_schema.session_status where +variable_name='query_time'); +select sleep(3) into @a; +set @s2=(select variable_value from information_schema.session_status where +variable_name='query_time'); +set @s3=(select variable_value from information_schema.global_status where +variable_name='query_time'); + +select @s1 >= 0.00 and @s1 <= 2.00 as "should be true"; +select @s2 >= 2.00 and @s2 < 10.00 as "should be true"; +select @s3 >= 3.00 as "should be true"; + +# select @s1,@s2,@s3; +disconnect con2; +connection default; + +delimiter |; +create procedure p1() +begin +select sleep(1) into @a; +select sleep(2) into @a; +end| +delimiter ;| + +connect (con2,localhost,root,,); +call p1(); +set @s1=(select variable_value from information_schema.session_status where +variable_name='query_time'); +select @s1 > 2.00 and @s1 < 10.00 as "should be true"; + +# select @s1; +disconnect con2; +connection default; + # # Cleanup # diff --git a/sql/mysqld.cc b/sql/mysqld.cc index a910602018b..f1d21163a3e 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -6913,7 +6913,6 @@ static int show_queries(THD *thd, SHOW_VAR *var, void *, return 0; } - static int show_net_compression(THD *thd, SHOW_VAR *var, void *, system_status_var *, enum_var_type) { @@ -7430,7 +7429,7 @@ SHOW_VAR status_vars[]= { {"Binlog_cache_use", (char*) &binlog_cache_use, SHOW_LONG}, {"Binlog_stmt_cache_disk_use",(char*) &binlog_stmt_cache_disk_use, SHOW_LONG}, {"Binlog_stmt_cache_use", (char*) &binlog_stmt_cache_use, SHOW_LONG}, - {"Busy_time", (char*) offsetof(STATUS_VAR, busy_time), SHOW_DOUBLE_STATUS}, + {"Busy_time", (char*) offsetof(STATUS_VAR, busy_time), SHOW_MICROSECOND_STATUS}, {"Bytes_received", (char*) offsetof(STATUS_VAR, bytes_received), SHOW_LONGLONG_STATUS}, {"Bytes_sent", (char*) offsetof(STATUS_VAR, bytes_sent), SHOW_LONGLONG_STATUS}, {"Column_compressions", (char*) offsetof(STATUS_VAR, column_compressions), SHOW_LONG_STATUS}, @@ -7444,7 +7443,7 @@ SHOW_VAR status_vars[]= { {"Connection_errors_peer_address", (char*) &connection_errors_peer_addr, SHOW_LONG}, {"Connection_errors_select", (char*) &connection_errors_select, SHOW_LONG}, {"Connection_errors_tcpwrap", (char*) &connection_errors_tcpwrap, SHOW_LONG}, - {"Cpu_time", (char*) offsetof(STATUS_VAR, cpu_time), SHOW_DOUBLE_STATUS}, + {"Cpu_time", (char*) offsetof(STATUS_VAR, cpu_time), SHOW_MICROSECOND_STATUS}, {"Created_tmp_disk_tables", (char*) offsetof(STATUS_VAR, created_tmp_disk_tables_), SHOW_LONG_STATUS}, {"Created_tmp_files", (char*) &my_tmp_file_created, SHOW_LONG}, {"Created_tmp_tables", (char*) offsetof(STATUS_VAR, created_tmp_tables_), SHOW_LONG_STATUS}, @@ -7561,6 +7560,7 @@ SHOW_VAR status_vars[]= { {"Qcache_total_blocks", (char*) &query_cache.total_blocks, SHOW_LONG_NOFLUSH}, #endif /*HAVE_QUERY_CACHE*/ {"Queries", (char*) &show_queries, SHOW_SIMPLE_FUNC}, + {"Query_time", (char*) offsetof(STATUS_VAR, query_time), SHOW_MICROSECOND_STATUS}, {"Questions", (char*) offsetof(STATUS_VAR, questions), SHOW_LONG_STATUS}, #ifdef HAVE_REPLICATION {"Rpl_status", (char*) &show_rpl_status, SHOW_SIMPLE_FUNC}, diff --git a/sql/sql_class.cc b/sql/sql_class.cc index c2b44945e91..572c8ec167d 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1419,7 +1419,10 @@ void THD::update_stats(void) void THD::update_all_stats() { ulonglong end_cpu_time, end_utime; - double busy_time, cpu_time; + ulonglong busy_time, cpu_time; + + status_var_add(status_var.query_time, + (utime_after_query - utime_after_lock)); /* This is set at start of query if opt_userstat_running was set */ if (!userstat_running) @@ -1427,10 +1430,10 @@ void THD::update_all_stats() end_cpu_time= my_getcputime(); end_utime= microsecond_interval_timer(); - busy_time= (end_utime - start_utime) / 1000000.0; - cpu_time= (end_cpu_time - start_cpu_time) / 10000000.0; + busy_time= end_utime - start_utime; + cpu_time= end_cpu_time - start_cpu_time; /* In case there are bad values, 2629743 is the #seconds in a month. */ - if (cpu_time > 2629743.0) + if (cpu_time > 2629743000000ULL) cpu_time= 0; status_var_add(status_var.cpu_time, cpu_time); status_var_add(status_var.busy_time, busy_time); @@ -1853,6 +1856,7 @@ void add_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var) to_var->table_open_cache_hits+= from_var->table_open_cache_hits; to_var->table_open_cache_misses+= from_var->table_open_cache_misses; to_var->table_open_cache_overflows+= from_var->table_open_cache_overflows; + to_var->query_time+= from_var->query_time; /* Update global_memory_used. We have to do this with atomic_add as the @@ -1910,6 +1914,7 @@ void add_diff_to_status(STATUS_VAR *to_var, STATUS_VAR *from_var, dec_var->table_open_cache_misses; to_var->table_open_cache_overflows+= from_var->table_open_cache_overflows - dec_var->table_open_cache_overflows; + to_var->query_time+= from_var->query_time - dec_var->query_time; /* We don't need to accumulate memory_used as these are not reset or used by diff --git a/sql/sql_class.h b/sql/sql_class.h index d0918b2eb67..fb8d6129561 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1046,8 +1046,8 @@ typedef struct system_status_var ulonglong table_open_cache_misses; ulonglong table_open_cache_overflows; ulonglong send_metadata_skips; + ulonglong cpu_time, busy_time, query_time; double last_query_cost; - double cpu_time, busy_time; uint32 threads_running; /* Don't initialize */ /* Memory used for thread local storage */ diff --git a/sql/sql_plugin.h b/sql/sql_plugin.h index d9e48ff64b1..60ff6859e4c 100644 --- a/sql/sql_plugin.h +++ b/sql/sql_plugin.h @@ -26,7 +26,7 @@ SHOW_LONG_NOFLUSH, SHOW_LEX_STRING, SHOW_ATOMIC_COUNTER_UINT32_T, \ /* SHOW_*_STATUS must be at the end, SHOW_LONG_STATUS being first */ \ SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS, SHOW_LONGLONG_STATUS, \ - SHOW_UINT32_STATUS + SHOW_UINT32_STATUS, SHOW_MICROSECOND_STATUS, #include "mariadb.h" #undef SHOW_always_last diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 718971a2574..36d3e629d79 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -3737,6 +3737,16 @@ const char* get_one_variable(THD *thd, case SHOW_SLONGLONG: end= longlong10_to_str(*value.as_longlong, buff, -10); break; + case SHOW_MICROSECOND_STATUS: + { + /* Show a long long as double in seconds */ + ulonglong microseconds; + value.as_char= status_var_value.as_char + value.as_intptr; + microseconds= *value.as_longlong; + /* 6 is the default precision for '%f' in sprintf() */ + end= buff + my_fcvt(microseconds / 1000000.0, 6, buff, NULL); + break; + } case SHOW_HAVE: { pos= show_comp_option_name[(int) *value.as_show_comp_options]; From 48b724047e4638e4795019e69d90fb26010d924a Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Thu, 2 Jan 2025 17:34:24 +0530 Subject: [PATCH 55/84] MDEV-34119 Assertion `page_dir_get_n_heap(new_page) == 2U' failed in dberr_t PageBulk::init() Problem: ======= - insert..select statement on partition table fails to use bulk insert for the transaction. Solution: ======== - Enable the bulk insert operation for insert..select statement for partition table. --- .../suite/innodb/r/insert_into_empty,4k.rdiff | 10 ++++++---- .../suite/innodb/r/insert_into_empty,8k.rdiff | 10 ++++++---- .../suite/innodb/r/insert_into_empty.result | 17 +++++++++++++++++ .../suite/innodb/t/insert_into_empty.test | 19 +++++++++++++++++++ storage/innobase/row/row0ins.cc | 18 +++++++++++++++++- 5 files changed, 65 insertions(+), 9 deletions(-) diff --git a/mysql-test/suite/innodb/r/insert_into_empty,4k.rdiff b/mysql-test/suite/innodb/r/insert_into_empty,4k.rdiff index 358005bbeff..9964ae21f9f 100644 --- a/mysql-test/suite/innodb/r/insert_into_empty,4k.rdiff +++ b/mysql-test/suite/innodb/r/insert_into_empty,4k.rdiff @@ -9,11 +9,10 @@ CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK -@@ -541,26 +541,4 @@ - DELETE FROM t1; +@@ -542,28 +542,6 @@ commit; DROP TABLE t1; --# + # -# MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)' -# failed in cmp_rec_rec_simple_field -# @@ -35,4 +34,7 @@ -(REPEAT('x',16111),'bb'), (REPEAT('x',4805),'cc'), -(REPEAT('x',65535),'dd'); -DROP TABLE t1; - # End of 10.11 tests +-# + # Assertion `page_dir_get_n_heap(new_page) == 2U' failed + # in dberr_t PageBulk::init() + # diff --git a/mysql-test/suite/innodb/r/insert_into_empty,8k.rdiff b/mysql-test/suite/innodb/r/insert_into_empty,8k.rdiff index 99ad06d971a..6a10197f021 100644 --- a/mysql-test/suite/innodb/r/insert_into_empty,8k.rdiff +++ b/mysql-test/suite/innodb/r/insert_into_empty,8k.rdiff @@ -9,11 +9,10 @@ CHECK TABLE t1; Table Op Msg_type Msg_text test.t1 check status OK -@@ -541,26 +541,4 @@ - DELETE FROM t1; +@@ -542,28 +542,6 @@ commit; DROP TABLE t1; --# + # -# MDEV-35475 Assertion `!rec_offs_nth_extern(offsets1, n)' -# failed in cmp_rec_rec_simple_field -# @@ -35,4 +34,7 @@ -(REPEAT('x',16111),'bb'), (REPEAT('x',4805),'cc'), -(REPEAT('x',65535),'dd'); -DROP TABLE t1; - # End of 10.11 tests +-# + # Assertion `page_dir_get_n_heap(new_page) == 2U' failed + # in dberr_t PageBulk::init() + # diff --git a/mysql-test/suite/innodb/r/insert_into_empty.result b/mysql-test/suite/innodb/r/insert_into_empty.result index 4277d2c3fa6..b9cfe965c13 100644 --- a/mysql-test/suite/innodb/r/insert_into_empty.result +++ b/mysql-test/suite/innodb/r/insert_into_empty.result @@ -563,4 +563,21 @@ INSERT INTO t1 VALUES (REPEAT('x',4805),'a'), (REPEAT('x',16111),'b'), (REPEAT('x',16111),'bb'), (REPEAT('x',4805),'cc'), (REPEAT('x',65535),'dd'); DROP TABLE t1; +# +# Assertion `page_dir_get_n_heap(new_page) == 2U' failed +# in dberr_t PageBulk::init() +# +CREATE TABLE t1(f1 INT)ENGINE=InnoDB PARTITION BY RANGE (f1) (PARTITION p0 VALUES LESS THAN (100)); +SET @old_bulk_op= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_bulk_operations'); +BEGIN; +INSERT INTO t1 SELECT seq FROM seq_1_to_1; +COMMIT; +SELECT variable_value-@old_bulk_op bulk_operations +FROM information_schema.global_status +WHERE variable_name = 'innodb_bulk_operations'; +bulk_operations +1 +DROP TABLE t1; # End of 10.11 tests diff --git a/mysql-test/suite/innodb/t/insert_into_empty.test b/mysql-test/suite/innodb/t/insert_into_empty.test index 79f6c23f7ee..de36ccdb85f 100644 --- a/mysql-test/suite/innodb/t/insert_into_empty.test +++ b/mysql-test/suite/innodb/t/insert_into_empty.test @@ -619,4 +619,23 @@ INSERT INTO t1 VALUES (REPEAT('x',4805),'a'), (REPEAT('x',16111),'b'), (REPEAT('x',65535),'dd'); DROP TABLE t1; } + +--echo # +--echo # Assertion `page_dir_get_n_heap(new_page) == 2U' failed +--echo # in dberr_t PageBulk::init() +--echo # +CREATE TABLE t1(f1 INT)ENGINE=InnoDB PARTITION BY RANGE (f1) (PARTITION p0 VALUES LESS THAN (100)); + +SET @old_bulk_op= +(SELECT variable_value FROM information_schema.global_status +WHERE variable_name = 'innodb_bulk_operations'); + +BEGIN; +INSERT INTO t1 SELECT seq FROM seq_1_to_1; +COMMIT; + +SELECT variable_value-@old_bulk_op bulk_operations +FROM information_schema.global_status +WHERE variable_name = 'innodb_bulk_operations'; +DROP TABLE t1; --echo # End of 10.11 tests diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index 17d784e7d65..c060759410f 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -2562,6 +2562,22 @@ row_ins_index_entry_big_rec( return(error); } +/** Check whether the executed sql command is from insert +statement +@param thd thread information +@return true if it is insert statement */ +static bool thd_sql_is_insert(const THD *thd) noexcept +{ + switch(thd_sql_command(thd)) + { + case SQLCOM_INSERT: + case SQLCOM_INSERT_SELECT: + return true; + default: + return false; + } +} + #if defined __aarch64__&&defined __GNUC__&&__GNUC__==4&&!defined __clang__ /* Avoid GCC 4.8.5 internal compiler error due to srw_mutex::wr_unlock(). We would only need this for row_ins_clust_index_entry_low(), @@ -2712,7 +2728,7 @@ err_exit: && block->page.id().page_no() == index->page && !index->table->is_native_online_ddl() && (!dict_table_is_partition(index->table) - || thd_sql_command(trx->mysql_thd) == SQLCOM_INSERT)) { + || thd_sql_is_insert(trx->mysql_thd))) { if (!index->table->n_rec_locks && !index->table->versioned() From 52c29f3bdc8afd1f4f4b91956d233c500f21ae5a Mon Sep 17 00:00:00 2001 From: Monty Date: Thu, 21 Nov 2024 12:28:57 +0200 Subject: [PATCH 56/84] MDEV-35469 Heap tables are calling mallocs to often Heap tables are allocated blocks to store rows according to my_default_record_cache (mapped to the server global variable read_buffer_size). This causes performance issues when the record length is big (> 1000 bytes) and the my_default_record_cache is small. Changed to instead split the default heap allocation to 1/16 of the allowed space and not use my_default_record_cache anymore when creating the heap. The allocation is also aligned to be just under a power of 2. For some test that I have been running, which was using record length=633, the speed of the query doubled thanks to this change. Other things: - Fixed calculation of max_records passed to hp_create() to take into account padding between records. - Updated calculation of memory needed by heap tables. Before we did not take into account internal structures needed to access rows. - Changed block sized for memory_table from 1 to 16384 to get less fragmentation. This also avoids a problem where we need 1K to manage index and row storage which was not counted for before. - Moved heap memory usage to a separate test for 32 bit. - Allocate all data blocks in heap in powers of 2. Change reported memory usage for heap to reflect this. Reviewed-by: Sergei Golubchik --- include/heap.h | 1 + include/my_global.h | 2 +- mysql-test/main/count_distinct.result | 4 + mysql-test/main/derived_opt.result | 2 +- mysql-test/main/derived_opt.test | 2 +- mysql-test/main/derived_view.result | 2 + mysql-test/main/distinct.result | 2 + mysql-test/main/error_simulation.result | 17 ++- mysql-test/main/error_simulation.test | 19 ++-- mysql-test/main/order_by.result | 2 + mysql-test/main/set_operation.result | 6 +- mysql-test/main/set_operation.test | 4 +- mysql-test/main/union.result | 2 +- mysql-test/main/union.test | 2 +- mysql-test/main/update.result | 4 +- mysql-test/main/update.test | 2 +- mysql-test/main/variables.result | 2 +- mysql-test/main/variables.test | 2 +- mysql-test/suite/heap/heap.result | 52 --------- mysql-test/suite/heap/heap.test | 54 +--------- .../suite/heap/heap_memory_used,32bit.rdiff | 40 +++++++ mysql-test/suite/heap/heap_memory_used.result | 55 ++++++++++ mysql-test/suite/heap/heap_memory_used.test | 50 +++++++++ .../suite/maria/aria_sort_buffer.result | 2 + mysql-test/suite/maria/repair-big-sort.result | 2 + .../suite/sys_vars/r/maximum_basic.result | 2 +- .../sys_vars/r/sysvars_server_embedded.result | 4 +- .../r/sysvars_server_notembedded.result | 4 +- .../r/tmp_disk_table_size_func.result | 2 +- .../transaction_alloc_block_size_basic.result | 1 - .../suite/sys_vars/t/maximum_basic-master.opt | 2 +- .../sys_vars/t/tmp_disk_table_size_func.test | 2 +- .../t/transaction_alloc_block_size_basic.test | 2 - .../suite/versioning/r/partition.result | 4 +- mysql-test/suite/versioning/t/partition.test | 4 +- sql/sql_select.cc | 2 +- sql/sys_vars.cc | 4 +- storage/heap/ha_heap.cc | 14 ++- storage/heap/heapdef.h | 3 + storage/heap/hp_block.c | 4 +- storage/heap/hp_create.c | 101 ++++++++++++++---- storage/heap/hp_write.c | 27 ++--- 42 files changed, 316 insertions(+), 198 deletions(-) create mode 100644 mysql-test/suite/heap/heap_memory_used,32bit.rdiff create mode 100644 mysql-test/suite/heap/heap_memory_used.result create mode 100644 mysql-test/suite/heap/heap_memory_used.test diff --git a/include/heap.h b/include/heap.h index 2e0e9357a3b..3fac752abd0 100644 --- a/include/heap.h +++ b/include/heap.h @@ -105,6 +105,7 @@ typedef struct st_heap_block uint recbuffer; /* Length of one saved record */ ulong records_in_block; /* Records in one heap-block */ ulong last_allocated; /* number of records there is allocated space for */ + size_t alloc_size; /* Allocate blocks of this size */ } HP_BLOCK; struct st_heap_info; /* For reference */ diff --git a/include/my_global.h b/include/my_global.h index 6d5085b79a5..043a20b216f 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -670,7 +670,7 @@ typedef SOCKET_SIZE_TYPE size_socket; How much overhead does malloc have. The code often allocates something like 1024-MALLOC_OVERHEAD bytes */ -#define MALLOC_OVERHEAD 8 +#define MALLOC_OVERHEAD (8+24) /* get memory in huncs */ #define ONCE_ALLOC_INIT (uint) 4096 diff --git a/mysql-test/main/count_distinct.result b/mysql-test/main/count_distinct.result index 760b2710586..4454dcc524a 100644 --- a/mysql-test/main/count_distinct.result +++ b/mysql-test/main/count_distinct.result @@ -97,6 +97,8 @@ drop view v1; create table t1 (user_id char(64) character set utf8); insert t1 values(1),(2),(3),(4),(5),(6),(7),(8),(9),(10),(11),(12),(13),(14),(15),(16),(17); set @@tmp_table_size = 1024; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '1024' select count(distinct user_id) from t1; count(distinct user_id) 17 @@ -126,6 +128,8 @@ insert into t1 values ( 2 , 13 ), ( 3 , 14 ); set @@tmp_table_size=1024; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '1024' select count(distinct a) from t1; count(distinct a) 10 diff --git a/mysql-test/main/derived_opt.result b/mysql-test/main/derived_opt.result index cf0c1cb617f..c235027d556 100644 --- a/mysql-test/main/derived_opt.result +++ b/mysql-test/main/derived_opt.result @@ -310,7 +310,7 @@ a char(2) NOT NULL DEFAULT '', PRIMARY KEY (a) ) ENGINE=MyISAM; INSERT INTO t4 VALUES ('CD'); -set @@tmp_table_size=8192; +set @@tmp_table_size=16384; EXPLAIN SELECT * FROM t3 AS tx JOIN t2 AS ty ON (tx.pk = ty.pk) WHERE diff --git a/mysql-test/main/derived_opt.test b/mysql-test/main/derived_opt.test index dee424559ee..57c97cc4071 100644 --- a/mysql-test/main/derived_opt.test +++ b/mysql-test/main/derived_opt.test @@ -245,7 +245,7 @@ CREATE TABLE t4 ( ) ENGINE=MyISAM; INSERT INTO t4 VALUES ('CD'); -set @@tmp_table_size=8192; +set @@tmp_table_size=16384; --replace_column 9 # EXPLAIN diff --git a/mysql-test/main/derived_view.result b/mysql-test/main/derived_view.result index 6ddcf97c676..cd71cd05eb0 100644 --- a/mysql-test/main/derived_view.result +++ b/mysql-test/main/derived_view.result @@ -2183,6 +2183,8 @@ INSERT INTO t3 VALUES ('Miami'); SET @save_optimizer_switch=@@optimizer_switch; SET optimizer_switch = 'derived_with_keys=on'; SET @@tmp_table_size=1024*4; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '4096' explain SELECT * FROM (SELECT t1.* FROM t1, t2) AS t JOIN t3 ON t3.a = t.b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t3 system NULL NULL NULL NULL 1 diff --git a/mysql-test/main/distinct.result b/mysql-test/main/distinct.result index ec9253837be..4618b8962ad 100644 --- a/mysql-test/main/distinct.result +++ b/mysql-test/main/distinct.result @@ -1005,6 +1005,8 @@ DROP TABLE t1; # SET @tmp_table_size_save= @@tmp_table_size; SET @@tmp_table_size= 1024; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '1024' CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8); INSERT INTO t1 SELECT a+8 FROM t1; diff --git a/mysql-test/main/error_simulation.result b/mysql-test/main/error_simulation.result index 3b41e0bc5a4..c128ad88fa0 100644 --- a/mysql-test/main/error_simulation.result +++ b/mysql-test/main/error_simulation.result @@ -1,15 +1,12 @@ CREATE TABLE t1 ( -a varchar(32) character set utf8 collate utf8_bin NOT NULL, -b varchar(32) character set utf8 collate utf8_bin NOT NULL ) +a varchar(128) character set utf8 collate utf8_bin NOT NULL, +b varchar(128) character set utf8 collate utf8_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -INSERT INTO t1 VALUES -('AAAAAAAAAA','AAAAAAAAAA'), ('AAAAAAAAAB','AAAAAAAAAB '), -('AAAAAAAAAB','AAAAAAAAAB'), ('AAAAAAAAAC','AAAAAAAAAC'), -('AAAAAAAAAD','AAAAAAAAAD'), ('AAAAAAAAAE','AAAAAAAAAE'), -('AAAAAAAAAF','AAAAAAAAAF'), ('AAAAAAAAAG','AAAAAAAAAG'), -('AAAAAAAAAH','AAAAAAAAAH'), ('AAAAAAAAAI','AAAAAAAAAI'), -('AAAAAAAAAJ','AAAAAAAAAJ'), ('AAAAAAAAAK','AAAAAAAAAK'); -set tmp_table_size=1024; +INSERT INTO t1 +select concat(repeat("A", 50),char(32+mod(seq,31)),char(32+mod(seq,29))), +concat(repeat("A", 50),char(32+mod(seq,31)),char(32+mod(seq,29))) +from seq_1_to_128; +set tmp_table_size=16384; SET @saved_dbug = @@SESSION.debug_dbug; set session debug_dbug="+d,raise_error"; SELECT MAX(a) FROM t1 GROUP BY a,b; diff --git a/mysql-test/main/error_simulation.test b/mysql-test/main/error_simulation.test index c4e2d442727..fc5d9c537c7 100644 --- a/mysql-test/main/error_simulation.test +++ b/mysql-test/main/error_simulation.test @@ -1,23 +1,20 @@ --source include/have_debug.inc --source include/not_embedded.inc - +--source include/have_sequence.inc # # Bug #28499: crash for grouping query when tmp_table_size is too small # CREATE TABLE t1 ( - a varchar(32) character set utf8 collate utf8_bin NOT NULL, - b varchar(32) character set utf8 collate utf8_bin NOT NULL ) + a varchar(128) character set utf8 collate utf8_bin NOT NULL, + b varchar(128) character set utf8 collate utf8_bin NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8; -INSERT INTO t1 VALUES - ('AAAAAAAAAA','AAAAAAAAAA'), ('AAAAAAAAAB','AAAAAAAAAB '), - ('AAAAAAAAAB','AAAAAAAAAB'), ('AAAAAAAAAC','AAAAAAAAAC'), - ('AAAAAAAAAD','AAAAAAAAAD'), ('AAAAAAAAAE','AAAAAAAAAE'), - ('AAAAAAAAAF','AAAAAAAAAF'), ('AAAAAAAAAG','AAAAAAAAAG'), - ('AAAAAAAAAH','AAAAAAAAAH'), ('AAAAAAAAAI','AAAAAAAAAI'), - ('AAAAAAAAAJ','AAAAAAAAAJ'), ('AAAAAAAAAK','AAAAAAAAAK'); +INSERT INTO t1 +select concat(repeat("A", 50),char(32+mod(seq,31)),char(32+mod(seq,29))), + concat(repeat("A", 50),char(32+mod(seq,31)),char(32+mod(seq,29))) + from seq_1_to_128; -set tmp_table_size=1024; +set tmp_table_size=16384; # Set debug flag so an error is returned when # tmp table in query is converted from heap to myisam diff --git a/mysql-test/main/order_by.result b/mysql-test/main/order_by.result index 3f52f276001..db8ffed8fe9 100644 --- a/mysql-test/main/order_by.result +++ b/mysql-test/main/order_by.result @@ -4331,6 +4331,8 @@ CREATE TABLE t1(a VARCHAR(1027), b INT); INSERT INTO t1 SELECT seq, seq from seq_1_to_34; SET @save_tmp_memory_table_size= @@tmp_memory_table_size; SET tmp_memory_table_size= 1056*2; +Warnings: +Warning 1292 Truncated incorrect tmp_memory_table_size value: '2112' SELECT COUNT(DISTINCT a) FROM t1; COUNT(DISTINCT a) 34 diff --git a/mysql-test/main/set_operation.result b/mysql-test/main/set_operation.result index dd3912629bb..601f7ed916d 100644 --- a/mysql-test/main/set_operation.result +++ b/mysql-test/main/set_operation.result @@ -1085,10 +1085,8 @@ select 1 union all select 2 union all select 3 union select 4; 3 4 # test with limited resource -set @@max_heap_table_size= 1024; -Warnings: -Warning 1292 Truncated incorrect max_heap_table_size value: '1024' -set @@tmp_table_size= 1024; +set @@max_heap_table_size= 16384; +set @@tmp_table_size= 16384; create table t1 (a int, b int); insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(0,0); insert into t1 select * from t1; diff --git a/mysql-test/main/set_operation.test b/mysql-test/main/set_operation.test index c422042f371..11560d19008 100644 --- a/mysql-test/main/set_operation.test +++ b/mysql-test/main/set_operation.test @@ -457,8 +457,8 @@ select 1 union all select 2 union all select 3 union select 4; --echo # test with limited resource -set @@max_heap_table_size= 1024; -set @@tmp_table_size= 1024; +set @@max_heap_table_size= 16384; +set @@tmp_table_size= 16384; create table t1 (a int, b int); insert into t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(0,0); diff --git a/mysql-test/main/union.result b/mysql-test/main/union.result index 151ffdb4ad0..a0a38e2bd22 100644 --- a/mysql-test/main/union.result +++ b/mysql-test/main/union.result @@ -874,7 +874,7 @@ insert into t1 select * from t2; insert into t2 select * from t1; insert into t1 select * from t2; insert into t2 select * from t1; -set local tmp_table_size=1024; +set local tmp_table_size=16384; select count(*) from (select * from t1 union all select * from t2 order by 1) b; count(*) 21 diff --git a/mysql-test/main/union.test b/mysql-test/main/union.test index cabd1ad0b25..3ec933c6c08 100644 --- a/mysql-test/main/union.test +++ b/mysql-test/main/union.test @@ -503,7 +503,7 @@ insert into t1 select * from t2; insert into t2 select * from t1; insert into t1 select * from t2; insert into t2 select * from t1; -set local tmp_table_size=1024; +set local tmp_table_size=16384; select count(*) from (select * from t1 union all select * from t2 order by 1) b; select count(*) from t1; select count(*) from t2; diff --git a/mysql-test/main/update.result b/mysql-test/main/update.result index 9c91a4835fe..d91a74f9cef 100644 --- a/mysql-test/main/update.result +++ b/mysql-test/main/update.result @@ -491,7 +491,9 @@ a quux DROP TABLE t1; connect con1,localhost,root,,test; connection con1; -set tmp_table_size=1024; +set tmp_table_size=2048; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '2048' create table t1 (id int, a int, key idx(a)); create table t2 (id int unsigned not null auto_increment primary key, a int); insert into t2(a) values(1),(2),(3),(4),(5),(6),(7),(8); diff --git a/mysql-test/main/update.test b/mysql-test/main/update.test index 144f89b0053..9b329cce3c9 100644 --- a/mysql-test/main/update.test +++ b/mysql-test/main/update.test @@ -397,7 +397,7 @@ DROP TABLE t1; connect (con1,localhost,root,,test); connection con1; -set tmp_table_size=1024; +set tmp_table_size=2048; # Create the test tables create table t1 (id int, a int, key idx(a)); diff --git a/mysql-test/main/variables.result b/mysql-test/main/variables.result index 40fd69a321e..a16dcd2d44c 100644 --- a/mysql-test/main/variables.result +++ b/mysql-test/main/variables.result @@ -547,7 +547,7 @@ set global table_open_cache=100; set default_storage_engine=myisam; set global thread_cache_size=100; set timestamp=1, timestamp=default; -set tmp_table_size=1024; +set tmp_table_size=16384; set tx_isolation="READ-COMMITTED"; set wait_timeout=100; set log_warnings=1; diff --git a/mysql-test/main/variables.test b/mysql-test/main/variables.test index 1e5302e6d42..ff4d0c5ab3f 100644 --- a/mysql-test/main/variables.test +++ b/mysql-test/main/variables.test @@ -340,7 +340,7 @@ set global table_open_cache=100; set default_storage_engine=myisam; set global thread_cache_size=100; set timestamp=1, timestamp=default; -set tmp_table_size=1024; +set tmp_table_size=16384; set tx_isolation="READ-COMMITTED"; set wait_timeout=100; set log_warnings=1; diff --git a/mysql-test/suite/heap/heap.result b/mysql-test/suite/heap/heap.result index bef3913dcb1..583f4fc9b3f 100644 --- a/mysql-test/suite/heap/heap.result +++ b/mysql-test/suite/heap/heap.result @@ -798,58 +798,6 @@ id select_type table type possible_keys key key_len ref rows Extra 3 DERIVED t1 range PRIMARY PRIMARY 4 NULL 1 Using index condition; Using where DROP TABLE t1,t2,h1; DROP VIEW v1; -CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=100; -insert into t1 values(1); -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -data_length index_length -1600 2400 -drop table t1; -CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=10000; -insert into t1 values(1); -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -data_length index_length -16000 24000 -drop table t1; -CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=3000 max_rows=3000; -insert into t1 values(1); -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -data_length index_length -48000 72000 -drop table t1; -CREATE TABLE t1 (a int, index(a)) engine=heap max_rows=15000; -insert into t1 values(1); -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -data_length index_length -24000 36000 -drop table t1; -create table t1 (c1 int, index(c1)) engine=heap max_rows=10000; -insert into t1 select rand(100000000); -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1 limit 488; -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -data_length index_length -16000 24000 -insert into t1 select rand(100000000) from t1 limit 1; -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -data_length index_length -33024 49024 -insert into t1 select rand(100000000) from t1 limit 1000; -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -data_length index_length -49024 73024 -insert into t1 select rand(100000000) from t1; -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -data_length index_length -81024 121024 -drop table t1; CREATE TABLE t1 (id INT); INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (2); diff --git a/mysql-test/suite/heap/heap.test b/mysql-test/suite/heap/heap.test index ef950da5484..fdda9d54e0e 100644 --- a/mysql-test/suite/heap/heap.test +++ b/mysql-test/suite/heap/heap.test @@ -546,7 +546,7 @@ CREATE TABLE t1 ( ); INSERT INTO t1 VALUES (19,5,'h'),(20,5,'h'); - + CREATE TABLE t2 (col_int_nokey INT); INSERT INTO t2 VALUES (1),(2); @@ -567,58 +567,6 @@ DROP TABLE t1,t2,h1; DROP VIEW v1; # End of 5.1 tests -# -# Show that MIN_ROWS and MAX_ROWS have an effect on how data_length -# and index_length are allocated. -# Result is different for 32 / 64 bit machines as pointer lengths are different -# - -CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=100; -insert into t1 values(1); ---replace_result 800 1600 1200 2400 -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -drop table t1; -CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=10000; -insert into t1 values(1); ---replace_result 8000 16000 12000 24000 -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -drop table t1; -CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=3000 max_rows=3000; -insert into t1 values(1); ---replace_result 24000 48000 36000 72000 -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -drop table t1; -CREATE TABLE t1 (a int, index(a)) engine=heap max_rows=15000; -insert into t1 values(1); ---replace_result 12000 24000 18000 36000 -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -drop table t1; - -create table t1 (c1 int, index(c1)) engine=heap max_rows=10000; -insert into t1 select rand(100000000); -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1; -insert into t1 select rand(100000000) from t1 limit 488; ---replace_result 8000 16000 12000 24000 -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -insert into t1 select rand(100000000) from t1 limit 1; ---replace_result 16512 33024 24512 49024 -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -insert into t1 select rand(100000000) from t1 limit 1000; ---replace_result 24512 49024 36512 73024 -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -insert into t1 select rand(100000000) from t1; ---replace_result 40512 81024 60512 121024 -select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; -drop table t1; - # # MDEV-5905 Creating tmp. memory table kills the server # diff --git a/mysql-test/suite/heap/heap_memory_used,32bit.rdiff b/mysql-test/suite/heap/heap_memory_used,32bit.rdiff new file mode 100644 index 00000000000..19004c065c8 --- /dev/null +++ b/mysql-test/suite/heap/heap_memory_used,32bit.rdiff @@ -0,0 +1,40 @@ +--- suite/heap/heap_memory_used.result ++++ suite/heap/heap_memory_used.reject +@@ -17,13 +17,13 @@ + insert into t1 values(1); + select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; + data_length index_length +-65504 131040 ++32736 65504 + drop table t1; + CREATE TABLE t1 (a int, index(a)) engine=heap max_rows=15000; + insert into t1 values(1); + select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; + data_length index_length +-16352 32736 ++16352 16352 + drop table t1; + create table t1 (c1 int, index(c1)) engine=heap max_rows=10000; + insert into t1 select rand(100000000); +@@ -39,17 +39,17 @@ + insert into t1 select rand(100000000) from t1 limit 488; + select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; + data_length index_length +-32704 32704 ++16352 16352 + insert into t1 select rand(100000000) from t1 limit 1; + select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; + data_length index_length +-32704 32704 ++16352 16352 + insert into t1 select rand(100000000) from t1 limit 1000; + select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; + data_length index_length +-49056 65408 ++32704 32704 + insert into t1 select rand(100000000) from t1; + select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; + data_length index_length +-81760 114464 ++49056 65408 + drop table t1; diff --git a/mysql-test/suite/heap/heap_memory_used.result b/mysql-test/suite/heap/heap_memory_used.result new file mode 100644 index 00000000000..c09755fed88 --- /dev/null +++ b/mysql-test/suite/heap/heap_memory_used.result @@ -0,0 +1,55 @@ +# +# Test of heap table memory usage +# +CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=100; +insert into t1 values(1); +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +data_length index_length +16352 16352 +drop table t1; +CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=10000; +insert into t1 values(1); +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +data_length index_length +16352 16352 +drop table t1; +CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=3000 max_rows=3000; +insert into t1 values(1); +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +data_length index_length +65504 131040 +drop table t1; +CREATE TABLE t1 (a int, index(a)) engine=heap max_rows=15000; +insert into t1 values(1); +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +data_length index_length +16352 32736 +drop table t1; +create table t1 (c1 int, index(c1)) engine=heap max_rows=10000; +insert into t1 select rand(100000000); +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1 limit 488; +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +data_length index_length +32704 32704 +insert into t1 select rand(100000000) from t1 limit 1; +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +data_length index_length +32704 32704 +insert into t1 select rand(100000000) from t1 limit 1000; +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +data_length index_length +49056 65408 +insert into t1 select rand(100000000) from t1; +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +data_length index_length +81760 114464 +drop table t1; diff --git a/mysql-test/suite/heap/heap_memory_used.test b/mysql-test/suite/heap/heap_memory_used.test new file mode 100644 index 00000000000..c9b8578e2d5 --- /dev/null +++ b/mysql-test/suite/heap/heap_memory_used.test @@ -0,0 +1,50 @@ +--echo # +--echo # Test of heap table memory usage +--echo # + +--source include/word_size.inc + +# +# Show that MIN_ROWS and MAX_ROWS have an effect on how data_length +# and index_length are allocated. +# Result is different for 32 / 64 bit machines as pointer lengths are different +# + +CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=100; +insert into t1 values(1); +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +drop table t1; + +CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=10 max_rows=10000; +insert into t1 values(1); +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +drop table t1; +CREATE TABLE t1 (a int, index(a)) engine=heap min_rows=3000 max_rows=3000; +insert into t1 values(1); +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +drop table t1; +CREATE TABLE t1 (a int, index(a)) engine=heap max_rows=15000; +insert into t1 values(1); +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +drop table t1; + +create table t1 (c1 int, index(c1)) engine=heap max_rows=10000; +insert into t1 select rand(100000000); +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1; +insert into t1 select rand(100000000) from t1 limit 488; +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +insert into t1 select rand(100000000) from t1 limit 1; +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +insert into t1 select rand(100000000) from t1 limit 1000; +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +insert into t1 select rand(100000000) from t1; +select data_length,index_length from information_schema.tables where table_schema="test" and table_name="t1"; +drop table t1; diff --git a/mysql-test/suite/maria/aria_sort_buffer.result b/mysql-test/suite/maria/aria_sort_buffer.result index 5db9b9d7d44..a9e06cc3db3 100644 --- a/mysql-test/suite/maria/aria_sort_buffer.result +++ b/mysql-test/suite/maria/aria_sort_buffer.result @@ -5,6 +5,8 @@ Note 1105 Cast to unsigned converted negative integer to it's positive complemen Note 1105 Cast to unsigned converted negative integer to it's positive complement Warning 1292 Truncated incorrect aria_sort_buffer_size value: '18446744073709551615' SET SESSION tmp_table_size=65535; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '65535' CREATE TABLE t1 (a VARCHAR(255)); insert into t1 (a) select seq from seq_1_to_1000; UPDATE t1 SET a=( (SELECT MAX(a) FROM t1)); diff --git a/mysql-test/suite/maria/repair-big-sort.result b/mysql-test/suite/maria/repair-big-sort.result index a650a3872d3..d1dfe3f7c2f 100644 --- a/mysql-test/suite/maria/repair-big-sort.result +++ b/mysql-test/suite/maria/repair-big-sort.result @@ -2,6 +2,8 @@ SET sql_mode=''; CREATE TEMPORARY TABLE t1 (a tinyINT,b CHAR(1)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT; INSERT INTO t1 VALUES (1,1),(3,3),(2,2); SET SESSION tmp_table_size=True; +Warnings: +Warning 1292 Truncated incorrect tmp_table_size value: '1' CREATE TABLE t2 (c INT, d DATE) ENGINE=InnoDB PARTITION BY RANGE (YEAR (d)) SUBPARTITION BY HASH (TO_DAYS (d)) (PARTITION p0 VALUES LESS THAN (1990) (SUBPARTITION s0, SUBPARTITION s1), PARTITION p1 VALUES LESS THAN MAXVALUE (SUBPARTITION s4, SUBPARTITION s5)); SET SESSION aria_sort_buffer_size=CAST(-1 AS UNSIGNED INT); Warnings: diff --git a/mysql-test/suite/sys_vars/r/maximum_basic.result b/mysql-test/suite/sys_vars/r/maximum_basic.result index becd6da91f4..2a5c3e2a70c 100644 --- a/mysql-test/suite/sys_vars/r/maximum_basic.result +++ b/mysql-test/suite/sys_vars/r/maximum_basic.result @@ -9,7 +9,7 @@ Warnings: Warning 1292 Truncated incorrect tmp_table_size value: '40960' SELECT @@session.tmp_table_size; @@session.tmp_table_size -8192 +16384 SET @@session.max_join_size=40960; Warnings: Warning 1292 Truncated incorrect max_join_size value: '40960' diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index 18fceb52b8f..21ddf0a85f4 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -3718,7 +3718,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table. Same as tmp_table_size. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 18446744073709551615 -NUMERIC_BLOCK_SIZE 1 +NUMERIC_BLOCK_SIZE 16384 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED @@ -3728,7 +3728,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Alias for tmp_memory_table_size. If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 18446744073709551615 -NUMERIC_BLOCK_SIZE 1 +NUMERIC_BLOCK_SIZE 16384 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index 3f22a7cd968..f09ff460807 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -4498,7 +4498,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table. Same as tmp_table_size. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 18446744073709551615 -NUMERIC_BLOCK_SIZE 1 +NUMERIC_BLOCK_SIZE 16384 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED @@ -4508,7 +4508,7 @@ VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Alias for tmp_memory_table_size. If an internal in-memory temporary table exceeds this size, MariaDB will automatically convert it to an on-disk MyISAM or Aria table. NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 18446744073709551615 -NUMERIC_BLOCK_SIZE 1 +NUMERIC_BLOCK_SIZE 16384 ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED diff --git a/mysql-test/suite/sys_vars/r/tmp_disk_table_size_func.result b/mysql-test/suite/sys_vars/r/tmp_disk_table_size_func.result index 7b26106384b..c0866cfec6a 100644 --- a/mysql-test/suite/sys_vars/r/tmp_disk_table_size_func.result +++ b/mysql-test/suite/sys_vars/r/tmp_disk_table_size_func.result @@ -3,7 +3,7 @@ SET @start_tmp_memory_table_size=@@session.tmp_memory_table_size; SET @start_tmp_disk_table_size=@@session.tmp_disk_table_size; -set @@session.tmp_memory_table_size=1000; +set @@session.tmp_memory_table_size=16384; set @@session.tmp_disk_table_size=3000000; create table t1 (a int primary key, b varchar(2000)); insert into t1 select seq,repeat(char(mod(seq,62)+64),seq) from seq_1_to_2000; diff --git a/mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic.result b/mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic.result index 8d36354a7bb..4049e7e8c3a 100644 --- a/mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic.result +++ b/mysql-test/suite/sys_vars/r/transaction_alloc_block_size_basic.result @@ -168,7 +168,6 @@ SET @@global.transaction_alloc_block_size = @start_global_value; SELECT @@global.transaction_alloc_block_size; @@global.transaction_alloc_block_size 8192 -SET @@session.tmp_table_size = @start_session_value; SELECT @@session.transaction_alloc_block_size; @@session.transaction_alloc_block_size 1024 diff --git a/mysql-test/suite/sys_vars/t/maximum_basic-master.opt b/mysql-test/suite/sys_vars/t/maximum_basic-master.opt index 16e365d491c..db0ee8b60c4 100644 --- a/mysql-test/suite/sys_vars/t/maximum_basic-master.opt +++ b/mysql-test/suite/sys_vars/t/maximum_basic-master.opt @@ -1,5 +1,5 @@ --maximum-auto-increment-increment=8192 ---maximum-tmp-table-size=8192 +--maximum-tmp-table-size=16384 --maximum-max-join-size=8192 --maximum-use-stat-tables=COMPLEMENTARY --maximum-sql-mode='REAL_AS_FLOAT,ANSI_QUOTES' diff --git a/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test b/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test index c78eac199c3..8eb4a2790fc 100644 --- a/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test +++ b/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test @@ -12,7 +12,7 @@ SET @start_tmp_memory_table_size=@@session.tmp_memory_table_size; SET @start_tmp_disk_table_size=@@session.tmp_disk_table_size; -set @@session.tmp_memory_table_size=1000; +set @@session.tmp_memory_table_size=16384; set @@session.tmp_disk_table_size=3000000; --disable_ps2_protocol diff --git a/mysql-test/suite/sys_vars/t/transaction_alloc_block_size_basic.test b/mysql-test/suite/sys_vars/t/transaction_alloc_block_size_basic.test index 0faa95c8fe6..64452ad3f36 100644 --- a/mysql-test/suite/sys_vars/t/transaction_alloc_block_size_basic.test +++ b/mysql-test/suite/sys_vars/t/transaction_alloc_block_size_basic.test @@ -218,11 +218,9 @@ SELECT transaction_alloc_block_size = @@session.transaction_alloc_block_size; SET @@global.transaction_alloc_block_size = @start_global_value; SELECT @@global.transaction_alloc_block_size; -SET @@session.tmp_table_size = @start_session_value; SELECT @@session.transaction_alloc_block_size; ############################################################# # END OF transaction_alloc_block_size TESTS # ############################################################# - diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result index 1ceb9c443a2..b0e8057b486 100644 --- a/mysql-test/suite/versioning/r/partition.result +++ b/mysql-test/suite/versioning/r/partition.result @@ -1117,7 +1117,7 @@ f varchar(45000) partition by system_time interval 1 year (partition p1 history, partition pn current); # fill the table until full -insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); +insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); insert into t1 (f) select f from t1; ERROR HY000: The table 't1' is full # leave space for exactly one record in current partition @@ -1133,7 +1133,7 @@ f varchar(45000) ) with system versioning engine=memory partition by system_time interval 1 year (partition p1 history, partition pn current); -insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); +insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); select * into outfile 'load.data' from t1; load data infile 'load.data' replace into table t1; load data infile 'load.data' replace into table t1; diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test index ec27215b083..e662299bc22 100644 --- a/mysql-test/suite/versioning/t/partition.test +++ b/mysql-test/suite/versioning/t/partition.test @@ -977,7 +977,7 @@ create or replace table t1 ( partition pn current); --echo # fill the table until full -insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); +insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); --error ER_RECORD_FILE_FULL insert into t1 (f) select f from t1; --echo # leave space for exactly one record in current partition @@ -995,7 +995,7 @@ create or replace table t1 ( partition by system_time interval 1 year (partition p1 history, partition pn current); -insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); +insert into t1 () values (),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(),(); --disable_cursor_protocol --disable_ps2_protocol diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 206c924117e..7f282c597d6 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -20577,7 +20577,7 @@ bool Create_tmp_table::finalize(THD *thd, MY_MIN(thd->variables.tmp_memory_table_size, thd->variables.max_heap_table_size) : thd->variables.tmp_disk_table_size) / - share->reclength); + MY_ALIGN(share->reclength, sizeof(char*))); set_if_bigger(share->max_rows,1); // For dummy start options /* Push the LIMIT clause to the temporary table creation, so that we diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 2eda3ce9c8f..9a7077e357b 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -4218,7 +4218,7 @@ static Sys_var_ulonglong Sys_tmp_table_size( "will automatically convert it to an on-disk MyISAM or Aria table.", SESSION_VAR(tmp_memory_table_size), CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, (ulonglong)~(intptr)0), DEFAULT(16*1024*1024), - BLOCK_SIZE(1)); + BLOCK_SIZE(16384)); static Sys_var_ulonglong Sys_tmp_memory_table_size( "tmp_memory_table_size", @@ -4227,7 +4227,7 @@ static Sys_var_ulonglong Sys_tmp_memory_table_size( "Same as tmp_table_size.", SESSION_VAR(tmp_memory_table_size), CMD_LINE(REQUIRED_ARG), VALID_RANGE(0, (ulonglong)~(intptr)0), DEFAULT(16*1024*1024), - BLOCK_SIZE(1)); + BLOCK_SIZE(16384)); static Sys_var_ulonglong Sys_tmp_disk_table_size( "tmp_disk_table_size", diff --git a/storage/heap/ha_heap.cc b/storage/heap/ha_heap.cc index 404ad22a88a..3f4d1ab69ef 100644 --- a/storage/heap/ha_heap.cc +++ b/storage/heap/ha_heap.cc @@ -619,7 +619,7 @@ static int heap_prepare_hp_create_info(TABLE *table_arg, bool internal_table, case HA_KEY_ALG_UNDEF: case HA_KEY_ALG_HASH: keydef[key].algorithm= HA_KEY_ALG_HASH; - mem_per_row+= sizeof(char*) * 2; // = sizeof(HASH_INFO) + mem_per_row+= sizeof(HASH_INFO); break; case HA_KEY_ALG_BTREE: keydef[key].algorithm= HA_KEY_ALG_BTREE; @@ -688,7 +688,6 @@ static int heap_prepare_hp_create_info(TABLE *table_arg, bool internal_table, } } } - mem_per_row+= MY_ALIGN(MY_MAX(share->reclength, sizeof(char*)) + 1, sizeof(char*)); if (table_arg->found_next_number_field) { keydef[share->next_number_index].flag|= HA_AUTO_KEY; @@ -696,11 +695,18 @@ static int heap_prepare_hp_create_info(TABLE *table_arg, bool internal_table, } hp_create_info->auto_key= auto_key; hp_create_info->auto_key_type= auto_key_type; - hp_create_info->max_table_size=current_thd->variables.max_heap_table_size; + hp_create_info->max_table_size= MY_MAX(current_thd->variables.max_heap_table_size, sizeof(HP_PTRS)); hp_create_info->with_auto_increment= found_real_auto_increment; hp_create_info->internal_table= internal_table; - max_rows= (ha_rows) (hp_create_info->max_table_size / mem_per_row); + max_rows= hp_rows_in_memory(share->reclength, mem_per_row, + hp_create_info->max_table_size); +#ifdef GIVE_ERROR_IF_NOT_MEMORY_TO_INSERT_ONE_ROW + /* We do not give the error now but instead give an error on first insert */ + if (!max_rows) + return HA_WRONG_CREATE_OPTION; +#endif + if (share->max_rows && share->max_rows < max_rows) max_rows= share->max_rows; diff --git a/storage/heap/heapdef.h b/storage/heap/heapdef.h index ffd5382b6f7..e51fe88d8e2 100644 --- a/storage/heap/heapdef.h +++ b/storage/heap/heapdef.h @@ -100,6 +100,9 @@ extern void hp_clear(HP_SHARE *info); extern void hp_clear_keys(HP_SHARE *info); extern uint hp_rb_pack_key(HP_KEYDEF *keydef, uchar *key, const uchar *old, key_part_map keypart_map); +extern ha_rows hp_rows_in_memory(size_t reclength, size_t index_size, + size_t memory_limit); +extern size_t hp_memory_needed_per_row(size_t reclength); extern mysql_mutex_t THR_LOCK_heap; diff --git a/storage/heap/hp_block.c b/storage/heap/hp_block.c index 324efc8b4af..44bca363746 100644 --- a/storage/heap/hp_block.c +++ b/storage/heap/hp_block.c @@ -75,9 +75,11 @@ int hp_get_new_block(HP_SHARE *info, HP_BLOCK *block, size_t *alloc_length) Next time we allocate data for X rows. When level 1 is full, we allocate data for HP_PTRS_IN_NOD at level 2 and 1 + X rows at level 0. - */ + */ *alloc_length= (sizeof(HP_PTRS) * ((i == block->levels) ? i : i - 1) + (ulonglong)block->records_in_block * block->recbuffer); + /* Alloc in blocks of powers of 2 */ + *alloc_length= MY_MAX(*alloc_length, block->alloc_size); if (!(root=(HP_PTRS*) my_malloc(hp_key_memory_HP_PTRS, *alloc_length, MYF(MY_WME | (info->internal ? diff --git a/storage/heap/hp_create.c b/storage/heap/hp_create.c index c07a1e968c4..f35e8e3fac9 100644 --- a/storage/heap/hp_create.c +++ b/storage/heap/hp_create.c @@ -15,11 +15,23 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ #include "heapdef.h" +#include static int keys_compare(void *heap_rb, const void *key1, const void *key2); -static void init_block(HP_BLOCK *block,uint reclength,ulong min_records, +static void init_block(HP_BLOCK *block, size_t reclength, ulong min_records, ulong max_records); + +/* + In how many parts are we going to do allocations of memory and indexes + If we assigne 1M to the heap table memory, we will allocate roughly + (1M/16) bytes per allocaiton +*/ +static const int heap_allocation_parts= 16; + +/* min block allocation */ +static const ulong heap_min_allocation_block= 16384; + /* Create a heap table */ int heap_create(const char *name, HP_CREATE_INFO *create_info, @@ -170,7 +182,8 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info, share->keydef= (HP_KEYDEF*) (share + 1); share->key_stat_version= 1; keyseg= (HA_KEYSEG*) (share->keydef + keys); - init_block(&share->block, visible_offset + 1, min_records, max_records); + init_block(&share->block, hp_memory_needed_per_row(reclength), + min_records, max_records); /* Fix keys */ memcpy(share->keydef, keydef, (size_t) (sizeof(keydef[0]) * keys)); for (i= 0, keyinfo= share->keydef; i < keys; i++, keyinfo++) @@ -266,44 +279,90 @@ static int keys_compare(void *heap_rb_, const void *key1_, heap_rb->search_flag, not_used); } -static void init_block(HP_BLOCK *block, uint reclength, ulong min_records, + +/* + Calculate length needed for storing one row +*/ + +size_t hp_memory_needed_per_row(size_t reclength) +{ + /* Data needed for storing record + pointer to records */ + reclength= MY_MAX(reclength, sizeof(char*)); + /* The + 1 below is for the delete marker at the end of record*/ + reclength= MY_ALIGN(reclength+1, sizeof(char*)); + return reclength; +} + +/* + Calculate the number of rows that fits into a given memory size +*/ + +ha_rows hp_rows_in_memory(size_t reclength, size_t index_size, + size_t memory_limit) +{ + reclength= hp_memory_needed_per_row(reclength); + if ((memory_limit < index_size + reclength + sizeof(HP_PTRS))) + return 0; /* Wrong arguments */ + return (ha_rows) ((memory_limit - sizeof(HP_PTRS)) / + (index_size + reclength)); +} + + +static void init_block(HP_BLOCK *block, size_t reclength, ulong min_records, ulong max_records) { - ulong i,recbuffer,records_in_block; + ulong i,records_in_block; + ulong recbuffer= (ulong) MY_ALIGN(reclength, sizeof(uchar*)); + ulong extra; + ulonglong memory_needed; + size_t alloc_size; /* If not min_records and max_records are given, optimize for 1000 rows */ if (!min_records) - min_records= MY_MIN(1000, max_records); + min_records= MY_MIN(1000, max_records / heap_allocation_parts); if (!max_records) max_records= MY_MAX(min_records, 1000); + min_records= MY_MIN(min_records, max_records); - /* + /* We don't want too few records_in_block as otherwise the overhead of of the HP_PTRS block will be too notable */ - records_in_block= MY_MAX(1000, min_records); - records_in_block= MY_MIN(records_in_block, max_records); - /* If big max_records is given, allocate bigger blocks */ - records_in_block= MY_MAX(records_in_block, max_records / 10); + records_in_block= MY_MAX(min_records, max_records / heap_allocation_parts); + + /* + Align allocation sizes to power of 2 to get less memory fragmentation from + system alloc(). + As long as we have less than 128 allocations, all but one of the + allocations will have an extra HP_PTRS size structure at the start + of the block. + + We ensure that the block is not smaller than heap_min_allocation_block + as otherwise we get strange results when max_records < + heap_allocation_parts) + */ + extra= sizeof(HP_PTRS) + MALLOC_OVERHEAD; + /* We don't want too few blocks per row either */ if (records_in_block < 10) - records_in_block= 10; + records_in_block= MY_MIN(10, max_records); + memory_needed= MY_MAX(((ulonglong) records_in_block * recbuffer + extra), + (ulonglong) heap_min_allocation_block); + + /* We have to limit memory to INT_MAX32 as my_round_up_to_next_power() is 32 bit */ + memory_needed= MY_MIN(memory_needed, (ulonglong) INT_MAX32); + alloc_size= my_round_up_to_next_power((uint32)memory_needed); + records_in_block= (ulong) ((alloc_size - extra)/ recbuffer); + + DBUG_PRINT("info", ("records_in_block: %lu" ,records_in_block)); - recbuffer= (uint) (reclength + sizeof(uchar**) - 1) & ~(sizeof(uchar**) - 1); - /* - Don't allocate more than my_default_record_cache_size per level. - The + 1 is there to ensure that we get at least 1 row per level (for - the exceptional case of very long rows) - */ - if ((ulonglong) records_in_block*recbuffer > - (my_default_record_cache_size-sizeof(HP_PTRS)*HP_MAX_LEVELS)) - records_in_block= (my_default_record_cache_size - sizeof(HP_PTRS) * - HP_MAX_LEVELS) / recbuffer + 1; block->records_in_block= records_in_block; block->recbuffer= recbuffer; block->last_allocated= 0L; + /* All alloctions are done with this size, if possible */ + block->alloc_size= alloc_size - MALLOC_OVERHEAD; for (i= 0; i <= HP_MAX_LEVELS; i++) block->level_info[i].records_under_level= diff --git a/storage/heap/hp_write.c b/storage/heap/hp_write.c index 5469784c8c1..cb079eac757 100644 --- a/storage/heap/hp_write.c +++ b/storage/heap/hp_write.c @@ -145,21 +145,22 @@ static uchar *next_free_record_pos(HP_SHARE *info) DBUG_PRINT("exit",("Used old position: %p", pos)); DBUG_RETURN(pos); } - if ((info->records > info->max_records && info->max_records) || - (info->data_length + info->index_length >= info->max_table_size)) - { - DBUG_PRINT("error", - ("record file full. records: %lu max_records: %lu " - "data_length: %llu index_length: %llu " - "max_table_size: %llu", - info->records, info->max_records, - info->data_length, info->index_length, - info->max_table_size)); - my_errno=HA_ERR_RECORD_FILE_FULL; - DBUG_RETURN(NULL); - } if (!(block_pos=(info->records % info->block.records_in_block))) { + if ((info->records > info->max_records && info->max_records) || + (info->data_length + info->index_length >= info->max_table_size)) + { + DBUG_PRINT("error", + ("record file full. records: %lu max_records: %lu " + "data_length: %llu index_length: %llu " + "max_table_size: %llu", + info->records, info->max_records, + info->data_length, info->index_length, + info->max_table_size)); + my_errno=HA_ERR_RECORD_FILE_FULL; + DBUG_RETURN(NULL); + } + if (hp_get_new_block(info, &info->block,&length)) DBUG_RETURN(NULL); info->data_length+=length; From f29762334588da5c76646eb8a9a2d6fddcdc61f4 Mon Sep 17 00:00:00 2001 From: Monty Date: Sun, 1 Dec 2024 16:05:58 +0200 Subject: [PATCH 57/84] Update my_default_record_cache_size if global.read_buff_size is changed Before this patch, my_default_record_cache_size was only updated on server start from global_read_buff.size --- sql/sys_vars.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index 9a7077e357b..b9d944ab3ee 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -2923,6 +2923,14 @@ static Sys_var_proxy_user Sys_proxy_user( static Sys_var_external_user Sys_exterenal_user( "external_user", "The external user account used when logging in"); + +static bool update_record_cache(sys_var *self, THD *thd, enum_var_type type) +{ + if (type == OPT_GLOBAL) + my_default_record_cache_size= global_system_variables.read_buff_size; + return false; +} + static Sys_var_ulong Sys_read_buff_size( "read_buffer_size", "Each thread that does a sequential scan allocates a buffer of " @@ -2930,7 +2938,8 @@ static Sys_var_ulong Sys_read_buff_size( "you may want to increase this value", SESSION_VAR(read_buff_size), CMD_LINE(REQUIRED_ARG), VALID_RANGE(IO_SIZE*2, INT_MAX32), DEFAULT(128*1024), - BLOCK_SIZE(IO_SIZE)); + BLOCK_SIZE(IO_SIZE), NO_MUTEX_GUARD, NOT_IN_BINLOG, + ON_CHECK(0), ON_UPDATE(update_record_cache)); static bool check_read_only(sys_var *self, THD *thd, set_var *var) { From e600f9aebb5606243550d8996161dc76696e8124 Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 22 Nov 2024 14:23:57 +0200 Subject: [PATCH 58/84] MDEV-35750 Change MEM_ROOT allocation sizes to reduse calls to malloc() and avoid memory fragmentation This commit updates default memory allocations size used with MEM_ROOT objects to minimize the number of calls to malloc(). Changes: - Updated MEM_ROOT block sizes in sql_const.h - Updated MALLOC_OVERHEAD to also take into account the extra memory allocated by my_malloc() - Updated init_alloc_root() to only take MALLOC_OVERHEAD into account as buffer size, not MALLOC_OVERHEAD + sizeof(USED_MEM). - Reset mem_root->first_block_usage if and only if first block was used. - Increase MEM_ROOT buffers sized used by my_load_defaults, plugin_init, Create_tmp_table, allocate_table_share, TABLE and TABLE_SHARE. This decreases number of malloc calls during queries. - Use a small buffer for THD->main_mem_root in THD::THD. This avoids multiple malloc() call for new connections. I tried the above changes on a complex select query with 12 tables. The following shows the number of extra allocations that where used to increase the size of the MEM_ROOT buffers. Original code: - Connection to MariaDB: 9 allocations - First query run: 146 allocations - Second query run: 24 allocations Max memory allocated for thd when using with heap table: 61,262,408 Max memory allocated for thd when using Aria tmp table: 419,464 After changes: Connection to MariaDB: 0 allocations - First run: 25 allocations - Second run: 7 allocations Max memory allocated for thd when using with heap table: 61,347,424 Max memory allocated for thd when using Aria table: 529,168 The new code uses slightly more memory, but avoids memory fragmentation and is slightly faster thanks to much fewer calls to malloc(). Reviewed-by: Sergei Golubchik --- include/my_global.h | 2 +- include/my_sys.h | 1 + mysql-test/main/mysqld--help.result | 4 +- mysql-test/main/variables.result | 12 +++--- .../r/aria_sort_buffer_size_basic.result | 6 +-- .../r/query_alloc_block_size_basic.result | 20 +++++----- .../r/query_prealloc_size_basic.result | 20 +++++----- .../suite/sys_vars/r/sysvars_aria.result | 2 +- .../sys_vars/r/sysvars_server_embedded.result | 2 +- .../r/sysvars_server_notembedded.result | 2 +- .../t/query_alloc_block_size_basic.test | 4 +- .../sys_vars/t/query_prealloc_size_basic.test | 4 +- mysys/my_alloc.c | 37 +++++++++++++------ mysys/my_default.c | 6 +-- sql/sql_class.cc | 3 +- sql/sql_class.h | 2 +- sql/sql_const.h | 21 +++++++---- sql/sql_plugin.cc | 6 +-- sql/sql_select.cc | 4 +- sql/table.cc | 16 ++++---- 20 files changed, 98 insertions(+), 76 deletions(-) diff --git a/include/my_global.h b/include/my_global.h index 043a20b216f..fd774bdac1f 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -667,7 +667,7 @@ typedef SOCKET_SIZE_TYPE size_socket; */ #define IO_SIZE 4096U /* - How much overhead does malloc have. The code often allocates + How much overhead does malloc/my_malloc have. The code often allocates something like 1024-MALLOC_OVERHEAD bytes */ #define MALLOC_OVERHEAD (8+24) diff --git a/include/my_sys.h b/include/my_sys.h index 02aef947d6f..4c371244ab9 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -878,6 +878,7 @@ extern void my_free_lock(void *ptr); #endif #define alloc_root_inited(A) ((A)->min_malloc != 0) #define ALLOC_ROOT_MIN_BLOCK_SIZE (MALLOC_OVERHEAD + sizeof(USED_MEM) + 8) +#define DEFAULT_ROOT_BLOCK_SIZE 1024 #define clear_alloc_root(A) do { (A)->free= (A)->used= (A)->pre_alloc= 0; (A)->min_malloc=0;} while(0) extern void init_alloc_root(PSI_memory_key key, MEM_ROOT *mem_root, size_t block_size, size_t pre_alloc_size, diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result index 352063ece38..8857aff2fc2 100644 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@ -1785,14 +1785,14 @@ profiling-history-size 15 progress-report-time 5 protocol-version 10 proxy-protocol-networks -query-alloc-block-size 16384 +query-alloc-block-size 32768 query-cache-limit 1048576 query-cache-min-res-unit 4096 query-cache-size 1048576 query-cache-strip-comments FALSE query-cache-type OFF query-cache-wlock-invalidate FALSE -query-prealloc-size 24576 +query-prealloc-size 32768 range-alloc-block-size 4096 read-binlog-speed-limit 0 read-buffer-size 131072 diff --git a/mysql-test/main/variables.result b/mysql-test/main/variables.result index a16dcd2d44c..73cfa0e613d 100644 --- a/mysql-test/main/variables.result +++ b/mysql-test/main/variables.result @@ -299,8 +299,8 @@ SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size', 'query_alloc_block_size', 'query_prealloc_size', 'transaction_alloc_block_size', 'transaction_prealloc_size'); Variable_name Value -query_alloc_block_size 16384 -query_prealloc_size 24576 +query_alloc_block_size 32768 +query_prealloc_size 32768 range_alloc_block_size 4096 transaction_alloc_block_size 8192 transaction_prealloc_size 4096 @@ -310,8 +310,8 @@ WHERE variable_name IN ('range_alloc_block_size', 'query_alloc_block_size', 'query_prealloc_size', 'transaction_alloc_block_size', 'transaction_prealloc_size') ORDER BY 1; VARIABLE_NAME VARIABLE_VALUE -QUERY_ALLOC_BLOCK_SIZE 16384 -QUERY_PREALLOC_SIZE 24576 +QUERY_ALLOC_BLOCK_SIZE 32768 +QUERY_PREALLOC_SIZE 32768 RANGE_ALLOC_BLOCK_SIZE 4096 TRANSACTION_ALLOC_BLOCK_SIZE 8192 TRANSACTION_PREALLOC_SIZE 4096 @@ -392,8 +392,8 @@ SHOW VARIABLES WHERE variable_name IN ('range_alloc_block_size', 'query_alloc_block_size', 'query_prealloc_size', 'transaction_alloc_block_size', 'transaction_prealloc_size'); Variable_name Value -query_alloc_block_size 16384 -query_prealloc_size 24576 +query_alloc_block_size 32768 +query_prealloc_size 32768 range_alloc_block_size 4096 transaction_alloc_block_size 8192 transaction_prealloc_size 4096 diff --git a/mysql-test/suite/sys_vars/r/aria_sort_buffer_size_basic.result b/mysql-test/suite/sys_vars/r/aria_sort_buffer_size_basic.result index 6da4c9bfe97..32e1c9965d6 100644 --- a/mysql-test/suite/sys_vars/r/aria_sort_buffer_size_basic.result +++ b/mysql-test/suite/sys_vars/r/aria_sort_buffer_size_basic.result @@ -22,13 +22,13 @@ Warnings: Warning 1292 Truncated incorrect aria_sort_buffer_size value: '10' select @@global.aria_sort_buffer_size; @@global.aria_sort_buffer_size -16376 +16352 set session aria_sort_buffer_size=10; Warnings: Warning 1292 Truncated incorrect aria_sort_buffer_size value: '10' select @@session.aria_sort_buffer_size; @@session.aria_sort_buffer_size -16376 +16352 set global aria_sort_buffer_size=1.1; ERROR 42000: Incorrect argument type to variable 'aria_sort_buffer_size' set session aria_sort_buffer_size=1e1; @@ -40,7 +40,7 @@ Warnings: Warning 1292 Truncated incorrect aria_sort_buffer_size value: '0' select @@global.aria_sort_buffer_size; @@global.aria_sort_buffer_size -16376 +16352 set session aria_sort_buffer_size=cast(-1 as unsigned int); select @@session.aria_sort_buffer_size; @@session.aria_sort_buffer_size diff --git a/mysql-test/suite/sys_vars/r/query_alloc_block_size_basic.result b/mysql-test/suite/sys_vars/r/query_alloc_block_size_basic.result index accabb34dbe..2f49ab15705 100644 --- a/mysql-test/suite/sys_vars/r/query_alloc_block_size_basic.result +++ b/mysql-test/suite/sys_vars/r/query_alloc_block_size_basic.result @@ -1,11 +1,11 @@ SET @start_global_value = @@global.query_alloc_block_size; SELECT @start_global_value; @start_global_value -16384 +32768 SET @start_session_value = @@session.query_alloc_block_size; SELECT @start_session_value; @start_session_value -16384 +32768 '#--------------------FN_DYNVARS_130_01-------------------------#' SET @@global.query_alloc_block_size = 10000; Warnings: @@ -13,22 +13,22 @@ Warning 1292 Truncated incorrect query_alloc_block_size value: '10000' SET @@global.query_alloc_block_size = DEFAULT; SELECT @@global.query_alloc_block_size; @@global.query_alloc_block_size -16384 +32768 SET @@session.query_alloc_block_size = 20000; Warnings: Warning 1292 Truncated incorrect query_alloc_block_size value: '20000' SET @@session.query_alloc_block_size = DEFAULT; SELECT @@session.query_alloc_block_size; @@session.query_alloc_block_size -16384 +32768 '#--------------------FN_DYNVARS_130_02-------------------------#' SET @@global.query_alloc_block_size = DEFAULT; -SELECT @@global.query_alloc_block_size = 16384; -@@global.query_alloc_block_size = 16384 +SELECT @@global.query_alloc_block_size = 32768; +@@global.query_alloc_block_size = 32768 1 SET @@session.query_alloc_block_size = DEFAULT; -SELECT @@session.query_alloc_block_size = 16384; -@@session.query_alloc_block_size = 16384 +SELECT @@session.query_alloc_block_size = 32768; +@@session.query_alloc_block_size = 32768 1 '#--------------------FN_DYNVARS_130_03-------------------------#' SET @@global.query_alloc_block_size = 1024; @@ -177,8 +177,8 @@ ERROR 42S22: Unknown column 'query_alloc_block_size' in 'SELECT' SET @@global.query_alloc_block_size = @start_global_value; SELECT @@global.query_alloc_block_size; @@global.query_alloc_block_size -16384 +32768 SET @@session.query_alloc_block_size = @start_session_value; SELECT @@session.query_alloc_block_size; @@session.query_alloc_block_size -16384 +32768 diff --git a/mysql-test/suite/sys_vars/r/query_prealloc_size_basic.result b/mysql-test/suite/sys_vars/r/query_prealloc_size_basic.result index 23cb61f0849..9e02be78b8b 100644 --- a/mysql-test/suite/sys_vars/r/query_prealloc_size_basic.result +++ b/mysql-test/suite/sys_vars/r/query_prealloc_size_basic.result @@ -1,11 +1,11 @@ SET @start_global_value = @@global.query_prealloc_size ; SELECT @start_global_value; @start_global_value -24576 +32768 SET @start_session_value = @@session.query_prealloc_size ; SELECT @start_session_value; @start_session_value -24576 +32768 '#--------------------FN_DYNVARS_005_01-------------------------#' SET @@global.query_prealloc_size = 100; Warnings: @@ -13,22 +13,22 @@ Warning 1292 Truncated incorrect query_prealloc_size value: '100' SET @@global.query_prealloc_size = DEFAULT; SELECT @@global.query_prealloc_size ; @@global.query_prealloc_size -24576 +32768 SET @@session.query_prealloc_size = 200; Warnings: Warning 1292 Truncated incorrect query_prealloc_size value: '200' SET @@session.query_prealloc_size = DEFAULT; SELECT @@session.query_prealloc_size ; @@session.query_prealloc_size -24576 +32768 '#--------------------FN_DYNVARS_005_02-------------------------#' SET @@global.query_prealloc_size = DEFAULT; -SELECT @@global.query_prealloc_size = 24576; -@@global.query_prealloc_size = 24576 +SELECT @@global.query_prealloc_size = 32768; +@@global.query_prealloc_size = 32768 1 SET @@session.query_prealloc_size = DEFAULT; -SELECT @@session.query_prealloc_size = 24576; -@@session.query_prealloc_size = 24576 +SELECT @@session.query_prealloc_size = 32768; +@@session.query_prealloc_size = 32768 1 '#--------------------FN_DYNVARS_005_03-------------------------#' SET @@global.query_prealloc_size = 8192; @@ -163,8 +163,8 @@ ERROR 42S22: Unknown column 'query_prealloc_size' in 'SELECT' SET @@global.query_prealloc_size = @start_global_value; SELECT @@global.query_prealloc_size ; @@global.query_prealloc_size -24576 +32768 SET @@session.query_prealloc_size = @start_session_value; SELECT @@session.query_prealloc_size ; @@session.query_prealloc_size -24576 +32768 diff --git a/mysql-test/suite/sys_vars/r/sysvars_aria.result b/mysql-test/suite/sys_vars/r/sysvars_aria.result index 427eb83c949..58aae0fc664 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_aria.result +++ b/mysql-test/suite/sys_vars/r/sysvars_aria.result @@ -223,7 +223,7 @@ DEFAULT_VALUE 268434432 VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE. -NUMERIC_MIN_VALUE 16376 +NUMERIC_MIN_VALUE 16352 NUMERIC_MAX_VALUE 1152921504606846975 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result index 21ddf0a85f4..5a24c88f4ca 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -216,7 +216,7 @@ VARIABLE_NAME ARIA_SORT_BUFFER_SIZE VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE. -NUMERIC_MIN_VALUE 16376 +NUMERIC_MIN_VALUE 16352 NUMERIC_MAX_VALUE 1152921504606846975 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index f09ff460807..1cea5c34427 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -216,7 +216,7 @@ VARIABLE_NAME ARIA_SORT_BUFFER_SIZE VARIABLE_SCOPE SESSION VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT The buffer that is allocated when sorting the index when doing a REPAIR or when creating indexes with CREATE INDEX or ALTER TABLE. -NUMERIC_MIN_VALUE 16376 +NUMERIC_MIN_VALUE 16352 NUMERIC_MAX_VALUE 1152921504606846975 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL diff --git a/mysql-test/suite/sys_vars/t/query_alloc_block_size_basic.test b/mysql-test/suite/sys_vars/t/query_alloc_block_size_basic.test index 1793652397f..85c0c34f0ac 100644 --- a/mysql-test/suite/sys_vars/t/query_alloc_block_size_basic.test +++ b/mysql-test/suite/sys_vars/t/query_alloc_block_size_basic.test @@ -60,10 +60,10 @@ SELECT @@session.query_alloc_block_size; ################################################################### SET @@global.query_alloc_block_size = DEFAULT; -SELECT @@global.query_alloc_block_size = 16384; +SELECT @@global.query_alloc_block_size = 32768; SET @@session.query_alloc_block_size = DEFAULT; -SELECT @@session.query_alloc_block_size = 16384; +SELECT @@session.query_alloc_block_size = 32768; --echo '#--------------------FN_DYNVARS_130_03-------------------------#' diff --git a/mysql-test/suite/sys_vars/t/query_prealloc_size_basic.test b/mysql-test/suite/sys_vars/t/query_prealloc_size_basic.test index 1a6ed56c5f9..6122a288610 100644 --- a/mysql-test/suite/sys_vars/t/query_prealloc_size_basic.test +++ b/mysql-test/suite/sys_vars/t/query_prealloc_size_basic.test @@ -60,10 +60,10 @@ SELECT @@session.query_prealloc_size ; ######################################################################## SET @@global.query_prealloc_size = DEFAULT; -SELECT @@global.query_prealloc_size = 24576; +SELECT @@global.query_prealloc_size = 32768; SET @@session.query_prealloc_size = DEFAULT; -SELECT @@session.query_prealloc_size = 24576; +SELECT @@session.query_prealloc_size = 32768; --echo '#--------------------FN_DYNVARS_005_03-------------------------#' diff --git a/mysys/my_alloc.c b/mysys/my_alloc.c index e81509c9efc..1be03033424 100644 --- a/mysys/my_alloc.c +++ b/mysys/my_alloc.c @@ -64,7 +64,13 @@ void init_alloc_root(PSI_memory_key key, MEM_ROOT *mem_root, size_t block_size, mem_root->free= mem_root->used= mem_root->pre_alloc= 0; mem_root->min_malloc= 32; - mem_root->block_size= block_size - ALLOC_ROOT_MIN_BLOCK_SIZE; + /* + We remove MALLOC_OVERHEAD from blocksize to ensure that if the user + used a block size of power of 2, we will not allocate over it, + including the extra memory added by safe_malloc & malloc(). + */ + mem_root->block_size= (block_size > MALLOC_OVERHEAD ? + block_size - MALLOC_OVERHEAD : 0); mem_root->flags= 0; if (my_flags & MY_THREAD_SPECIFIC) mem_root->flags|= ROOT_FLAG_THREAD_SPECIFIC; @@ -114,7 +120,8 @@ void reset_root_defaults(MEM_ROOT *mem_root, size_t block_size, DBUG_ENTER("reset_root_defaults"); DBUG_ASSERT(alloc_root_inited(mem_root)); - mem_root->block_size= block_size - ALLOC_ROOT_MIN_BLOCK_SIZE; + mem_root->block_size= (block_size > MALLOC_OVERHEAD ? + block_size - MALLOC_OVERHEAD : 0); #if !(defined(HAVE_valgrind) && defined(EXTRA_DEBUG)) if (pre_alloc_size) { @@ -173,7 +180,7 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length) #if defined(HAVE_valgrind) && defined(EXTRA_DEBUG) reg1 USED_MEM *next; DBUG_ENTER("alloc_root"); - DBUG_PRINT("enter",("root: %p", mem_root)); + DBUG_PRINT("enter",("root: %p length: %ld", mem_root, (long) length)); DBUG_ASSERT(alloc_root_inited(mem_root)); @@ -207,7 +214,7 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length) reg2 USED_MEM **prev; size_t original_length __attribute__((unused)) = length; DBUG_ENTER("alloc_root"); - DBUG_PRINT("enter",("root: %p", mem_root)); + DBUG_PRINT("enter",("root: %p length: %ld", mem_root, (long) length)); DBUG_ASSERT(alloc_root_inited(mem_root)); DBUG_ASSERT((mem_root->flags & ROOT_FLAG_READ_ONLY) == 0); @@ -227,8 +234,8 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length) (*prev)->left < ALLOC_MAX_BLOCK_TO_DROP) { next= *prev; - *prev= next->next; /* Remove block from list */ - next->next= mem_root->used; + *prev= next->next; /* Remove block from free list */ + next->next= mem_root->used; /* Add to used list */ mem_root->used= next; mem_root->first_block_usage= 0; } @@ -250,21 +257,27 @@ void *alloc_root(MEM_ROOT *mem_root, size_t length) DBUG_RETURN((void*) 0); /* purecov: inspected */ } mem_root->block_num++; - next->next= *prev; next->size= get_size; next->left= get_size-ALIGN_SIZE(sizeof(USED_MEM)); - *prev=next; + next->next= 0; + DBUG_ASSERT(*prev == 0); + *prev= next; /* Put last in free list */ TRASH_MEM(next); } + else + { + /* Reset first_block_usage if we used the first block */ + if (prev == &mem_root->free) + mem_root->first_block_usage= 0; + } point= (uchar*) ((char*) next+ (next->size-next->left)); - /*TODO: next part may be unneded due to mem_root->first_block_usage counter*/ if ((next->left-= length) < mem_root->min_malloc) - { /* Full block */ - *prev= next->next; /* Remove block from list */ + { + /* Full block. Move the block from the free list to the used list */ + *prev= next->next; next->next= mem_root->used; mem_root->used= next; - mem_root->first_block_usage= 0; } point+= REDZONE_SIZE; TRASH_ALLOC(point, original_length); diff --git a/mysys/my_default.c b/mysys/my_default.c index fb367f43e66..1743ee744ef 100644 --- a/mysys/my_default.c +++ b/mysys/my_default.c @@ -410,14 +410,14 @@ int my_load_defaults(const char *conf_file, const char **groups, int *argc, const char **dirs; DBUG_ENTER("my_load_defaults"); - init_alloc_root(key_memory_defaults, &alloc, 512, 0, MYF(0)); + init_alloc_root(key_memory_defaults, &alloc, 4096, 0, MYF(0)); if ((dirs= init_default_directories(&alloc)) == NULL) goto err; args_used= get_defaults_options(*argv); - if (my_init_dynamic_array(key_memory_defaults, &args, sizeof(char*), 128, 64, - MYF(0))) + if (my_init_dynamic_array(key_memory_defaults, &args, sizeof(char*), + DEFAULT_ROOT_BLOCK_SIZE, 0, MYF(0))) goto err; insert_dynamic(&args, *argv);/* Name MUST be set, even by embedded library */ diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 6542ffd8cb3..059d6c03d3a 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -803,9 +803,10 @@ THD::THD(my_thread_id id, bool is_wsrep_applier) Pass nominal parameters to init_alloc_root only to ensure that the destructor works OK in case of an error. The main_mem_root will be re-initialized in init_for_queries(). + The base one will mainly be use to allocate memory during authentication. */ init_sql_alloc(key_memory_thd_main_mem_root, - &main_mem_root, ALLOC_ROOT_MIN_BLOCK_SIZE, 0, + &main_mem_root, DEFAULT_ROOT_BLOCK_SIZE, 0, MYF(MY_THREAD_SPECIFIC)); /* diff --git a/sql/sql_class.h b/sql/sql_class.h index b47716270f1..8e3bb7c7467 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -3243,7 +3243,7 @@ public: bzero((char*)this, sizeof(*this)); implicit_xid.null(); init_sql_alloc(key_memory_thd_transactions, &mem_root, - ALLOC_ROOT_MIN_BLOCK_SIZE, 0, MYF(MY_THREAD_SPECIFIC)); + DEFAULT_ROOT_BLOCK_SIZE, 0, MYF(MY_THREAD_SPECIFIC)); } } default_transaction, *transaction; Global_read_lock global_read_lock; diff --git a/sql/sql_const.h b/sql/sql_const.h index 490b870d768..354d942e160 100644 --- a/sql/sql_const.h +++ b/sql/sql_const.h @@ -175,21 +175,26 @@ #define MYSQLD_NET_RETRY_COUNT 10 ///< Abort read after this many int. #endif -#define QUERY_ALLOC_BLOCK_SIZE 16384 -#define QUERY_ALLOC_PREALLOC_SIZE 24576 +/* + Allocations with MEM_ROOT. We should try to keep these as powers of 2 + and not higher than 32768 to get full benefit of allocators like + tcmalloc that will for these use a local heap without locks. +*/ + +#define QUERY_ALLOC_BLOCK_SIZE 32768 +#define QUERY_ALLOC_PREALLOC_SIZE 32768 /* 65536 could be better */ #define TRANS_ALLOC_BLOCK_SIZE 8192 #define TRANS_ALLOC_PREALLOC_SIZE 4096 #define RANGE_ALLOC_BLOCK_SIZE 4096 #define ACL_ALLOC_BLOCK_SIZE 1024 #define UDF_ALLOC_BLOCK_SIZE 1024 -#define TABLE_ALLOC_BLOCK_SIZE 1024 +#define TABLE_PREALLOC_BLOCK_SIZE 8192 +#define TABLE_ALLOC_BLOCK_SIZE 4096 #define WARN_ALLOC_BLOCK_SIZE 2048 #define WARN_ALLOC_PREALLOC_SIZE 1024 -/* - Note that if we are using 32K or less, then TCmalloc will use a local - heap without locks! -*/ -#define SHOW_ALLOC_BLOCK_SIZE (32768-MALLOC_OVERHEAD) +#define TMP_TABLE_BLOCK_SIZE 16384 +#define TMP_TABLE_PREALLOC_SIZE 32768 +#define SHOW_ALLOC_BLOCK_SIZE 32768 /* The following parameters is to decide when to use an extra cache to diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index a1c0a889274..6ad0c35e945 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -1616,9 +1616,9 @@ int plugin_init(int *argc, char **argv, int flags) init_plugin_psi_keys(); - init_alloc_root(key_memory_plugin_mem_root, &plugin_mem_root, 4096, 4096, MYF(0)); - init_alloc_root(key_memory_plugin_mem_root, &plugin_vars_mem_root, 4096, 4096, MYF(0)); - init_alloc_root(PSI_NOT_INSTRUMENTED, &tmp_root, 4096, 4096, MYF(0)); + init_alloc_root(key_memory_plugin_mem_root, &plugin_mem_root, 4096, 16384, MYF(0)); + init_alloc_root(key_memory_plugin_mem_root, &plugin_vars_mem_root, 4096, 32768, MYF(0)); + init_alloc_root(PSI_NOT_INSTRUMENTED, &tmp_root, 16384, 32768, MYF(0)); if (my_hash_init(key_memory_plugin_bookmark, &bookmark_hash, &my_charset_bin, 32, 0, 0, get_bookmark_hash_key, NULL, HASH_UNIQUE)) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 7f282c597d6..a4e57a759ff 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -20049,8 +20049,8 @@ TABLE *Create_tmp_table::start(THD *thd, copy_func_count+= param->sum_func_count; param->copy_func_count= copy_func_count; - init_sql_alloc(key_memory_TABLE, &own_root, TABLE_ALLOC_BLOCK_SIZE, 0, - MYF(MY_THREAD_SPECIFIC)); + init_sql_alloc(key_memory_TABLE, &own_root, TMP_TABLE_BLOCK_SIZE, + TMP_TABLE_PREALLOC_SIZE, MYF(MY_THREAD_SPECIFIC)); if (!multi_alloc_root(&own_root, &table, sizeof(*table), diff --git a/sql/table.cc b/sql/table.cc index 3bf1906f62f..fa88ddf4407 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -345,8 +345,8 @@ TABLE_SHARE *alloc_table_share(const char *db, const char *table_name, path_length= build_table_filename(path, sizeof(path) - 1, db, table_name, "", 0); - init_sql_alloc(key_memory_table_share, &mem_root, TABLE_ALLOC_BLOCK_SIZE, 0, - MYF(0)); + init_sql_alloc(key_memory_table_share, &mem_root, TABLE_ALLOC_BLOCK_SIZE, + TABLE_PREALLOC_BLOCK_SIZE, MYF(0)); if (multi_alloc_root(&mem_root, &share, sizeof(*share), &key_buff, key_length, @@ -435,10 +435,12 @@ void init_tmp_table_share(THD *thd, TABLE_SHARE *share, const char *key, bzero((char*) share, sizeof(*share)); /* This can't be MY_THREAD_SPECIFIC for slaves as they are freed - during cleanup() from Relay_log_info::close_temporary_tables() + during cleanup() from Relay_log_info::close_temporary_tables(). + We can also not use pre-alloc here, as internal temporary tables + are not freeing table->share->mem_root */ init_sql_alloc(key_memory_table_share, &share->mem_root, - TABLE_ALLOC_BLOCK_SIZE, 0, + TABLE_PREALLOC_BLOCK_SIZE, 0, MYF(thd->slave_thread ? 0 : MY_THREAD_SPECIFIC)); share->table_category= TABLE_CATEGORY_TEMPORARY; share->tmp_table= INTERNAL_TMP_TABLE; @@ -4136,7 +4138,7 @@ enum open_frm_error open_table_from_share(THD *thd, TABLE_SHARE *share, goto err; } init_sql_alloc(key_memory_TABLE, &outparam->mem_root, TABLE_ALLOC_BLOCK_SIZE, - 0, MYF(0)); + TABLE_PREALLOC_BLOCK_SIZE, MYF(0)); /* We have to store the original alias in mem_root as constraints and virtual @@ -4512,8 +4514,8 @@ partititon_err: thd->lex->context_analysis_only= save_context_analysis_only; DBUG_EXECUTE_IF("print_long_unique_internal_state", - print_long_unique_table(outparam);); - DBUG_RETURN (OPEN_FRM_OK); + print_long_unique_table(outparam);); + DBUG_RETURN(OPEN_FRM_OK); err: if (! error_reported) From 504cfa4857026749c9aae01d8f099b4a67356672 Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 3 Dec 2024 19:06:34 +0200 Subject: [PATCH 59/84] Updated misc_session_status.test to not fail if select does not fail The test with memory restrictions randomly works or fails in buildbot depending on server configurations. On my machine the original test worked. As the test was there to just check if the server crashes when run with small memory configurations, I disabled testing if the query would fail or not. The test still has its original purpose. Discussed with: Sergei Golubchik --- mysql-test/suite/perfschema/r/misc_session_status.result | 1 - mysql-test/suite/perfschema/t/misc_session_status.test | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/perfschema/r/misc_session_status.result b/mysql-test/suite/perfschema/r/misc_session_status.result index 3ce472fc617..2133b064eb2 100644 --- a/mysql-test/suite/perfschema/r/misc_session_status.result +++ b/mysql-test/suite/perfschema/r/misc_session_status.result @@ -7,7 +7,6 @@ select * from performance_schema.session_status limit 0; VARIABLE_NAME VARIABLE_VALUE set max_session_mem_used=32768; select * from performance_schema.session_status; -ERROR HY000: The MariaDB server is running with the --max-session-mem-used=32768 option so it cannot execute this statement set global innodb_io_capacity_max=100; Warnings: Warning 1210 Setting innodb_io_capacity_max 100 lower than innodb_io_capacity 200. diff --git a/mysql-test/suite/perfschema/t/misc_session_status.test b/mysql-test/suite/perfschema/t/misc_session_status.test index c9e7d066b0c..afb08eb4e9d 100644 --- a/mysql-test/suite/perfschema/t/misc_session_status.test +++ b/mysql-test/suite/perfschema/t/misc_session_status.test @@ -10,9 +10,11 @@ set @old_innodb_io_capacity=@@global.innodb_io_capacity; set @old_innodb_io_capacity_max=@@global.innodb_io_capacity_max; select * from performance_schema.session_status limit 0; # discover the table set max_session_mem_used=32768; ---error ER_OPTION_PREVENTS_STATEMENT +--disable_result_log +--error 0,ER_OPTION_PREVENTS_STATEMENT # this used to crash, when OOM happened under LOCK_thd_kill select * from performance_schema.session_status; +--enable_result_log # this used to cause mutex lock order violation when OOM happened under LOCK_global_system_variables set global innodb_io_capacity_max=100; set max_session_mem_used=default; From 996e7fd7d5d595aa674ec32f9f3814f96137c324 Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 3 Dec 2024 19:08:10 +0200 Subject: [PATCH 60/84] Avoid printing "rowid_filter_skipped" in optimizer trace if no rowid filter There is no point in saying something is skipped when it does not exists. --- mysql-test/main/opt_trace.result | 1 - sql/sql_select.cc | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mysql-test/main/opt_trace.result b/mysql-test/main/opt_trace.result index ff9797a7072..8120914acaf 100644 --- a/mysql-test/main/opt_trace.result +++ b/mysql-test/main/opt_trace.result @@ -4134,7 +4134,6 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 { "rec_per_key_stats_missing": true, "used_range_estimates": false, "cause": "not better than ref estimates", - "rowid_filter_skipped": "worst/max seeks clipping", "rows": 2, "cost": 3.003514767, "chosen": true diff --git a/sql/sql_select.cc b/sql/sql_select.cc index a4e57a759ff..024743f02f3 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -8704,8 +8704,11 @@ best_access_path(JOIN *join, if (!(records < s->worst_seeks && records <= thd->variables.max_seeks_for_key)) { - // Don't use rowid filter - trace_access_idx.add("rowid_filter_skipped", "worst/max seeks clipping"); + if (table->range_rowid_filter_cost_info_elems) + { + // Don't use rowid filter + trace_access_idx.add("rowid_filter_skipped", "worst/max seeks clipping"); + } filter= NULL; } else From a0bfdef5e6f8a26d9fdb0f518feee697312a6482 Mon Sep 17 00:00:00 2001 From: Monty Date: Wed, 4 Dec 2024 11:31:00 +0200 Subject: [PATCH 61/84] Added more information to errors reported by report_reply_packet() In particular ""Read semi-sync reply magic number error" now prints out what was wrong with the packet. Reviewed-by: Sergei Golubchik --- sql/semisync_master.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/sql/semisync_master.cc b/sql/semisync_master.cc index 7694c2cfd49..437b9bb99b4 100644 --- a/sql/semisync_master.cc +++ b/sql/semisync_master.cc @@ -608,13 +608,17 @@ int Repl_semi_sync_master::report_reply_packet(uint32 server_id, DBUG_RETURN(-1); } else - sql_print_error("Read semi-sync reply magic number error"); + sql_print_error("Read semi-sync reply magic number error. " + "Got magic: %u command %u length: %lu", + (uint) packet[REPLY_MAGIC_NUM_OFFSET], (uint) packet[0], + packet_len); goto l_end; } if (unlikely(packet_len < REPLY_BINLOG_NAME_OFFSET)) { - sql_print_error("Read semi-sync reply length error: packet is too small"); + sql_print_error("Read semi-sync reply length error: packet is too small: %lu", + packet_len); goto l_end; } @@ -622,7 +626,8 @@ int Repl_semi_sync_master::report_reply_packet(uint32 server_id, log_file_len = packet_len - REPLY_BINLOG_NAME_OFFSET; if (unlikely(log_file_len >= FN_REFLEN)) { - sql_print_error("Read semi-sync reply binlog file length too large"); + sql_print_error("Read semi-sync reply binlog file length too large: %llu", + (ulonglong) log_file_pos); goto l_end; } strncpy(log_file_name, (const char*)packet + REPLY_BINLOG_NAME_OFFSET, log_file_len); From 47a5eed43791717d4cefb40e6e30bff1dbabfe50 Mon Sep 17 00:00:00 2001 From: Monty Date: Wed, 4 Dec 2024 12:03:40 +0200 Subject: [PATCH 62/84] Added status variable "Max_memory_used" to SHOW STATUS This shows the maximum memory allocations used by the current connection. The value for @@global.max_memory_used is 0 as we are not collecting this value as it would cause a notable performance issue registering this for all threads for every memory allocation Reviewed-by: Sergei Golubchik --- mysql-test/main/memory_used.result | 8 ++++++++ mysql-test/main/memory_used.test | 20 ++++++++++++++++++++ sql/mysqld.cc | 17 +++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 mysql-test/main/memory_used.result create mode 100644 mysql-test/main/memory_used.test diff --git a/mysql-test/main/memory_used.result b/mysql-test/main/memory_used.result new file mode 100644 index 00000000000..974be5a6e1e --- /dev/null +++ b/mysql-test/main/memory_used.result @@ -0,0 +1,8 @@ +select * from information_schema.processlist where id=0; +should be true +1 +should be true +1 +show global status like "max_memory_used"; +Variable_name Value +Max_memory_used NULL diff --git a/mysql-test/main/memory_used.test b/mysql-test/main/memory_used.test new file mode 100644 index 00000000000..0416f5114a5 --- /dev/null +++ b/mysql-test/main/memory_used.test @@ -0,0 +1,20 @@ +# +# Added status variable "Max_memory_used" to SHOW STATUS +# + +let $l1=`show status like "max_memory_used"`; +--disable_result_log +select * from information_schema.processlist where id=0; +--enable_result_log +let $l2=`show status like "max_memory_used"`; + +--disable_query_log +eval SET @l1= SUBSTRING_INDEX('$l1', ' ', -1); +eval SET @l2= SUBSTRING_INDEX('$l2', ' ', -1); +eval select @l1 > 10000 as "should be true"; +eval select @l2+0 > @l1+0 as "should be true"; + +--enable_query_log +# global max_memory should be NULL as we cannot calculate this +show global status like "max_memory_used"; + diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d204a8482f0..43c6c2f86ef 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -7222,6 +7222,22 @@ static int show_memory_used(THD *thd, SHOW_VAR *var, void *buff, return 0; } +static int show_max_memory_used(THD *thd, SHOW_VAR *var, void *buff, + struct system_status_var *status_var, + enum enum_var_type scope) +{ + var->type= SHOW_LONGLONG; + var->value= buff; + if (scope == OPT_GLOBAL) + { + var->type= SHOW_CHAR; + var->value= (char*) "NULL"; // Emulate null value + } + else + *(longlong*) buff= (longlong) status_var->max_local_memory_used; + return 0; +} + static int show_stack_usage(THD *thd, SHOW_VAR *var, void *buff, system_status_var *, enum_var_type scope) @@ -7404,6 +7420,7 @@ SHOW_VAR status_vars[]= { {"Master_gtid_wait_timeouts", (char*) offsetof(STATUS_VAR, master_gtid_wait_timeouts), SHOW_LONG_STATUS}, {"Master_gtid_wait_time", (char*) offsetof(STATUS_VAR, master_gtid_wait_time), SHOW_LONG_STATUS}, {"Max_used_connections", (char*) &max_used_connections, SHOW_LONG}, + {"Max_memory_used", (char*) &show_max_memory_used, SHOW_SIMPLE_FUNC}, {"Memory_used", (char*) &show_memory_used, SHOW_SIMPLE_FUNC}, {"Memory_used_initial", (char*) &start_memory_used, SHOW_LONGLONG}, {"Resultset_metadata_skipped", (char *) offsetof(STATUS_VAR, skip_metadata_count),SHOW_LONG_STATUS}, From 87ee1e75bcb783386b1f717a02bcbb6983fd0f55 Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 13 Dec 2024 15:41:59 +0200 Subject: [PATCH 63/84] MDEV-35643 Add support for MySQL 8.0 binlog events MDEV-29533 Crash when MariaDB is replica of MySQL 8.0 MySQL 8.0 has added the following new events in the MySQL binary log PARTIAL_UPDATE_ROWS_EVENT TRANSACTION_PAYLOAD_EVENT HEARTBEAT_LOG_EVENT_V2 - PARTIAL_UPDATE_ROWS_EVENT is used by MySQL to generate update statements using JSON_SET, JSON_REPLACE and JSON_REMOVE to make update of JSON columns more efficient. These events can be disabled by setting 'binlog-row-value-options=""' - TRANSACTION_PAYLOAD_EVENT is used by MySQL to signal that a row event is compressed. It an be disably by setting 'binlog_transaction_compression=0'. - HEARTBEAT_LOG_EVENT_V2 is written to the binary log many times per seconds. It can be ignored by the server. What this patch does: - If PARTIAL_UPDATE_ROWS_EVENT or TRANSACTION_PAYLOAD_EVENT is found, the server will stop with an error message of how to disable the MySQL server to generate such events. - HEARTBEAT_LOG_EVENT_V2 events are ignored. - mariadb-binlog will write the name of the new events. - mariadb-binlog will stop if PARTIAL_UPDATE_ROWS_EVENT or TRANSACTION_PAYLOAD_EVENT is found, unless --force is given. - Fixes a crash in mariadb-binlog if a character set unknown to MariaDB is found. (MDEV-29533) From Kristian Nielsen: - Add test case for MySQL 8.0 to MariaDB replication and fixed a a small typo in post_header_len initialization. Reviewer: knielsen@mariadb.org --- .../std_data/mdev35643_mysql_80_binlog.000001 | Bin 0 -> 4438 bytes .../suite/rpl/r/rpl_from_mysql80.result | 52 ++++++++ mysql-test/suite/rpl/t/rpl_from_mysql80.test | 121 ++++++++++++++++++ sql/log_event.cc | 29 ++++- sql/log_event.h | 8 ++ sql/log_event_client.cc | 7 +- sql/sql_repl.cc | 8 -- 7 files changed, 213 insertions(+), 12 deletions(-) create mode 100644 mysql-test/std_data/mdev35643_mysql_80_binlog.000001 create mode 100644 mysql-test/suite/rpl/r/rpl_from_mysql80.result create mode 100644 mysql-test/suite/rpl/t/rpl_from_mysql80.test diff --git a/mysql-test/std_data/mdev35643_mysql_80_binlog.000001 b/mysql-test/std_data/mdev35643_mysql_80_binlog.000001 new file mode 100644 index 0000000000000000000000000000000000000000..2953c2a277cb81bca21868837725a4ca807d9f1b GIT binary patch literal 4438 zcmeHLdsLH07N2|x7();h6%d4vNO=#ezjn{*oXq!_d+%@N z{$}p|F8oW9oW8d>Cdq^b0LX^@J=g(Y06v$;UC47wTr0^;!b7jTAQ)3%444`K2E0iC zV=j7SGMNOtu~;l;XE1XiU^xQX&u{Mh1)0o8Guyyk1A9K~nznA%qY@u^wAv1N{XHG>=mF#LwbfH zk->!SFaevUSeu~$Gn5(~FmoK30z4EDF7OixNRglaN&%^GCmqFPkWfU1g$ITBg|8ul z1#4VM2^w-G6Ua!v@POrh;g0S+kA+T7q(B%LBoufBrKd}m`IAWE7a$UZldA+GGF7Zd zPIs63{92|*!T{x+b|Ej_uy<&TV&hS_h6HO&!ti%_M|30vL$#$)4|=CXfh5e+Jklm2 z0XmIc_7}iqe|FaYZwSg1E$A)SGw_so*q#O$Sd&n=13H~6sCLJ`SF{cw*GB3TaPAL+FT{!`i3e6KWM{Wo}5UJ0d1@jbM^1fvusCQadxC zVW%9kWANULNCbyTMC`l+^8j;@hrk7%}ngSW!2CF2@`({05)2={th;bJj7h@f;^VP$}3 zq+Fehp%#yXmB>uD6+%5T%n;=w17xHm%N{E(IUx%jLuuGTrS<-3QTqWT)-iMzi?!0< z-v|nwQoH^25}ePr(NR9DzxAjM!8xMP@Pcd(6EwaxrQ0z|?1N?VOTNKL6`G!A#q& z(}~i$@Ce+lS6{vO<8sy}AP1?S-gDHt*5TAQAB386dQU9-b|8r87_u5j&UwFo#A1JI z==6@B!N!ksvrC({O5EM%SO#oVy5yw|dG2;`apSIjy14btkrX@6JICMkif;U|wkBpx zvOFTlZ;@L~QKoGVcbB-a_`3g`$n?=A@{nEg2InRI5SI7!%<=ZStT(Eg2j8&BQqAAr z7G-y7xHz95SJ~J7Tj#ADuQS!sDS?AUX`XS@j_evv-!_+XsiCv=Ex)S1o|NHr)~(Od z@0}=LHN2<(P|n3G{0}diceOaMul_VBSpDlm!frTqV0+H-{$<`#3fo#|rDxOAfig)- zxxwuA3xAPbdGL69SxDU8%7?$vxw*OCholu%kMBLKR4wVa8kOWZ(!Dmy56aue zazgpFM_XdT_h3 zDtLb3(Va^5r?Z@gI0aKxfi_!??#NO{U$YpRDK}6BSQhlvmC;pq9o3faN5t{i{bRl$ zuJ6Fe#@pAbdJd{A&7NF8m4CC&HeOK5U4H0Tvw3CVmRX{9+DzXt()C^ce&%`R`EeJf z&pGhRdlJX)0++WHbS<1 zi@lXRn$ON^Jk8${-RUhXOz0d{nsl(TI&)&q-IIBJasG)caW#ASzS4hQ5GyU)nr3vc zp2_E08QpKrRYxj~?spN~k{-G77bV|!osn%fD!xo>P_tu-EM-ggG&?C{`4WD`W|?bD zvw_T}txI-;2fPbC*A;I#Qkp%+cIy0xI+E|h->kI0X>fDe%}ry+QWr7uS66@aAmL|` zsp;;Ngm1@ZyU*@5m*3Kh#pP3fAAm265L65rY6pM$P7{kP!({(B$4x zUg3NT^)vIZccXHA7QW2du}tS*I23;d;q=ae9UO#>Hc^SCtuys1t&^8hQgn#*&@u{> z^#Wu61!9nJl^|S%>d{bA;QhELXkU<=j2K{Af*JPgsKEiu7i`)=`NZtTCnaoZNzJJ(^4AG zJIT@`yoquJ`Zhr$D59wtJyE71{1^irs4n~Ub~<`Q(B8uMCBp4BptOkypGxhs9_32| zS7ahg9EGS33x=2g6rc+%PpO*00}%8lGzI}nTbH3xTrS|4ISW6>Q)VDt%7OsIxTdhZ zhw3*v_=&K9KyzWYgq>{#*tURuhY(8=7>N0^23nr~xW)cK!T%ct43r9BP@veVMPWd< z<4Sh3Kc-1TrT>G!ysgrmdily8$1YEs8V*>v;J@V<=$!|9Bobinlog_version)); DBUG_DUMP_EVENT_BUF(buf, event_len); + *error= 0; /* Check the integrity; This is needed because handle_slave_io() doesn't check if packet is of proper length. @@ -1237,6 +1241,7 @@ Log_event* Log_event::read_log_event(const uchar *buf, uint event_len, case ANONYMOUS_GTID_LOG_EVENT: case PREVIOUS_GTIDS_LOG_EVENT: case TRANSACTION_CONTEXT_EVENT: + case HEARTBEAT_LOG_EVENT_V2: // MySQL 8.0 case VIEW_CHANGE_EVENT: ev= new Ignorable_log_event(buf, fdle, get_type_str((Log_event_type) event_type)); @@ -1261,6 +1266,21 @@ Log_event* Log_event::read_log_event(const uchar *buf, uint event_len, case START_ENCRYPTION_EVENT: ev= new Start_encryption_log_event(buf, event_len, fdle); break; + case TRANSACTION_PAYLOAD_EVENT: // MySQL 8.0 + *error= + "Found incompatible MySQL 8.0 TRANSACTION_PAYLOAD_EVENT event. " + "You can avoid this event by specifying " + "'binlog_transaction_compression=0' in the MySQL server"; + ev= NULL; + break; + case PARTIAL_UPDATE_ROWS_EVENT: // MySQL 8.0 + *error= + "Found incompatible MySQL 8.0 PARTIAL_UPDATE_ROWS_EVENT event. " + "You can avoid this event by specifying " + "'binlog-row-value-options=\"\"' in the MySQL server"; + ev= NULL; + break; + default: DBUG_PRINT("error",("Unknown event code: %d", (uchar) buf[EVENT_TYPE_OFFSET])); @@ -1303,12 +1323,14 @@ exit: #ifdef MYSQL_CLIENT if (!force_opt) /* then mysqlbinlog dies */ { - *error= "Found invalid event in binary log"; + if (!*error) + *error= "Found invalid event in binary log"; DBUG_RETURN(0); } ev= new Unknown_log_event(buf, fdle); #else - *error= "Found invalid event in binary log"; + if (!*error) + *error= "Found invalid event in binary log"; DBUG_RETURN(0); #endif } @@ -2126,6 +2148,9 @@ Format_description_log_event(uint8 binlog_ver, const char* server_ver) post_header_len[TRANSACTION_CONTEXT_EVENT-1]= 0; post_header_len[VIEW_CHANGE_EVENT-1]= 0; post_header_len[XA_PREPARE_LOG_EVENT-1]= 0; + post_header_len[PARTIAL_UPDATE_ROWS_EVENT-1]= ROWS_HEADER_LEN_V2; + post_header_len[TRANSACTION_PAYLOAD_EVENT-1]= ROWS_HEADER_LEN_V2; + post_header_len[HEARTBEAT_LOG_EVENT_V2-1]= ROWS_HEADER_LEN_V2; post_header_len[WRITE_ROWS_EVENT-1]= ROWS_HEADER_LEN_V2; post_header_len[UPDATE_ROWS_EVENT-1]= ROWS_HEADER_LEN_V2; post_header_len[DELETE_ROWS_EVENT-1]= ROWS_HEADER_LEN_V2; diff --git a/sql/log_event.h b/sql/log_event.h index e4bda624e0c..03902cc286e 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -678,6 +678,14 @@ enum Log_event_type /* not ignored */ XA_PREPARE_LOG_EVENT= 38, + /** + Extension of UPDATE_ROWS_EVENT, allowing partial values according + to binlog_row_value_options. + */ + PARTIAL_UPDATE_ROWS_EVENT = 39, + TRANSACTION_PAYLOAD_EVENT = 40, + HEARTBEAT_LOG_EVENT_V2 = 41, + /* Add new events here - right above this comment! Existing events (except ENUM_END_EVENT) should never change their numbers diff --git a/sql/log_event_client.cc b/sql/log_event_client.cc index 0b431dc5bed..6e62734ae9a 100644 --- a/sql/log_event_client.cc +++ b/sql/log_event_client.cc @@ -1970,7 +1970,7 @@ bool Query_log_event::print_query_header(IO_CACHE* file, print_event_info->auto_increment_offset= auto_increment_offset; } - /* TODO: print the catalog when we feature SET CATALOG */ + /* TODO: print the catalog when we feature USE CATALOG */ if (likely(charset_inited) && (unlikely(!print_event_info->charset_inited || @@ -1984,12 +1984,15 @@ bool Query_log_event::print_query_header(IO_CACHE* file, cs_info->cs_name.str, print_event_info->delimiter)) goto err; } + else if (my_b_printf(file, "# Ignored (Unknown charset) ")) + goto err; + if (my_b_printf(file,"SET " "@@session.character_set_client=%s," "@@session.collation_connection=%d," "@@session.collation_server=%d" "%s\n", - cs_info->cs_name.str, + cs_info ? cs_info->cs_name.str : "Unknown", uint2korr(charset+2), uint2korr(charset+4), print_event_info->delimiter)) diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 418e6aafab1..e33ad987fe8 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -434,7 +434,6 @@ static int send_file(THD *thd) Internal to mysql_binlog_send() routine that recalculates checksum for 1. FD event (asserted) that needs additional arrangement prior sending to slave. 2. Start_encryption_log_event whose Ignored flag is set -TODO DBUG_ASSERT can be removed if this function is used for more general cases */ inline void fix_checksum(enum_binlog_checksum_alg checksum_alg, String *packet, @@ -446,13 +445,6 @@ inline void fix_checksum(enum_binlog_checksum_alg checksum_alg, String *packet, /* recalculate the crc for this event */ uint data_len = uint4korr(packet->ptr() + ev_offset + EVENT_LEN_OFFSET); ha_checksum crc; - DBUG_ASSERT((data_len == - LOG_EVENT_MINIMAL_HEADER_LEN + FORMAT_DESCRIPTION_HEADER_LEN + - BINLOG_CHECKSUM_ALG_DESC_LEN + BINLOG_CHECKSUM_LEN) || - (data_len == - LOG_EVENT_MINIMAL_HEADER_LEN + BINLOG_CRYPTO_SCHEME_LENGTH + - BINLOG_KEY_VERSION_LENGTH + BINLOG_NONCE_LENGTH + - BINLOG_CHECKSUM_LEN)); crc= my_checksum(0, (uchar *)packet->ptr() + ev_offset, data_len - BINLOG_CHECKSUM_LEN); int4store(packet->ptr() + ev_offset + data_len - BINLOG_CHECKSUM_LEN, crc); From 88d9348dfc494105046451beef15a8e68d7f51be Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 27 Dec 2024 13:59:24 +0200 Subject: [PATCH 64/84] Remove dates from all rdiff files --- mysql-test/main/alter_table_combinations,aria.rdiff | 4 ++-- mysql-test/main/alter_table_combinations,heap.rdiff | 4 ++-- mysql-test/main/myisam_mrr,32bit.rdiff | 4 ++-- mysql-test/main/select,ps.rdiff | 4 ++-- mysql-test/main/select_jcl6,ps.rdiff | 4 ++-- mysql-test/main/select_pkeycache,ps.rdiff | 4 ++-- mysql-test/suite/encryption/r/encrypt_and_grep,undo3.rdiff | 4 ++-- .../suite/encryption/r/innodb-remove-encryption,undo3.rdiff | 4 ++-- .../suite/encryption/r/innodb_encrypt_freed,undo3.rdiff | 4 ++-- .../encryption/r/innodb_encrypt_key_rotation_age,undo3.rdiff | 4 ++-- mysql-test/suite/engines/funcs/r/rpl_sp,myisam,mix.rdiff | 4 ++-- mysql-test/suite/galera/r/galera_ist_mariabackup,debug.rdiff | 4 ++-- .../r/galera_ist_mariabackup_innodb_flush_logs,debug.rdiff | 4 ++-- mysql-test/suite/galera/r/galera_ist_rsync,debug.rdiff | 4 ++-- .../galera/r/galera_sst_mariabackup_data_dir,debug.rdiff | 4 ++-- .../r/galera_sst_mariabackup_force_recovery,debug.rdiff | 4 ++-- mysql-test/suite/galera/r/galera_sst_rsync2,debug.rdiff | 4 ++-- .../suite/galera/r/galera_sst_rsync_data_dir,debug.rdiff | 4 ++-- mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff | 4 ++-- mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff | 4 ++-- mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff | 4 ++-- mysql-test/suite/innodb/r/instant_alter_limit,16k.rdiff | 4 ++-- mysql-test/suite/innodb/r/instant_alter_limit,32k.rdiff | 4 ++-- mysql-test/suite/innodb/r/instant_alter_limit,4k.rdiff | 4 ++-- mysql-test/suite/innodb/r/instant_alter_limit,64k.rdiff | 4 ++-- mysql-test/suite/innodb/r/instant_alter_limit,8k.rdiff | 4 ++-- mysql-test/suite/innodb/r/max_record_size,16k,compact.rdiff | 4 ++-- mysql-test/suite/innodb/r/max_record_size,16k,dynamic.rdiff | 4 ++-- mysql-test/suite/innodb/r/max_record_size,16k,redundant.rdiff | 4 ++-- mysql-test/suite/innodb/r/max_record_size,32k,compact.rdiff | 4 ++-- mysql-test/suite/innodb/r/max_record_size,32k,dynamic.rdiff | 4 ++-- mysql-test/suite/innodb/r/max_record_size,32k,redundant.rdiff | 4 ++-- mysql-test/suite/innodb/r/max_record_size,4k,compact.rdiff | 4 ++-- mysql-test/suite/innodb/r/max_record_size,4k,dynamic.rdiff | 4 ++-- mysql-test/suite/innodb/r/max_record_size,4k,redundant.rdiff | 4 ++-- mysql-test/suite/innodb/r/max_record_size,64k,compact.rdiff | 4 ++-- mysql-test/suite/innodb/r/max_record_size,64k,dynamic.rdiff | 4 ++-- mysql-test/suite/innodb/r/max_record_size,64k,redundant.rdiff | 4 ++-- mysql-test/suite/innodb/r/max_record_size,8k,compact.rdiff | 4 ++-- mysql-test/suite/innodb/r/max_record_size,8k,dynamic.rdiff | 4 ++-- mysql-test/suite/innodb/r/recovery_memory,debug.rdiff | 4 ++-- mysql-test/suite/innodb/r/restart,16k.rdiff | 4 ++-- mysql-test/suite/innodb/r/restart,32k.rdiff | 4 ++-- mysql-test/suite/innodb/r/restart,4k.rdiff | 4 ++-- mysql-test/suite/innodb/r/restart,64k.rdiff | 4 ++-- mysql-test/suite/innodb/r/restart,8k.rdiff | 4 ++-- mysql-test/suite/mtr/t/simple,c2,s1.rdiff | 4 ++-- mysql-test/suite/mtr/t/simple,s2,c2.rdiff | 4 ++-- mysql-test/suite/period/r/delete,myisam.rdiff | 4 ++-- mysql-test/suite/rpl/r/rpl_delayed_slave,parallel.rdiff | 4 ++-- mysql-test/suite/rpl/r/rpl_insert_delayed,stmt.rdiff | 4 ++-- mysql-test/suite/rpl/r/rpl_iodku,stmt.rdiff | 4 ++-- mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.rdiff | 4 ++-- .../suite/sys_vars/r/aria_sort_buffer_size_basic,32bit.rdiff | 4 ++-- .../suite/sys_vars/r/innodb_ft_result_cache_limit,32bit.rdiff | 4 ++-- mysql-test/suite/sys_vars/r/sysvars_aria,32bit.rdiff | 4 ++-- mysql-test/suite/sys_vars/r/sysvars_debug,32bit.rdiff | 4 ++-- mysql-test/suite/sys_vars/r/sysvars_wsrep,32bit.rdiff | 4 ++-- mysql-test/suite/versioning/r/select,trx_id.rdiff | 4 ++-- mysql-test/suite/versioning/r/select2,trx_id.rdiff | 4 ++-- mysql-test/suite/wsrep/r/wsrep-recover-v25,binlogon.rdiff | 4 ++-- storage/example/mysql-test/mtr/t/test2.rdiff | 4 ++-- .../mysql-test/storage_engine/autoinc_secondary.rdiff | 4 ++-- storage/innobase/mysql-test/storage_engine/cache_index.rdiff | 4 ++-- .../mysql-test/storage_engine/checksum_table_live.rdiff | 4 ++-- .../innobase/mysql-test/storage_engine/fulltext_search.rdiff | 4 ++-- .../mysql-test/storage_engine/index_enable_disable.rdiff | 4 ++-- .../innobase/mysql-test/storage_engine/index_type_hash.rdiff | 4 ++-- .../innobase/mysql-test/storage_engine/insert_delayed.rdiff | 4 ++-- .../innobase/mysql-test/storage_engine/lock_concurrent.rdiff | 4 ++-- .../innobase/mysql-test/storage_engine/optimize_table.rdiff | 4 ++-- .../mysql-test/storage_engine/parts/checksum_table.rdiff | 4 ++-- .../mysql-test/storage_engine/parts/create_table.rdiff | 4 ++-- .../mysql-test/storage_engine/parts/optimize_table.rdiff | 4 ++-- .../mysql-test/storage_engine/parts/repair_table.rdiff | 4 ++-- storage/innobase/mysql-test/storage_engine/repair_table.rdiff | 4 ++-- .../mysql-test/storage_engine/tbl_opt_index_dir.rdiff | 4 ++-- .../mysql-test/storage_engine/tbl_opt_insert_method.rdiff | 4 ++-- .../mysql-test/storage_engine/tbl_opt_row_format.rdiff | 4 ++-- .../innobase/mysql-test/storage_engine/tbl_opt_union.rdiff | 4 ++-- .../storage_engine/trx/cons_snapshot_serializable.rdiff | 4 ++-- .../mysql-test/storage_engine/trx/level_read_committed.rdiff | 4 ++-- .../storage_engine/trx/level_read_uncommitted.rdiff | 4 ++-- .../mysql-test/storage_engine/type_char_indexes.rdiff | 4 ++-- .../mysql-test/storage_engine/type_float_indexes.rdiff | 4 ++-- storage/myisam/mysql-test/mtr2/single.rdiff | 4 ++-- .../myisam/mysql-test/storage_engine/alter_table_online.rdiff | 4 ++-- .../myisam/mysql-test/storage_engine/alter_tablespace.rdiff | 4 ++-- storage/myisam/mysql-test/storage_engine/check_table.rdiff | 4 ++-- storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff | 4 ++-- .../myisam/mysql-test/storage_engine/index_type_hash.rdiff | 4 ++-- storage/myisam/mysql-test/storage_engine/misc.rdiff | 4 ++-- storage/myisam/mysql-test/storage_engine/show_engine.rdiff | 4 ++-- .../mysql-test/storage_engine/tbl_opt_insert_method.rdiff | 4 ++-- storage/myisam/mysql-test/storage_engine/tbl_opt_union.rdiff | 4 ++-- .../storage_engine/trx/cons_snapshot_repeatable_read.rdiff | 4 ++-- .../storage_engine/trx/cons_snapshot_serializable.rdiff | 4 ++-- storage/myisam/mysql-test/storage_engine/trx/delete.rdiff | 4 ++-- storage/myisam/mysql-test/storage_engine/trx/insert.rdiff | 4 ++-- .../mysql-test/storage_engine/trx/level_read_committed.rdiff | 4 ++-- .../storage_engine/trx/level_read_uncommitted.rdiff | 4 ++-- .../mysql-test/storage_engine/trx/level_repeatable_read.rdiff | 4 ++-- .../mysql-test/storage_engine/trx/level_serializable.rdiff | 4 ++-- .../mysql-test/storage_engine/trx/select_for_update.rdiff | 4 ++-- .../storage_engine/trx/select_lock_in_share_mode.rdiff | 4 ++-- storage/myisam/mysql-test/storage_engine/trx/update.rdiff | 4 ++-- storage/myisam/mysql-test/storage_engine/trx/xa.rdiff | 4 ++-- .../myisam/mysql-test/storage_engine/trx/xa_recovery.rdiff | 4 ++-- storage/myisammrg/mysql-test/storage_engine/alter_table.rdiff | 4 ++-- .../mysql-test/storage_engine/alter_table_online.rdiff | 4 ++-- .../mysql-test/storage_engine/alter_tablespace.rdiff | 4 ++-- .../myisammrg/mysql-test/storage_engine/analyze_table.rdiff | 4 ++-- .../myisammrg/mysql-test/storage_engine/autoincrement.rdiff | 4 ++-- storage/myisammrg/mysql-test/storage_engine/cache_index.rdiff | 4 ++-- .../mysql-test/storage_engine/checksum_table_live.rdiff | 4 ++-- .../myisammrg/mysql-test/storage_engine/create_table.rdiff | 4 ++-- .../myisammrg/mysql-test/storage_engine/foreign_keys.rdiff | 4 ++-- .../myisammrg/mysql-test/storage_engine/fulltext_search.rdiff | 4 ++-- storage/myisammrg/mysql-test/storage_engine/handler.rdiff | 4 ++-- storage/myisammrg/mysql-test/storage_engine/index.rdiff | 4 ++-- .../mysql-test/storage_engine/index_enable_disable.rdiff | 4 ++-- .../mysql-test/storage_engine/index_type_btree.rdiff | 4 ++-- .../myisammrg/mysql-test/storage_engine/index_type_hash.rdiff | 4 ++-- .../myisammrg/mysql-test/storage_engine/insert_delayed.rdiff | 4 ++-- storage/myisammrg/mysql-test/storage_engine/lock.rdiff | 4 ++-- storage/myisammrg/mysql-test/storage_engine/misc.rdiff | 4 ++-- .../myisammrg/mysql-test/storage_engine/optimize_table.rdiff | 4 ++-- .../mysql-test/storage_engine/parts/alter_table.rdiff | 4 ++-- .../mysql-test/storage_engine/parts/analyze_table.rdiff | 4 ++-- .../mysql-test/storage_engine/parts/check_table.rdiff | 4 ++-- .../mysql-test/storage_engine/parts/checksum_table.rdiff | 4 ++-- .../mysql-test/storage_engine/parts/create_table.rdiff | 4 ++-- .../mysql-test/storage_engine/parts/optimize_table.rdiff | 4 ++-- .../mysql-test/storage_engine/parts/repair_table.rdiff | 4 ++-- .../mysql-test/storage_engine/parts/truncate_table.rdiff | 4 ++-- .../myisammrg/mysql-test/storage_engine/repair_table.rdiff | 4 ++-- storage/myisammrg/mysql-test/storage_engine/show_engine.rdiff | 4 ++-- storage/myisammrg/mysql-test/storage_engine/tbl_opt_ai.rdiff | 4 ++-- .../mysql-test/storage_engine/tbl_opt_avg_row_length.rdiff | 4 ++-- .../mysql-test/storage_engine/tbl_opt_checksum.rdiff | 4 ++-- .../mysql-test/storage_engine/tbl_opt_connection.rdiff | 4 ++-- .../mysql-test/storage_engine/tbl_opt_data_dir.rdiff | 4 ++-- .../mysql-test/storage_engine/tbl_opt_delay_key_write.rdiff | 4 ++-- .../mysql-test/storage_engine/tbl_opt_index_dir.rdiff | 4 ++-- .../mysql-test/storage_engine/tbl_opt_insert_method.rdiff | 4 ++-- .../mysql-test/storage_engine/tbl_opt_key_block_size.rdiff | 4 ++-- .../mysql-test/storage_engine/tbl_opt_max_rows.rdiff | 4 ++-- .../mysql-test/storage_engine/tbl_opt_min_rows.rdiff | 4 ++-- .../mysql-test/storage_engine/tbl_opt_pack_keys.rdiff | 4 ++-- .../mysql-test/storage_engine/tbl_opt_password.rdiff | 4 ++-- .../mysql-test/storage_engine/tbl_opt_row_format.rdiff | 4 ++-- .../myisammrg/mysql-test/storage_engine/tbl_opt_union.rdiff | 4 ++-- .../mysql-test/storage_engine/tbl_standard_opts.rdiff | 4 ++-- .../myisammrg/mysql-test/storage_engine/tbl_temporary.rdiff | 4 ++-- .../myisammrg/mysql-test/storage_engine/truncate_table.rdiff | 4 ++-- .../storage_engine/trx/cons_snapshot_repeatable_read.rdiff | 4 ++-- .../storage_engine/trx/cons_snapshot_serializable.rdiff | 4 ++-- storage/myisammrg/mysql-test/storage_engine/trx/delete.rdiff | 4 ++-- storage/myisammrg/mysql-test/storage_engine/trx/insert.rdiff | 4 ++-- .../mysql-test/storage_engine/trx/level_read_committed.rdiff | 4 ++-- .../storage_engine/trx/level_read_uncommitted.rdiff | 4 ++-- .../mysql-test/storage_engine/trx/level_repeatable_read.rdiff | 4 ++-- .../mysql-test/storage_engine/trx/level_serializable.rdiff | 4 ++-- .../mysql-test/storage_engine/trx/select_for_update.rdiff | 4 ++-- .../storage_engine/trx/select_lock_in_share_mode.rdiff | 4 ++-- storage/myisammrg/mysql-test/storage_engine/trx/update.rdiff | 4 ++-- storage/myisammrg/mysql-test/storage_engine/trx/xa.rdiff | 4 ++-- .../myisammrg/mysql-test/storage_engine/trx/xa_recovery.rdiff | 4 ++-- .../mysql-test/storage_engine/type_char_indexes.rdiff | 4 ++-- .../mysql-test/storage_engine/type_float_indexes.rdiff | 4 ++-- .../myisammrg/mysql-test/storage_engine/type_spatial.rdiff | 4 ++-- .../mysql-test/storage_engine/type_spatial_indexes.rdiff | 4 ++-- storage/myisammrg/mysql-test/storage_engine/vcol.rdiff | 4 ++-- storage/rocksdb/mysql-test/storage_engine/cache_index.rdiff | 4 ++-- .../mysql-test/storage_engine/checksum_table_live.rdiff | 4 ++-- storage/rocksdb/mysql-test/storage_engine/index.rdiff | 4 ++-- .../rocksdb/mysql-test/storage_engine/index_type_btree.rdiff | 4 ++-- .../rocksdb/mysql-test/storage_engine/index_type_hash.rdiff | 4 ++-- storage/rocksdb/mysql-test/storage_engine/misc.rdiff | 4 ++-- .../mysql-test/storage_engine/parts/checksum_table.rdiff | 4 ++-- .../mysql-test/storage_engine/parts/create_table.rdiff | 4 ++-- storage/rocksdb/mysql-test/storage_engine/show_engine.rdiff | 4 ++-- .../rocksdb/mysql-test/storage_engine/show_table_status.rdiff | 4 ++-- .../mysql-test/storage_engine/tbl_opt_insert_method.rdiff | 4 ++-- storage/rocksdb/mysql-test/storage_engine/tbl_opt_union.rdiff | 4 ++-- storage/rocksdb/mysql-test/storage_engine/tbl_temporary.rdiff | 4 ++-- .../rocksdb/mysql-test/storage_engine/truncate_table.rdiff | 4 ++-- storage/rocksdb/mysql-test/storage_engine/trx/delete.rdiff | 4 ++-- storage/rocksdb/mysql-test/storage_engine/trx/insert.rdiff | 4 ++-- .../mysql-test/storage_engine/trx/level_read_committed.rdiff | 4 ++-- .../mysql-test/storage_engine/trx/level_repeatable_read.rdiff | 4 ++-- storage/rocksdb/mysql-test/storage_engine/trx/update.rdiff | 4 ++-- .../mysql-test/storage_engine/type_binary_indexes.rdiff | 4 ++-- .../rocksdb/mysql-test/storage_engine/type_bit_indexes.rdiff | 4 ++-- .../rocksdb/mysql-test/storage_engine/type_enum_indexes.rdiff | 4 ++-- .../rocksdb/mysql-test/storage_engine/type_set_indexes.rdiff | 4 ++-- 196 files changed, 392 insertions(+), 392 deletions(-) diff --git a/mysql-test/main/alter_table_combinations,aria.rdiff b/mysql-test/main/alter_table_combinations,aria.rdiff index 9ea38135908..e030571679f 100644 --- a/mysql-test/main/alter_table_combinations,aria.rdiff +++ b/mysql-test/main/alter_table_combinations,aria.rdiff @@ -1,5 +1,5 @@ ---- main/alter_table_combinations.result 2022-05-24 17:16:56.769146869 +0200 -+++ main/alter_table_combinations.reject 2022-05-24 17:25:20.847126357 +0200 +--- main/alter_table_combinations.result ++++ main/alter_table_combinations.reject @@ -173,8 +173,7 @@ t3 CREATE TABLE `t3` ( `a` int(11) DEFAULT NULL, diff --git a/mysql-test/main/alter_table_combinations,heap.rdiff b/mysql-test/main/alter_table_combinations,heap.rdiff index 0ca6d3de88d..493ce0ea884 100644 --- a/mysql-test/main/alter_table_combinations,heap.rdiff +++ b/mysql-test/main/alter_table_combinations,heap.rdiff @@ -1,5 +1,5 @@ ---- main/alter_table_combinations.result 2022-05-24 17:16:56.769146869 +0200 -+++ main/alter_table_combinations.reject 2022-05-24 17:25:01.216127156 +0200 +--- main/alter_table_combinations.result ++++ main/alter_table_combinations.reject @@ -11,7 +11,7 @@ alter table t1 change x xx int, algorithm=inplace; check table t1; diff --git a/mysql-test/main/myisam_mrr,32bit.rdiff b/mysql-test/main/myisam_mrr,32bit.rdiff index 746bf48dedd..eda77abbfce 100644 --- a/mysql-test/main/myisam_mrr,32bit.rdiff +++ b/mysql-test/main/myisam_mrr,32bit.rdiff @@ -1,5 +1,5 @@ ---- main/myisam_mrr.result 2019-05-14 15:44:52.232663568 +0530 -+++ main/myisam_mrr.reject 2019-05-14 15:51:37.123563538 +0530 +--- main/myisam_mrr.result ++++ main/myisam_mrr.reject @@ -617,8 +617,8 @@ show status like 'handler_mrr%'; Variable_name Value diff --git a/mysql-test/main/select,ps.rdiff b/mysql-test/main/select,ps.rdiff index 7cbcd2be98e..61d6867c1dc 100644 --- a/mysql-test/main/select,ps.rdiff +++ b/mysql-test/main/select,ps.rdiff @@ -1,5 +1,5 @@ ---- mysql-test/main/select.result 2023-01-31 09:30:58.151377805 +0100 -+++ mysql-test/main/select.reject 2023-02-01 13:44:11.026958614 +0100 +--- mysql-test/main/select.result ++++ mysql-test/main/select.reject @@ -5661,6 +5661,8 @@ Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 diff --git a/mysql-test/main/select_jcl6,ps.rdiff b/mysql-test/main/select_jcl6,ps.rdiff index 18652a0683b..fc59dd211f9 100644 --- a/mysql-test/main/select_jcl6,ps.rdiff +++ b/mysql-test/main/select_jcl6,ps.rdiff @@ -1,5 +1,5 @@ ---- mysql-test/main/select_jcl6.result 2023-01-31 09:30:58.151377805 +0100 -+++ mysql-test/main/select_jcl6.reject 2023-02-01 13:44:10.722958771 +0100 +--- mysql-test/main/select_jcl6.result ++++ mysql-test/main/select_jcl6.reject @@ -5672,6 +5672,8 @@ Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 diff --git a/mysql-test/main/select_pkeycache,ps.rdiff b/mysql-test/main/select_pkeycache,ps.rdiff index 320a402fefc..dc9c30408a9 100644 --- a/mysql-test/main/select_pkeycache,ps.rdiff +++ b/mysql-test/main/select_pkeycache,ps.rdiff @@ -1,5 +1,5 @@ ---- mysql-test/main/select_pkeycache.result 2023-01-31 09:30:58.151377805 +0100 -+++ mysql-test/main/select_pkeycache.reject 2023-02-01 13:43:21.742985365 +0100 +--- mysql-test/main/select_pkeycache.result ++++ mysql-test/main/select_pkeycache.reject @@ -5661,6 +5661,8 @@ Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1 diff --git a/mysql-test/suite/encryption/r/encrypt_and_grep,undo3.rdiff b/mysql-test/suite/encryption/r/encrypt_and_grep,undo3.rdiff index 210c2a61a17..ad81aacaf59 100644 --- a/mysql-test/suite/encryption/r/encrypt_and_grep,undo3.rdiff +++ b/mysql-test/suite/encryption/r/encrypt_and_grep,undo3.rdiff @@ -1,5 +1,5 @@ ---- encrypt_and_grep.result 2022-09-02 22:36:21.669650278 +0530 -+++ encrypt_and_grep.reject 2022-11-29 19:01:22.080027528 +0530 +--- encrypt_and_grep.result ++++ encrypt_and_grep.reject @@ -14,6 +14,9 @@ SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; NAME diff --git a/mysql-test/suite/encryption/r/innodb-remove-encryption,undo3.rdiff b/mysql-test/suite/encryption/r/innodb-remove-encryption,undo3.rdiff index 421c962bd2e..5d26dd20ac8 100644 --- a/mysql-test/suite/encryption/r/innodb-remove-encryption,undo3.rdiff +++ b/mysql-test/suite/encryption/r/innodb-remove-encryption,undo3.rdiff @@ -1,5 +1,5 @@ ---- innodb-remove-encryption.result 2022-09-02 20:44:59.960430396 +0530 -+++ innodb-remove-encryption,undo3.reject 2022-11-29 19:02:24.813094277 +0530 +--- innodb-remove-encryption.result ++++ innodb-remove-encryption,undo3.reject @@ -13,6 +13,9 @@ SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; NAME diff --git a/mysql-test/suite/encryption/r/innodb_encrypt_freed,undo3.rdiff b/mysql-test/suite/encryption/r/innodb_encrypt_freed,undo3.rdiff index 36eea901a6e..721a847acb8 100644 --- a/mysql-test/suite/encryption/r/innodb_encrypt_freed,undo3.rdiff +++ b/mysql-test/suite/encryption/r/innodb_encrypt_freed,undo3.rdiff @@ -1,5 +1,5 @@ ---- innodb_encrypt_freed.result 2021-03-23 15:44:14.466377983 +0530 -+++ innodb_encrypt_freed,undo3.reject 2022-11-29 19:04:24.987010571 +0530 +--- innodb_encrypt_freed.result ++++ innodb_encrypt_freed,undo3.reject @@ -14,6 +14,9 @@ SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; NAME diff --git a/mysql-test/suite/encryption/r/innodb_encrypt_key_rotation_age,undo3.rdiff b/mysql-test/suite/encryption/r/innodb_encrypt_key_rotation_age,undo3.rdiff index 476b0b3f213..830155acab6 100644 --- a/mysql-test/suite/encryption/r/innodb_encrypt_key_rotation_age,undo3.rdiff +++ b/mysql-test/suite/encryption/r/innodb_encrypt_key_rotation_age,undo3.rdiff @@ -1,5 +1,5 @@ ---- innodb_encrypt_key_rotation_age.result 2022-06-02 16:15:08.395122720 +0530 -+++ innodb_encrypt_key_rotation_age,undo3.reject 2022-11-29 19:06:07.964542115 +0530 +--- innodb_encrypt_key_rotation_age.result ++++ innodb_encrypt_key_rotation_age,undo3.reject @@ -12,6 +12,9 @@ SELECT NAME FROM INFORMATION_SCHEMA.INNODB_TABLESPACES_ENCRYPTION WHERE MIN_KEY_VERSION <> 0; NAME diff --git a/mysql-test/suite/engines/funcs/r/rpl_sp,myisam,mix.rdiff b/mysql-test/suite/engines/funcs/r/rpl_sp,myisam,mix.rdiff index da41283e42f..cbf297f8071 100644 --- a/mysql-test/suite/engines/funcs/r/rpl_sp,myisam,mix.rdiff +++ b/mysql-test/suite/engines/funcs/r/rpl_sp,myisam,mix.rdiff @@ -1,5 +1,5 @@ ---- /home/alice/git/10.3/mysql-test/suite/engines/funcs/r/rpl_sp,myisam,mix.result~ 2021-03-19 17:27:12.935559866 +0100 -+++ /home/alice/git/10.3/mysql-test/suite/engines/funcs/r/rpl_sp,myisam,mix.reject 2021-03-19 17:27:14.071534938 +0100 +--- /home/alice/git/10.3/mysql-test/suite/engines/funcs/r/rpl_sp,myisam,mix.result~ ++++ /home/alice/git/10.3/mysql-test/suite/engines/funcs/r/rpl_sp,myisam,mix.reject @@ -126,12 +126,15 @@ show warnings; Level Code Message 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_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_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..da294317c27 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.result ++++ r/galera_sst_mariabackup,debug.reject @@ -516,5 +516,189 @@ 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/innodb/r/alter_algorithm,INPLACE.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff index a176a9af29e..79b3d8854fa 100644 --- a/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff +++ b/mysql-test/suite/innodb/r/alter_algorithm,INPLACE.rdiff @@ -1,5 +1,5 @@ ---- alter_algorithm.result 2020-04-30 21:39:48.923115511 +0530 -+++ alter_algorithm.reject 2020-04-30 21:45:04.131642093 +0530 +--- alter_algorithm.result ++++ alter_algorithm.reject @@ -7,43 +7,43 @@ INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1); SELECT @@alter_algorithm; diff --git a/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff index 414b7dc8b0c..fbcb5ca8704 100644 --- a/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff +++ b/mysql-test/suite/innodb/r/alter_algorithm,INSTANT.rdiff @@ -1,5 +1,5 @@ ---- alter_algorithm.result 2020-04-30 21:39:48.923115511 +0530 -+++ alter_algorithm.reject 2020-04-30 21:47:08.245465018 +0530 +--- alter_algorithm.result ++++ alter_algorithm.reject @@ -7,43 +7,35 @@ INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1); SELECT @@alter_algorithm; diff --git a/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff b/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff index 2aa8c72265a..44e9f63a5f4 100644 --- a/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff +++ b/mysql-test/suite/innodb/r/alter_algorithm,NOCOPY.rdiff @@ -1,5 +1,5 @@ ---- alter_algorithm.result 2020-04-30 21:39:48.923115511 +0530 -+++ alter_algorithm.reject 2020-04-30 21:52:10.785967739 +0530 +--- alter_algorithm.result ++++ alter_algorithm.reject @@ -7,43 +7,35 @@ INSERT INTO t1(f1, f2, f3) VALUES(1, 1, 1); SELECT @@alter_algorithm; diff --git a/mysql-test/suite/innodb/r/instant_alter_limit,16k.rdiff b/mysql-test/suite/innodb/r/instant_alter_limit,16k.rdiff index 57d87f7172f..320df318434 100644 --- a/mysql-test/suite/innodb/r/instant_alter_limit,16k.rdiff +++ b/mysql-test/suite/innodb/r/instant_alter_limit,16k.rdiff @@ -1,5 +1,5 @@ ---- instant_alter_limit.result 2020-05-26 18:01:27.377946439 +0530 -+++ instant_alter_limit,16k.reject 2020-05-26 20:14:38.452463919 +0530 +--- instant_alter_limit.result ++++ instant_alter_limit,16k.reject @@ -45,3 +45,10 @@ instants 502 diff --git a/mysql-test/suite/innodb/r/instant_alter_limit,32k.rdiff b/mysql-test/suite/innodb/r/instant_alter_limit,32k.rdiff index 8f8cf64b7fc..951f0ce2320 100644 --- a/mysql-test/suite/innodb/r/instant_alter_limit,32k.rdiff +++ b/mysql-test/suite/innodb/r/instant_alter_limit,32k.rdiff @@ -1,5 +1,5 @@ ---- instant_alter_limit.result 2020-05-26 18:01:27.377946439 +0530 -+++ instant_alter_limit,32k.reject 2020-05-26 19:59:19.743877366 +0530 +--- instant_alter_limit.result ++++ instant_alter_limit,32k.reject @@ -43,5 +43,12 @@ FROM information_schema.global_status WHERE variable_name = 'innodb_instant_alter_column'; diff --git a/mysql-test/suite/innodb/r/instant_alter_limit,4k.rdiff b/mysql-test/suite/innodb/r/instant_alter_limit,4k.rdiff index dad28218a02..0ebd590ad54 100644 --- a/mysql-test/suite/innodb/r/instant_alter_limit,4k.rdiff +++ b/mysql-test/suite/innodb/r/instant_alter_limit,4k.rdiff @@ -1,5 +1,5 @@ ---- instant_alter_limit.result 2020-05-26 18:01:27.377946439 +0530 -+++ instant_alter_limit,4k.reject 2020-05-26 20:17:53.314736548 +0530 +--- instant_alter_limit.result ++++ instant_alter_limit,4k.reject @@ -5,6 +5,276 @@ ENGINE=InnoDB; INSERT INTO t VALUES(1,2,3,4,5); diff --git a/mysql-test/suite/innodb/r/instant_alter_limit,64k.rdiff b/mysql-test/suite/innodb/r/instant_alter_limit,64k.rdiff index d7479dbba40..7c58fa4a8db 100644 --- a/mysql-test/suite/innodb/r/instant_alter_limit,64k.rdiff +++ b/mysql-test/suite/innodb/r/instant_alter_limit,64k.rdiff @@ -1,5 +1,5 @@ ---- instant_alter_limit.result 2020-05-26 18:01:27.377946439 +0530 -+++ instant_alter_limit,64k.reject 2020-05-26 20:00:22.499711222 +0530 +--- instant_alter_limit.result ++++ instant_alter_limit,64k.reject @@ -43,5 +43,12 @@ FROM information_schema.global_status WHERE variable_name = 'innodb_instant_alter_column'; diff --git a/mysql-test/suite/innodb/r/instant_alter_limit,8k.rdiff b/mysql-test/suite/innodb/r/instant_alter_limit,8k.rdiff index 1fe3e1a56eb..d70156f3083 100644 --- a/mysql-test/suite/innodb/r/instant_alter_limit,8k.rdiff +++ b/mysql-test/suite/innodb/r/instant_alter_limit,8k.rdiff @@ -1,5 +1,5 @@ ---- instant_alter_limit.result 2020-05-26 18:01:27.377946439 +0530 -+++ instant_alter_limit,8k.reject 2020-05-26 20:19:50.881869095 +0530 +--- instant_alter_limit.result ++++ instant_alter_limit,8k.reject @@ -5,6 +5,28 @@ ENGINE=InnoDB; INSERT INTO t VALUES(1,2,3,4,5); diff --git a/mysql-test/suite/innodb/r/max_record_size,16k,compact.rdiff b/mysql-test/suite/innodb/r/max_record_size,16k,compact.rdiff index 118145bec2e..b9f51624729 100644 --- a/mysql-test/suite/innodb/r/max_record_size,16k,compact.rdiff +++ b/mysql-test/suite/innodb/r/max_record_size,16k,compact.rdiff @@ -1,5 +1,5 @@ ---- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 -+++ max_record_size.reject 2019-07-03 12:51:26.070418078 +0300 +--- max_record_size.result ++++ max_record_size.reject @@ -3,45 +3,65 @@ c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), diff --git a/mysql-test/suite/innodb/r/max_record_size,16k,dynamic.rdiff b/mysql-test/suite/innodb/r/max_record_size,16k,dynamic.rdiff index 33067866b82..5effc664f2c 100644 --- a/mysql-test/suite/innodb/r/max_record_size,16k,dynamic.rdiff +++ b/mysql-test/suite/innodb/r/max_record_size,16k,dynamic.rdiff @@ -1,5 +1,5 @@ ---- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 -+++ max_record_size.reject 2019-07-03 12:52:54.580956978 +0300 +--- max_record_size.result ++++ max_record_size.reject @@ -3,45 +3,207 @@ c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), diff --git a/mysql-test/suite/innodb/r/max_record_size,16k,redundant.rdiff b/mysql-test/suite/innodb/r/max_record_size,16k,redundant.rdiff index e50e4d2be3a..227b64a8a48 100644 --- a/mysql-test/suite/innodb/r/max_record_size,16k,redundant.rdiff +++ b/mysql-test/suite/innodb/r/max_record_size,16k,redundant.rdiff @@ -1,5 +1,5 @@ ---- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 -+++ max_record_size.reject 2019-07-03 12:55:05.258762945 +0300 +--- max_record_size.result ++++ max_record_size.reject @@ -3,45 +3,65 @@ c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), diff --git a/mysql-test/suite/innodb/r/max_record_size,32k,compact.rdiff b/mysql-test/suite/innodb/r/max_record_size,32k,compact.rdiff index 1bc03a5d97a..d236e12b1e1 100644 --- a/mysql-test/suite/innodb/r/max_record_size,32k,compact.rdiff +++ b/mysql-test/suite/innodb/r/max_record_size,32k,compact.rdiff @@ -1,5 +1,5 @@ ---- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 -+++ max_record_size.reject 2019-07-03 12:27:08.004932026 +0300 +--- max_record_size.result ++++ max_record_size.reject @@ -3,45 +3,104 @@ c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), diff --git a/mysql-test/suite/innodb/r/max_record_size,32k,dynamic.rdiff b/mysql-test/suite/innodb/r/max_record_size,32k,dynamic.rdiff index 71c4c2e41b7..ce9462b6900 100644 --- a/mysql-test/suite/innodb/r/max_record_size,32k,dynamic.rdiff +++ b/mysql-test/suite/innodb/r/max_record_size,32k,dynamic.rdiff @@ -1,5 +1,5 @@ ---- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 -+++ max_record_size.reject 2019-07-03 12:38:41.609328820 +0300 +--- max_record_size.result ++++ max_record_size.reject @@ -3,45 +3,351 @@ c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), diff --git a/mysql-test/suite/innodb/r/max_record_size,32k,redundant.rdiff b/mysql-test/suite/innodb/r/max_record_size,32k,redundant.rdiff index e42b3de8845..53d6f76a2d2 100644 --- a/mysql-test/suite/innodb/r/max_record_size,32k,redundant.rdiff +++ b/mysql-test/suite/innodb/r/max_record_size,32k,redundant.rdiff @@ -1,5 +1,5 @@ ---- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 -+++ max_record_size.reject 2019-07-03 12:41:03.319664978 +0300 +--- max_record_size.result ++++ max_record_size.reject @@ -3,45 +3,104 @@ c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), diff --git a/mysql-test/suite/innodb/r/max_record_size,4k,compact.rdiff b/mysql-test/suite/innodb/r/max_record_size,4k,compact.rdiff index 6f08dab3ca1..37871798f31 100644 --- a/mysql-test/suite/innodb/r/max_record_size,4k,compact.rdiff +++ b/mysql-test/suite/innodb/r/max_record_size,4k,compact.rdiff @@ -1,5 +1,5 @@ ---- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 -+++ max_record_size.reject 2019-07-03 12:56:23.489432164 +0300 +--- max_record_size.result ++++ max_record_size.reject @@ -1,47 +1,37 @@ call mtr.add_suppression("Cannot add field `.*` in table `test`.`t1` because after adding it, the row size is"); CREATE TABLE t1 ( diff --git a/mysql-test/suite/innodb/r/max_record_size,4k,dynamic.rdiff b/mysql-test/suite/innodb/r/max_record_size,4k,dynamic.rdiff index bd37d4354e7..b0b6b007d97 100644 --- a/mysql-test/suite/innodb/r/max_record_size,4k,dynamic.rdiff +++ b/mysql-test/suite/innodb/r/max_record_size,4k,dynamic.rdiff @@ -1,5 +1,5 @@ ---- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 -+++ max_record_size.reject 2019-07-03 12:57:38.636143710 +0300 +--- max_record_size.result ++++ max_record_size.reject @@ -1,47 +1,103 @@ call mtr.add_suppression("Cannot add field `.*` in table `test`.`t1` because after adding it, the row size is"); CREATE TABLE t1 ( diff --git a/mysql-test/suite/innodb/r/max_record_size,4k,redundant.rdiff b/mysql-test/suite/innodb/r/max_record_size,4k,redundant.rdiff index 93c39ff6714..0db6450d9c1 100644 --- a/mysql-test/suite/innodb/r/max_record_size,4k,redundant.rdiff +++ b/mysql-test/suite/innodb/r/max_record_size,4k,redundant.rdiff @@ -1,5 +1,5 @@ ---- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 -+++ max_record_size.reject 2019-07-03 12:58:58.318768169 +0300 +--- max_record_size.result ++++ max_record_size.reject @@ -1,47 +1,37 @@ call mtr.add_suppression("Cannot add field `.*` in table `test`.`t1` because after adding it, the row size is"); CREATE TABLE t1 ( diff --git a/mysql-test/suite/innodb/r/max_record_size,64k,compact.rdiff b/mysql-test/suite/innodb/r/max_record_size,64k,compact.rdiff index 5e6c62212d1..ab75975e238 100644 --- a/mysql-test/suite/innodb/r/max_record_size,64k,compact.rdiff +++ b/mysql-test/suite/innodb/r/max_record_size,64k,compact.rdiff @@ -1,5 +1,5 @@ ---- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 -+++ max_record_size.reject 2019-07-03 12:45:21.760116841 +0300 +--- max_record_size.result ++++ max_record_size.reject @@ -3,45 +3,186 @@ c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), diff --git a/mysql-test/suite/innodb/r/max_record_size,64k,dynamic.rdiff b/mysql-test/suite/innodb/r/max_record_size,64k,dynamic.rdiff index 2cbf4cd9c54..3e13a510055 100644 --- a/mysql-test/suite/innodb/r/max_record_size,64k,dynamic.rdiff +++ b/mysql-test/suite/innodb/r/max_record_size,64k,dynamic.rdiff @@ -1,5 +1,5 @@ ---- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 -+++ max_record_size.reject 2019-07-03 12:48:32.453208310 +0300 +--- max_record_size.result ++++ max_record_size.reject @@ -3,45 +3,486 @@ c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), diff --git a/mysql-test/suite/innodb/r/max_record_size,64k,redundant.rdiff b/mysql-test/suite/innodb/r/max_record_size,64k,redundant.rdiff index c324969fb21..a31285a2714 100644 --- a/mysql-test/suite/innodb/r/max_record_size,64k,redundant.rdiff +++ b/mysql-test/suite/innodb/r/max_record_size,64k,redundant.rdiff @@ -1,5 +1,5 @@ ---- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 -+++ max_record_size.reject 2019-07-03 12:50:05.663724193 +0300 +--- max_record_size.result ++++ max_record_size.reject @@ -3,45 +3,104 @@ c1 CHAR(255), c2 CHAR(255), c3 CHAR(255), c4 CHAR(255), c5 CHAR(255), c6 CHAR(255), c7 CHAR(255), c8 CHAR(255), diff --git a/mysql-test/suite/innodb/r/max_record_size,8k,compact.rdiff b/mysql-test/suite/innodb/r/max_record_size,8k,compact.rdiff index 4db669a8aa6..cafb5f25a0d 100644 --- a/mysql-test/suite/innodb/r/max_record_size,8k,compact.rdiff +++ b/mysql-test/suite/innodb/r/max_record_size,8k,compact.rdiff @@ -1,5 +1,5 @@ ---- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 -+++ max_record_size.reject 2019-07-03 13:00:25.037261867 +0300 +--- max_record_size.result ++++ max_record_size.reject @@ -12,7 +12,7 @@ c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255) diff --git a/mysql-test/suite/innodb/r/max_record_size,8k,dynamic.rdiff b/mysql-test/suite/innodb/r/max_record_size,8k,dynamic.rdiff index 5f79d77e7f9..2f592fbb4b3 100644 --- a/mysql-test/suite/innodb/r/max_record_size,8k,dynamic.rdiff +++ b/mysql-test/suite/innodb/r/max_record_size,8k,dynamic.rdiff @@ -1,5 +1,5 @@ ---- max_record_size.result 2019-07-03 11:54:44.591421526 +0300 -+++ max_record_size.reject 2019-07-03 13:01:51.215756779 +0300 +--- max_record_size.result ++++ max_record_size.reject @@ -12,7 +12,7 @@ c9 CHAR(255), c10 CHAR(255), c11 CHAR(255), c12 CHAR(255), c13 CHAR(255), c14 CHAR(255), c15 CHAR(255), c16 CHAR(255) diff --git a/mysql-test/suite/innodb/r/recovery_memory,debug.rdiff b/mysql-test/suite/innodb/r/recovery_memory,debug.rdiff index f0e9985b04e..2879ee6adec 100644 --- a/mysql-test/suite/innodb/r/recovery_memory,debug.rdiff +++ b/mysql-test/suite/innodb/r/recovery_memory,debug.rdiff @@ -1,5 +1,5 @@ ---- recovery_memory.result 2024-06-21 12:54:38.026355524 +0530 -+++ recovery_memory.reject 2024-06-21 17:22:49.394535026 +0530 +--- recovery_memory.result ++++ recovery_memory.reject @@ -23,6 +23,7 @@ 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/r/restart,16k.rdiff b/mysql-test/suite/innodb/r/restart,16k.rdiff index b36ed067913..3149b9aeab0 100644 --- a/mysql-test/suite/innodb/r/restart,16k.rdiff +++ b/mysql-test/suite/innodb/r/restart,16k.rdiff @@ -1,5 +1,5 @@ ---- ./suite/innodb/r/restart.result 2022-01-18 20:36:56.054653376 +1100 -+++ suite/innodb/r/restart.reject 2022-01-19 08:12:28.602794678 +1100 +--- ./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; diff --git a/mysql-test/suite/innodb/r/restart,32k.rdiff b/mysql-test/suite/innodb/r/restart,32k.rdiff index 8fa057814c4..3f00646cb37 100644 --- a/mysql-test/suite/innodb/r/restart,32k.rdiff +++ b/mysql-test/suite/innodb/r/restart,32k.rdiff @@ -1,5 +1,5 @@ ---- ./suite/innodb/r/restart.result 2022-01-18 20:36:56.054653376 +1100 -+++ suite/innodb/r/restart.reject 2022-01-19 08:07:57.402230887 +1100 +--- ./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; diff --git a/mysql-test/suite/innodb/r/restart,4k.rdiff b/mysql-test/suite/innodb/r/restart,4k.rdiff index 7d0846360e0..b00c56ef81f 100644 --- a/mysql-test/suite/innodb/r/restart,4k.rdiff +++ b/mysql-test/suite/innodb/r/restart,4k.rdiff @@ -1,5 +1,5 @@ ---- ./suite/innodb/r/restart.result 2022-01-18 20:36:56.054653376 +1100 -+++ suite/innodb/r/restart.reject 2022-01-19 08:13:56.397475513 +1100 +--- ./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; diff --git a/mysql-test/suite/innodb/r/restart,64k.rdiff b/mysql-test/suite/innodb/r/restart,64k.rdiff index 3ac9f45b196..886cbcde7d9 100644 --- a/mysql-test/suite/innodb/r/restart,64k.rdiff +++ b/mysql-test/suite/innodb/r/restart,64k.rdiff @@ -1,5 +1,5 @@ ---- ./suite/innodb/r/restart.result 2022-01-18 20:36:56.054653376 +1100 -+++ suite/innodb/r/restart.reject 2022-01-19 08:11:32.418759095 +1100 +--- ./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; diff --git a/mysql-test/suite/innodb/r/restart,8k.rdiff b/mysql-test/suite/innodb/r/restart,8k.rdiff index 4da55ebfcef..40a9e1bad1c 100644 --- a/mysql-test/suite/innodb/r/restart,8k.rdiff +++ b/mysql-test/suite/innodb/r/restart,8k.rdiff @@ -1,5 +1,5 @@ ---- ./suite/innodb/r/restart.result 2022-01-18 20:36:56.054653376 +1100 -+++ suite/innodb/r/restart.reject 2022-01-19 08:13:11.027788852 +1100 +--- ./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; diff --git a/mysql-test/suite/mtr/t/simple,c2,s1.rdiff b/mysql-test/suite/mtr/t/simple,c2,s1.rdiff index 3023756aa8a..91f800a6211 100644 --- a/mysql-test/suite/mtr/t/simple,c2,s1.rdiff +++ b/mysql-test/suite/mtr/t/simple,c2,s1.rdiff @@ -1,5 +1,5 @@ ---- suite/mtr/t/simple.result 2012-02-04 12:13:41.000000000 +0100 -+++ suite/mtr/t/simple,infile,verbose.reject 2012-02-04 12:16:10.000000000 +0100 +--- suite/mtr/t/simple.result ++++ suite/mtr/t/simple,infile,verbose.reject @@ -3,7 +3,7 @@ proxy select @@local_infile; diff --git a/mysql-test/suite/mtr/t/simple,s2,c2.rdiff b/mysql-test/suite/mtr/t/simple,s2,c2.rdiff index a9b9b56ef1c..a4c9ab968c5 100644 --- a/mysql-test/suite/mtr/t/simple,s2,c2.rdiff +++ b/mysql-test/suite/mtr/t/simple,s2,c2.rdiff @@ -1,5 +1,5 @@ ---- suite/mtr/t/simple,old.result 2012-02-04 12:13:25.000000000 +0100 -+++ suite/mtr/t/simple,old,infile.reject 2012-02-04 12:13:59.000000000 +0100 +--- suite/mtr/t/simple,old.result ++++ suite/mtr/t/simple,old,infile.reject @@ -3,7 +3,7 @@ proxy select @@local_infile; diff --git a/mysql-test/suite/period/r/delete,myisam.rdiff b/mysql-test/suite/period/r/delete,myisam.rdiff index 78fb972b0bc..179f399ac9a 100644 --- a/mysql-test/suite/period/r/delete,myisam.rdiff +++ b/mysql-test/suite/period/r/delete,myisam.rdiff @@ -1,5 +1,5 @@ ---- suite/period/r/delete.result 2019-02-16 11:14:23.511258191 +0100 -+++ suite/period/r/delete.reject 2019-02-16 11:14:32.869258690 +0100 +--- suite/period/r/delete.result ++++ suite/period/r/delete.reject @@ -250,7 +250,6 @@ ERROR 22003: Out of range value for column 'id' at row 1 select * from t; diff --git a/mysql-test/suite/rpl/r/rpl_delayed_slave,parallel.rdiff b/mysql-test/suite/rpl/r/rpl_delayed_slave,parallel.rdiff index aaadbb28ca3..d803f8be5c2 100644 --- a/mysql-test/suite/rpl/r/rpl_delayed_slave,parallel.rdiff +++ b/mysql-test/suite/rpl/r/rpl_delayed_slave,parallel.rdiff @@ -1,5 +1,5 @@ ---- mysql-test/suite/rpl/r/rpl_delayed_slave.result 2016-10-14 21:14:02.338075590 +0200 -+++ mysql-test/suite/rpl/r/rpl_delayed_slave,parallel.reject 2016-10-14 21:17:51.296986686 +0200 +--- mysql-test/suite/rpl/r/rpl_delayed_slave.result ++++ mysql-test/suite/rpl/r/rpl_delayed_slave,parallel.reject @@ -45,7 +45,6 @@ # wait for first query to execute # sleep 1*T diff --git a/mysql-test/suite/rpl/r/rpl_insert_delayed,stmt.rdiff b/mysql-test/suite/rpl/r/rpl_insert_delayed,stmt.rdiff index 1946228f401..d1a101e51ca 100644 --- a/mysql-test/suite/rpl/r/rpl_insert_delayed,stmt.rdiff +++ b/mysql-test/suite/rpl/r/rpl_insert_delayed,stmt.rdiff @@ -1,5 +1,5 @@ ---- suite/rpl/r/rpl_insert_delayed.result 2016-03-25 19:44:43.408210896 +0400 -+++ suite/rpl/r/rpl_insert_delayed,stmt.reject 2016-03-25 23:55:18.396360848 +0400 +--- suite/rpl/r/rpl_insert_delayed.result ++++ suite/rpl/r/rpl_insert_delayed,stmt.reject @@ -18,19 +18,19 @@ insert delayed into t1 values(10, "my name"); flush table t1; diff --git a/mysql-test/suite/rpl/r/rpl_iodku,stmt.rdiff b/mysql-test/suite/rpl/r/rpl_iodku,stmt.rdiff index e31f1e5d991..2986a47c9ae 100644 --- a/mysql-test/suite/rpl/r/rpl_iodku,stmt.rdiff +++ b/mysql-test/suite/rpl/r/rpl_iodku,stmt.rdiff @@ -1,5 +1,5 @@ ---- r/rpl_iodku.result 2022-05-04 18:51:24.956414404 +0300 -+++ r/rpl_iodku,stmt.reject 2022-05-04 18:51:49.520106231 +0300 +--- r/rpl_iodku.result ++++ r/rpl_iodku,stmt.reject @@ -1,10 +1,15 @@ include/master-slave.inc [connection master] diff --git a/mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.rdiff b/mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.rdiff index 3815ec9375d..1154f92c39e 100644 --- a/mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.rdiff +++ b/mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.rdiff @@ -1,5 +1,5 @@ ---- /home/my/maria-test/mysql-test/suite/rpl/r/rpl_row_big_table_id.result 2019-08-18 15:19:56.829962449 +0300 -+++ /home/my/maria-test/mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.reject 2019-08-18 15:20:19.253763968 +0300 +--- /home/my/maria-test/mysql-test/suite/rpl/r/rpl_row_big_table_id.result ++++ /home/my/maria-test/mysql-test/suite/rpl/r/rpl_row_big_table_id,32bit.reject @@ -20,22 +20,22 @@ master-bin.000001 # Query 1 # use `test`; ALTER TABLE t comment '' master-bin.000001 # Gtid 1 # BEGIN GTID #-#-# diff --git a/mysql-test/suite/sys_vars/r/aria_sort_buffer_size_basic,32bit.rdiff b/mysql-test/suite/sys_vars/r/aria_sort_buffer_size_basic,32bit.rdiff index c30b99f1f95..77bb1f81d40 100644 --- a/mysql-test/suite/sys_vars/r/aria_sort_buffer_size_basic,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/aria_sort_buffer_size_basic,32bit.rdiff @@ -1,5 +1,5 @@ ---- suite/sys_vars/r/aria_sort_buffer_size_basic.result 2021-02-02 02:58:55.686921205 +0200 -+++ suite/sys_vars/r/aria_sort_buffer_size_basic.reject 2021-02-02 11:02:12.361178360 +0200 +--- suite/sys_vars/r/aria_sort_buffer_size_basic.result ++++ suite/sys_vars/r/aria_sort_buffer_size_basic.reject @@ -44,5 +44,5 @@ set session aria_sort_buffer_size=cast(-1 as unsigned int); select @@session.aria_sort_buffer_size; diff --git a/mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit,32bit.rdiff b/mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit,32bit.rdiff index cd9a004a686..79e15420af3 100644 --- a/mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit,32bit.rdiff @@ -1,5 +1,5 @@ ---- mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit.result 2019-05-07 15:09:57.220599318 +0530 -+++ mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit.reject 2019-05-07 15:10:20.012718538 +0530 +--- mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit.result ++++ mysql-test/suite/sys_vars/r/innodb_ft_result_cache_limit.reject @@ -1,5 +1,7 @@ set global innodb_ft_result_cache_limit=5000000000; +Warnings: diff --git a/mysql-test/suite/sys_vars/r/sysvars_aria,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_aria,32bit.rdiff index 6569d266695..1469397e83b 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_aria,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_aria,32bit.rdiff @@ -1,5 +1,5 @@ ---- suite/sys_vars/r/sysvars_aria.result 2021-02-02 02:58:55.686921205 +0200 -+++ suite/sys_vars/r/sysvars_aria,32bit.reject 2021-02-02 10:55:53.876791633 +0200 +--- suite/sys_vars/r/sysvars_aria.result ++++ suite/sys_vars/r/sysvars_aria,32bit.reject @@ -5,7 +5,7 @@ SESSION_VALUE NULL DEFAULT_VALUE 8192 diff --git a/mysql-test/suite/sys_vars/r/sysvars_debug,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_debug,32bit.rdiff index 8adb294db00..cb8338d4e9b 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_debug,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_debug,32bit.rdiff @@ -1,5 +1,5 @@ ---- r\sysvars_debug.result 2017-08-08 10:52:39.036804900 +0300 -+++ r\sysvars_debug,32bit.reject 2017-09-10 08:06:38.447122100 +0300 +--- r\sysvars_debug.result ++++ r\sysvars_debug,32bit.reject @@ -21,7 +21,7 @@ GLOBAL_VALUE_ORIGIN CONFIG DEFAULT_VALUE 0 diff --git a/mysql-test/suite/sys_vars/r/sysvars_wsrep,32bit.rdiff b/mysql-test/suite/sys_vars/r/sysvars_wsrep,32bit.rdiff index 016bd016f29..73b788057cb 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_wsrep,32bit.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_wsrep,32bit.rdiff @@ -1,5 +1,5 @@ ---- suite/sys_vars/r/sysvars_wsrep.result 2014-10-10 13:33:55.000000000 +0300 -+++ suite/sys_vars/r/sysvars_wsrep,32bit.reject 2014-10-10 19:38:09.000000000 +0300 +--- suite/sys_vars/r/sysvars_wsrep.result ++++ suite/sys_vars/r/sysvars_wsrep,32bit.reject @@ -245,7 +245,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE 131072 diff --git a/mysql-test/suite/versioning/r/select,trx_id.rdiff b/mysql-test/suite/versioning/r/select,trx_id.rdiff index 8906007a348..1b879493475 100644 --- a/mysql-test/suite/versioning/r/select,trx_id.rdiff +++ b/mysql-test/suite/versioning/r/select,trx_id.rdiff @@ -1,5 +1,5 @@ ---- select.result 2018-06-29 18:09:17.962447067 +0200 -+++ select.reject 2018-06-29 18:10:04.618808616 +0200 +--- select.result ++++ select.reject @@ -17,6 +17,8 @@ (8, 108), (9, 109); diff --git a/mysql-test/suite/versioning/r/select2,trx_id.rdiff b/mysql-test/suite/versioning/r/select2,trx_id.rdiff index bdc20d1dc4f..085a2a12653 100644 --- a/mysql-test/suite/versioning/r/select2,trx_id.rdiff +++ b/mysql-test/suite/versioning/r/select2,trx_id.rdiff @@ -1,5 +1,5 @@ ---- select2.result 2018-06-29 17:51:17.142172085 +0200 -+++ select2,trx_id.reject 2018-06-29 18:03:49.034273090 +0200 +--- select2.result ++++ select2,trx_id.reject @@ -26,6 +26,8 @@ select sys_start from t1 where x = 3 and y = 33 into @t1; Warnings: 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..5fc091c7752 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.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/storage/example/mysql-test/mtr/t/test2.rdiff b/storage/example/mysql-test/mtr/t/test2.rdiff index b0bf2fdfe4d..e0e67630df3 100644 --- a/storage/example/mysql-test/mtr/t/test2.rdiff +++ b/storage/example/mysql-test/mtr/t/test2.rdiff @@ -1,5 +1,5 @@ ---- /usr/home/serg/Abk/mysql/5.1/mysql-test/suite/mtr/t/test2.result 2012-02-04 21:15:14.000000000 +0100 -+++ /usr/home/serg/Abk/mysql/5.1/mysql-test/suite/mtr/t/test2.reject 2012-02-04 21:31:45.000000000 +0100 +--- /usr/home/serg/Abk/mysql/5.1/mysql-test/suite/mtr/t/test2.result ++++ /usr/home/serg/Abk/mysql/5.1/mysql-test/suite/mtr/t/test2.reject @@ -1,4 +1,4 @@ select @@local_infile; select @@max_error_count; diff --git a/storage/innobase/mysql-test/storage_engine/autoinc_secondary.rdiff b/storage/innobase/mysql-test/storage_engine/autoinc_secondary.rdiff index 00cda7c4435..5f183c9216e 100644 --- a/storage/innobase/mysql-test/storage_engine/autoinc_secondary.rdiff +++ b/storage/innobase/mysql-test/storage_engine/autoinc_secondary.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/autoinc_secondary.result 2012-07-12 04:34:18.153885986 +0400 -+++ suite/storage_engine/autoinc_secondary.reject 2012-07-15 17:47:03.937703666 +0400 +--- suite/storage_engine/autoinc_secondary.result ++++ suite/storage_engine/autoinc_secondary.reject @@ -13,18 +13,15 @@ 5 a DROP TABLE t1; diff --git a/storage/innobase/mysql-test/storage_engine/cache_index.rdiff b/storage/innobase/mysql-test/storage_engine/cache_index.rdiff index e04df87aa34..7be04d3ec28 100644 --- a/storage/innobase/mysql-test/storage_engine/cache_index.rdiff +++ b/storage/innobase/mysql-test/storage_engine/cache_index.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/cache_index.result 2012-07-15 00:22:19.822493731 +0400 -+++ suite/storage_engine/cache_index.reject 2012-07-15 17:47:18.321522834 +0400 +--- suite/storage_engine/cache_index.result ++++ suite/storage_engine/cache_index.reject @@ -12,31 +12,31 @@ SET GLOBAL .key_buffer_size=128*1024; CACHE INDEX t1 INDEX (a), t2 IN ; diff --git a/storage/innobase/mysql-test/storage_engine/checksum_table_live.rdiff b/storage/innobase/mysql-test/storage_engine/checksum_table_live.rdiff index 71c782848a6..31a480f0585 100644 --- a/storage/innobase/mysql-test/storage_engine/checksum_table_live.rdiff +++ b/storage/innobase/mysql-test/storage_engine/checksum_table_live.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/checksum_table_live.result 2012-07-12 21:05:44.497062968 +0400 -+++ suite/storage_engine/checksum_table_live.reject 2012-07-15 17:47:28.105399836 +0400 +--- suite/storage_engine/checksum_table_live.result ++++ suite/storage_engine/checksum_table_live.reject @@ -11,8 +11,8 @@ test.t1 4272806499 CHECKSUM TABLE t1, t2 QUICK; diff --git a/storage/innobase/mysql-test/storage_engine/fulltext_search.rdiff b/storage/innobase/mysql-test/storage_engine/fulltext_search.rdiff index a68fe83070e..e35cd5dcfa1 100644 --- a/storage/innobase/mysql-test/storage_engine/fulltext_search.rdiff +++ b/storage/innobase/mysql-test/storage_engine/fulltext_search.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/fulltext_search.result 2013-11-27 18:50:16.000000000 +0400 -+++ suite/storage_engine/fulltext_search.reject 2014-02-05 15:33:26.000000000 +0400 +--- suite/storage_engine/fulltext_search.result ++++ suite/storage_engine/fulltext_search.reject @@ -52,15 +52,14 @@ INSERT INTO t1 (v0,v1,v2) VALUES ('text4','Contributing more...','...is a good idea'),('text5','test','test'); SELECT v0, MATCH(v1) AGAINST('contributing') AS rating FROM t1 WHERE MATCH(v1) AGAINST ('contributing'); diff --git a/storage/innobase/mysql-test/storage_engine/index_enable_disable.rdiff b/storage/innobase/mysql-test/storage_engine/index_enable_disable.rdiff index f8e812e7edb..b0e730205cd 100644 --- a/storage/innobase/mysql-test/storage_engine/index_enable_disable.rdiff +++ b/storage/innobase/mysql-test/storage_engine/index_enable_disable.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/index_enable_disable.result 2012-07-15 00:30:05.296641931 +0400 -+++ suite/storage_engine/index_enable_disable.reject 2012-07-15 17:49:12.988081281 +0400 +--- suite/storage_engine/index_enable_disable.result ++++ suite/storage_engine/index_enable_disable.reject @@ -11,15 +11,19 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment t1 1 a 1 a # # NULL NULL YES BTREE diff --git a/storage/innobase/mysql-test/storage_engine/index_type_hash.rdiff b/storage/innobase/mysql-test/storage_engine/index_type_hash.rdiff index 02f9d93588f..665b45c0274 100644 --- a/storage/innobase/mysql-test/storage_engine/index_type_hash.rdiff +++ b/storage/innobase/mysql-test/storage_engine/index_type_hash.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/index_type_hash.result 2012-07-15 01:10:17.919128889 +0400 -+++ suite/storage_engine/index_type_hash.reject 2012-07-15 17:49:26.135915989 +0400 +--- suite/storage_engine/index_type_hash.result ++++ suite/storage_engine/index_type_hash.reject @@ -4,7 +4,7 @@ ) ENGINE= ; SHOW KEYS IN t1; diff --git a/storage/innobase/mysql-test/storage_engine/insert_delayed.rdiff b/storage/innobase/mysql-test/storage_engine/insert_delayed.rdiff index 9e6cddf03f0..16252566fdb 100644 --- a/storage/innobase/mysql-test/storage_engine/insert_delayed.rdiff +++ b/storage/innobase/mysql-test/storage_engine/insert_delayed.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/insert_delayed.result 2013-01-23 01:23:49.461254916 +0400 -+++ suite/storage_engine/insert_delayed.reject 2013-01-23 01:47:05.975698364 +0400 +--- suite/storage_engine/insert_delayed.result ++++ suite/storage_engine/insert_delayed.reject @@ -5,7 +5,16 @@ connect con0,localhost,root,,; SET lock_wait_timeout = 1; diff --git a/storage/innobase/mysql-test/storage_engine/lock_concurrent.rdiff b/storage/innobase/mysql-test/storage_engine/lock_concurrent.rdiff index c76a5fe7f15..8b4452ea5ee 100644 --- a/storage/innobase/mysql-test/storage_engine/lock_concurrent.rdiff +++ b/storage/innobase/mysql-test/storage_engine/lock_concurrent.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/lock_concurrent.result 2012-06-24 23:55:19.539380000 +0400 -+++ suite/storage_engine/lock_concurrent.reject 2012-07-15 17:50:21.279222746 +0400 +--- suite/storage_engine/lock_concurrent.result ++++ suite/storage_engine/lock_concurrent.reject @@ -4,6 +4,14 @@ connect con1,localhost,root,,; SET lock_wait_timeout = 1; diff --git a/storage/innobase/mysql-test/storage_engine/optimize_table.rdiff b/storage/innobase/mysql-test/storage_engine/optimize_table.rdiff index 54d1f600516..14dbeaec3a2 100644 --- a/storage/innobase/mysql-test/storage_engine/optimize_table.rdiff +++ b/storage/innobase/mysql-test/storage_engine/optimize_table.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/optimize_table.result 2012-07-12 19:13:53.741428591 +0400 -+++ suite/storage_engine/optimize_table.reject 2012-07-15 17:50:30.843102510 +0400 +--- suite/storage_engine/optimize_table.result ++++ suite/storage_engine/optimize_table.reject @@ -5,25 +5,32 @@ INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d'); OPTIMIZE TABLE t1; diff --git a/storage/innobase/mysql-test/storage_engine/parts/checksum_table.rdiff b/storage/innobase/mysql-test/storage_engine/parts/checksum_table.rdiff index c8aabb787e9..660195498fa 100644 --- a/storage/innobase/mysql-test/storage_engine/parts/checksum_table.rdiff +++ b/storage/innobase/mysql-test/storage_engine/parts/checksum_table.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/parts/checksum_table.result 2013-11-08 22:30:34.000000000 +0400 -+++ suite/storage_engine/parts/checksum_table.reject 2013-11-08 22:32:30.000000000 +0400 +--- suite/storage_engine/parts/checksum_table.result ++++ suite/storage_engine/parts/checksum_table.reject @@ -31,8 +31,8 @@ test.t1 4272806499 CHECKSUM TABLE t1, t2 QUICK; diff --git a/storage/innobase/mysql-test/storage_engine/parts/create_table.rdiff b/storage/innobase/mysql-test/storage_engine/parts/create_table.rdiff index 0df91c6fc6e..4f4165b1143 100644 --- a/storage/innobase/mysql-test/storage_engine/parts/create_table.rdiff +++ b/storage/innobase/mysql-test/storage_engine/parts/create_table.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/parts/create_table.result 2012-07-12 21:56:38.618667460 +0400 -+++ suite/storage_engine/parts/create_table.reject 2012-07-15 20:06:43.496358345 +0400 +--- suite/storage_engine/parts/create_table.result ++++ suite/storage_engine/parts/create_table.reject @@ -65,7 +65,7 @@ 1 SIMPLE t1 abc,def # # # # # # # EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 100; diff --git a/storage/innobase/mysql-test/storage_engine/parts/optimize_table.rdiff b/storage/innobase/mysql-test/storage_engine/parts/optimize_table.rdiff index a35ba5167d9..0133a43088e 100644 --- a/storage/innobase/mysql-test/storage_engine/parts/optimize_table.rdiff +++ b/storage/innobase/mysql-test/storage_engine/parts/optimize_table.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/parts/optimize_table.result 2013-07-18 22:55:38.000000000 +0400 -+++ suite/storage_engine/parts/optimize_table.reject 2013-08-05 19:45:19.000000000 +0400 +--- suite/storage_engine/parts/optimize_table.result ++++ suite/storage_engine/parts/optimize_table.reject @@ -9,18 +9,22 @@ INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d'); ALTER TABLE t1 OPTIMIZE PARTITION p1; diff --git a/storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff b/storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff index 35b150e82d1..19d665ce93a 100644 --- a/storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff +++ b/storage/innobase/mysql-test/storage_engine/parts/repair_table.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/parts/repair_table.result 2013-07-18 22:55:38.000000000 +0400 -+++ suite/storage_engine/parts/repair_table.reject 2013-08-05 19:54:09.000000000 +0400 +--- suite/storage_engine/parts/repair_table.result ++++ suite/storage_engine/parts/repair_table.reject @@ -25,7 +25,7 @@ INSERT INTO t1 (a,b) VALUES (10,'j'); ALTER TABLE t1 REPAIR PARTITION p1 QUICK USE_FRM; diff --git a/storage/innobase/mysql-test/storage_engine/repair_table.rdiff b/storage/innobase/mysql-test/storage_engine/repair_table.rdiff index e9c46b3a6c1..18852739d06 100644 --- a/storage/innobase/mysql-test/storage_engine/repair_table.rdiff +++ b/storage/innobase/mysql-test/storage_engine/repair_table.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/repair_table.result 2013-10-03 20:35:06.000000000 +0400 -+++ suite/storage_engine/repair_table.reject 2013-11-08 22:04:22.000000000 +0400 +--- suite/storage_engine/repair_table.result ++++ suite/storage_engine/repair_table.reject @@ -4,56 +4,57 @@ CREATE TABLE t2 (a , b ) ENGINE= ; REPAIR TABLE t1; diff --git a/storage/innobase/mysql-test/storage_engine/tbl_opt_index_dir.rdiff b/storage/innobase/mysql-test/storage_engine/tbl_opt_index_dir.rdiff index e09e50b17ec..7d08e30a70b 100644 --- a/storage/innobase/mysql-test/storage_engine/tbl_opt_index_dir.rdiff +++ b/storage/innobase/mysql-test/storage_engine/tbl_opt_index_dir.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/tbl_opt_data_index_dir.result 2013-10-03 20:35:06.000000000 +0400 -+++ suite/storage_engine/tbl_opt_data_index_dir.reject 2013-11-08 22:06:54.000000000 +0400 +--- suite/storage_engine/tbl_opt_data_index_dir.result ++++ suite/storage_engine/tbl_opt_data_index_dir.reject @@ -1,10 +1,12 @@ DROP TABLE IF EXISTS t1; +Warnings: diff --git a/storage/innobase/mysql-test/storage_engine/tbl_opt_insert_method.rdiff b/storage/innobase/mysql-test/storage_engine/tbl_opt_insert_method.rdiff index 468b82926f0..d94836573a8 100644 --- a/storage/innobase/mysql-test/storage_engine/tbl_opt_insert_method.rdiff +++ b/storage/innobase/mysql-test/storage_engine/tbl_opt_insert_method.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/tbl_opt_insert_method.result 2012-06-24 23:55:19.539380000 +0400 -+++ suite/storage_engine/tbl_opt_insert_method.reject 2012-07-15 17:51:09.978610512 +0400 +--- suite/storage_engine/tbl_opt_insert_method.result ++++ suite/storage_engine/tbl_opt_insert_method.reject @@ -5,7 +5,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.rdiff b/storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.rdiff index daa5fc67dec..717ccf954cf 100644 --- a/storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.rdiff +++ b/storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.rdiff @@ -1,5 +1,5 @@ ---- ../storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.result~ 2017-05-24 00:40:12.854181048 +0300 -+++ ../storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.reject 2017-05-24 00:49:06.578191030 +0300 +--- ../storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.result~ ++++ ../storage/innobase/mysql-test/storage_engine/tbl_opt_row_format.reject @@ -7,19 +7,39 @@ `b` char(8) DEFAULT NULL ) ENGINE= DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC diff --git a/storage/innobase/mysql-test/storage_engine/tbl_opt_union.rdiff b/storage/innobase/mysql-test/storage_engine/tbl_opt_union.rdiff index cbdf5818022..bf30d718c56 100644 --- a/storage/innobase/mysql-test/storage_engine/tbl_opt_union.rdiff +++ b/storage/innobase/mysql-test/storage_engine/tbl_opt_union.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/tbl_opt_union.result 2012-06-24 23:55:19.539380000 +0400 -+++ suite/storage_engine/tbl_opt_union.reject 2012-07-15 17:51:31.014346053 +0400 +--- suite/storage_engine/tbl_opt_union.result ++++ suite/storage_engine/tbl_opt_union.reject @@ -4,11 +4,11 @@ Table Create Table t1 CREATE TABLE `t1` ( diff --git a/storage/innobase/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff b/storage/innobase/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff index e6149be58dc..2860d5cb0b8 100644 --- a/storage/innobase/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff +++ b/storage/innobase/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/cons_snapshot_serializable.result 2013-11-27 18:46:36.000000000 +0400 -+++ suite/storage_engine/trx/cons_snapshot_serializable.reject 2013-11-28 19:17:02.000000000 +0400 +--- suite/storage_engine/trx/cons_snapshot_serializable.result ++++ suite/storage_engine/trx/cons_snapshot_serializable.reject @@ -5,12 +5,15 @@ CREATE TABLE t1 (a ) ENGINE= ; SET SESSION TRANSACTION ISOLATION LEVEL SERIALIZABLE; diff --git a/storage/innobase/mysql-test/storage_engine/trx/level_read_committed.rdiff b/storage/innobase/mysql-test/storage_engine/trx/level_read_committed.rdiff index cb64d32138b..d0a846ee1f7 100644 --- a/storage/innobase/mysql-test/storage_engine/trx/level_read_committed.rdiff +++ b/storage/innobase/mysql-test/storage_engine/trx/level_read_committed.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/level_read_committed.result 2013-11-28 19:18:48.000000000 +0400 -+++ suite/storage_engine/trx/level_read_committed.reject 2013-11-28 19:18:59.000000000 +0400 +--- suite/storage_engine/trx/level_read_committed.result ++++ suite/storage_engine/trx/level_read_committed.reject @@ -77,6 +77,8 @@ CREATE TABLE t1 (a ) ENGINE= ; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; diff --git a/storage/innobase/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff b/storage/innobase/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff index 6a79abe3ca5..ee483dd64bb 100644 --- a/storage/innobase/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff +++ b/storage/innobase/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/level_read_uncommitted.result 2013-11-28 19:18:48.000000000 +0400 -+++ suite/storage_engine/trx/level_read_uncommitted.reject 2013-11-28 19:19:50.000000000 +0400 +--- suite/storage_engine/trx/level_read_uncommitted.result ++++ suite/storage_engine/trx/level_read_uncommitted.reject @@ -102,6 +102,8 @@ CREATE TABLE t1 (a ) ENGINE= ; SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; diff --git a/storage/innobase/mysql-test/storage_engine/type_char_indexes.rdiff b/storage/innobase/mysql-test/storage_engine/type_char_indexes.rdiff index 98e17f3c825..72f86c2af50 100644 --- a/storage/innobase/mysql-test/storage_engine/type_char_indexes.rdiff +++ b/storage/innobase/mysql-test/storage_engine/type_char_indexes.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/type_char_indexes.result 2014-10-12 14:22:11.000000000 +0400 -+++ suite/storage_engine/type_char_indexes.reject 2014-10-12 14:23:28.000000000 +0400 +--- suite/storage_engine/type_char_indexes.result ++++ suite/storage_engine/type_char_indexes.reject @@ -137,7 +137,7 @@ r3a EXPLAIN SELECT c,c20,v16,v128 FROM t1 WHERE v16 = 'varchar1a' OR v16 = 'varchar3a' ORDER BY v16; diff --git a/storage/innobase/mysql-test/storage_engine/type_float_indexes.rdiff b/storage/innobase/mysql-test/storage_engine/type_float_indexes.rdiff index 6ebfd61d876..79af0d9dd37 100644 --- a/storage/innobase/mysql-test/storage_engine/type_float_indexes.rdiff +++ b/storage/innobase/mysql-test/storage_engine/type_float_indexes.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/type_float_indexes.result 2012-07-12 19:37:27.031661128 +0400 -+++ suite/storage_engine/type_float_indexes.reject 2012-07-15 17:52:12.189828410 +0400 +--- suite/storage_engine/type_float_indexes.result ++++ suite/storage_engine/type_float_indexes.reject @@ -60,7 +60,7 @@ ALTER TABLE t1 ADD UNIQUE KEY(d); EXPLAIN SELECT d FROM t1 WHERE r > 0 and d > 0 ORDER BY d; diff --git a/storage/myisam/mysql-test/mtr2/single.rdiff b/storage/myisam/mysql-test/mtr2/single.rdiff index fd590d53d4a..db13b5f4593 100644 --- a/storage/myisam/mysql-test/mtr2/single.rdiff +++ b/storage/myisam/mysql-test/mtr2/single.rdiff @@ -1,5 +1,5 @@ ---- suite/mtr2/single.result 2013-11-10 03:58:37.000000000 +0400 -+++ suite/mtr2/single.reject 2013-11-10 03:59:08.000000000 +0400 +--- suite/mtr2/single.result ++++ suite/mtr2/single.reject @@ -1,6 +1,6 @@ select 1; 1 diff --git a/storage/myisam/mysql-test/storage_engine/alter_table_online.rdiff b/storage/myisam/mysql-test/storage_engine/alter_table_online.rdiff index 58c7620f3b9..745cf0416ad 100644 --- a/storage/myisam/mysql-test/storage_engine/alter_table_online.rdiff +++ b/storage/myisam/mysql-test/storage_engine/alter_table_online.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/alter_table_online.result 2013-11-08 20:01:16.000000000 +0400 -+++ suite/storage_engine/alter_table_online.reject 2013-11-08 20:02:03.000000000 +0400 +--- suite/storage_engine/alter_table_online.result ++++ suite/storage_engine/alter_table_online.reject @@ -23,12 +50,30 @@ CREATE TABLE t1 (a , b , c ) ENGINE= ; INSERT INTO t1 (a,b,c) VALUES (1,100,'a'),(2,200,'b'),(3,300,'c'); diff --git a/storage/myisam/mysql-test/storage_engine/alter_tablespace.rdiff b/storage/myisam/mysql-test/storage_engine/alter_tablespace.rdiff index a8c78b117a9..0292bde2fe5 100644 --- a/storage/myisam/mysql-test/storage_engine/alter_tablespace.rdiff +++ b/storage/myisam/mysql-test/storage_engine/alter_tablespace.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/alter_tablespace.result 2012-07-12 19:53:40.775419511 +0400 -+++ suite/storage_engine/alter_tablespace.reject 2012-07-15 16:21:14.910435703 +0400 +--- suite/storage_engine/alter_tablespace.result ++++ suite/storage_engine/alter_tablespace.reject @@ -1,21 +1,14 @@ DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 (a ) ENGINE= ; diff --git a/storage/myisam/mysql-test/storage_engine/check_table.rdiff b/storage/myisam/mysql-test/storage_engine/check_table.rdiff index 48e8fc2e770..7ded1d9bc36 100644 --- a/storage/myisam/mysql-test/storage_engine/check_table.rdiff +++ b/storage/myisam/mysql-test/storage_engine/check_table.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/check_table.result 2012-07-15 04:19:07.782936394 +0400 -+++ suite/storage_engine/check_table.reject 2012-07-15 16:21:16.734412773 +0400 +--- suite/storage_engine/check_table.result ++++ suite/storage_engine/check_table.reject @@ -18,7 +18,7 @@ INSERT INTO t1 (a,b) VALUES (6,'f'); CHECK TABLE t1 FAST; diff --git a/storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff b/storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff index cf24f2c3e61..65d11557c86 100644 --- a/storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff +++ b/storage/myisam/mysql-test/storage_engine/foreign_keys.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/foreign_keys.result 2012-07-12 18:56:19.782678645 +0400 -+++ suite/storage_engine/foreign_keys.reject 2012-07-15 16:21:30.414240794 +0400 +--- suite/storage_engine/foreign_keys.result ++++ suite/storage_engine/foreign_keys.reject @@ -12,29 +12,57 @@ t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisam/mysql-test/storage_engine/index_type_hash.rdiff b/storage/myisam/mysql-test/storage_engine/index_type_hash.rdiff index e7fa0013fa9..665b45c0274 100644 --- a/storage/myisam/mysql-test/storage_engine/index_type_hash.rdiff +++ b/storage/myisam/mysql-test/storage_engine/index_type_hash.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/index_type_hash.result 2012-07-15 01:10:17.919128889 +0400 -+++ suite/storage_engine/index_type_hash.reject 2012-07-15 16:21:32.806210722 +0400 +--- suite/storage_engine/index_type_hash.result ++++ suite/storage_engine/index_type_hash.reject @@ -4,7 +4,7 @@ ) ENGINE= ; SHOW KEYS IN t1; diff --git a/storage/myisam/mysql-test/storage_engine/misc.rdiff b/storage/myisam/mysql-test/storage_engine/misc.rdiff index cdbad003217..0d2f085074f 100644 --- a/storage/myisam/mysql-test/storage_engine/misc.rdiff +++ b/storage/myisam/mysql-test/storage_engine/misc.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/misc.result 2018-02-23 03:01:49.673249912 +0200 -+++ suite/storage_engine/misc.reject 2018-02-23 03:02:05.669249564 +0200 +--- suite/storage_engine/misc.result ++++ suite/storage_engine/misc.reject @@ -28,6 +28,10 @@ SELECT TABLE_NAME, COLUMN_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE ORDER BY TABLE_NAME; diff --git a/storage/myisam/mysql-test/storage_engine/show_engine.rdiff b/storage/myisam/mysql-test/storage_engine/show_engine.rdiff index 4e6624653ea..8918fdbee71 100644 --- a/storage/myisam/mysql-test/storage_engine/show_engine.rdiff +++ b/storage/myisam/mysql-test/storage_engine/show_engine.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/show_engine.result 2012-06-24 23:55:19.539380000 +0400 -+++ suite/storage_engine/show_engine.reject 2012-07-15 16:21:54.401939228 +0400 +--- suite/storage_engine/show_engine.result ++++ suite/storage_engine/show_engine.reject @@ -4,7 +4,6 @@ # volatile data (timestamps, memory info, etc.) SHOW ENGINE STATUS; diff --git a/storage/myisam/mysql-test/storage_engine/tbl_opt_insert_method.rdiff b/storage/myisam/mysql-test/storage_engine/tbl_opt_insert_method.rdiff index a8df852515a..d94836573a8 100644 --- a/storage/myisam/mysql-test/storage_engine/tbl_opt_insert_method.rdiff +++ b/storage/myisam/mysql-test/storage_engine/tbl_opt_insert_method.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/tbl_opt_insert_method.result 2012-06-24 23:55:19.539380000 +0400 -+++ suite/storage_engine/tbl_opt_insert_method.reject 2012-07-15 16:21:56.381914337 +0400 +--- suite/storage_engine/tbl_opt_insert_method.result ++++ suite/storage_engine/tbl_opt_insert_method.reject @@ -5,7 +5,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisam/mysql-test/storage_engine/tbl_opt_union.rdiff b/storage/myisam/mysql-test/storage_engine/tbl_opt_union.rdiff index 4fa164523db..bf30d718c56 100644 --- a/storage/myisam/mysql-test/storage_engine/tbl_opt_union.rdiff +++ b/storage/myisam/mysql-test/storage_engine/tbl_opt_union.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/tbl_opt_union.result 2012-06-24 23:55:19.539380000 +0400 -+++ suite/storage_engine/tbl_opt_union.reject 2012-07-15 16:21:58.121892463 +0400 +--- suite/storage_engine/tbl_opt_union.result ++++ suite/storage_engine/tbl_opt_union.reject @@ -4,11 +4,11 @@ Table Create Table t1 CREATE TABLE `t1` ( diff --git a/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff b/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff index b460b5b4763..8791d9795fe 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/cons_snapshot_repeatable_read.result 2013-01-22 22:05:05.246633000 +0400 -+++ suite/storage_engine/trx/cons_snapshot_repeatable_read.reject 2013-01-23 02:44:05.336711176 +0400 +--- suite/storage_engine/trx/cons_snapshot_repeatable_read.result ++++ suite/storage_engine/trx/cons_snapshot_repeatable_read.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support transactions. diff --git a/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff b/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff index d5f1a03084e..f8c7f93b134 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/cons_snapshot_serializable.result 2013-01-22 22:05:05.246633000 +0400 -+++ suite/storage_engine/trx/cons_snapshot_serializable.reject 2013-01-23 02:44:05.928703734 +0400 +--- suite/storage_engine/trx/cons_snapshot_serializable.result ++++ suite/storage_engine/trx/cons_snapshot_serializable.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support transactions. diff --git a/storage/myisam/mysql-test/storage_engine/trx/delete.rdiff b/storage/myisam/mysql-test/storage_engine/trx/delete.rdiff index d7111ab28fc..83b2e3d5f64 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/delete.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/delete.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/delete.result 2012-07-12 23:06:18.946113626 +0400 -+++ suite/storage_engine/trx/delete.reject 2012-07-15 16:55:46.108397219 +0400 +--- suite/storage_engine/trx/delete.result ++++ suite/storage_engine/trx/delete.reject @@ -1,3 +1,15 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support transactions. diff --git a/storage/myisam/mysql-test/storage_engine/trx/insert.rdiff b/storage/myisam/mysql-test/storage_engine/trx/insert.rdiff index cee69633860..1fa1e8a2652 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/insert.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/insert.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/insert.result 2012-07-12 23:09:44.663527407 +0400 -+++ suite/storage_engine/trx/insert.reject 2012-07-15 16:55:46.676390078 +0400 +--- suite/storage_engine/trx/insert.result ++++ suite/storage_engine/trx/insert.reject @@ -1,3 +1,15 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support transactions. diff --git a/storage/myisam/mysql-test/storage_engine/trx/level_read_committed.rdiff b/storage/myisam/mysql-test/storage_engine/trx/level_read_committed.rdiff index 94e3fc83e1e..54528c7c872 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/level_read_committed.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/level_read_committed.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/level_read_committed.result 2013-01-22 22:05:05.246633000 +0400 -+++ suite/storage_engine/trx/level_read_committed.reject 2013-01-23 02:44:06.572695636 +0400 +--- suite/storage_engine/trx/level_read_committed.result ++++ suite/storage_engine/trx/level_read_committed.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support transactions. diff --git a/storage/myisam/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff b/storage/myisam/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff index 91a2786cb68..618d6b32a75 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/level_read_uncommitted.result 2013-01-22 22:05:05.246633000 +0400 -+++ suite/storage_engine/trx/level_read_uncommitted.reject 2013-01-23 02:44:07.196687792 +0400 +--- suite/storage_engine/trx/level_read_uncommitted.result ++++ suite/storage_engine/trx/level_read_uncommitted.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support transactions. diff --git a/storage/myisam/mysql-test/storage_engine/trx/level_repeatable_read.rdiff b/storage/myisam/mysql-test/storage_engine/trx/level_repeatable_read.rdiff index 2c265900004..6e1ce736413 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/level_repeatable_read.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/level_repeatable_read.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/level_repeatable_read.result 2013-01-22 22:05:05.246633000 +0400 -+++ suite/storage_engine/trx/level_repeatable_read.reject 2013-01-23 02:44:07.776680499 +0400 +--- suite/storage_engine/trx/level_repeatable_read.result ++++ suite/storage_engine/trx/level_repeatable_read.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support transactions. diff --git a/storage/myisam/mysql-test/storage_engine/trx/level_serializable.rdiff b/storage/myisam/mysql-test/storage_engine/trx/level_serializable.rdiff index 7955036e000..b69a809bf97 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/level_serializable.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/level_serializable.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/level_serializable.result 2013-01-22 22:05:05.246633000 +0400 -+++ suite/storage_engine/trx/level_serializable.reject 2013-01-23 02:44:08.384672856 +0400 +--- suite/storage_engine/trx/level_serializable.result ++++ suite/storage_engine/trx/level_serializable.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support transactions. diff --git a/storage/myisam/mysql-test/storage_engine/trx/select_for_update.rdiff b/storage/myisam/mysql-test/storage_engine/trx/select_for_update.rdiff index 044ce56da43..2d5e718691d 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/select_for_update.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/select_for_update.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/select_for_update.result 2012-07-13 01:26:07.612653808 +0400 -+++ suite/storage_engine/trx/select_for_update.reject 2012-07-15 16:55:49.784351006 +0400 +--- suite/storage_engine/trx/select_for_update.result ++++ suite/storage_engine/trx/select_for_update.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support transactions. diff --git a/storage/myisam/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff b/storage/myisam/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff index e1e8d3050e7..5600b41ad57 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/select_lock_in_share_mode.result 2012-07-13 01:30:17.505512229 +0400 -+++ suite/storage_engine/trx/select_lock_in_share_mode.reject 2012-07-15 16:55:50.444342708 +0400 +--- suite/storage_engine/trx/select_lock_in_share_mode.result ++++ suite/storage_engine/trx/select_lock_in_share_mode.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support transactions. diff --git a/storage/myisam/mysql-test/storage_engine/trx/update.rdiff b/storage/myisam/mysql-test/storage_engine/trx/update.rdiff index ca3b77e7cec..b5e5f3491c1 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/update.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/update.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/update.result 2012-07-13 01:43:50.355293322 +0400 -+++ suite/storage_engine/trx/update.reject 2012-07-15 16:55:51.016335518 +0400 +--- suite/storage_engine/trx/update.result ++++ suite/storage_engine/trx/update.reject @@ -1,3 +1,15 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support transactions. diff --git a/storage/myisam/mysql-test/storage_engine/trx/xa.rdiff b/storage/myisam/mysql-test/storage_engine/trx/xa.rdiff index 73c3796b13b..4f06ba899e4 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/xa.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/xa.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/xa.result 2012-07-13 01:47:00.788899248 +0400 -+++ suite/storage_engine/trx/xa.reject 2012-07-15 16:55:51.604328125 +0400 +--- suite/storage_engine/trx/xa.result ++++ suite/storage_engine/trx/xa.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support XA. diff --git a/storage/myisam/mysql-test/storage_engine/trx/xa_recovery.rdiff b/storage/myisam/mysql-test/storage_engine/trx/xa_recovery.rdiff index 4b057019bbd..a2b7e0dab29 100644 --- a/storage/myisam/mysql-test/storage_engine/trx/xa_recovery.rdiff +++ b/storage/myisam/mysql-test/storage_engine/trx/xa_recovery.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/trx/xa_recovery.result 2012-07-13 01:48:46.859565758 +0400 -+++ suite/storage_engine/trx/xa_recovery.reject 2012-07-15 16:55:53.740301272 +0400 +--- suite/storage_engine/trx/xa_recovery.result ++++ suite/storage_engine/trx/xa_recovery.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MyISAM does not support XA. diff --git a/storage/myisammrg/mysql-test/storage_engine/alter_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/alter_table.rdiff index b2ec2129d04..bd1a78fbcc0 100644 --- a/storage/myisammrg/mysql-test/storage_engine/alter_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/alter_table.rdiff @@ -1,5 +1,5 @@ ---- alter_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ alter_table.reject 2013-01-23 02:50:10.652118538 +0400 +--- alter_table.result ++++ alter_table.reject @@ -8,7 +8,7 @@ `a` int(11) DEFAULT NULL, `c` char(8) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/alter_table_online.rdiff b/storage/myisammrg/mysql-test/storage_engine/alter_table_online.rdiff index 857854a6115..51779d4bbee 100644 --- a/storage/myisammrg/mysql-test/storage_engine/alter_table_online.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/alter_table_online.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/alter_table_online.result 2014-11-12 05:27:00.000000000 +0400 -+++ suite/storage_engine/alter_table_online.reject 2014-12-05 20:42:25.000000000 +0400 +--- suite/storage_engine/alter_table_online.result ++++ suite/storage_engine/alter_table_online.reject @@ -2,8 +2,35 @@ CREATE TABLE t1 (a , b , c ) ENGINE= ; INSERT INTO t1 (a,b,c) VALUES (1,100,'a'),(2,200,'b'),(3,300,'c'); diff --git a/storage/myisammrg/mysql-test/storage_engine/alter_tablespace.rdiff b/storage/myisammrg/mysql-test/storage_engine/alter_tablespace.rdiff index e5462f8cb1f..5d51ece13bd 100644 --- a/storage/myisammrg/mysql-test/storage_engine/alter_tablespace.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/alter_tablespace.rdiff @@ -1,5 +1,5 @@ ---- alter_tablespace.result 2013-01-22 22:05:05.246633000 +0400 -+++ alter_tablespace.reject 2013-01-23 02:50:11.288110543 +0400 +--- alter_tablespace.result ++++ alter_tablespace.reject @@ -1,21 +1,14 @@ DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 (a ) ENGINE= ; diff --git a/storage/myisammrg/mysql-test/storage_engine/analyze_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/analyze_table.rdiff index 9854a986cc5..ffe16e16e06 100644 --- a/storage/myisammrg/mysql-test/storage_engine/analyze_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/analyze_table.rdiff @@ -1,5 +1,5 @@ ---- analyze_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ analyze_table.reject 2013-01-23 02:50:11.912102699 +0400 +--- analyze_table.result ++++ analyze_table.reject @@ -5,25 +5,25 @@ INSERT INTO t1 (a,b) VALUES (3,'c'); ANALYZE TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff b/storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff index cc04b800793..8ad8c70d10f 100644 --- a/storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/autoincrement.rdiff @@ -1,5 +1,5 @@ ---- autoincrement.result 2013-01-22 22:05:05.246633000 +0400 -+++ autoincrement.reject 2013-01-23 02:50:12.848090932 +0400 +--- autoincrement.result ++++ autoincrement.reject @@ -6,7 +6,7 @@ `a` int(11) NOT NULL AUTO_INCREMENT, `b` char(8) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/cache_index.rdiff b/storage/myisammrg/mysql-test/storage_engine/cache_index.rdiff index 612c8d38311..2606c7e5cca 100644 --- a/storage/myisammrg/mysql-test/storage_engine/cache_index.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/cache_index.rdiff @@ -1,5 +1,5 @@ ---- cache_index.result 2013-01-22 22:05:05.246633000 +0400 -+++ cache_index.reject 2013-01-23 02:50:13.468083137 +0400 +--- cache_index.result ++++ cache_index.reject @@ -12,31 +12,31 @@ SET GLOBAL .key_buffer_size=128*1024; CACHE INDEX t1 INDEX (a), t2 IN ; diff --git a/storage/myisammrg/mysql-test/storage_engine/checksum_table_live.rdiff b/storage/myisammrg/mysql-test/storage_engine/checksum_table_live.rdiff index f09aec971a9..8e1daa9f6a7 100644 --- a/storage/myisammrg/mysql-test/storage_engine/checksum_table_live.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/checksum_table_live.rdiff @@ -1,5 +1,5 @@ ---- checksum_table_live.result 2013-01-22 22:05:05.246633000 +0400 -+++ checksum_table_live.reject 2013-01-23 02:50:14.440070917 +0400 +--- checksum_table_live.result ++++ checksum_table_live.reject @@ -11,8 +11,8 @@ test.t1 4272806499 CHECKSUM TABLE t1, t2 QUICK; diff --git a/storage/myisammrg/mysql-test/storage_engine/create_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/create_table.rdiff index ad6352d3e7b..f90406e9dff 100644 --- a/storage/myisammrg/mysql-test/storage_engine/create_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/create_table.rdiff @@ -1,5 +1,5 @@ ---- create_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ create_table.reject 2013-01-23 02:50:19.544006752 +0400 +--- create_table.result ++++ create_table.reject @@ -4,7 +4,7 @@ Table Create Table t1 CREATE TABLE `t1` ( diff --git a/storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff b/storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff index fc07ebc0e94..4af98e0d3b4 100644 --- a/storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/foreign_keys.rdiff @@ -1,5 +1,5 @@ ---- foreign_keys.result 2013-01-22 22:05:05.246633000 +0400 -+++ foreign_keys.reject 2013-01-23 02:50:28.187898084 +0400 +--- foreign_keys.result ++++ foreign_keys.reject @@ -12,29 +12,57 @@ t2 CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/fulltext_search.rdiff b/storage/myisammrg/mysql-test/storage_engine/fulltext_search.rdiff index c96b697167c..7c63cc87df9 100644 --- a/storage/myisammrg/mysql-test/storage_engine/fulltext_search.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/fulltext_search.rdiff @@ -1,5 +1,5 @@ ---- fulltext_search.result 2013-01-22 22:05:05.246633000 +0400 -+++ fulltext_search.reject 2013-01-23 02:50:28.807890289 +0400 +--- fulltext_search.result ++++ fulltext_search.reject @@ -4,129 +4,27 @@ v2 TEXT , FULLTEXT v1 (v1) diff --git a/storage/myisammrg/mysql-test/storage_engine/handler.rdiff b/storage/myisammrg/mysql-test/storage_engine/handler.rdiff index 9e9117e04fc..a8fdce842e4 100644 --- a/storage/myisammrg/mysql-test/storage_engine/handler.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/handler.rdiff @@ -1,5 +1,5 @@ ---- handler.result 2013-01-22 22:05:05.246633000 +0400 -+++ handler.reject 2013-01-23 02:50:29.411882697 +0400 +--- handler.result ++++ handler.reject @@ -2,76 +2,19 @@ CREATE TABLE t1 (a , b ) ENGINE= ; INSERT INTO t1 (a,b) VALUES ('foobar',1000),('a',1),('bar',200),('foo',100); diff --git a/storage/myisammrg/mysql-test/storage_engine/index.rdiff b/storage/myisammrg/mysql-test/storage_engine/index.rdiff index bf6806979ec..f797a6f628c 100644 --- a/storage/myisammrg/mysql-test/storage_engine/index.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/index.rdiff @@ -1,5 +1,5 @@ ---- index.result 2013-01-22 22:05:05.246633000 +0400 -+++ index.reject 2013-01-23 02:50:30.111873897 +0400 +--- index.result ++++ index.reject @@ -61,7 +61,5 @@ ALTER TABLE t1 DROP INDEX a; INSERT INTO t1 (a,b) VALUES (1,'c'); diff --git a/storage/myisammrg/mysql-test/storage_engine/index_enable_disable.rdiff b/storage/myisammrg/mysql-test/storage_engine/index_enable_disable.rdiff index 357d4e931d2..8a4d47fa4ad 100644 --- a/storage/myisammrg/mysql-test/storage_engine/index_enable_disable.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/index_enable_disable.rdiff @@ -1,5 +1,5 @@ ---- index_enable_disable.result 2013-01-22 22:05:05.246633000 +0400 -+++ index_enable_disable.reject 2013-01-23 02:50:30.723866202 +0400 +--- index_enable_disable.result ++++ index_enable_disable.reject @@ -11,15 +11,19 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment t1 1 a 1 a # # NULL NULL YES BTREE diff --git a/storage/myisammrg/mysql-test/storage_engine/index_type_btree.rdiff b/storage/myisammrg/mysql-test/storage_engine/index_type_btree.rdiff index 1874b0d5891..46958642019 100644 --- a/storage/myisammrg/mysql-test/storage_engine/index_type_btree.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/index_type_btree.rdiff @@ -1,5 +1,5 @@ ---- index_type_btree.result 2013-01-22 22:05:05.246633000 +0400 -+++ index_type_btree.reject 2013-01-23 02:50:31.963850614 +0400 +--- index_type_btree.result ++++ index_type_btree.reject @@ -61,7 +61,5 @@ ALTER TABLE t1 DROP INDEX a; INSERT INTO t1 (a,b) VALUES (1,'c'); diff --git a/storage/myisammrg/mysql-test/storage_engine/index_type_hash.rdiff b/storage/myisammrg/mysql-test/storage_engine/index_type_hash.rdiff index f6fd1e391aa..c3d6108f9f4 100644 --- a/storage/myisammrg/mysql-test/storage_engine/index_type_hash.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/index_type_hash.rdiff @@ -1,5 +1,5 @@ ---- index_type_hash.result 2013-01-22 22:05:05.246633000 +0400 -+++ index_type_hash.reject 2013-01-23 02:50:32.647842015 +0400 +--- index_type_hash.result ++++ index_type_hash.reject @@ -4,7 +4,7 @@ ) ENGINE= ; SHOW KEYS IN t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/insert_delayed.rdiff b/storage/myisammrg/mysql-test/storage_engine/insert_delayed.rdiff index 24ffa2ab82f..1fe06b5004e 100644 --- a/storage/myisammrg/mysql-test/storage_engine/insert_delayed.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/insert_delayed.rdiff @@ -1,5 +1,5 @@ ---- insert_delayed.result 2013-01-23 01:23:49.461254916 +0400 -+++ insert_delayed.reject 2013-01-23 02:50:34.475819034 +0400 +--- insert_delayed.result ++++ insert_delayed.reject @@ -5,7 +5,16 @@ connect con0,localhost,root,,; SET lock_wait_timeout = 1; diff --git a/storage/myisammrg/mysql-test/storage_engine/lock.rdiff b/storage/myisammrg/mysql-test/storage_engine/lock.rdiff index f6bb75409d3..8aa52943d08 100644 --- a/storage/myisammrg/mysql-test/storage_engine/lock.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/lock.rdiff @@ -1,5 +1,5 @@ ---- lock.result 2013-01-23 01:24:01.797100027 +0400 -+++ lock.reject 2013-01-23 02:50:53.291582487 +0400 +--- lock.result ++++ lock.reject @@ -42,34 +42,67 @@ UPDATE t1 SET id=1 WHERE id=-1; DROP TABLE t1,t2; diff --git a/storage/myisammrg/mysql-test/storage_engine/misc.rdiff b/storage/myisammrg/mysql-test/storage_engine/misc.rdiff index cdbad003217..0d2f085074f 100644 --- a/storage/myisammrg/mysql-test/storage_engine/misc.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/misc.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/misc.result 2018-02-23 03:01:49.673249912 +0200 -+++ suite/storage_engine/misc.reject 2018-02-23 03:02:05.669249564 +0200 +--- suite/storage_engine/misc.result ++++ suite/storage_engine/misc.reject @@ -28,6 +28,10 @@ SELECT TABLE_NAME, COLUMN_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE ORDER BY TABLE_NAME; diff --git a/storage/myisammrg/mysql-test/storage_engine/optimize_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/optimize_table.rdiff index 1b611adf25a..0ef657a2d16 100644 --- a/storage/myisammrg/mysql-test/storage_engine/optimize_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/optimize_table.rdiff @@ -1,5 +1,5 @@ ---- optimize_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ optimize_table.reject 2013-01-23 02:50:54.339569313 +0400 +--- optimize_table.result ++++ optimize_table.reject @@ -5,25 +5,25 @@ INSERT INTO t1 (a,b) VALUES (3,'c'),(4,'d'); OPTIMIZE TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/alter_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/alter_table.rdiff index 4c7ba7d8232..13881adcefb 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/alter_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/alter_table.rdiff @@ -1,5 +1,5 @@ ---- alter_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ alter_table.reject 2013-01-23 03:16:22.620356221 +0400 +--- alter_table.result ++++ alter_table.reject @@ -1,42 +1,29 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a ) ENGINE= PARTITION BY HASH(a) PARTITIONS 2; diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/analyze_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/analyze_table.rdiff index 7163aaefc53..5e25afb83ea 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/analyze_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/analyze_table.rdiff @@ -1,5 +1,5 @@ ---- analyze_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ analyze_table.reject 2013-01-23 03:16:23.240348427 +0400 +--- analyze_table.result ++++ analyze_table.reject @@ -1,47 +1,62 @@ DROP TABLE IF EXISTS t1,t2; CREATE TABLE t1 (a , b ) ENGINE= PARTITION BY HASH(a) PARTITIONS 2; diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/check_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/check_table.rdiff index 5f7b7c75713..8f55bb5e12d 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/check_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/check_table.rdiff @@ -1,5 +1,5 @@ ---- check_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ check_table.reject 2013-01-23 03:16:23.872340482 +0400 +--- check_table.result ++++ check_table.reject @@ -1,104 +1,122 @@ DROP TABLE IF EXISTS t1, t2; CREATE TABLE t1 (a , b ) ENGINE= PARTITION BY HASH(a) PARTITIONS 2; diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/checksum_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/checksum_table.rdiff index 6d01f0564f2..5be01fc6d3d 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/checksum_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/checksum_table.rdiff @@ -1,5 +1,5 @@ ---- checksum_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ checksum_table.reject 2013-01-23 03:16:24.496332636 +0400 +--- checksum_table.result ++++ checksum_table.reject @@ -1,40 +1,74 @@ DROP TABLE IF EXISTS t1,t2; CREATE TABLE t1 (a , b ) ENGINE= CHECKSUM=0 PARTITION BY HASH(a) PARTITIONS 2; diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/create_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/create_table.rdiff index d6aa75f1c44..bc814a9b100 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/create_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/create_table.rdiff @@ -1,5 +1,5 @@ ---- create_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ create_table.reject 2013-01-23 03:16:25.160324290 +0400 +--- create_table.result ++++ create_table.reject @@ -1,91 +1,79 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a ) ENGINE= PARTITION BY HASH(a) PARTITIONS 2; diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/optimize_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/optimize_table.rdiff index 2e2a1fecb8f..e6e646212bc 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/optimize_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/optimize_table.rdiff @@ -1,5 +1,5 @@ ---- optimize_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ optimize_table.reject 2013-01-23 03:16:25.780316495 +0400 +--- optimize_table.result ++++ optimize_table.reject @@ -1,54 +1,62 @@ DROP TABLE IF EXISTS t1,t2; CREATE TABLE t1 (a , b ) ENGINE= PARTITION BY HASH(a) PARTITIONS 2; diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/repair_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/repair_table.rdiff index eddb6872ec3..4e7f0ab2fed 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/repair_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/repair_table.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/parts/repair_table.result 2017-08-28 19:29:20.491633306 +0300 -+++ suite/storage_engine/parts/repair_table.reject 2017-08-28 19:34:41.723633059 +0300 +--- suite/storage_engine/parts/repair_table.result ++++ suite/storage_engine/parts/repair_table.reject @@ -1,232 +1,116 @@ call mtr.add_suppression("Table '.*t1.*' is marked as crashed and should be repaired"); DROP TABLE IF EXISTS t1, t2; diff --git a/storage/myisammrg/mysql-test/storage_engine/parts/truncate_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/parts/truncate_table.rdiff index 9ba985f7adc..cec7083f4ff 100644 --- a/storage/myisammrg/mysql-test/storage_engine/parts/truncate_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/parts/truncate_table.rdiff @@ -1,5 +1,5 @@ ---- truncate_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ truncate_table.reject 2013-01-23 03:16:27.076300201 +0400 +--- truncate_table.result ++++ truncate_table.reject @@ -1,68 +1,34 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a , b ) ENGINE= PARTITION BY HASH(a) PARTITIONS 2; diff --git a/storage/myisammrg/mysql-test/storage_engine/repair_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/repair_table.rdiff index d6c46b8c5b8..db5b8566b5d 100644 --- a/storage/myisammrg/mysql-test/storage_engine/repair_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/repair_table.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/repair_table.result 2017-05-24 01:09:07.274213486 +0300 -+++ suite/storage_engine/repair_table.reject 2017-05-24 01:10:25.466214949 +0300 +--- suite/storage_engine/repair_table.result ++++ suite/storage_engine/repair_table.reject @@ -4,56 +4,50 @@ CREATE TABLE t2 (a , b ) ENGINE= ; REPAIR TABLE t1; diff --git a/storage/myisammrg/mysql-test/storage_engine/show_engine.rdiff b/storage/myisammrg/mysql-test/storage_engine/show_engine.rdiff index e78e6fdad53..3c7332e1330 100644 --- a/storage/myisammrg/mysql-test/storage_engine/show_engine.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/show_engine.rdiff @@ -1,5 +1,5 @@ ---- show_engine.result 2013-01-22 22:05:05.246633000 +0400 -+++ show_engine.reject 2013-01-23 02:50:56.871537482 +0400 +--- show_engine.result ++++ show_engine.reject @@ -4,7 +4,6 @@ # volatile data (timestamps, memory info, etc.) SHOW ENGINE STATUS; diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_ai.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_ai.rdiff index 4de7e81ffba..809bce6c3f3 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_ai.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_ai.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_ai.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_ai.reject 2013-01-23 02:50:57.547528984 +0400 +--- tbl_opt_ai.result ++++ tbl_opt_ai.reject @@ -4,11 +4,11 @@ Table Create Table t1 CREATE TABLE `t1` ( diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_avg_row_length.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_avg_row_length.rdiff index 2632fabf89d..91b72a901c1 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_avg_row_length.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_avg_row_length.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_avg_row_length.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_avg_row_length.reject 2013-01-23 02:50:58.123521742 +0400 +--- tbl_opt_avg_row_length.result ++++ tbl_opt_avg_row_length.reject @@ -5,12 +5,12 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_checksum.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_checksum.rdiff index baad32dd4db..a471a1ce388 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_checksum.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_checksum.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_checksum.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_checksum.reject 2013-01-23 02:50:58.739513998 +0400 +--- tbl_opt_checksum.result ++++ tbl_opt_checksum.reject @@ -5,12 +5,12 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_connection.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_connection.rdiff index 3dc06fb2704..b08d922bab6 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_connection.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_connection.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_connection.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_connection.reject 2013-01-23 02:50:59.335506506 +0400 +--- tbl_opt_connection.result ++++ tbl_opt_connection.reject @@ -10,14 +10,14 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_dir.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_dir.rdiff index 671e26ec617..f4b1c89ec0b 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_dir.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_dir.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/tbl_opt_data_dir.result 2017-05-24 00:21:15.550159778 +0300 -+++ ../storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_dir.reject 2017-05-24 00:25:45.506164827 +0300 +--- suite/storage_engine/tbl_opt_data_dir.result ++++ ../storage/myisammrg/mysql-test/storage_engine/tbl_opt_data_dir.reject @@ -5,7 +5,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_delay_key_write.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_delay_key_write.rdiff index 2c2e40fa4b7..95e0ee1015d 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_delay_key_write.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_delay_key_write.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_delay_key_write.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_delay_key_write.reject 2013-01-23 02:51:00.591490716 +0400 +--- tbl_opt_delay_key_write.result ++++ tbl_opt_delay_key_write.reject @@ -5,12 +5,12 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_index_dir.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_index_dir.rdiff index ca025861f68..bd078ef7350 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_index_dir.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_index_dir.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/tbl_opt_index_dir.result 2017-05-24 00:21:15.550159778 +0300 -+++ ../storage/myisammrg/mysql-test/storage_engine/tbl_opt_index_dir.reject 2017-05-24 00:25:45.506164827 +0300 +--- suite/storage_engine/tbl_opt_index_dir.result ++++ ../storage/myisammrg/mysql-test/storage_engine/tbl_opt_index_dir.reject @@ -5,7 +5,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_insert_method.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_insert_method.rdiff index f5dc536c7ee..2de1e5d1ad4 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_insert_method.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_insert_method.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_insert_method.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_insert_method.reject 2013-01-23 02:51:01.211482922 +0400 +--- tbl_opt_insert_method.result ++++ tbl_opt_insert_method.reject @@ -5,12 +5,12 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_key_block_size.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_key_block_size.rdiff index be90252f0b9..09370d12146 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_key_block_size.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_key_block_size.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_key_block_size.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_key_block_size.reject 2013-01-23 02:51:01.787475681 +0400 +--- tbl_opt_key_block_size.result ++++ tbl_opt_key_block_size.reject @@ -5,12 +5,12 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_max_rows.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_max_rows.rdiff index 3eebf8cce9b..ae71f158a57 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_max_rows.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_max_rows.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_max_rows.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_max_rows.reject 2013-01-23 02:51:02.403467936 +0400 +--- tbl_opt_max_rows.result ++++ tbl_opt_max_rows.reject @@ -5,12 +5,12 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_min_rows.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_min_rows.rdiff index 48c7124ca36..805a6f7d4d1 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_min_rows.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_min_rows.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_min_rows.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_min_rows.reject 2013-01-23 02:51:02.983460644 +0400 +--- tbl_opt_min_rows.result ++++ tbl_opt_min_rows.reject @@ -5,12 +5,12 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_pack_keys.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_pack_keys.rdiff index ab16cbcb0dc..9318c4875f3 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_pack_keys.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_pack_keys.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_pack_keys.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_pack_keys.reject 2013-01-23 02:51:03.563453353 +0400 +--- tbl_opt_pack_keys.result ++++ tbl_opt_pack_keys.reject @@ -5,12 +5,12 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_password.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_password.rdiff index dc8303682db..6ba898f2cd6 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_password.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_password.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_password.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_password.reject 2013-01-23 02:51:04.155445910 +0400 +--- tbl_opt_password.result ++++ tbl_opt_password.reject @@ -5,12 +5,12 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.rdiff index 6c756e7b8e1..1d5e5e43796 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.rdiff @@ -1,5 +1,5 @@ ---- ../storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.result~ 2017-05-24 00:50:44.254192857 +0300 -+++ ../storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.reject 2017-05-24 00:50:44.334192859 +0300 +--- ../storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.result~ ++++ ../storage/myisammrg/mysql-test/storage_engine/tbl_opt_row_format.reject @@ -5,26 +5,26 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_union.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_union.rdiff index e4e098a1b94..0a286b2863d 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_opt_union.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_opt_union.rdiff @@ -1,5 +1,5 @@ ---- tbl_opt_union.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_opt_union.reject 2013-01-23 02:51:05.375430573 +0400 +--- tbl_opt_union.result ++++ tbl_opt_union.reject @@ -4,11 +4,11 @@ Table Create Table t1 CREATE TABLE `t1` ( diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_standard_opts.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_standard_opts.rdiff index a929b6df54b..3b238fc815c 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_standard_opts.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_standard_opts.rdiff @@ -1,5 +1,5 @@ ---- tbl_standard_opts.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_standard_opts.reject 2013-01-23 02:51:05.991422829 +0400 +--- tbl_standard_opts.result ++++ tbl_standard_opts.reject @@ -8,14 +8,14 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/tbl_temporary.rdiff b/storage/myisammrg/mysql-test/storage_engine/tbl_temporary.rdiff index d2c7d4f2836..0b1882587e6 100644 --- a/storage/myisammrg/mysql-test/storage_engine/tbl_temporary.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/tbl_temporary.rdiff @@ -1,5 +1,5 @@ ---- tbl_temporary.result 2013-01-22 22:05:05.246633000 +0400 -+++ tbl_temporary.reject 2013-01-23 02:51:06.599415185 +0400 +--- tbl_temporary.result ++++ tbl_temporary.reject @@ -6,6 +6,6 @@ t1 CREATE TEMPORARY TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff b/storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff index e429bbdb177..0823239ecbe 100644 --- a/storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/truncate_table.rdiff @@ -1,5 +1,5 @@ ---- truncate_table.result 2013-01-22 22:05:05.246633000 +0400 -+++ truncate_table.reject 2013-01-23 02:51:07.507403770 +0400 +--- truncate_table.result ++++ truncate_table.reject @@ -9,19 +9,19 @@ CREATE TABLE t1 (a KEY AUTO_INCREMENT, c ) ENGINE= ; SHOW TABLE STATUS LIKE 't1'; diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff index 94cfa74f384..45da1550e33 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_repeatable_read.rdiff @@ -1,5 +1,5 @@ ---- cons_snapshot_repeatable_read.result 2013-01-22 22:05:05.246633000 +0400 -+++ cons_snapshot_repeatable_read.reject 2013-01-23 03:22:34.255684132 +0400 +--- cons_snapshot_repeatable_read.result ++++ cons_snapshot_repeatable_read.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support transactions. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff index a9b9ba7f94b..df602ce2970 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/cons_snapshot_serializable.rdiff @@ -1,5 +1,5 @@ ---- cons_snapshot_serializable.result 2013-01-22 22:05:05.246633000 +0400 -+++ cons_snapshot_serializable.reject 2013-01-23 03:22:34.847676690 +0400 +--- cons_snapshot_serializable.result ++++ cons_snapshot_serializable.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support transactions. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/delete.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/delete.rdiff index e4249478c76..8f7801f7b98 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/delete.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/delete.rdiff @@ -1,5 +1,5 @@ ---- delete.result 2013-01-22 22:05:05.246633000 +0400 -+++ delete.reject 2013-01-23 03:22:35.419669500 +0400 +--- delete.result ++++ delete.reject @@ -1,3 +1,15 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support transactions. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/insert.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/insert.rdiff index d5e99b6d7dc..59c7c73e189 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/insert.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/insert.rdiff @@ -1,5 +1,5 @@ ---- insert.result 2013-01-22 22:05:05.246633000 +0400 -+++ insert.reject 2013-01-23 03:22:35.987662359 +0400 +--- insert.result ++++ insert.reject @@ -1,3 +1,15 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support transactions. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/level_read_committed.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/level_read_committed.rdiff index 9e7c340c524..a0f9a74ece7 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/level_read_committed.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/level_read_committed.rdiff @@ -1,5 +1,5 @@ ---- level_read_committed.result 2013-01-22 22:05:05.246633000 +0400 -+++ level_read_committed.reject 2013-01-23 03:22:36.603654615 +0400 +--- level_read_committed.result ++++ level_read_committed.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support transactions. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff index d44e4aa7a12..d2d6b261eef 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/level_read_uncommitted.rdiff @@ -1,5 +1,5 @@ ---- level_read_uncommitted.result 2013-01-22 22:05:05.246633000 +0400 -+++ level_read_uncommitted.reject 2013-01-23 03:22:37.263646318 +0400 +--- level_read_uncommitted.result ++++ level_read_uncommitted.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support transactions. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/level_repeatable_read.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/level_repeatable_read.rdiff index b24376a9c28..e049c56f67c 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/level_repeatable_read.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/level_repeatable_read.rdiff @@ -1,5 +1,5 @@ ---- level_repeatable_read.result 2013-01-22 22:05:05.246633000 +0400 -+++ level_repeatable_read.reject 2013-01-23 03:22:37.867638724 +0400 +--- level_repeatable_read.result ++++ level_repeatable_read.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support transactions. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/level_serializable.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/level_serializable.rdiff index 3567e718459..56953a3bf6d 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/level_serializable.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/level_serializable.rdiff @@ -1,5 +1,5 @@ ---- level_serializable.result 2013-01-22 22:05:05.246633000 +0400 -+++ level_serializable.reject 2013-01-23 03:22:38.471631132 +0400 +--- level_serializable.result ++++ level_serializable.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support transactions. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/select_for_update.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/select_for_update.rdiff index bad014d87ed..a29686bc851 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/select_for_update.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/select_for_update.rdiff @@ -1,5 +1,5 @@ ---- select_for_update.result 2013-01-22 22:05:05.246633000 +0400 -+++ select_for_update.reject 2013-01-23 03:22:39.123622935 +0400 +--- select_for_update.result ++++ select_for_update.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support transactions. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff index db3eec1bc24..2db37c985a4 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/select_lock_in_share_mode.rdiff @@ -1,5 +1,5 @@ ---- select_lock_in_share_mode.result 2013-01-22 22:05:05.246633000 +0400 -+++ select_lock_in_share_mode.reject 2013-01-23 03:22:39.739615191 +0400 +--- select_lock_in_share_mode.result ++++ select_lock_in_share_mode.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support transactions. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/update.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/update.rdiff index baac054766b..b0a589c8fd1 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/update.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/update.rdiff @@ -1,5 +1,5 @@ ---- update.result 2013-01-22 22:05:05.246633000 +0400 -+++ update.reject 2013-01-23 03:22:40.355607446 +0400 +--- update.result ++++ update.reject @@ -1,3 +1,15 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support transactions. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/xa.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/xa.rdiff index a491287337d..1f6e2b9e24f 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/xa.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/xa.rdiff @@ -1,5 +1,5 @@ ---- xa.result 2013-01-22 22:05:05.246633000 +0400 -+++ xa.reject 2013-01-23 03:22:41.047598747 +0400 +--- xa.result ++++ xa.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support XA. diff --git a/storage/myisammrg/mysql-test/storage_engine/trx/xa_recovery.rdiff b/storage/myisammrg/mysql-test/storage_engine/trx/xa_recovery.rdiff index fa920abefc8..51964b6c32b 100644 --- a/storage/myisammrg/mysql-test/storage_engine/trx/xa_recovery.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/trx/xa_recovery.rdiff @@ -1,5 +1,5 @@ ---- xa_recovery.result 2013-01-22 22:05:05.246633000 +0400 -+++ xa_recovery.reject 2013-01-23 03:22:43.247571090 +0400 +--- xa_recovery.result ++++ xa_recovery.reject @@ -1,3 +1,9 @@ +# -- WARNING ---------------------------------------------------------------- +# According to I_S.ENGINES, MRG_MYISAM does not support XA. diff --git a/storage/myisammrg/mysql-test/storage_engine/type_char_indexes.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_char_indexes.rdiff index 797907fa71a..da11d4120a1 100644 --- a/storage/myisammrg/mysql-test/storage_engine/type_char_indexes.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/type_char_indexes.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/type_char_indexes.result 2014-10-12 14:22:11.000000000 +0400 -+++ suite/storage_engine/type_char_indexes.reject 2014-10-12 14:22:41.000000000 +0400 +--- suite/storage_engine/type_char_indexes.result ++++ suite/storage_engine/type_char_indexes.reject @@ -100,7 +100,7 @@ Warning 1681 'engine_condition_pushdown=on' is deprecated and will be removed in a future release. EXPLAIN SELECT c,c20,v16,v128 FROM t1 WHERE c > 'a'; diff --git a/storage/myisammrg/mysql-test/storage_engine/type_float_indexes.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_float_indexes.rdiff index eb4da4db951..053136f7b9f 100644 --- a/storage/myisammrg/mysql-test/storage_engine/type_float_indexes.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/type_float_indexes.rdiff @@ -1,5 +1,5 @@ ---- type_float_indexes.result 2013-01-22 22:05:05.246633000 +0400 -+++ type_float_indexes.reject 2013-01-23 02:51:13.059333973 +0400 +--- type_float_indexes.result ++++ type_float_indexes.reject @@ -60,7 +60,7 @@ ALTER TABLE t1 ADD UNIQUE KEY(d); EXPLAIN SELECT d FROM t1 WHERE r > 0 and d > 0 ORDER BY d; diff --git a/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff index 6f337ffb638..99bc91cc3b8 100644 --- a/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/type_spatial.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/type_spatial.result 2013-08-05 17:52:53.000000000 +0400 -+++ suite/storage_engine/type_spatial.reject 2013-08-05 17:56:37.000000000 +0400 +--- suite/storage_engine/type_spatial.result ++++ suite/storage_engine/type_spatial.reject @@ -2,699 +2,15 @@ DROP DATABASE IF EXISTS gis_ogs; CREATE DATABASE gis_ogs; diff --git a/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff b/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff index 04c56979244..3d5ae37b840 100644 --- a/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/type_spatial_indexes.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/type_spatial_indexes.result 2013-08-05 18:08:49.000000000 +0400 -+++ suite/storage_engine/type_spatial_indexes.reject 2013-08-05 18:27:47.000000000 +0400 +--- suite/storage_engine/type_spatial_indexes.result ++++ suite/storage_engine/type_spatial_indexes.reject @@ -2,1399 +2,31 @@ DROP DATABASE IF EXISTS gis_ogs; CREATE DATABASE gis_ogs; diff --git a/storage/myisammrg/mysql-test/storage_engine/vcol.rdiff b/storage/myisammrg/mysql-test/storage_engine/vcol.rdiff index 6c4971c63be..cc1218f43e3 100644 --- a/storage/myisammrg/mysql-test/storage_engine/vcol.rdiff +++ b/storage/myisammrg/mysql-test/storage_engine/vcol.rdiff @@ -1,5 +1,5 @@ ---- vcol.result 2013-01-22 22:05:05.246633000 +0400 -+++ vcol.reject 2013-01-23 02:51:26.851160587 +0400 +--- vcol.result ++++ vcol.reject @@ -1,69 +1,12 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a , b GENERATED ALWAYS AS (a+1)) ENGINE= ; diff --git a/storage/rocksdb/mysql-test/storage_engine/cache_index.rdiff b/storage/rocksdb/mysql-test/storage_engine/cache_index.rdiff index 76e7705e377..1151a95d1f8 100644 --- a/storage/rocksdb/mysql-test/storage_engine/cache_index.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/cache_index.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/cache_index.result 2017-06-22 00:33:46.419995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/cache_index.reject 2017-06-22 01:11:22.479981459 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/cache_index.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/cache_index.reject @@ -12,31 +12,31 @@ SET GLOBAL .key_buffer_size=128*1024; CACHE INDEX t1 INDEX (a), t2 IN ; diff --git a/storage/rocksdb/mysql-test/storage_engine/checksum_table_live.rdiff b/storage/rocksdb/mysql-test/storage_engine/checksum_table_live.rdiff index 094136ee926..d0b35c939bd 100644 --- a/storage/rocksdb/mysql-test/storage_engine/checksum_table_live.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/checksum_table_live.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/checksum_table_live.result 2017-06-22 00:33:46.419995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/checksum_table_live.reject 2017-06-22 01:12:38.695980980 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/checksum_table_live.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/checksum_table_live.reject @@ -11,8 +11,8 @@ test.t1 4272806499 CHECKSUM TABLE t1, t2 QUICK; diff --git a/storage/rocksdb/mysql-test/storage_engine/index.rdiff b/storage/rocksdb/mysql-test/storage_engine/index.rdiff index 76d6c6dd8e4..d8cd56e9d70 100644 --- a/storage/rocksdb/mysql-test/storage_engine/index.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/index.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/index.result 2017-03-12 04:57:07.169911845 +0200 -+++ suite/storage_engine/index.reject 2017-08-14 22:41:06.548555663 +0300 +--- suite/storage_engine/index.result ++++ suite/storage_engine/index.reject @@ -4,7 +4,7 @@ ) ENGINE= ; SHOW KEYS IN t1; diff --git a/storage/rocksdb/mysql-test/storage_engine/index_type_btree.rdiff b/storage/rocksdb/mysql-test/storage_engine/index_type_btree.rdiff index 5fcffbea13b..08cb76dbb7a 100644 --- a/storage/rocksdb/mysql-test/storage_engine/index_type_btree.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/index_type_btree.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/index_type_btree.result 2017-03-12 04:57:07.169911845 +0200 -+++ suite/storage_engine/index_type_btree.reject 2017-08-14 22:50:47.264555216 +0300 +--- suite/storage_engine/index_type_btree.result ++++ suite/storage_engine/index_type_btree.reject @@ -4,7 +4,7 @@ ) ENGINE= ; SHOW KEYS IN t1; diff --git a/storage/rocksdb/mysql-test/storage_engine/index_type_hash.rdiff b/storage/rocksdb/mysql-test/storage_engine/index_type_hash.rdiff index 815b2983b87..709c8e42632 100644 --- a/storage/rocksdb/mysql-test/storage_engine/index_type_hash.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/index_type_hash.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/index_type_hash.result 2017-03-12 04:57:07.169911845 +0200 -+++ suite/storage_engine/index_type_hash.reject 2017-08-14 22:51:55.644555163 +0300 +--- suite/storage_engine/index_type_hash.result ++++ suite/storage_engine/index_type_hash.reject @@ -4,7 +4,7 @@ ) ENGINE= ; SHOW KEYS IN t1; diff --git a/storage/rocksdb/mysql-test/storage_engine/misc.rdiff b/storage/rocksdb/mysql-test/storage_engine/misc.rdiff index cdbad003217..0d2f085074f 100644 --- a/storage/rocksdb/mysql-test/storage_engine/misc.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/misc.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/misc.result 2018-02-23 03:01:49.673249912 +0200 -+++ suite/storage_engine/misc.reject 2018-02-23 03:02:05.669249564 +0200 +--- suite/storage_engine/misc.result ++++ suite/storage_engine/misc.reject @@ -28,6 +28,10 @@ SELECT TABLE_NAME, COLUMN_NAME, REFERENCED_TABLE_NAME, REFERENCED_COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE ORDER BY TABLE_NAME; diff --git a/storage/rocksdb/mysql-test/storage_engine/parts/checksum_table.rdiff b/storage/rocksdb/mysql-test/storage_engine/parts/checksum_table.rdiff index bf3347a4341..62b4c77306a 100644 --- a/storage/rocksdb/mysql-test/storage_engine/parts/checksum_table.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/parts/checksum_table.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/parts/checksum_table.result 2017-06-22 00:33:46.419995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/parts/checksum_table.reject 2017-06-22 19:25:02.935568998 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/parts/checksum_table.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/parts/checksum_table.reject @@ -31,8 +31,8 @@ test.t1 4272806499 CHECKSUM TABLE t1, t2 QUICK; diff --git a/storage/rocksdb/mysql-test/storage_engine/parts/create_table.rdiff b/storage/rocksdb/mysql-test/storage_engine/parts/create_table.rdiff index b2cb47a0927..9c46bece70e 100644 --- a/storage/rocksdb/mysql-test/storage_engine/parts/create_table.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/parts/create_table.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/parts/create_table.result 2017-06-22 00:33:46.419995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/parts/create_table.reject 2017-06-22 19:25:05.335568983 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/parts/create_table.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/parts/create_table.reject @@ -65,7 +65,7 @@ 1 SIMPLE t1 abc,def # # # # # # # EXPLAIN PARTITIONS SELECT a FROM t1 WHERE a = 100; diff --git a/storage/rocksdb/mysql-test/storage_engine/show_engine.rdiff b/storage/rocksdb/mysql-test/storage_engine/show_engine.rdiff index 15a9bb6f171..869be38fa6e 100644 --- a/storage/rocksdb/mysql-test/storage_engine/show_engine.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/show_engine.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/show_engine.result 2017-03-12 04:57:07.169911845 +0200 -+++ suite/storage_engine/show_engine.reject 2017-08-14 22:58:15.508554871 +0300 +--- suite/storage_engine/show_engine.result ++++ suite/storage_engine/show_engine.reject @@ -4,7 +4,11 @@ # volatile data (timestamps, memory info, etc.) SHOW ENGINE STATUS; diff --git a/storage/rocksdb/mysql-test/storage_engine/show_table_status.rdiff b/storage/rocksdb/mysql-test/storage_engine/show_table_status.rdiff index d7252eb54ed..7f78b3bfda2 100644 --- a/storage/rocksdb/mysql-test/storage_engine/show_table_status.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/show_table_status.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/show_table_status.result 2017-06-22 00:33:46.423995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/show_table_status.reject 2017-06-22 14:04:10.723690009 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/show_table_status.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/show_table_status.reject @@ -19,7 +19,7 @@ Create_time ### Update_time ### diff --git a/storage/rocksdb/mysql-test/storage_engine/tbl_opt_insert_method.rdiff b/storage/rocksdb/mysql-test/storage_engine/tbl_opt_insert_method.rdiff index 20f594fbb40..f2a5c24857b 100644 --- a/storage/rocksdb/mysql-test/storage_engine/tbl_opt_insert_method.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/tbl_opt_insert_method.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_opt_insert_method.result 2017-06-22 00:33:46.423995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_opt_insert_method.reject 2017-06-22 02:39:45.243948128 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_opt_insert_method.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_opt_insert_method.reject @@ -5,7 +5,7 @@ t1 CREATE TABLE `t1` ( `a` int(11) DEFAULT NULL, diff --git a/storage/rocksdb/mysql-test/storage_engine/tbl_opt_union.rdiff b/storage/rocksdb/mysql-test/storage_engine/tbl_opt_union.rdiff index 0d65ad0744a..04ff062fa41 100644 --- a/storage/rocksdb/mysql-test/storage_engine/tbl_opt_union.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/tbl_opt_union.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_opt_union.result 2017-06-22 00:33:46.423995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_opt_union.reject 2017-06-22 02:41:02.719947641 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_opt_union.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_opt_union.reject @@ -4,11 +4,11 @@ Table Create Table t1 CREATE TABLE `t1` ( diff --git a/storage/rocksdb/mysql-test/storage_engine/tbl_temporary.rdiff b/storage/rocksdb/mysql-test/storage_engine/tbl_temporary.rdiff index d24806e7c9f..34a2161a891 100644 --- a/storage/rocksdb/mysql-test/storage_engine/tbl_temporary.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/tbl_temporary.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_temporary.result 2017-06-22 00:33:46.423995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_temporary.reject 2017-06-22 15:27:50.643658456 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_temporary.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/tbl_temporary.reject @@ -1,11 +1,14 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (c CHAR(1)) ENGINE=MyISAM; diff --git a/storage/rocksdb/mysql-test/storage_engine/truncate_table.rdiff b/storage/rocksdb/mysql-test/storage_engine/truncate_table.rdiff index 9ca7861d51e..1ebdeb1d30b 100644 --- a/storage/rocksdb/mysql-test/storage_engine/truncate_table.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/truncate_table.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/truncate_table.result 2017-06-22 00:33:46.423995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/truncate_table.reject 2017-06-22 02:43:27.183946733 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/truncate_table.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/truncate_table.reject @@ -29,13 +29,12 @@ CREATE TABLE t1 (a , b ) ENGINE= ; INSERT INTO t1 (a,b) VALUES (1,'a'),(2,'b'),(3,'c'); diff --git a/storage/rocksdb/mysql-test/storage_engine/trx/delete.rdiff b/storage/rocksdb/mysql-test/storage_engine/trx/delete.rdiff index dac23b83579..7e9f7fd8ce8 100644 --- a/storage/rocksdb/mysql-test/storage_engine/trx/delete.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/trx/delete.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/delete.result 2017-06-22 00:33:46.423995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/delete.reject 2017-06-22 19:29:36.827567276 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/delete.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/delete.reject @@ -68,5 +68,7 @@ DELETE FROM t1; INSERT INTO t1 (a,b) VALUES (1,'a'); diff --git a/storage/rocksdb/mysql-test/storage_engine/trx/insert.rdiff b/storage/rocksdb/mysql-test/storage_engine/trx/insert.rdiff index 36a71076a2b..532bb1f4c7b 100644 --- a/storage/rocksdb/mysql-test/storage_engine/trx/insert.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/trx/insert.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/insert.result 2017-06-22 00:33:46.423995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/insert.reject 2017-06-22 19:29:39.131567262 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/insert.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/insert.reject @@ -37,18 +37,18 @@ INSERT INTO t1 SET a = 11, b = 'f'; INSERT t1 SET b = DEFAULT; diff --git a/storage/rocksdb/mysql-test/storage_engine/trx/level_read_committed.rdiff b/storage/rocksdb/mysql-test/storage_engine/trx/level_read_committed.rdiff index 6b9e4a3f4e9..c847dcaae70 100644 --- a/storage/rocksdb/mysql-test/storage_engine/trx/level_read_committed.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/trx/level_read_committed.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/level_read_committed.result 2017-06-22 00:33:46.423995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/level_read_committed.reject 2017-06-22 19:29:41.459567247 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/level_read_committed.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/level_read_committed.reject @@ -77,6 +77,7 @@ CREATE TABLE t1 (a ) ENGINE= ; SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED; diff --git a/storage/rocksdb/mysql-test/storage_engine/trx/level_repeatable_read.rdiff b/storage/rocksdb/mysql-test/storage_engine/trx/level_repeatable_read.rdiff index cf770755243..e5e300d7d87 100644 --- a/storage/rocksdb/mysql-test/storage_engine/trx/level_repeatable_read.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/trx/level_repeatable_read.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/level_repeatable_read.result 2017-06-22 00:33:46.423995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/level_repeatable_read.reject 2017-06-22 20:33:13.935543284 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/level_repeatable_read.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/level_repeatable_read.reject @@ -24,8 +24,7 @@ SELECT a FROM t1; a diff --git a/storage/rocksdb/mysql-test/storage_engine/trx/update.rdiff b/storage/rocksdb/mysql-test/storage_engine/trx/update.rdiff index ab181947733..1430782b491 100644 --- a/storage/rocksdb/mysql-test/storage_engine/trx/update.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/trx/update.rdiff @@ -1,5 +1,5 @@ ---- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/update.result 2017-06-22 00:33:46.423995639 +0300 -+++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/update.reject 2017-06-22 19:29:57.267567148 +0300 +--- /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/update.result ++++ /data/src/bb-10.2-mdev12528/mysql-test/suite/storage_engine/trx/update.reject @@ -29,20 +29,23 @@ SAVEPOINT spt1; UPDATE t1 SET b = ''; diff --git a/storage/rocksdb/mysql-test/storage_engine/type_binary_indexes.rdiff b/storage/rocksdb/mysql-test/storage_engine/type_binary_indexes.rdiff index 5eec9d24250..55c269374bb 100644 --- a/storage/rocksdb/mysql-test/storage_engine/type_binary_indexes.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/type_binary_indexes.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/type_binary_indexes.result 2017-03-12 04:57:07.173911845 +0200 -+++ suite/storage_engine/type_binary_indexes.reject 2017-08-14 22:54:02.144555066 +0300 +--- suite/storage_engine/type_binary_indexes.result ++++ suite/storage_engine/type_binary_indexes.reject @@ -91,7 +91,7 @@ INSERT INTO t1 (b,b20,v16,v128) SELECT b,b20,v16,v128 FROM t1; EXPLAIN SELECT HEX(SUBSTRING(v16,0,3)) FROM t1 WHERE v16 LIKE 'varchar%'; diff --git a/storage/rocksdb/mysql-test/storage_engine/type_bit_indexes.rdiff b/storage/rocksdb/mysql-test/storage_engine/type_bit_indexes.rdiff index e53a33b4fba..5825ca2731c 100644 --- a/storage/rocksdb/mysql-test/storage_engine/type_bit_indexes.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/type_bit_indexes.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/type_bit_indexes.result 2017-12-12 20:34:34.000000000 +0200 -+++ suite/storage_engine/type_bit_indexes.reject 2017-12-12 20:35:24.539330056 +0200 +--- suite/storage_engine/type_bit_indexes.result ++++ suite/storage_engine/type_bit_indexes.reject @@ -69,7 +69,7 @@ (1,0xFFFF,0xFFFFFFFF,0xFFFFFFFFFFFFFFFF); EXPLAIN SELECT HEX(b+c) FROM t1 WHERE c > 1 OR HEX(b) < 0xFFFFFF; diff --git a/storage/rocksdb/mysql-test/storage_engine/type_enum_indexes.rdiff b/storage/rocksdb/mysql-test/storage_engine/type_enum_indexes.rdiff index be83fb6e212..bd6290ae112 100644 --- a/storage/rocksdb/mysql-test/storage_engine/type_enum_indexes.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/type_enum_indexes.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/type_enum_indexes.result 2017-03-12 04:38:50.000000000 +0200 -+++ suite/storage_engine/type_enum_indexes.reject 2017-12-12 20:36:47.455331726 +0200 +--- suite/storage_engine/type_enum_indexes.result ++++ suite/storage_engine/type_enum_indexes.reject @@ -30,7 +30,7 @@ t1 0 a_b 2 b # # NULL NULL # # EXPLAIN SELECT a FROM t1 WHERE b > 'test2' ORDER BY a; diff --git a/storage/rocksdb/mysql-test/storage_engine/type_set_indexes.rdiff b/storage/rocksdb/mysql-test/storage_engine/type_set_indexes.rdiff index 2703e81b745..1608f617c75 100644 --- a/storage/rocksdb/mysql-test/storage_engine/type_set_indexes.rdiff +++ b/storage/rocksdb/mysql-test/storage_engine/type_set_indexes.rdiff @@ -1,5 +1,5 @@ ---- suite/storage_engine/type_set_indexes.result 2017-03-12 04:38:50.000000000 +0200 -+++ suite/storage_engine/type_set_indexes.reject 2017-12-12 20:37:16.187332305 +0200 +--- suite/storage_engine/type_set_indexes.result ++++ suite/storage_engine/type_set_indexes.reject @@ -97,7 +97,7 @@ Warning 1265 Data truncated for column 'b' at row 7 EXPLAIN SELECT a FROM t1 WHERE FIND_IN_SET('Europe',a) > 0; From 2085f36c6c547fc8333a9bdf44b51d4070b69f19 Mon Sep 17 00:00:00 2001 From: Monty Date: Fri, 27 Dec 2024 17:31:42 +0200 Subject: [PATCH 65/84] Removed not used and not visible send_metdata_skip variable. Reviewed-by: Sergei Golubchik --- sql/sql_class.h | 1 - 1 file changed, 1 deletion(-) diff --git a/sql/sql_class.h b/sql/sql_class.h index 8e3bb7c7467..326f0dc150d 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -1037,7 +1037,6 @@ typedef struct system_status_var ulonglong table_open_cache_hits; ulonglong table_open_cache_misses; ulonglong table_open_cache_overflows; - ulonglong send_metadata_skips; double last_query_cost; double cpu_time, busy_time; uint32 threads_running; From 130d6f9c4bfaa63b2156eef7fe5ca0ffa27554af Mon Sep 17 00:00:00 2001 From: Monty Date: Sat, 28 Dec 2024 11:06:04 +0200 Subject: [PATCH 66/84] Fixed memory leak in get_window_functions_required_cursors() Found by buildbot with test main.gis --- sql/sql_window.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sql/sql_window.cc b/sql/sql_window.cc index 816d49a1a65..7beba09387f 100644 --- a/sql/sql_window.cc +++ b/sql/sql_window.cc @@ -2726,7 +2726,10 @@ bool get_window_functions_required_cursors( item_win_func->requires_special_cursors()) { if (add_special_frame_cursors(thd, cursor_manager, item_win_func)) + { + delete cursor_manager; return true; + } cursor_managers->push_back(cursor_manager); continue; } From a2d37705ca5a79149b1b064fe3a0be0bbf7eaf73 Mon Sep 17 00:00:00 2001 From: Monty Date: Thu, 2 Jan 2025 15:15:22 +0200 Subject: [PATCH 67/84] Only print "InnoDB: Transaction was aborted..." if log_warnings >= 4 This is a minor fixup for MDEV-24035 Failing assertion UT_LIST_GET_LEN(lock.trx_locks) == 0 causing disruption and replication failure --- include/mysql/service_log_warnings.h | 52 +++++++++++++++++++++++++++ sql/sql_class.cc | 14 ++++++++ storage/innobase/handler/ha_innodb.cc | 6 ++-- 3 files changed, 70 insertions(+), 2 deletions(-) create mode 100644 include/mysql/service_log_warnings.h diff --git a/include/mysql/service_log_warnings.h b/include/mysql/service_log_warnings.h new file mode 100644 index 00000000000..f55df70ef8e --- /dev/null +++ b/include/mysql/service_log_warnings.h @@ -0,0 +1,52 @@ +/* Copyright (c) 2013, 2018, 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 */ + +#ifndef MYSQL_SERVICE_LOG_WARNINGS +#define MYSQL_SERVICE_LOG_WARNINGS + +/** + @file + This service provides access to the log warning level for the + current session. + + thd_log_warnings(thd) + @return thd->log_warnings +*/ + +#ifdef __cplusplus +extern "C" { +#endif + +extern struct thd_log_warnings_service_st { + void *(*thd_log_warnings)(MYSQL_THD); +} *thd_log_warnings_service; + +#ifdef MYSQL_DYNAMIC_PLUGIN +# define thd_log_warnings(THD) thd_log_warnings_service->thd_log_warnings(THD) +#else +/** + MDL_context accessor + @param thd the current session + @return pointer to thd->mdl_context +*/ +int thd_log_warnings(MYSQL_THD thd); +#endif + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 059d6c03d3a..f500b740892 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -5805,6 +5805,20 @@ extern "C" void *thd_mdl_context(MYSQL_THD thd) return &thd->mdl_context; } + +/** + log_warnings accessor + @param thd the current session + + @return log warning level +*/ + +extern "C" int thd_log_warnings(const MYSQL_THD thd) +{ + return thd->variables.log_warnings; +} + + /** Send check/repair message to the user diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index ee18adbf909..c520de7c297 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -48,6 +48,7 @@ this program; if not, write to the Free Software Foundation, Inc., #include #include #include +#include #include "sql_type_geom.h" #include "scope.h" #include "srv0srv.h" @@ -2154,8 +2155,9 @@ static void innodb_transaction_abort(THD *thd, bool all, dberr_t err) noexcept { ut_ad(trx->state == TRX_STATE_NOT_STARTED); trx->state= TRX_STATE_ABORTED; - sql_print_error("InnoDB: Transaction was aborted due to %s", - ut_strerr(err)); + if (thd_log_warnings(thd) >= 4) + sql_print_error("InnoDB: Transaction was aborted due to %s", + ut_strerr(err)); } thd_mark_transaction_to_rollback(thd, all); } From 6abbfdef7aeea5b12e64f41f9e788b3e2b8c2d4a Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 2 May 2024 22:14:19 +0200 Subject: [PATCH 68/84] sporadic failures of binlog_encryption.rpl_parallel_gco_wait_kill CURRENT_TEST: binlog_encryption.rpl_parallel_gco_wait_kill mysqltest: In included file "./suite/rpl/t/rpl_parallel_gco_wait_kill.test": included from /home/buildbot/amd64-ubuntu-2004-debug/build/mysql-test/suite/binlog_encryption/rpl_parallel_gco_wait_kill.test at line 2: At line 334: Can't initialize replace from 'replace_result $thd_id THD_ID' An sql thread can reach the "Slave has read all relay log" state and then start reading relay log again. Let's use a more generic pattern to retrieve the sql thread ID even if it's not in the "read all relay log" state. --- mysql-test/suite/rpl/t/rpl_parallel_gco_wait_kill.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/suite/rpl/t/rpl_parallel_gco_wait_kill.test b/mysql-test/suite/rpl/t/rpl_parallel_gco_wait_kill.test index c5d2b85cf34..c34c4f20dc0 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel_gco_wait_kill.test +++ b/mysql-test/suite/rpl/t/rpl_parallel_gco_wait_kill.test @@ -300,7 +300,7 @@ SET GLOBAL slave_parallel_threads=10; # Find the thread id of the driver SQL thread that we want to kill. --let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Slave has read all relay log%' --source include/wait_condition.inc ---let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%Slave has read all relay log%'` +--let $thd_id= `SELECT ID FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE '%relay log%'` SET @old_max_queued= @@GLOBAL.slave_parallel_max_queued; SET GLOBAL slave_parallel_max_queued=9000; From fd9a11d8a5b820f8d08b28fb2f198edc6f196342 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Mon, 6 Jan 2025 01:43:42 +0100 Subject: [PATCH 69/84] MDEV-35749: Add support for --use-memory option for SST with mariabackup Mariabackup (mariadb-backup) supports the --use-memory option that sets the buffer pool size for innodb. However, current SST scripts do not use this option. This commit adds support for this option, the value for which can be specified via the "use_memory" parameter in the configuration file in the [sst], [mariabackup] or [xtrabackup] sections (supported only for compatibility with old configurations). In addition, if the innodb_buffer_pool_size option is specified in the user configuration (in the main server configuration sections) or passed to the SST scripts or the server via arguments, its value is also passed to mariadb-backup as the value for the --use-memory option. A new section name [mariabackup] has also been added, which can be used instead of the deprecated [xtrabackup] (the section name "mariabackup" was specified in the documentation, but was not actually supported by SST scripts before this commit). --- .../galera_sst_mariabackup_use_memory.result | 13 +++++ .../t/galera_sst_mariabackup_use_memory.cnf | 8 +++ .../t/galera_sst_mariabackup_use_memory.test | 53 +++++++++++++++++++ scripts/wsrep_sst_common.sh | 24 +++++++-- scripts/wsrep_sst_mariabackup.sh | 40 +++++++++----- 5 files changed, 121 insertions(+), 17 deletions(-) create mode 100644 mysql-test/suite/galera/r/galera_sst_mariabackup_use_memory.result create mode 100644 mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.cnf create mode 100644 mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.test 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 new file mode 100644 index 00000000000..1d631198990 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_sst_mariabackup_use_memory.result @@ -0,0 +1,13 @@ +connection node_2; +connection node_1; +connection node_1; +connection node_2; +connection node_2; +Shutting down server ... +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\)] +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 new file mode 100644 index 00000000000..05a647eb090 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.cnf @@ -0,0 +1,8 @@ +!include ../galera_2nodes.cnf + +[mysqld] +wsrep_sst_method=mariabackup +wsrep_sst_auth="root:" + +[mariabackup] +use_memory=123m 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 new file mode 100644 index 00000000000..f6ba873976e --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_use_memory.test @@ -0,0 +1,53 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_mariabackup.inc + +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + +--connection node_2 + +--echo Shutting down server ... +--source include/shutdown_mysqld.inc + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size' +--source include/wait_condition.inc + +# +# Force SST +# +--echo Cleaning var directory ... +--remove_file $MYSQLTEST_VARDIR/mysqld.2/data/grastate.dat +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mtr +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/performance_schema +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/test +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data/mysql +--remove_files_wildcard $MYSQLTEST_VARDIR/mysqld.2/data + +--connection node_2 + +--echo Starting server ... +let $restart_noprint=2; +--source include/start_mysqld.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; +--source include/wait_condition.inc + +# 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_count = 1 +--let $assert_file = $MYSQLTEST_VARDIR/mysqld.2/data/mariabackup.prepare.log +--let $assert_only_after = Starting InnoDB instance for recovery +--source include/assert_grep.inc + +# Restore original auto_increment_offset values. +--source include/auto_increment_offset_restore.inc + +--source include/galera_end.inc diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index ff4befa6680..550165b0c3a 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -209,6 +209,7 @@ INNODB_DATA_HOME_DIR=$(trim_dir "${INNODB_DATA_HOME_DIR:-}") INNODB_LOG_GROUP_HOME=$(trim_dir "${INNODB_LOG_GROUP_HOME:-}") INNODB_UNDO_DIR=$(trim_dir "${INNODB_UNDO_DIR:-}") INNODB_BUFFER_POOL="" +INNODB_BUFFER_POOL_SIZE="" INNODB_FORCE_RECOVERY="" INNOEXTRA="" @@ -329,6 +330,10 @@ case "$1" in readonly INNODB_BUFFER_POOL=$(trim_string "$2") shift ;; + '--innodb-buffer-pool-size') + readonly INNODB_BUFFER_POOL_SIZE=$(trim_string "$2") + shift + ;; '--defaults-file') file=$(trim_string "$2") readonly WSREP_SST_OPT_DEFAULT="$1=$file" @@ -607,6 +612,12 @@ case "$1" in fi skip_mysqld_arg=1 ;; + '--innodb-buffer-pool-size') + if [ -z "$INNODB_BUFFER_POOL_SIZE" ]; then + MYSQLD_OPT_INNODB_BUFFER_POOL_SIZE=$(trim_string "$value") + fi + skip_mysqld_arg=1 + ;; '--innodb-force-recovery') if [ -n "$value" -a "$value" != "0" ]; then INNODB_FORCE_RECOVERY=$(trim_string "$value") @@ -696,6 +707,10 @@ if [ -n "${MYSQLD_OPT_INNODB_BUFFER_POOL:-}" -a \ -z "$INNODB_BUFFER_POOL" ]; then readonly INNODB_BUFFER_POOL="$MYSQLD_OPT_INNODB_BUFFER_POOL" fi +if [ -n "${MYSQLD_OPT_INNODB_BUFFER_POOL_SIZE:-}" -a \ + -z "$INNODB_BUFFER_POOL_SIZE" ]; then + readonly INNODB_BUFFER_POOL_SIZE="$MYSQLD_OPT_INNODB_BUFFER_POOL_SIZE" +fi if [ -n "${MYSQLD_OPT_LOG_BIN:-}" -a \ -z "$WSREP_SST_OPT_BINLOG" ]; then readonly WSREP_SST_OPT_BINLOG="$MYSQLD_OPT_LOG_BIN" @@ -752,6 +767,9 @@ fi if [ -n "$INNODB_BUFFER_POOL" ]; then INNOEXTRA="$INNOEXTRA --innodb-buffer-pool-filename='$INNODB_BUFFER_POOL'" fi +if [ -n "$INNODB_BUFFER_POOL_SIZE" ]; then + INNOEXTRA="$INNOEXTRA --innodb-buffer-pool-size='$INNODB_BUFFER_POOL_SIZE'" +fi if [ -n "$WSREP_SST_OPT_BINLOG" ]; then INNOEXTRA="$INNOEXTRA --log-bin='$WSREP_SST_OPT_BINLOG'" if [ -n "$WSREP_SST_OPT_BINLOG_INDEX" ]; then @@ -1775,14 +1793,14 @@ simple_cleanup() create_data() { OLD_PWD="$(pwd)" + DATA_DIR="$OLD_PWD" if [ -n "$DATA" -a "$DATA" != '.' ]; then [ ! -d "$DATA" ] && mkdir -p "$DATA" cd "$DATA" + DATA_DIR="$(pwd)" + cd "$OLD_PWD" fi - DATA_DIR="$(pwd)" - - cd "$OLD_PWD" } create_dirs() diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh index e50704b7cdc..3e13efb6c6d 100644 --- a/scripts/wsrep_sst_mariabackup.sh +++ b/scripts/wsrep_sst_mariabackup.sh @@ -540,7 +540,8 @@ adjust_progress() fi } -encgroups='--mysqld|sst|xtrabackup' +bkgroups='sst|xtrabackup|mariabackup' +encgroups="--mysqld|$bkgroups" read_cnf() { @@ -596,26 +597,34 @@ read_cnf() ssl_dhparams=$(parse_cnf "$encgroups" 'ssl-dhparams') fi - sockopt=$(parse_cnf sst sockopt "") - progress=$(parse_cnf sst progress "") + sockopt=$(parse_cnf sst sockopt) + progress=$(parse_cnf sst progress) ttime=$(parse_cnf sst time 0) cpat='.*\.pem$\|.*galera\.cache$\|.*sst_in_progress$\|.*\.sst$\|.*gvwstate\.dat$\|.*grastate\.dat$\|.*\.err$\|.*\.log$\|.*RPM_UPGRADE_MARKER$\|.*RPM_UPGRADE_HISTORY$' [ "$OS" = 'FreeBSD' ] && cpat=$(echo "$cpat" | sed 's/\\|/|/g') cpat=$(parse_cnf sst cpat "$cpat") - scomp=$(parse_cnf sst compressor "") - sdecomp=$(parse_cnf sst decompressor "") + scomp=$(parse_cnf sst compressor) + sdecomp=$(parse_cnf sst decompressor) - rlimit=$(parse_cnf sst rlimit "") + rlimit=$(parse_cnf sst rlimit) uextra=$(parse_cnf sst use-extra 0) - speciald=$(parse_cnf sst sst-special-dirs 1) - iopts=$(parse_cnf sst inno-backup-opts "") - iapts=$(parse_cnf sst inno-apply-opts "") - impts=$(parse_cnf sst inno-move-opts "") - stimeout=$(parse_cnf sst sst-initial-timeout 300) - ssyslog=$(parse_cnf sst sst-syslog 0) - ssystag=$(parse_cnf mysqld_safe syslog-tag "${SST_SYSLOG_TAG:-}") + speciald=$(parse_cnf sst 'sst-special-dirs' 1) + iopts=$(parse_cnf "$bkgroups" 'inno-backup-opts') + iapts=$(parse_cnf "$bkgroups" 'inno-apply-opts') + impts=$(parse_cnf "$bkgroups" 'inno-move-opts') + use_memory=$(parse_cnf "$bkgroups" 'use-memory') + if [ -z "$use_memory" ]; then + if [ -n "$INNODB_BUFFER_POOL_SIZE" ]; then + use_memory="$INNODB_BUFFER_POOL_SIZE" + else + use_memory=$(parse_cnf '--mysqld' 'innodb-buffer-pool-size') + fi + fi + stimeout=$(parse_cnf sst 'sst-initial-timeout' 300) + ssyslog=$(parse_cnf sst 'sst-syslog' 0) + ssystag=$(parse_cnf mysqld_safe 'syslog-tag' "${SST_SYSLOG_TAG:-}") ssystag="$ssystag-" - sstlogarchive=$(parse_cnf sst sst-log-archive 1) + sstlogarchive=$(parse_cnf sst 'sst-log-archive' 1) sstlogarchivedir="" if [ $sstlogarchive -ne 0 ]; then sstlogarchivedir=$(parse_cnf sst sst-log-archive-dir \ @@ -1053,6 +1062,9 @@ setup_commands() if [ -n "$INNODB_FORCE_RECOVERY" ]; then recovery=" --innodb-force-recovery=$INNODB_FORCE_RECOVERY" fi + if [ -n "$use_memory" ]; then + INNOEXTRA="$INNOEXTRA --use-memory=$use_memory" + fi INNOAPPLY="$BACKUP_BIN --prepare$disver$recovery${iapts:+ }$iapts$INNOEXTRA --target-dir='$DATA' --datadir='$DATA'$mysqld_args $INNOAPPLY" INNOMOVE="$BACKUP_BIN$WSREP_SST_OPT_CONF --move-back$disver${impts:+ }$impts$INNOEXTRA --galera-info --force-non-empty-directories --target-dir='$DATA' --datadir='${TDATA:-$DATA}' $INNOMOVE" INNOBACKUP="$BACKUP_BIN$WSREP_SST_OPT_CONF --backup$disver${iopts:+ }$iopts$tmpopts$INNOEXTRA --galera-info --stream=$sfmt --target-dir='$itmpdir' --datadir='$DATA'$mysqld_args $INNOBACKUP" From cc5d7389991616bd630f3e460f92cb81fcb0e416 Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 7 Jan 2025 12:12:24 +0200 Subject: [PATCH 70/84] Disable mmap usage in Aria and MyISAM when compiling with valgrind This removes a valgrind warning "cannot read program header" while it tries to search for memory leaks. --- storage/maria/ma_extra.c | 6 +++--- storage/myisam/mi_extra.c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/storage/maria/ma_extra.c b/storage/maria/ma_extra.c index 6be1edbc5ce..3b562c26613 100644 --- a/storage/maria/ma_extra.c +++ b/storage/maria/ma_extra.c @@ -74,7 +74,7 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function, } if (info->s->file_map) /* Don't use cache if mmap */ break; -#if defined(HAVE_MMAP) && defined(HAVE_MADVISE) +#if defined(HAVE_MMAP) && defined(HAVE_MADVISE) && !defined(HAVE_valgrind) if ((share->options & HA_OPTION_COMPRESS_RECORD)) { mysql_mutex_lock(&share->intern_lock); @@ -162,7 +162,7 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function, error= end_io_cache(&info->rec_cache); /* Sergei will insert full text index caching here */ } -#if defined(HAVE_MMAP) && defined(HAVE_MADVISE) +#if defined(HAVE_MMAP) && defined(HAVE_MADVISE) && !defined(HAVE_valgrind) if (info->opt_flag & MEMMAP_USED) madvise((char*) share->file_map, share->state.state.data_file_length, MADV_RANDOM); @@ -456,7 +456,7 @@ int maria_extra(MARIA_HA *info, enum ha_extra_function function, maria_extra_keyflag(info, function); break; case HA_EXTRA_MMAP: -#ifdef HAVE_MMAP +#if defined(HAVE_MMAP) && !defined(HAVE_valgrind) if (block_records) break; /* Not supported */ mysql_mutex_lock(&share->intern_lock); diff --git a/storage/myisam/mi_extra.c b/storage/myisam/mi_extra.c index 4ce138e888c..453e8869f1e 100644 --- a/storage/myisam/mi_extra.c +++ b/storage/myisam/mi_extra.c @@ -69,7 +69,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) } if (info->s->file_map) /* Don't use cache if mmap */ break; -#if defined(HAVE_MMAP) && defined(HAVE_MADVISE) +#if defined(HAVE_MMAP) && defined(HAVE_MADVISE) && !defined(HAVE_valgrind) if ((share->options & HA_OPTION_COMPRESS_RECORD)) { mysql_mutex_lock(&share->intern_lock); @@ -155,7 +155,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) error=end_io_cache(&info->rec_cache); /* Sergei will insert full text index caching here */ } -#if defined(HAVE_MMAP) && defined(HAVE_MADVISE) +#if defined(HAVE_MMAP) && defined(HAVE_MADVISE) && !defined(HAVE_valgrind) if (info->opt_flag & MEMMAP_USED) madvise((char*) share->file_map, share->state.state.data_file_length, MADV_RANDOM); @@ -320,7 +320,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg) mi_extra_keyflag(info, function); break; case HA_EXTRA_MMAP: -#ifdef HAVE_MMAP +#if defined(HAVE_MMAP) && !defined(HAVE_valgrind) mysql_mutex_lock(&share->intern_lock); /* Memory map the data file if it is not already mapped. It is safe From f8cf4932903aa3e14076357cdfc9abed01c390b6 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Tue, 7 Jan 2025 18:39:46 +0530 Subject: [PATCH 71/84] MDEV-34898 Doublewrite recovery of innodb_checksum_algorithm=full_crc32 encrypted pages does not work - InnoDB fails to recover the full crc32 encrypted 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 been encrypted from FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION bytes. Fix: === buf_dblwr_t::recover(): preserve any pages whose space_id does not match a known tablespace. These could be encrypted pages of tablespaces that had been created with innodb_checksum_algorithm=full_crc32. buf_page_t::read_complete(): If the page looks corrupted and the tablespace is encrypted and in full_crc32 format, try to restore the page from doublewrite buffer. recv_dblwr_t::recover_encrypted_page(): Find the page which has the same page number and try to decrypt the page using space->crypt_data. After decryption, compare the space id. Write the recovered page back to the file. --- extra/mariabackup/xtrabackup.cc | 3 +- .../encryption/r/debug_key_management.result | 1 + .../encryption/r/doublewrite_debug.result | 81 +++++++ .../encryption/t/debug_key_management.test | 1 + .../suite/encryption/t/doublewrite_debug.opt | 3 + .../suite/encryption/t/doublewrite_debug.test | 223 ++++++++++++++++++ storage/innobase/buf/buf0buf.cc | 11 + storage/innobase/buf/buf0dblwr.cc | 13 +- storage/innobase/include/log0recv.h | 15 +- storage/innobase/log/log0recv.cc | 43 ++++ storage/innobase/srv/srv0start.cc | 11 +- 11 files changed, 395 insertions(+), 10 deletions(-) create mode 100644 mysql-test/suite/encryption/r/doublewrite_debug.result create mode 100644 mysql-test/suite/encryption/t/doublewrite_debug.opt create mode 100644 mysql-test/suite/encryption/t/doublewrite_debug.test diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 3342ec47760..c1d7085237f 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -6185,7 +6185,8 @@ static bool xtrabackup_prepare_func(char** argv) srv_max_dirty_pages_pct_lwm = srv_max_buf_pool_modified_pct; } - if (innodb_init()) { + recv_sys.recovery_on = false; + if (innodb_init()) { goto error_cleanup; } diff --git a/mysql-test/suite/encryption/r/debug_key_management.result b/mysql-test/suite/encryption/r/debug_key_management.result index 7fe681d52ae..394477969ad 100644 --- a/mysql-test/suite/encryption/r/debug_key_management.result +++ b/mysql-test/suite/encryption/r/debug_key_management.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=[0-9]*\\] in file"); create table t1(a serial) engine=innoDB; set global innodb_encrypt_tables=ON; show variables like 'innodb_encrypt%'; diff --git a/mysql-test/suite/encryption/r/doublewrite_debug.result b/mysql-test/suite/encryption/r/doublewrite_debug.result new file mode 100644 index 00000000000..b289df9f77d --- /dev/null +++ b/mysql-test/suite/encryption/r/doublewrite_debug.result @@ -0,0 +1,81 @@ +call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t[12]\\.ibd looks corrupted"); +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; +start transaction; +insert into t1 values(1, repeat('#',12)); +insert into t1 values(2, repeat('+',12)); +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; +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'; +begin; +insert into t1 values (6, repeat('%', 400)); +insert into t2 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_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 +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 +select f1, f2 from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +select f1, f2 from t2; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +SET GLOBAL innodb_fast_shutdown = 0; +# shutdown server +# remove datadir +# xtrabackup move back +# 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'; +begin; +insert into t1 values (6, repeat('%', 400)); +set global innodb_saved_page_number_debug = 3; +set global innodb_fil_make_page_dirty_debug = @t1_space_id; +set global innodb_buf_flush_list_now = 1; +# Kill the server +# Corrupt the page 3 in t1.ibd file +# Assign the maximum value to lsn in doublewrite buffer page +# restart +FOUND 1 /InnoDB: Encrypted page \[page id: space=[1-9]*, page number=3\] in file .*test.t1.ibd looks corrupted/ in mysqld.1.err +select * from t1; +ERROR 42000: Unknown storage engine 'InnoDB' +# shutdown server +# remove datadir +# xtrabackup move back +# restart +select * from t1; +f1 f2 +1 ############ +2 ++++++++++++ +3 //////////// +4 ------------ +5 ............ +drop table t2, t1; diff --git a/mysql-test/suite/encryption/t/debug_key_management.test b/mysql-test/suite/encryption/t/debug_key_management.test index 45a93040d73..9638391e690 100644 --- a/mysql-test/suite/encryption/t/debug_key_management.test +++ b/mysql-test/suite/encryption/t/debug_key_management.test @@ -3,6 +3,7 @@ -- source include/innodb_undo_tablespaces.inc -- source include/not_embedded.inc +call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=[0-9]*\\] in file"); if (`select count(*) = 0 from information_schema.plugins where plugin_name = 'debug_key_management' and plugin_status='active'`) { diff --git a/mysql-test/suite/encryption/t/doublewrite_debug.opt b/mysql-test/suite/encryption/t/doublewrite_debug.opt new file mode 100644 index 00000000000..ed86654270b --- /dev/null +++ b/mysql-test/suite/encryption/t/doublewrite_debug.opt @@ -0,0 +1,3 @@ +--innodb-use-atomic-writes=0 +--innodb-encrypt-tables=FORCE +--innodb_sys_tablespaces diff --git a/mysql-test/suite/encryption/t/doublewrite_debug.test b/mysql-test/suite/encryption/t/doublewrite_debug.test new file mode 100644 index 00000000000..4dc6032c902 --- /dev/null +++ b/mysql-test/suite/encryption/t/doublewrite_debug.test @@ -0,0 +1,223 @@ +--source include/have_innodb.inc +--source include/have_debug.inc +--source include/not_embedded.inc +--source include/have_example_key_management_plugin.inc +call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t[12]\\.ibd looks corrupted"); +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"); + +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; + +start transaction; +insert into t1 values(1, repeat('#',12)); +insert into t1 values(2, repeat('+',12)); +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; +commit work; + +# Slow shutdown and restart to make sure ibuf merge is finished +SET GLOBAL innodb_fast_shutdown = 0; +let $shutdown_timeout=; +let $restart_parameters=--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0; +--source include/restart_mysqld.inc +--source ../../suite/innodb/include/no_checkpoint_start.inc + +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'; + +begin; +insert into t1 values (6, repeat('%', 400)); +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; +--enable_result_log + +echo # xtrabackup prepare; +--disable_result_log +exec $XTRABACKUP --prepare --target-dir=$targetdir; + +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_buf_flush_list_now = 1; +--let CLEANUP_IF_CHECKPOINT=drop table t1, t2, unexpected_checkpoint; +--source ../../suite/innodb/include/no_checkpoint_end.inc +# Corrupt the page 3 in t1.ibd, t2.ibd file +perl; +use IO::Handle; +do "$ENV{MTR_SUITE_DIR}/include/crc32.pl"; +my $polynomial = 0x82f63b78; # CRC-32C +my $algo = $ENV{ALGO}; +die "Unsupported innodb_checksum_algorithm=$algo\n" unless $algo =~ /crc32/; + +my $fname= "$ENV{'MYSQLD_DATADIR'}test/t1.ibd"; +my $page_size = $ENV{INNODB_PAGE_SIZE}; +my $page; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl"; +open(FILE, "+<", $fname) or die; +sysseek(FILE, 3*$page_size, 0); +sysread(FILE, $page, $page_size)==$page_size||die "Unable to read $name\n"; +sysseek(FILE, 3*$page_size, 0)||die "Unable to seek $fname\n"; +my $corrupted = $page; +# Set FIL_PAGE_LSN to the maximum +substr($corrupted, 16, 8) = chr(255) x 8; +substr($corrupted, $page_size - 8, 8) = chr(255) x 8; +if ($algo =~ /full_crc32/) +{ + my $ck = mycrc32(substr($corrupted, 0, $page_size - 4), 0, $polynomial); + substr($corrupted, $page_size - 4, 4) = pack("N", $ck); +} +else +{ + # Replace the innodb_checksum_algorithm=crc32 checksum + my $ck= pack("N", + mycrc32(substr($corrupted, 4, 22), 0, $polynomial) ^ + mycrc32(substr($corrupted_, 38, $page_size - 38 - 8), 0, + $polynomial)); + substr ($corrupted, 0, 4) = $ck; + substr ($corrupted, $page_size - 8, 4) = $ck; +} +syswrite(FILE, $corrupted); +close FILE; + +# Zero the complete page +my $fname= "$ENV{'MYSQLD_DATADIR'}test/t2.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 +let $restart_parameters=; +--source include/start_mysqld.inc +let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; +let SEARCH_PATTERN=InnoDB: Recovered page \\[page id: space=[1-9]*, page number=3\\]; +--source include/search_pattern_in_file.inc + +check table t1; +check table t2; +select f1, f2 from t1; +select f1, f2 from t2; + +SET GLOBAL innodb_fast_shutdown = 0; +let $shutdown_timeout=; +let $restart_parameters=--debug_dbug=+d,ib_log_checkpoint_avoid_hard --innodb_flush_sync=0; +--source ../../mariabackup/include/restart_and_restore.inc +--source ../../suite/innodb/include/no_checkpoint_start.inc +select space into @t1_space_id from information_schema.innodb_sys_tablespaces where name='test/t1'; + +begin; +insert into t1 values (6, repeat('%', 400)); + +set global innodb_saved_page_number_debug = 3; +set global innodb_fil_make_page_dirty_debug = @t1_space_id; + +set global innodb_buf_flush_list_now = 1; +--let CLEANUP_IF_CHECKPOINT=drop table t1, unexpected_checkpoint; +--source ../../suite/innodb/include/no_checkpoint_end.inc + +--echo # Corrupt the page 3 in t1.ibd file +--echo # Assign the maximum value to lsn in doublewrite buffer page +perl; +use IO::Handle; +do "$ENV{MTR_SUITE_DIR}/include/crc32.pl"; +my $polynomial = 0x82f63b78; # CRC-32C +my $algo = $ENV{ALGO}; +die "Unsupported innodb_checksum_algorithm=$algo\n" unless $algo =~ /crc32/; + +my $fname= "$ENV{'MYSQLD_DATADIR'}test/t1.ibd"; +my $page_size = $ENV{INNODB_PAGE_SIZE}; +my $page; +do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl"; +open(FILE, "+<", $fname) or die; +sysseek(FILE, 3*$page_size, 0); +sysread(FILE, $page, $page_size)==$page_size||die "Unable to read $name\n"; +sysseek(FILE, 3*$page_size, 0)||die "Unable to seek $fname\n"; +my $corrupted = $page; +# Set FIL_PAGE_LSN to the maximum +substr($corrupted, 16, 8) = chr(255) x 8; +substr($corrupted, $page_size - 8, 8) = chr(255) x 8; +if ($algo =~ /full_crc32/) +{ + my $ck = mycrc32(substr($corrupted, 0, $page_size - 4), 0, $polynomial); + substr($corrupted, $page_size - 4, 4) = pack("N", $ck); +} +else +{ + # Replace the innodb_checksum_algorithm=crc32 checksum + my $ck= pack("N", + mycrc32(substr($corrupted, 4, 22), 0, $polynomial) ^ + mycrc32(substr($corrupted_, 38, $page_size - 38 - 8), 0, + $polynomial)); + substr ($corrupted, 0, 4) = $ck; + substr ($corrupted, $page_size - 8, 4) = $ck; +} +syswrite(FILE, $corrupted); +close FILE; + +# Change the page lsn to maximum value +open(FILE, "+<", "$ENV{MYSQLD_DATADIR}ibdata1")||die "cannot open ibdata1\n"; +sysseek(FILE, 6 * $page_size - 190, 0)||die "Unable to seek ibdata1\n"; +sysread(FILE, $_, 12) == 12||die "Unable to read TRX_SYS\n"; +my($magic,$d1,$d2)=unpack "NNN", $_; +die "magic=$magic, $d1, $d2\n" unless $magic == 536853855 && $d2 >= $d1 + 64; +sysseek(FILE, $d1 * $page_size, 0)||die "Unable to seek ibdata1\n"; +# Find the page in the doublewrite buffer +for (my $d = $d1; $d < $d2 + 64; $d++) +{ + sysread(FILE, $_, $page_size)==$page_size||die "Cannot read doublewrite\n"; + next unless $_ eq $page; + sysseek(FILE, $d * $page_size, 0)||die "Unable to seek ibdata1\n"; + substr($_, 16, 8) = chr(255) x 8; + if ($algo =~ /full_crc32/) + { + my $ck = mycrc32(substr($_, 0, $page_size - 4), 0, $polynomial); + substr($_, $page_size - 4, 4) = pack("N", $ck); + } + else + { + # Replace the innodb_checksum_algorithm=crc32 checksum + my $ck= pack("N", + mycrc32(substr($_, 4, 22), 0, $polynomial) ^ + mycrc32(substr($_, 38, $page_size - 38 - 8), 0, + $polynomial)); + substr ($_, 0, 4) = $ck; + substr ($_, $page_size - 8, 4) = $ck; + } + syswrite(FILE, $_, $page_size)==$page_size||die; + close(FILE); + exit 0; +} +die "Did not find the page in the doublewrite buffer ($d1,$d2)\n"; +EOF + +let $restart_parameters=; +--source include/start_mysqld.inc +let SEARCH_FILE= $MYSQLTEST_VARDIR/log/mysqld.1.err; +let SEARCH_PATTERN=InnoDB: Encrypted page \\[page id: space=[1-9]*, page number=3\\] in file .*test.t1.ibd looks corrupted; +--source include/search_pattern_in_file.inc + +--error ER_UNKNOWN_STORAGE_ENGINE +select * from t1; + +--source ../../mariabackup/include/restart_and_restore.inc +select * from t1; +drop table t2, t1; diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 9387a146aee..0e4c2c5b0f2 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -3767,6 +3767,16 @@ 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))) + { + /* Recover from doublewrite buffer */ + err= DB_SUCCESS; + goto success_page; + } + if (recv_sys.free_corrupted_page(expected_id, node)); else if (err == DB_FAIL) err= DB_PAGE_CORRUPTED; @@ -3788,6 +3798,7 @@ release_page: buf_pool.corrupted_evict(this, buf_page_t::READ_FIX); return err; } +success_page: const bool recovery= recv_recovery_is_on(); diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index f53710caf1d..96d4c5e7c5e 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -370,6 +370,7 @@ void buf_dblwr_t::recover() srv_page_size)); byte *const buf= read_buf + srv_page_size; + std::deque encrypted_pages; for (recv_dblwr_t::list::iterator i= recv_sys.dblwr.pages.begin(); i != recv_sys.dblwr.pages.end(); ++i, ++page_no_dblwr) { @@ -385,8 +386,16 @@ void buf_dblwr_t::recover() fil_space_t *space= fil_space_t::get(space_id); if (!space) - /* The tablespace that this page once belonged to does not exist */ + { + /* 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); continue; + } if (UNIV_UNLIKELY(page_no >= space->get_size())) { @@ -465,6 +474,8 @@ next_page: } recv_sys.dblwr.pages.clear(); + for (byte *page : encrypted_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 fb7028126c8..f58543d7683 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -150,6 +150,16 @@ 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. + @param space tablespace object + @param page_no page number to find + @param buf buffer for unencrypted 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; + /** Restore the first page of the given tablespace from doublewrite buffer. 1) Find the page which has page_no as 0 @@ -257,8 +267,9 @@ private: during log scan or apply */ bool found_corrupt_fs; public: - /** whether we are applying redo log records during crash recovery */ - bool recovery_on; + /** whether we are applying redo log records during crash recovery. + This is protected by recv_sys.mutex */ + Atomic_relaxed recovery_on= false; /** whether recv_recover_page(), invoked from buf_page_t::read_complete(), should apply log records*/ bool apply_log_recs; diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index cb408313279..7b02de62119 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -3785,6 +3785,7 @@ void recv_sys_t::apply(bool last_batch) /* We skipped this in buf_page_create(). */ mlog_init.mark_ibuf_exist(); mlog_init.clear(); + dblwr.pages.clear(); } else { @@ -4841,6 +4842,48 @@ 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 +{ + ut_ad(node.space->crypt_data); + ut_ad(node.space->full_crc32()); + mysql_mutex_lock(&recv_sys.mutex); + byte *result_page= nullptr; + 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; + 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)); + slot->release(); + + if (invalidate || + mach_read_from_4(buf + FIL_PAGE_SPACE_ID) != node.space->id) + continue; + + result_page= *page_it; + pages.erase(page_it); + break; + } + mysql_mutex_unlock(&recv_sys.mutex); + if (result_page) + sql_print_information("InnoDB: Recovered page [page id: space=" + UINT32PF ", page number=" UINT32PF "] " + "to '%s' from the doublewrite buffer.", + uint32_t(node.space->id), page_no, + node.name); + return result_page; +} + const byte *recv_dblwr_t::find_page(const page_id_t page_id, lsn_t max_lsn, const fil_space_t *space, byte *tmp_buf) const noexcept diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index c3397c88336..ff1a363565a 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -324,8 +324,11 @@ static dberr_t create_log_file(bool create_new_db, lsn_t lsn, srv_startup_is_before_trx_rollback_phase = false; } - /* Enable checkpoints in buf_flush_page_cleaner(). */ + /* After disabling recv_no_log_write, enable checkpoints + in buf_flush_page_cleaner(). This could help to avoid + crash during log file resizing */ recv_sys.recovery_on = false; + mysql_mutex_unlock(&log_sys.mutex); log_make_checkpoint(); @@ -1351,8 +1354,7 @@ dberr_t srv_start(bool create_new_db) return(srv_init_abort(DB_ERROR)); } - /* Enable checkpoints in the page cleaner. */ - recv_sys.recovery_on = false; + ut_ad(!recv_sys.recovery_on); err= recv_recovery_read_max_checkpoint(); @@ -1507,8 +1509,6 @@ dberr_t srv_start(bool create_new_db) : recv_recovery_from_checkpoint_start(flushed_lsn); recv_sys.close_files(); - recv_sys.dblwr.pages.clear(); - if (err != DB_SUCCESS) { return(srv_init_abort(err)); } @@ -1667,7 +1667,6 @@ dberr_t srv_start(bool create_new_db) << "Starting to delete and rewrite log file."; srv_log_file_size = srv_log_file_size_requested; - err = create_log_file(false, flushed_lsn, logfile0); if (err == DB_SUCCESS) { From a2f510fccff23e5011486c240587b8f1a98ecacc Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 23 Dec 2024 15:58:55 +0100 Subject: [PATCH 72/84] MDEV-33978 P_S.THREADS is not showing all server threads This patch only makes sure Linux getevents thread is shown in PS --- tpool/aio_linux.cc | 7 +++++-- tpool/aio_win.cc | 2 ++ tpool/tpool.h | 13 +++++++++---- tpool/tpool_generic.cc | 6 ++---- tpool/tpool_win.cc | 7 ++----- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/tpool/aio_linux.cc b/tpool/aio_linux.cc index 6997cbcccab..1f52e62bd07 100644 --- a/tpool/aio_linux.cc +++ b/tpool/aio_linux.cc @@ -102,6 +102,7 @@ class aio_linux final : public aio */ constexpr unsigned MAX_EVENTS= 256; + aio->m_pool->m_worker_init_callback(); io_event events[MAX_EVENTS]; for (;;) { @@ -110,14 +111,14 @@ class aio_linux final : public aio continue; case -EINVAL: if (shutdown_in_progress) - return; + goto end; /* fall through */ default: if (ret < 0) { fprintf(stderr, "io_getevents returned %d\n", ret); abort(); - return; + goto end; } for (int i= 0; i < ret; i++) { @@ -142,6 +143,8 @@ class aio_linux final : public aio } } } +end: + aio->m_pool->m_worker_destroy_callback(); } public: diff --git a/tpool/aio_win.cc b/tpool/aio_win.cc index eec37383152..f483e3ca1e1 100644 --- a/tpool/aio_win.cc +++ b/tpool/aio_win.cc @@ -92,7 +92,9 @@ public: static void aio_completion_thread_proc(tpool_generic_win_aio* aio) { + aio->m_pool->m_worker_init_callback(); aio->completion_thread_work(); + aio->m_pool->m_worker_destroy_callback(); } ~tpool_generic_win_aio() diff --git a/tpool/tpool.h b/tpool/tpool.h index 7ac6763ae23..a5dccca5e91 100644 --- a/tpool/tpool.h +++ b/tpool/tpool.h @@ -27,6 +27,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 - 1301 USA*/ #define NOMINMAX #endif #include +#include + /** Windows-specific native file handle struct. Apart from the actual handle, contains PTP_IO @@ -202,21 +204,24 @@ protected: std::unique_ptr m_aio; virtual aio *create_native_aio(int max_io)= 0; +public: /** Functions to be called at worker thread start/end can be used for example to set some TLS variables */ - void (*m_worker_init_callback)(void); - void (*m_worker_destroy_callback)(void); + void (*m_worker_init_callback)(void)= [] {}; + void (*m_worker_destroy_callback)(void)= [] {}; -public: - thread_pool() : m_aio(), m_worker_init_callback(), m_worker_destroy_callback() + thread_pool() + : m_aio() { } virtual void submit_task(task *t)= 0; virtual timer* create_timer(callback_func func, void *data=nullptr) = 0; void set_thread_callbacks(void (*init)(), void (*destroy)()) { + assert(init); + assert(destroy); m_worker_init_callback= init; m_worker_destroy_callback= destroy; } diff --git a/tpool/tpool_generic.cc b/tpool/tpool_generic.cc index 9697194e0b2..cd4dd5f0bde 100644 --- a/tpool/tpool_generic.cc +++ b/tpool/tpool_generic.cc @@ -571,8 +571,7 @@ void thread_pool_generic::worker_main(worker_data *thread_var) { task* task; set_tls_pool(this); - if(m_worker_init_callback) - m_worker_init_callback(); + m_worker_init_callback(); tls_worker_data = thread_var; @@ -581,8 +580,7 @@ void thread_pool_generic::worker_main(worker_data *thread_var) task->execute(); } - if (m_worker_destroy_callback) - m_worker_destroy_callback(); + m_worker_destroy_callback(); worker_end(thread_var); } diff --git a/tpool/tpool_win.cc b/tpool/tpool_win.cc index 2b413b8d1b6..c012c4b6408 100644 --- a/tpool/tpool_win.cc +++ b/tpool/tpool_win.cc @@ -45,9 +45,7 @@ class thread_pool_win : public thread_pool if (!m_pool) return; - if (m_pool->m_worker_destroy_callback) - m_pool->m_worker_destroy_callback(); - + m_pool->m_worker_destroy_callback(); m_pool->m_thread_count--; } /** This needs to be called before every IO or simple task callback.*/ @@ -63,8 +61,7 @@ class thread_pool_win : public thread_pool m_pool = pool; m_pool->m_thread_count++; // Call the thread init function. - if (m_pool->m_worker_init_callback) - m_pool->m_worker_init_callback(); + m_pool->m_worker_init_callback(); } }; From 4e9c7031a54e91ddada7dec7e16001f6b4944995 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 27 Dec 2024 13:07:04 +0100 Subject: [PATCH 73/84] MDEV-35575 Fix memory leak, when installing auth_gssapi plugin fails. Make sure to release memory, which was allocated by gss_import_name(). Also when plugin_init() fails. --- plugin/auth_gssapi/gssapi_server.cc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/plugin/auth_gssapi/gssapi_server.cc b/plugin/auth_gssapi/gssapi_server.cc index db7bda9a6b4..8896c39859d 100644 --- a/plugin/auth_gssapi/gssapi_server.cc +++ b/plugin/auth_gssapi/gssapi_server.cc @@ -85,6 +85,15 @@ cleanup: return default_name; } +static void release_service_name() +{ + if (service_name != GSS_C_NO_NAME) + { + OM_uint32 minor; + gss_release_name(&minor, &service_name); + service_name= GSS_C_NO_NAME; + } +} int plugin_init() { @@ -127,6 +136,7 @@ int plugin_init() if (GSS_ERROR(major)) { log_error(major, minor, "gss_acquire_cred failed"); + release_service_name(); return -1; } gss_release_cred(&minor, &cred); @@ -136,11 +146,7 @@ int plugin_init() int plugin_deinit() { - if (service_name != GSS_C_NO_NAME) - { - OM_uint32 minor; - gss_release_name(&minor, &service_name); - } + release_service_name(); return 0; } From 680d461b5d5ba4ee6d69c11acde495950ce5d238 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 25 Oct 2024 13:41:28 +0200 Subject: [PATCH 74/84] MDEV-35239 Mariabackup incorrectly thinks we are on a multithreaded slave if slave_parallel_workers > 0 don't require GTID enabled for multi-threaded slave in MariaDB it's only needed for MySQL with it out-of-order commits. --- extra/mariabackup/backup_mysql.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc index d4fb6346bea..c0097fd3c45 100644 --- a/extra/mariabackup/backup_mysql.cc +++ b/extra/mariabackup/backup_mysql.cc @@ -614,7 +614,7 @@ detect_mysql_capabilities_for_backup() } if (opt_slave_info && have_multi_threaded_slave && - !have_gtid_slave) { + !have_gtid_slave && server_flavor != FLAVOR_MARIADB) { msg("The --slave-info option requires GTID enabled for a " "multi-threaded slave."); return(false); From 828b928fcecea727ca2aa29841575a663f7bdce7 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 15 Dec 2024 20:14:16 +0100 Subject: [PATCH 75/84] MDEV-35651 NO_UNSIGNED_SUBTRACTION does not work for multiple unsigned integers restore correct unsigned-unsigned logic followup for 031f11717d9 --- mysql-test/main/func_math.result | 15 +++++++++++++-- mysql-test/main/func_math.test | 14 ++++++++------ sql/item_func.cc | 5 +++-- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/mysql-test/main/func_math.result b/mysql-test/main/func_math.result index 4296a983d71..c5896953664 100644 --- a/mysql-test/main/func_math.result +++ b/mysql-test/main/func_math.result @@ -1,4 +1,3 @@ -drop table if exists t1; select floor(5.5),floor(-5.5); floor(5.5) floor(-5.5) 5 -6 @@ -3632,5 +3631,17 @@ SELECT(ASIN(-1)+ LN(-1)) % (ATAN(-1) MOD FLOOR(1)) * (TRUNCATE(EXP(-1.e-2),-1.e+ c1 NULL # -# End of 10.5 tests +# MDEV-35651 NO_UNSIGNED_SUBTRACTION does not work for multiple unsigned integers # +set sql_mode=no_unsigned_subtraction; +select cast(0 as unsigned) - 1; +cast(0 as unsigned) - 1 +-1 +select 2-cast(3 as unsigned); +2-cast(3 as unsigned) +-1 +select cast(1 as unsigned) - cast(2 as unsigned); +cast(1 as unsigned) - cast(2 as unsigned) +-1 +set sql_mode=default; +# End of 10.5 tests diff --git a/mysql-test/main/func_math.test b/mysql-test/main/func_math.test index d16fc3bc37b..938d7e00e14 100644 --- a/mysql-test/main/func_math.test +++ b/mysql-test/main/func_math.test @@ -4,10 +4,6 @@ --source include/default_charset.inc ---disable_warnings -drop table if exists t1; ---enable_warnings - select floor(5.5),floor(-5.5); explain extended select floor(5.5),floor(-5.5); select ceiling(5.5),ceiling(-5.5); @@ -1941,7 +1937,13 @@ SELECT (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) AS c1; SELECT (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) * (LAST_DAY('1-03-30 1:29:12') MOD 1 + COS(-1)) AS c1; SELECT(ASIN(-1)+ LN(-1)) % (ATAN(-1) MOD FLOOR(1)) * (TRUNCATE(EXP(-1.e-2),-1.e+30) % RADIANS(-1)) * (LAST_DAY('1-03-30 1:29:12') MOD 1 + COS(-1)) AS c1; +--echo # +--echo # MDEV-35651 NO_UNSIGNED_SUBTRACTION does not work for multiple unsigned integers +--echo # +set sql_mode=no_unsigned_subtraction; +select cast(0 as unsigned) - 1; +select 2-cast(3 as unsigned); +select cast(1 as unsigned) - cast(2 as unsigned); +set sql_mode=default; ---echo # --echo # End of 10.5 tests ---echo # diff --git a/sql/item_func.cc b/sql/item_func.cc index 34e4727681e..6a7b12ae4a0 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1316,9 +1316,10 @@ longlong Item_func_minus::int_op() { if (args[1]->unsigned_flag) { - if ((ulonglong) val0 < (ulonglong) val1) + if ((ulonglong) val0 >= (ulonglong) val1) + res_unsigned= TRUE; + else if ((ulonglong)val1 - (ulonglong)val0 > (ulonglong)LONGLONG_MAX) goto err; - res_unsigned= TRUE; } else { From b059f6051085657062fd1d3a5a6e5ff9cbf53050 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 23 Dec 2024 17:44:24 +0100 Subject: [PATCH 76/84] MDEV-35704 Error message mispelled when altering table engine to MEMORY reset progress report output before printing the error message. need to flush(stdout), because error message goes to stderr --- client/mysql.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/mysql.cc b/client/mysql.cc index 0d41ab928ec..e7e44c929d8 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -5122,6 +5122,9 @@ put_info(const char *str,INFO_TYPE info_type, uint error, const char *sqlstate) } if (!opt_silent || info_type == INFO_ERROR) { + report_progress_end(); + fflush(stdout); + if (!inited) { #ifdef HAVE_SETUPTERM From 9f9072c3440a008c2cef84da1b77378892176999 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 23 Dec 2024 21:55:02 +0100 Subject: [PATCH 77/84] MDEV-34733 main.mysqld--help-aria test failure: feedback plugin: failed to retrieve the MAC address * replace the message away in the test result * remove "feedback plugin:" prefix, it's a server message, not plugin's * downgrade to the warning, because 1) it's not a failure, no operation was aborted, server still works 2) it's something actionable, so not a [Note] either --- mysql-test/main/mysqld--help-aria.test | 6 +++--- mysql-test/mysql-test-run.pl | 2 +- sql/mysqld.cc | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/mysql-test/main/mysqld--help-aria.test b/mysql-test/main/mysqld--help-aria.test index 2bd332c1484..4f0da282040 100644 --- a/mysql-test/main/mysqld--help-aria.test +++ b/mysql-test/main/mysqld--help-aria.test @@ -6,7 +6,7 @@ flush tables; --let $args=--table-cache=5 --max-connections=10 --log-warnings=1 --silent-startup --lower-case-table-names=1 --help --verbose --exec $MYSQLD_CMD $args > $MYSQL_TMP_DIR/mysqld--help2.txt 2> $MYSQL_TMP_DIR/mysqld--help2.err ---replace_regex /mysqld/mariadbd/ /\d\d\d\d-\d*-\d* *\d*:\d*:\d* \d* // +--replace_regex /mysqld/mariadbd/ /\d\d\d\d-\d*-\d* *\d*:\d*:\d* \d* // /^.*failed to retrieve the MAC address\n// --cat_file $MYSQL_TMP_DIR/mysqld--help2.err --echo # @@ -14,7 +14,7 @@ flush tables; --echo # --exec $MYSQLD_CMD $args --datadir=$MYSQL_TMP_DIR/help > $MYSQL_TMP_DIR/mysqld--help2.txt 2> $MYSQL_TMP_DIR/mysqld--help2.err ---replace_regex /\d\d\d\d-\d*-\d* *\d*:\d*:\d* \d* // +--replace_regex /mysqld/mariadbd/ /\d\d\d\d-\d*-\d* *\d*:\d*:\d* \d* // /^.*failed to retrieve the MAC address\n// --cat_file $MYSQL_TMP_DIR/mysqld--help2.err --echo # @@ -23,7 +23,7 @@ flush tables; --mkdir $MYSQL_TMP_DIR/help --exec $MYSQLD_CMD $args --datadir=$MYSQL_TMP_DIR/help > $MYSQL_TMP_DIR/mysqld--help2.txt 2> $MYSQL_TMP_DIR/mysqld--help2.err ---replace_regex /\d\d\d\d-\d*-\d* *\d*:\d*:\d* \d* // +--replace_regex /mysqld/mariadbd/ /\d\d\d\d-\d*-\d* *\d*:\d*:\d* \d* // /^.*failed to retrieve the MAC address\n// --cat_file $MYSQL_TMP_DIR/mysqld--help2.err --list_files $MYSQL_TMP_DIR/help diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 83d5fe088f8..815eae1bb26 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -4487,7 +4487,7 @@ sub extract_warning_lines ($$) { qr|InnoDB: io_setup\(\) failed with EAGAIN|, qr/InnoDB: Failed to set (O_DIRECT|DIRECTIO_ON) on file/, qr|setrlimit could not change the size of core files to 'infinity';|, - qr|feedback plugin: failed to retrieve the MAC address|, + qr|failed to retrieve the MAC address|, qr|Plugin 'FEEDBACK' init function returned error|, qr|Plugin 'FEEDBACK' registration as a INFORMATION SCHEMA failed|, qr|'log-bin-use-v1-row-events' is MySQL .* compatible option|, diff --git a/sql/mysqld.cc b/sql/mysqld.cc index a9fa24c2064..31d9084f235 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -9866,7 +9866,7 @@ static int calculate_server_uid(char *dest) int2store(rawbuf, mysqld_port); if (my_gethwaddr(rawbuf + 2)) { - sql_print_error("feedback plugin: failed to retrieve the MAC address"); + sql_print_warning("failed to retrieve the MAC address"); return 1; } From 0031f4a74fcf7c61493409af5da5ab2c90905113 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 24 Dec 2024 17:53:03 +0100 Subject: [PATCH 78/84] MDEV-35663 Sporadic connection failures during FLUSH PRIVILEGES during FLUSH PRIVILEGES, allow_all_hosts temporarily goes out of sync with acl_check_hosts and acl_wild_hosts. As it's tested in acl_check_host() without a mutex, let's re-test it under a mutex to make sure the value is correct. Note that it's just an optimization and it's ok to see outdated allow_all_hosts value here. --- sql/sql_acl.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 949e9825dde..59980264741 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -3948,7 +3948,8 @@ bool acl_check_host(const char *host, const char *ip) return 0; mysql_mutex_lock(&acl_cache->lock); - if ((host && my_hash_search(&acl_check_hosts,(uchar*) host,strlen(host))) || + if (allow_all_hosts || + (host && my_hash_search(&acl_check_hosts,(uchar*) host,strlen(host))) || (ip && my_hash_search(&acl_check_hosts,(uchar*) ip, strlen(ip)))) { mysql_mutex_unlock(&acl_cache->lock); From 9508a44c376186b433b023b04cc5025860b2a52a Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 28 Dec 2024 20:15:43 +0100 Subject: [PATCH 79/84] enforce no trailing \n in Diagnostic_area messages that is in my_error(), push_warning(), etc --- mysql-test/main/long_unique_debug.result | 26 --- .../binlog/r/binlog_max_extension.result | 1 - .../binlog/r/binlog_no_uniqfile_crash.result | 1 - ...binlog_show_binlog_event_random_pos.result | 1 - .../rpl_binlog_errors.result | 9 - .../binlog_encryption/rpl_checksum.result | 1 - .../suite/rpl/r/rpl_binlog_errors.result | 9 - mysql-test/suite/rpl/r/rpl_checksum.result | 1 - sql/share/errmsg-utf8.txt | 200 +++++++++--------- sql/sql_error.cc | 1 + sql/sql_repl.cc | 2 +- sql/table.cc | 2 +- storage/connect/domdoc.cpp | 6 +- storage/innobase/handler/ha_innodb.cc | 25 +-- storage/maria/ma_check.c | 4 +- storage/myisam/mi_check.c | 8 +- 16 files changed, 123 insertions(+), 174 deletions(-) diff --git a/mysql-test/main/long_unique_debug.result b/mysql-test/main/long_unique_debug.result index fb56a9d024b..01df77fc58b 100644 --- a/mysql-test/main/long_unique_debug.result +++ b/mysql-test/main/long_unique_debug.result @@ -90,13 +90,11 @@ table->field[0]->offset = 1 table->field[0]->field_length = 10 table->field[0]->null_pos wrt to record 0 = 0 table->field[0]->null_bit_pos = 1 - table->field[1]->field_name DB_ROW_HASH_1 table->field[1]->offset = 11 table->field[1]->field_length = 8 table->field[1]->null_pos wrt to record 0 = 0 table->field[1]->null_bit_pos = 2 - SET debug_dbug=""; drop table t1; SET debug_dbug="d,print_long_unique_internal_state"; @@ -182,37 +180,31 @@ table->field[0]->offset = 1 table->field[0]->field_length = 10 table->field[0]->null_pos wrt to record 0 = 0 table->field[0]->null_bit_pos = 1 - table->field[1]->field_name b table->field[1]->offset = 11 table->field[1]->field_length = 10 table->field[1]->null_pos wrt to record 0 = 0 table->field[1]->null_bit_pos = 2 - table->field[2]->field_name c table->field[2]->offset = 21 table->field[2]->field_length = 10 table->field[2]->null_pos wrt to record 0 = 0 table->field[2]->null_bit_pos = 4 - table->field[3]->field_name DB_ROW_HASH_1 table->field[3]->offset = 31 table->field[3]->field_length = 8 table->field[3]->null_pos wrt to record 0 = 0 table->field[3]->null_bit_pos = 8 - table->field[4]->field_name DB_ROW_HASH_2 table->field[4]->offset = 39 table->field[4]->field_length = 8 table->field[4]->null_pos wrt to record 0 = 0 table->field[4]->null_bit_pos = 16 - table->field[5]->field_name DB_ROW_HASH_3 table->field[5]->offset = 47 table->field[5]->field_length = 8 table->field[5]->null_pos wrt to record 0 = 0 table->field[5]->null_bit_pos = 32 - SET debug_dbug=""; drop table t1; SET debug_dbug="d,print_long_unique_internal_state"; @@ -290,37 +282,31 @@ table->field[0]->offset = 1 table->field[0]->field_length = 10 table->field[0]->null_pos wrt to record 0 = 0 table->field[0]->null_bit_pos = 1 - table->field[1]->field_name b table->field[1]->offset = 11 table->field[1]->field_length = 10 table->field[1]->null_pos wrt to record 0 = 0 table->field[1]->null_bit_pos = 2 - table->field[2]->field_name c table->field[2]->offset = 21 table->field[2]->field_length = 10 table->field[2]->null_pos wrt to record 0 = 0 table->field[2]->null_bit_pos = 4 - table->field[3]->field_name d table->field[3]->offset = 31 table->field[3]->field_length = 10 table->field[3]->null_pos wrt to record 0 = 0 table->field[3]->null_bit_pos = 8 - table->field[4]->field_name DB_ROW_HASH_1 table->field[4]->offset = 41 table->field[4]->field_length = 8 table->field[4]->null_pos wrt to record 0 = 0 table->field[4]->null_bit_pos = 16 - table->field[5]->field_name DB_ROW_HASH_2 table->field[5]->offset = 49 table->field[5]->field_length = 8 table->field[5]->null_pos wrt to record 0 = 0 table->field[5]->null_bit_pos = 32 - SET debug_dbug=""; drop table t1; SET debug_dbug="d,print_long_unique_internal_state"; @@ -406,31 +392,26 @@ table->field[0]->offset = 1 table->field[0]->field_length = 4 table->field[0]->null_pos wrt to record 0 = -1 table->field[0]->null_bit_pos = 0 - table->field[1]->field_name b table->field[1]->offset = 5 table->field[1]->field_length = 10 table->field[1]->null_pos wrt to record 0 = 0 table->field[1]->null_bit_pos = 1 - table->field[2]->field_name c table->field[2]->offset = 15 table->field[2]->field_length = 10 table->field[2]->null_pos wrt to record 0 = -1 table->field[2]->null_bit_pos = 0 - table->field[3]->field_name DB_ROW_HASH_1 table->field[3]->offset = 25 table->field[3]->field_length = 8 table->field[3]->null_pos wrt to record 0 = 0 table->field[3]->null_bit_pos = 2 - table->field[4]->field_name DB_ROW_HASH_2 table->field[4]->offset = 33 table->field[4]->field_length = 8 table->field[4]->null_pos wrt to record 0 = -1 table->field[4]->null_bit_pos = 0 - SET debug_dbug=""; drop table t1; ##Using hash @@ -487,25 +468,21 @@ table->field[0]->offset = 1 table->field[0]->field_length = 4 table->field[0]->null_pos wrt to record 0 = 0 table->field[0]->null_bit_pos = 2 - table->field[1]->field_name b table->field[1]->offset = 5 table->field[1]->field_length = 4 table->field[1]->null_pos wrt to record 0 = 0 table->field[1]->null_bit_pos = 4 - table->field[2]->field_name c table->field[2]->offset = 9 table->field[2]->field_length = 4 table->field[2]->null_pos wrt to record 0 = 0 table->field[2]->null_bit_pos = 8 - table->field[3]->field_name DB_ROW_HASH_1 table->field[3]->offset = 13 table->field[3]->field_length = 8 table->field[3]->null_pos wrt to record 0 = 0 table->field[3]->null_bit_pos = 16 - SET debug_dbug=""; drop table t1; ##Using hash but with memory engine so no long unique column @@ -562,18 +539,15 @@ table->field[0]->offset = 1 table->field[0]->field_length = 4 table->field[0]->null_pos wrt to record 0 = 0 table->field[0]->null_bit_pos = 2 - table->field[1]->field_name b table->field[1]->offset = 5 table->field[1]->field_length = 4 table->field[1]->null_pos wrt to record 0 = 0 table->field[1]->null_bit_pos = 4 - table->field[2]->field_name c table->field[2]->offset = 9 table->field[2]->field_length = 4 table->field[2]->null_pos wrt to record 0 = 0 table->field[2]->null_bit_pos = 8 - SET debug_dbug=""; drop table t1; diff --git a/mysql-test/suite/binlog/r/binlog_max_extension.result b/mysql-test/suite/binlog/r/binlog_max_extension.result index f69ffcce16a..f353b071589 100644 --- a/mysql-test/suite/binlog/r/binlog_max_extension.result +++ b/mysql-test/suite/binlog/r/binlog_max_extension.result @@ -4,4 +4,3 @@ call mtr.add_suppression("Can't generate a unique log-filename"); RESET MASTER; FLUSH LOGS; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - diff --git a/mysql-test/suite/binlog/r/binlog_no_uniqfile_crash.result b/mysql-test/suite/binlog/r/binlog_no_uniqfile_crash.result index 88ed236a528..bd3d699a74a 100644 --- a/mysql-test/suite/binlog/r/binlog_no_uniqfile_crash.result +++ b/mysql-test/suite/binlog/r/binlog_no_uniqfile_crash.result @@ -16,7 +16,6 @@ master-bin.2147483647 # Gtid # # GTID #-#-# master-bin.2147483647 # Query # # CREATE DATABASE db1 RESET MASTER TO 2147483648; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - FOUND 1 /Turning logging off for the whole duration of the MariaDB server process/ in mysqld.1.err "Following CREATE DATABSE db2 command will not be present in binary log" "as binary log got closed due to ER_NO_UNIQUE_LOGFILE error." diff --git a/mysql-test/suite/binlog/r/binlog_show_binlog_event_random_pos.result b/mysql-test/suite/binlog/r/binlog_show_binlog_event_random_pos.result index c2e634ebe82..014019a3294 100644 --- a/mysql-test/suite/binlog/r/binlog_show_binlog_event_random_pos.result +++ b/mysql-test/suite/binlog/r/binlog_show_binlog_event_random_pos.result @@ -11,5 +11,4 @@ UPDATE t1 SET c1=repeat('b',255); INSERT INTO t1 VALUES (repeat('a', 255), repeat('a', 255),repeat('a', 255),repeat('a', 255),repeat('a', 255)); SHOW BINLOG EVENTS FROM POS; ERROR HY000: Error when executing command SHOW BINLOG EVENTS: Invalid pos specified. Requested from pos:POS is greater than actual file size:MAX_POS - DROP TABLE t1; diff --git a/mysql-test/suite/binlog_encryption/rpl_binlog_errors.result b/mysql-test/suite/binlog_encryption/rpl_binlog_errors.result index 4c667bd7f5a..a4228c6e781 100644 --- a/mysql-test/suite/binlog_encryption/rpl_binlog_errors.result +++ b/mysql-test/suite/binlog_encryption/rpl_binlog_errors.result @@ -26,7 +26,6 @@ RESET MASTER; SET @@global.debug_dbug="d,error_unique_log_filename"; FLUSH LOGS; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # assert: must show one binlog show binary logs; Log_name File_size @@ -52,7 +51,6 @@ RESET MASTER; SET @@global.debug_dbug="d,error_unique_log_filename"; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # assert: must show one entry SELECT count(*) FROM t2; count(*) @@ -78,7 +76,6 @@ LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; INSERT INTO t2 VALUES ('muse'); COMMIT; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # assert: must show three entries SELECT count(*) FROM t2; count(*) @@ -95,7 +92,6 @@ count(*) 0 LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t4; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # assert: must show 1 entry SELECT count(*) FROM t4; count(*) @@ -118,13 +114,10 @@ count(*) 0 LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t4; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'); ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # INFO: Count(*) Before Offending DELETEs # assert: must show 1 entry SELECT count(*) FROM t4; @@ -136,10 +129,8 @@ count(*) 4 DELETE FROM t4; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - DELETE FROM t2; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # INFO: Count(*) After Offending DELETEs # assert: must show zero entries SELECT count(*) FROM t4; diff --git a/mysql-test/suite/binlog_encryption/rpl_checksum.result b/mysql-test/suite/binlog_encryption/rpl_checksum.result index 22220b8e9fb..bfc4c4e831c 100644 --- a/mysql-test/suite/binlog_encryption/rpl_checksum.result +++ b/mysql-test/suite/binlog_encryption/rpl_checksum.result @@ -171,7 +171,6 @@ SET @old_dbug= @@GLOBAL.debug_dbug; SET debug_dbug= '+d,binlog_inject_new_name_error'; FLUSH LOGS; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - SET debug_dbug= @old_dbug; INSERT INTO t4 VALUES (2); connection slave; diff --git a/mysql-test/suite/rpl/r/rpl_binlog_errors.result b/mysql-test/suite/rpl/r/rpl_binlog_errors.result index 4c667bd7f5a..a4228c6e781 100644 --- a/mysql-test/suite/rpl/r/rpl_binlog_errors.result +++ b/mysql-test/suite/rpl/r/rpl_binlog_errors.result @@ -26,7 +26,6 @@ RESET MASTER; SET @@global.debug_dbug="d,error_unique_log_filename"; FLUSH LOGS; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # assert: must show one binlog show binary logs; Log_name File_size @@ -52,7 +51,6 @@ RESET MASTER; SET @@global.debug_dbug="d,error_unique_log_filename"; LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # assert: must show one entry SELECT count(*) FROM t2; count(*) @@ -78,7 +76,6 @@ LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; INSERT INTO t2 VALUES ('muse'); COMMIT; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # assert: must show three entries SELECT count(*) FROM t2; count(*) @@ -95,7 +92,6 @@ count(*) 0 LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t4; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # assert: must show 1 entry SELECT count(*) FROM t4; count(*) @@ -118,13 +114,10 @@ count(*) 0 LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t4; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - LOAD DATA INFILE 'MYSQLTEST_VARDIR/tmp/bug_46166.data' INTO TABLE t2; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - INSERT INTO t2 VALUES ('aaa'), ('bbb'), ('ccc'); ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # INFO: Count(*) Before Offending DELETEs # assert: must show 1 entry SELECT count(*) FROM t4; @@ -136,10 +129,8 @@ count(*) 4 DELETE FROM t4; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - DELETE FROM t2; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - # INFO: Count(*) After Offending DELETEs # assert: must show zero entries SELECT count(*) FROM t4; diff --git a/mysql-test/suite/rpl/r/rpl_checksum.result b/mysql-test/suite/rpl/r/rpl_checksum.result index 21d8ca22feb..94f119016c5 100644 --- a/mysql-test/suite/rpl/r/rpl_checksum.result +++ b/mysql-test/suite/rpl/r/rpl_checksum.result @@ -171,7 +171,6 @@ SET @old_dbug= @@GLOBAL.debug_dbug; SET debug_dbug= '+d,binlog_inject_new_name_error'; FLUSH LOGS; ERROR HY000: Can't generate a unique log-filename master-bin.(1-999) - SET debug_dbug= @old_dbug; INSERT INTO t4 VALUES (2); connection slave; diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 5be526dbece..87cf8938c90 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -1903,83 +1903,83 @@ ER_NORMAL_SHUTDOWN swe "%s (%s): Normal avslutning" ukr "%s (%s): Нормальне завершення" ER_GOT_SIGNAL - chi "%s: 收到信号 %d. 强行中止!\n" - cze "%s: přijat signal %d, končím\n" - dan "%s: Fangede signal %d. Afslutter!!\n" - eng "%s: Got signal %d. Aborting!\n" - est "%s: sain signaali %d. Lõpetan!\n" - fre "%s: Reçu le signal %d. Abandonne!\n" - ger "%s: Signal %d erhalten. Abbruch!\n" - greek "%s: Ελήφθη το μήνυμα %d. Η διαδικασία εγκαταλείπεται!\n" - hindi "%s: सिग्नल %d मिलने के कारण सिस्टम बंद किया जा रहा है!\n" - hun "%s: %d jelzes. Megszakitva!\n" - ita "%s: Ricevuto segnale %d. Interruzione!\n" - jpn "%s: シグナル %d を受信しました。強制終了します!\n" - kor "%s: %d 신호가 들어왔음. 중지!\n" - nla "%s: Signaal %d. Systeem breekt af!\n" - nor "%s: Oppdaget signal %d. Avslutter!\n" - norwegian-ny "%s: Oppdaga signal %d. Avsluttar!\n" - pol "%s: Otrzymano sygnał %d. Kończenie działania!\n" - por "%s: Obteve sinal %d. Abortando!\n" - rum "%s: Semnal %d obtinut. Aborting!\n" - rus "%s: Получен сигнал %d. Прекращаем!\n" - serbian "%s: Dobio signal %d. Prekidam!\n" - slo "%s: prijatý signál %d, ukončenie (Abort)!\n" - spa "%s: Recibiendo signal %d. Abortando!\n" - swe "%s: Fick signal %d. Avslutar!\n" - ukr "%s: Отримано сигнал %d. Перериваюсь!\n" + chi "%s: 收到信号 %d. 强行中止!" + cze "%s: přijat signal %d, končím" + dan "%s: Fangede signal %d. Afslutter!!" + eng "%s: Got signal %d. Aborting!" + est "%s: sain signaali %d. Lõpetan!" + fre "%s: Reçu le signal %d. Abandonne!" + ger "%s: Signal %d erhalten. Abbruch!" + greek "%s: Ελήφθη το μήνυμα %d. Η διαδικασία εγκαταλείπεται!" + hindi "%s: सिग्नल %d मिलने के कारण सिस्टम बंद किया जा रहा है!" + hun "%s: %d jelzes. Megszakitva!" + ita "%s: Ricevuto segnale %d. Interruzione!" + jpn "%s: シグナル %d を受信しました。強制終了します!" + kor "%s: %d 신호가 들어왔음. 중지!" + nla "%s: Signaal %d. Systeem breekt af!" + nor "%s: Oppdaget signal %d. Avslutter!" + norwegian-ny "%s: Oppdaga signal %d. Avsluttar!" + pol "%s: Otrzymano sygnał %d. Kończenie działania!" + por "%s: Obteve sinal %d. Abortando!" + rum "%s: Semnal %d obtinut. Aborting!" + rus "%s: Получен сигнал %d. Прекращаем!" + serbian "%s: Dobio signal %d. Prekidam!" + slo "%s: prijatý signál %d, ukončenie (Abort)!" + spa "%s: Recibiendo signal %d. Abortando!" + swe "%s: Fick signal %d. Avslutar!" + ukr "%s: Отримано сигнал %d. Перериваюсь!" ER_SHUTDOWN_COMPLETE - chi "%s:关闭完成\n" - cze "%s: ukončení práce hotovo\n" - dan "%s: Server lukket\n" - eng "%s: Shutdown complete\n" - est "%s: Lõpp\n" - fre "%s: Arrêt du serveur terminé\n" - ger "%s: Herunterfahren beendet\n" - greek "%s: Η διαδικασία Shutdown ολοκληρώθηκε\n" - hindi "%s: शटडाउन पूर्ण\n" - hun "%s: A leallitas kesz\n" - ita "%s: Shutdown completato\n" - jpn "%s: シャットダウン完了\n" - kor "%s: Shutdown 이 완료됨!\n" - nla "%s: Afsluiten afgerond\n" - nor "%s: Avslutning komplett\n" - norwegian-ny "%s: Nedkopling komplett\n" - pol "%s: Zakończenie działania wykonane\n" - por "%s: 'Shutdown' completo\n" - rum "%s: Terminare completa\n" - rus "%s: Остановка завершена\n" - serbian "%s: Gašenje završeno\n" - slo "%s: práca ukončená\n" - spa "%s: Apagado completado\n" - swe "%s: Avslutning klar\n" - ukr "%s: Роботу завершено\n" + chi "%s:关闭完成" + cze "%s: ukončení práce hotovo" + dan "%s: Server lukket" + eng "%s: Shutdown complete" + est "%s: Lõpp" + fre "%s: Arrêt du serveur terminé" + ger "%s: Herunterfahren beendet" + greek "%s: Η διαδικασία Shutdown ολοκληρώθηκε" + hindi "%s: शटडाउन पूर्ण" + hun "%s: A leallitas kesz" + ita "%s: Shutdown completato" + jpn "%s: シャットダウン完了" + kor "%s: Shutdown 이 완료됨!" + nla "%s: Afsluiten afgerond" + nor "%s: Avslutning komplett" + norwegian-ny "%s: Nedkopling komplett" + pol "%s: Zakończenie działania wykonane" + por "%s: 'Shutdown' completo" + rum "%s: Terminare completa" + rus "%s: Остановка завершена" + serbian "%s: Gašenje završeno" + slo "%s: práca ukončená" + spa "%s: Apagado completado" + swe "%s: Avslutning klar" + ukr "%s: Роботу завершено" ER_FORCING_CLOSE 08S01 - chi "%s: 强行关闭线程 %ld 用户: '%-.48s'\n" - cze "%s: násilné uzavření threadu %ld uživatele '%-.48s'\n" - dan "%s: Forceret nedlukning af tråd: %ld bruger: '%-.48s'\n" - eng "%s: Forcing close of thread %ld user: '%-.48s'\n" - est "%s: Sulgen jõuga lõime %ld kasutaja: '%-.48s'\n" - fre "%s: Arrêt forcé de la tâche (thread) %ld utilisateur: '%-.48s'\n" - ger "%s: Thread %ld zwangsweise beendet. Benutzer: '%-.48s'\n" - greek "%s: Το thread θα κλείσει %ld user: '%-.48s'\n" - hindi "%s: %ld थ्रेड बंद किया जा रहा है (यूज़र: '%-.48s')\n" - hun "%s: A(z) %ld thread kenyszeritett zarasa. Felhasznalo: '%-.48s'\n" - ita "%s: Forzata la chiusura del thread %ld utente: '%-.48s'\n" - jpn "%s: スレッド %ld を強制終了します (ユーザー: '%-.48s')\n" - kor "%s: thread %ld의 강제 종료 user: '%-.48s'\n" - nla "%s: Afsluiten afgedwongen van thread %ld gebruiker: '%-.48s'\n" - nor "%s: Påtvinget avslutning av tråd %ld bruker: '%-.48s'\n" - norwegian-ny "%s: Påtvinga avslutning av tråd %ld brukar: '%-.48s'\n" - pol "%s: Wymuszenie zamknięcia w?tku %ld użytkownik: '%-.48s'\n" - por "%s: Forçando finalização da 'thread' %ld - usuário '%-.48s'\n" - rum "%s: Terminare fortata a thread-ului %ld utilizatorului: '%-.48s'\n" - rus "%s: Принудительно закрываем поток %ld пользователя: '%-.48s'\n" - serbian "%s: Usiljeno gašenje thread-a %ld koji pripada korisniku: '%-.48s'\n" - slo "%s: násilné ukončenie vlákna %ld užívateľa '%-.48s'\n" - spa "%s: Forzando a cerrar el thread %ld usuario: '%-.48s'\n" - swe "%s: Stänger av tråd %ld; användare: '%-.48s'\n" - ukr "%s: Прискорюю закриття гілки %ld користувача: '%-.48s'\n" + chi "%s: 强行关闭线程 %ld 用户: '%-.48s'" + cze "%s: násilné uzavření threadu %ld uživatele '%-.48s'" + dan "%s: Forceret nedlukning af tråd: %ld bruger: '%-.48s'" + eng "%s: Forcing close of thread %ld user: '%-.48s'" + est "%s: Sulgen jõuga lõime %ld kasutaja: '%-.48s'" + fre "%s: Arrêt forcé de la tâche (thread) %ld utilisateur: '%-.48s'" + ger "%s: Thread %ld zwangsweise beendet. Benutzer: '%-.48s'" + greek "%s: Το thread θα κλείσει %ld user: '%-.48s'" + hindi "%s: %ld थ्रेड बंद किया जा रहा है (यूज़र: '%-.48s')" + hun "%s: A(z) %ld thread kenyszeritett zarasa. Felhasznalo: '%-.48s'" + ita "%s: Forzata la chiusura del thread %ld utente: '%-.48s'" + jpn "%s: スレッド %ld を強制終了します (ユーザー: '%-.48s')" + kor "%s: thread %ld의 강제 종료 user: '%-.48s'" + nla "%s: Afsluiten afgedwongen van thread %ld gebruiker: '%-.48s'" + nor "%s: Påtvinget avslutning av tråd %ld bruker: '%-.48s'" + norwegian-ny "%s: Påtvinga avslutning av tråd %ld brukar: '%-.48s'" + pol "%s: Wymuszenie zamknięcia w?tku %ld użytkownik: '%-.48s'" + por "%s: Forçando finalização da 'thread' %ld - usuário '%-.48s'" + rum "%s: Terminare fortata a thread-ului %ld utilizatorului: '%-.48s'" + rus "%s: Принудительно закрываем поток %ld пользователя: '%-.48s'" + serbian "%s: Usiljeno gašenje thread-a %ld koji pripada korisniku: '%-.48s'" + slo "%s: násilné ukončenie vlákna %ld užívateľa '%-.48s'" + spa "%s: Forzando a cerrar el thread %ld usuario: '%-.48s'" + swe "%s: Stänger av tråd %ld; användare: '%-.48s'" + ukr "%s: Прискорюю закриття гілки %ld користувача: '%-.48s'" ER_IPSOCK_ERROR 08S01 chi "无法创建IP插口" cze "Nemohu vytvořit IP socket" @@ -2398,31 +2398,31 @@ ER_TOO_BIG_SET swe "För många alternativ till kolumn %-.192s för SET" ukr "Забагато строк для стовбця %-.192s та SET" ER_NO_UNIQUE_LOGFILE - chi "无法生成唯一的log-filename%-.200s.(1-999)\ n" - cze "Nemohu vytvořit jednoznačné jméno logovacího souboru %-.200s.(1-999)\n" - dan "Kan ikke lave unikt log-filnavn %-.200s.(1-999)\n" - eng "Can't generate a unique log-filename %-.200s.(1-999)\n" - est "Ei suuda luua unikaalset logifaili nime %-.200s.(1-999)\n" - fre "Ne peut générer un unique nom de journal %-.200s.(1-999)\n" - ger "Kann keinen eindeutigen Dateinamen für die Logdatei %-.200s(1-999) erzeugen\n" - greek "Αδύνατη η δημιουργία unique log-filename %-.200s.(1-999)\n" - hindi "एक अनूठा लॉग-फ़ाइल नाम %-.200s.(1-999) उत्पन्न नहीं कर सके\n" - hun "Egyedi log-filenev nem generalhato: %-.200s.(1-999)\n" - ita "Impossibile generare un nome del file log unico %-.200s.(1-999)\n" - jpn "一意なログファイル名 %-.200s.(1-999) を生成できません。\n" - kor "Unique 로그화일 '%-.200s'를 만들수 없습니다.(1-999)\n" - nla "Het is niet mogelijk een unieke naam te maken voor de logfile %-.200s.(1-999)\n" - nor "Kan ikke lage unikt loggfilnavn %-.200s.(1-999)\n" - norwegian-ny "Kan ikkje lage unikt loggfilnavn %-.200s.(1-999)\n" - pol "Nie można stworzyć unikalnej nazwy pliku z logiem %-.200s.(1-999)\n" - por "Não pode gerar um nome de arquivo de 'log' único '%-.200s'.(1-999)\n" - rum "Nu pot sa generez un nume de log unic %-.200s.(1-999)\n" - rus "Невозможно создать уникальное имя файла журнала %-.200s.(1-999)\n" - serbian "Ne mogu da generišem jedinstveno ime log-file-a: '%-.200s.(1-999)'\n" - slo "Nemôžem vytvoriť unikátne meno log-súboru %-.200s.(1-999)\n" - spa "No puede crear un unico archivo log %-.200s.(1-999)\n" - swe "Kan inte generera ett unikt filnamn %-.200s.(1-999)\n" - ukr "Не можу згенерувати унікальне ім'я log-файлу %-.200s.(1-999)\n" + chi "无法生成唯一的log-filename%-.200s.(1-999)" + cze "Nemohu vytvořit jednoznačné jméno logovacího souboru %-.200s.(1-999)" + dan "Kan ikke lave unikt log-filnavn %-.200s.(1-999)" + eng "Can't generate a unique log-filename %-.200s.(1-999)" + est "Ei suuda luua unikaalset logifaili nime %-.200s.(1-999)" + fre "Ne peut générer un unique nom de journal %-.200s.(1-999)" + ger "Kann keinen eindeutigen Dateinamen für die Logdatei %-.200s(1-999) erzeugen" + greek "Αδύνατη η δημιουργία unique log-filename %-.200s.(1-999)" + hindi "एक अनूठा लॉग-फ़ाइल नाम %-.200s.(1-999) उत्पन्न नहीं कर सके" + hun "Egyedi log-filenev nem generalhato: %-.200s.(1-999)" + ita "Impossibile generare un nome del file log unico %-.200s.(1-999)" + jpn "一意なログファイル名 %-.200s.(1-999) を生成できません。" + kor "Unique 로그화일 '%-.200s'를 만들수 없습니다.(1-999)" + nla "Het is niet mogelijk een unieke naam te maken voor de logfile %-.200s.(1-999)" + nor "Kan ikke lage unikt loggfilnavn %-.200s.(1-999)" + norwegian-ny "Kan ikkje lage unikt loggfilnavn %-.200s.(1-999)" + pol "Nie można stworzyć unikalnej nazwy pliku z logiem %-.200s.(1-999)" + por "Não pode gerar um nome de arquivo de 'log' único '%-.200s'.(1-999)" + rum "Nu pot sa generez un nume de log unic %-.200s.(1-999)" + rus "Невозможно создать уникальное имя файла журнала %-.200s.(1-999)" + serbian "Ne mogu da generišem jedinstveno ime log-file-a: '%-.200s.(1-999)'" + slo "Nemôžem vytvoriť unikátne meno log-súboru %-.200s.(1-999)" + spa "No puede crear un unico archivo log %-.200s.(1-999)" + swe "Kan inte generera ett unikt filnamn %-.200s.(1-999)" + ukr "Не можу згенерувати унікальне ім'я log-файлу %-.200s.(1-999)" ER_TABLE_NOT_LOCKED_FOR_WRITE chi "表 '%-.192s' 有 READ 锁,无法更新" cze "Tabulka '%-.192s' byla zamčena s READ a nemůže být změněna" diff --git a/sql/sql_error.cc b/sql/sql_error.cc index 6a3730ed3df..e40a9a70f26 100644 --- a/sql/sql_error.cc +++ b/sql/sql_error.cc @@ -692,6 +692,7 @@ Sql_condition *Warning_info::push_warning(THD *thd, const char *msg) { Sql_condition *cond= NULL; + DBUG_ASSERT(msg[strlen(msg)-1] != '\n'); if (! m_read_only) { diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc index 54290cff242..6ad5159737c 100644 --- a/sql/sql_repl.cc +++ b/sql/sql_repl.cc @@ -4114,7 +4114,7 @@ bool mysql_show_binlog_events(THD* thd) if (lex_mi->pos > binlog_size) { snprintf(errmsg_buf, sizeof(errmsg_buf), "Invalid pos specified. Requested from pos:%llu is " - "greater than actual file size:%lu\n", lex_mi->pos, + "greater than actual file size:%lu", lex_mi->pos, (ulong)s.st_size); errmsg= errmsg_buf; goto err; diff --git a/sql/table.cc b/sql/table.cc index 1333cbff397..aaec593df76 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -3891,7 +3891,7 @@ static void print_long_unique_table(TABLE *table) "table->field[%u]->offset = %" PRIdPTR "\n" // `%td` not available "table->field[%u]->field_length = %d\n" "table->field[%u]->null_pos wrt to record 0 = %" PRIdPTR "\n" - "table->field[%u]->null_bit_pos = %d\n", + "table->field[%u]->null_bit_pos = %d", i, field->field_name.str, i, field->ptr- table->record[0], i, field->pack_length(), diff --git a/storage/connect/domdoc.cpp b/storage/connect/domdoc.cpp index b881a10628e..13f3180a59c 100644 --- a/storage/connect/domdoc.cpp +++ b/storage/connect/domdoc.cpp @@ -243,8 +243,10 @@ int DOMDOC::DumpDoc(PGLOBAL g, char *ofn) try { Docp->save(ofn); } catch(_com_error e) { - snprintf(g->Message, sizeof(g->Message), "%s: %s", MSG(COM_ERROR), - _com_util::ConvertBSTRToString(e.Description())); + int i = snprintf(g->Message, sizeof(g->Message), "%s: %s", MSG(COM_ERROR), + _com_util::ConvertBSTRToString(e.Description())); + for (i--; i >= 0 && g->Message[i] == '\n'; i--) + g->Message[i] = 0; rc = -1; } catch(...) {} diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index ad0f894f924..c2341aa667a 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -12684,7 +12684,7 @@ int create_table_info_t::create_table(bool create_fk) " on table %s. Please check" " the index definition to" " make sure it is of correct" - " type\n", + " type", FTS_DOC_ID_INDEX_NAME, m_table->name.m_name); @@ -12753,7 +12753,7 @@ int create_table_info_t::create_table(bool create_fk) "Create table '%s' with foreign key constraint" " failed. There is no index in the referenced" " table where the referenced columns appear" - " as the first columns.\n", m_table_name); + " as the first columns.", m_table_name); break; case DB_CHILD_NO_INDEX: @@ -12763,7 +12763,7 @@ int create_table_info_t::create_table(bool create_fk) "Create table '%s' with foreign key constraint" " failed. There is no index in the referencing" " table where referencing columns appear" - " as the first columns.\n", m_table_name); + " as the first columns.", m_table_name); break; case DB_NO_FK_ON_S_BASE_COL: push_warning_printf( @@ -12772,7 +12772,7 @@ int create_table_info_t::create_table(bool create_fk) "Create table '%s' with foreign key constraint" " failed. Cannot add foreign key constraint" " placed on the base column of stored" - " column. \n", + " column. ", m_table_name); default: break; @@ -14868,7 +14868,7 @@ ha_innobase::optimize( } else { push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, uint(err), - "InnoDB: Cannot defragment table %s: returned error code %d\n", + "InnoDB: Cannot defragment table %s: returned error code %d", m_prebuilt->table->name.m_name, err); if(err == ER_SP_ALREADY_EXISTS) { @@ -21376,8 +21376,7 @@ innodb_compression_algorithm_validate( if (compression_algorithm == PAGE_LZ4_ALGORITHM) { push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, HA_ERR_UNSUPPORTED, - "InnoDB: innodb_compression_algorithm = %lu unsupported.\n" - "InnoDB: liblz4 is not installed. \n", + "InnoDB: innodb_compression_algorithm = %lu unsupported. liblz4 is not installed.", compression_algorithm); DBUG_RETURN(1); } @@ -21387,8 +21386,7 @@ innodb_compression_algorithm_validate( if (compression_algorithm == PAGE_LZO_ALGORITHM) { push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, HA_ERR_UNSUPPORTED, - "InnoDB: innodb_compression_algorithm = %lu unsupported.\n" - "InnoDB: liblzo is not installed. \n", + "InnoDB: innodb_compression_algorithm = %lu unsupported. liblzo is not installed.", compression_algorithm); DBUG_RETURN(1); } @@ -21398,8 +21396,7 @@ innodb_compression_algorithm_validate( if (compression_algorithm == PAGE_LZMA_ALGORITHM) { push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, HA_ERR_UNSUPPORTED, - "InnoDB: innodb_compression_algorithm = %lu unsupported.\n" - "InnoDB: liblzma is not installed. \n", + "InnoDB: innodb_compression_algorithm = %lu unsupported. liblzma is not installed.", compression_algorithm); DBUG_RETURN(1); } @@ -21409,8 +21406,7 @@ innodb_compression_algorithm_validate( if (compression_algorithm == PAGE_BZIP2_ALGORITHM) { push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, HA_ERR_UNSUPPORTED, - "InnoDB: innodb_compression_algorithm = %lu unsupported.\n" - "InnoDB: libbz2 is not installed. \n", + "InnoDB: innodb_compression_algorithm = %lu unsupported. libbz2 is not installed.", compression_algorithm); DBUG_RETURN(1); } @@ -21420,8 +21416,7 @@ innodb_compression_algorithm_validate( if (compression_algorithm == PAGE_SNAPPY_ALGORITHM) { push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, HA_ERR_UNSUPPORTED, - "InnoDB: innodb_compression_algorithm = %lu unsupported.\n" - "InnoDB: libsnappy is not installed. \n", + "InnoDB: innodb_compression_algorithm = %lu unsupported. libsnappy is not installed.", compression_algorithm); DBUG_RETURN(1); } diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index 761ad0b7443..121f2056b55 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -5429,7 +5429,7 @@ static int sort_get_next_record(MARIA_SORT_PARAM *sort_param) if (! searching) _ma_check_print_info(param, "Found block with wrong recordlength: %lu " - "at %s\n", + "at %s", block_info.rec_len, llstr(sort_param->pos,llbuff)); continue; @@ -6429,7 +6429,7 @@ void _ma_update_auto_increment_key(HA_CHECK *param, MARIA_HA *info, { if (!(param->testflag & T_VERY_SILENT)) _ma_check_print_info(param, - "Table: %s doesn't have an auto increment key\n", + "Table: %s doesn't have an auto increment key", param->isam_file_name); DBUG_VOID_RETURN; } diff --git a/storage/myisam/mi_check.c b/storage/myisam/mi_check.c index 2bf400d08f3..e46dc35f861 100644 --- a/storage/myisam/mi_check.c +++ b/storage/myisam/mi_check.c @@ -1272,7 +1272,7 @@ int chk_data_link(HA_CHECK *param, MI_INFO *info, my_bool extend) (HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD))) { mi_check_print_warning(param, - "Record checksum is not the same as checksum stored in the index file\n"); + "Record checksum is not the same as checksum stored in the index file"); error=1; } else if (!extend) @@ -3625,7 +3625,7 @@ static int sort_get_next_record(MI_SORT_PARAM *sort_param) block_info.rec_len > (uint) share->max_pack_length) { if (! searching) - mi_check_print_info(param,"Found block with wrong recordlength: %ld at %s\n", + mi_check_print_info(param,"Found block with wrong recordlength: %ld at %s", block_info.rec_len, llstr(sort_param->pos,llbuff)); continue; @@ -4135,7 +4135,7 @@ static int sort_delete_record(MI_SORT_PARAM *sort_param) if (info->s->options & HA_OPTION_COMPRESS_RECORD) { mi_check_print_error(param, - "Recover aborted; Can't run standard recovery on compressed tables with errors in data-file. Use switch 'myisamchk --safe-recover' to fix it\n"); + "Recover aborted; Can't run standard recovery on compressed tables with errors in data-file. Use switch 'myisamchk --safe-recover' to fix it"); DBUG_RETURN(1); } @@ -4537,7 +4537,7 @@ void update_auto_increment_key(HA_CHECK *param, MI_INFO *info, { if (!(param->testflag & T_VERY_SILENT)) mi_check_print_info(param, - "Table: %s doesn't have an auto increment key\n", + "Table: %s doesn't have an auto increment key", param->isam_file_name); DBUG_VOID_RETURN; } From 3bf8b60cafb6f78759fbf06eab70f23a8ba546a9 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 28 Dec 2024 20:16:22 +0100 Subject: [PATCH 80/84] clarify the message when filesort is aborted by LIMIT ROWS EXAMINED --- mysql-test/main/information_schema.result | 2 +- mysql-test/main/limit_rows_examined.result | 4 ++-- sql/filesort.cc | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql-test/main/information_schema.result b/mysql-test/main/information_schema.result index ebc1aeffce4..502373c8bef 100644 --- a/mysql-test/main/information_schema.result +++ b/mysql-test/main/information_schema.result @@ -2240,7 +2240,7 @@ drop database dummy; USE test; CREATE VIEW v AS SELECT table_schema AS object_schema, table_name AS object_name, table_type AS object_type FROM information_schema.tables ORDER BY object_schema; SELECT * FROM v LIMIT ROWS EXAMINED 9; -ERROR HY000: Sort aborted: +ERROR HY000: Sort aborted: LIMIT ROWS EXAMINED DROP VIEW v; # # MDEV-23408 Wrong result upon query from I_S and further Assertion `!alias_arg || strlen(alias_arg->str) == alias_arg->length' failed with certain connection charset diff --git a/mysql-test/main/limit_rows_examined.result b/mysql-test/main/limit_rows_examined.result index 7bea8862c18..99c48dba454 100644 --- a/mysql-test/main/limit_rows_examined.result +++ b/mysql-test/main/limit_rows_examined.result @@ -608,7 +608,7 @@ select c1, c2 from t3 order by c2, c1 LIMIT ROWS EXAMINED 2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t3 ALL NULL NULL NULL NULL 5 Using filesort select c1, c2 from t3 order by c2, c1 LIMIT ROWS EXAMINED 2; -ERROR HY000: Sort aborted: +ERROR HY000: Sort aborted: LIMIT ROWS EXAMINED explain select c1, c2 from t3i order by c2, c1 LIMIT ROWS EXAMINED 2; id select_type table type possible_keys key key_len ref rows Extra @@ -624,7 +624,7 @@ select c1, c2 from t3i order by c2, c1 desc LIMIT ROWS EXAMINED 2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t3i index NULL it3j 8 NULL 5 Using index; Using filesort select c1, c2 from t3i order by c2, c1 desc LIMIT ROWS EXAMINED 2; -ERROR HY000: Sort aborted: +ERROR HY000: Sort aborted: LIMIT ROWS EXAMINED drop table t3,t3i; ========================================================================= INSERT/DELETE/UPDATE diff --git a/sql/filesort.cc b/sql/filesort.cc index 6f7513275bd..822c52700a6 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -474,7 +474,7 @@ SORT_INFO *filesort(THD *thd, TABLE *table, Filesort *filesort, MYF(0), ER_THD(thd, ER_FILSORT_ABORT), kill_errno ? ER_THD(thd, kill_errno) : - thd->killed == ABORT_QUERY ? "" : + thd->killed == ABORT_QUERY ? "LIMIT ROWS EXAMINED" : thd->get_stmt_da()->message()); if (global_system_variables.log_warnings > 1) From 1d6f857534eeadd1b6aaa37d8e27c081421d2ffa Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 29 Dec 2024 16:20:19 +0100 Subject: [PATCH 81/84] MDEV-35607 Compile error with gcc-15 (signal returns) set policy CMP0067 to NEW, this will make try_compile to use project-wide CMAKE_C_STANDARD and CMAKE_CXX_STANDARD settings --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 36b6a91068d..642f7b39b99 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 CMP0074 CMP0075 CMP0069 CMP0135) +FOREACH(p CMP0022 CMP0046 CMP0040 CMP0048 CMP0054 CMP0067 CMP0074 CMP0075 CMP0069 CMP0135) IF(POLICY ${p}) CMAKE_POLICY(SET ${p} NEW) ENDIF() From 3bbbeae792433e87a88b9b5773eade4486a7504b Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 7 Jan 2025 16:46:32 +0100 Subject: [PATCH 82/84] fix a memory leak --- sql/sql_window.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sql/sql_window.cc b/sql/sql_window.cc index 565a1b964b5..3f3b63e53ed 100644 --- a/sql/sql_window.cc +++ b/sql/sql_window.cc @@ -2730,7 +2730,10 @@ bool get_window_functions_required_cursors( item_win_func->requires_special_cursors()) { if (add_special_frame_cursors(thd, cursor_manager, item_win_func)) + { + delete cursor_manager; return true; + } cursor_managers->push_back(cursor_manager); continue; } From 2294ecdf0eccc1dcba511f596f814e9ee6dce5ee Mon Sep 17 00:00:00 2001 From: Tony Chen Date: Fri, 20 Sep 2024 01:05:52 +0000 Subject: [PATCH 83/84] Add MTR to ensure startup fails with invalid ssl-cipher Add a simple test to verify that the server will fail to start up when no valid cipher suites are passed to `ssl-cipher`. As different TLS libraries and versions have differing cipher suite support, it would be a good idea to ensure the server behaves in a safe manner if it is configured with invalid cipher suites. 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. --- mysql-test/main/bad_startup_options.result | 1 + mysql-test/main/bad_startup_options.test | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/mysql-test/main/bad_startup_options.result b/mysql-test/main/bad_startup_options.result index b1eed54e172..7846e629ef8 100644 --- a/mysql-test/main/bad_startup_options.result +++ b/mysql-test/main/bad_startup_options.result @@ -1,2 +1,3 @@ FOUND 1 /\[ERROR\] SSL error: Unable to get certificate/ in errorlog.err +FOUND 1 /\[ERROR\] SSL error: Failed to set ciphers to use/ in errorlog.err # restart diff --git a/mysql-test/main/bad_startup_options.test b/mysql-test/main/bad_startup_options.test index e758d786049..ba88476625d 100644 --- a/mysql-test/main/bad_startup_options.test +++ b/mysql-test/main/bad_startup_options.test @@ -19,4 +19,11 @@ --source include/search_pattern_in_file.inc --remove_file $SEARCH_FILE +# No valid cipher suites +--error 1 +--exec $MYSQLD --defaults-group-suffix=.1 --defaults-file=$MYSQLTEST_VARDIR/my.cnf --ssl-cipher=ECDHE-ECDSA-FAKE-CIPHER:ECDHE-RSA-INVALID --log-error=$errorlog +--let SEARCH_PATTERN=\[ERROR\] SSL error: Failed to set ciphers to use +--source include/search_pattern_in_file.inc +--remove_file $SEARCH_FILE + --source include/start_mysqld.inc From 28b295808281a882ca3a2be223973eb2475ac656 Mon Sep 17 00:00:00 2001 From: Tony Chen Date: Fri, 20 Sep 2024 02:59:10 +0000 Subject: [PATCH 84/84] Add MTR to verify behavior on incompatible TLS configuration Add a simple test to verify the server behaves in a safe manner if configured with ciphers that aren't compatible with the server certificate. 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. --- mysql-test/main/ssl_cipher.result | 3 +++ mysql-test/main/ssl_cipher.test | 17 +++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/mysql-test/main/ssl_cipher.result b/mysql-test/main/ssl_cipher.result index d549ec7d2b4..c6a6a0d94d5 100644 --- a/mysql-test/main/ssl_cipher.result +++ b/mysql-test/main/ssl_cipher.result @@ -68,3 +68,6 @@ disconnect ssl_con; connection default; call mtr.add_suppression("TLSv1.0 and TLSv1.1 are insecure"); FOUND 2 /TLSv1.0 and TLSv1.1 are insecure/ in mysqld.1.err +# restart: --ssl-cipher=ECDHE-ECDSA-AES128-GCM-SHA256 +Variable_name Value +Ssl_version diff --git a/mysql-test/main/ssl_cipher.test b/mysql-test/main/ssl_cipher.test index 0d33ec5d5e0..62e9a90d915 100644 --- a/mysql-test/main/ssl_cipher.test +++ b/mysql-test/main/ssl_cipher.test @@ -112,3 +112,20 @@ call mtr.add_suppression("TLSv1.0 and TLSv1.1 are insecure"); --let SEARCH_FILE=$MYSQLTEST_VARDIR/log/mysqld.1.err --let SEARCH_PATTERN= TLSv1.0 and TLSv1.1 are insecure --source include/search_pattern_in_file.inc + +# +# Server is configured with ciphers that are not compatible with the server certificate (std_data/cacert.pem is RSA) +# +let $restart_parameters=--ssl-cipher=ECDHE-ECDSA-AES128-GCM-SHA256; +source include/restart_mysqld.inc; + +# Connections are rejected as client attempts tls by default +--error 1 +--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'ssl_version'" + +# Connections are rejected if client explicitly specifies tls +--error 1 +--exec $MYSQL --host=localhost --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-verify-server-cert -e "SHOW STATUS LIKE 'ssl_version'" + +# Connections can be made with --skip-ssl +--exec $MYSQL --host=localhost --skip-ssl -e "SHOW STATUS LIKE 'ssl_version'"