From d48428e99aa7435ff72e2df7da05f35363e90ec3 Mon Sep 17 00:00:00 2001 From: Rucha Deodhar Date: Mon, 1 Aug 2022 19:39:09 +0530 Subject: MDEV-27151: JSON_VALUE() does not parse NULL properties properly Analysis: JSON_VALUE() returns "null" string instead of NULL pointer. Fix: When the type is JSON_VALUE_NULL (which is also a scalar) set null_value to true and return 0 instead of returning string. --- mysql-test/main/func_json.result | 27 +++++++++++++++++++++++++++ mysql-test/main/func_json.test | 19 +++++++++++++++++++ 2 files changed, 46 insertions(+) (limited to 'mysql-test') diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index 8e3b47e322a..2c3cb2f1e72 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -1016,5 +1016,32 @@ j {"ID": "4", "Name": "Betty", "Age": 19} drop table t1; # +# MDEV-27151: JSON_VALUE() does not parse NULL properties properly +# +# +# It is correct for JSON_EXTRACT() to give null instead of "NULL" because +# it returns the json literal that is put inside json. +# Hence it should return null as in 'null' string and not SQL NULL. +# JSON_VALUE() returns the "VALUE" so it is correct for it to return SQl NULL +# +SELECT NULL; +NULL +NULL +SELECT JSON_VALUE('{"nulltest": null}', '$.nulltest'); +JSON_VALUE('{"nulltest": null}', '$.nulltest') +NULL +SELECT 1 + NULL; +1 + NULL +NULL +SELECT 1 + JSON_VALUE('{"nulltest": null}', '$.nulltest'); +1 + JSON_VALUE('{"nulltest": null}', '$.nulltest') +NULL +SELECT NULL; +NULL +NULL +SELECT JSON_EXTRACT('{"a":null, "b":10, "c":"null"}', '$.a'); +JSON_EXTRACT('{"a":null, "b":10, "c":"null"}', '$.a') +null +# # End of 10.3 tests # diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index 16f323a9a56..51961c0406a 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -627,6 +627,25 @@ SELECT * FROM t1 WHERE JSON_EXTRACT(j, '$.Age')=19; drop table t1; +--echo # +--echo # MDEV-27151: JSON_VALUE() does not parse NULL properties properly +--echo # +--echo # +--echo # It is correct for JSON_EXTRACT() to give null instead of "NULL" because +--echo # it returns the json literal that is put inside json. +--echo # Hence it should return null as in 'null' string and not SQL NULL. +--echo # JSON_VALUE() returns the "VALUE" so it is correct for it to return SQl NULL +--echo # + +SELECT NULL; +SELECT JSON_VALUE('{"nulltest": null}', '$.nulltest'); +SELECT 1 + NULL; +SELECT 1 + JSON_VALUE('{"nulltest": null}', '$.nulltest'); + + +SELECT NULL; +SELECT JSON_EXTRACT('{"a":null, "b":10, "c":"null"}', '$.a'); + --echo # --echo # End of 10.3 tests --echo # -- cgit v1.2.1 From 32167225c728c19ca478bce0529d549a8d056f87 Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Tue, 16 Aug 2022 17:34:38 +0530 Subject: MDEV-13013 InnoDB unnecessarily extends data files - While creating a new InnoDB segment, allocates the extent before allocating the inode or page allocation even though the pages are present in fragment segment. This patch does reserve the extent when InnoDB ran out of fragment pages in the tablespace. --- .../suite/innodb/r/check_ibd_filesize,32k.rdiff | 12 +++++------ .../suite/innodb/r/check_ibd_filesize,4k.rdiff | 12 +++++------ .../suite/innodb/r/check_ibd_filesize,64k.rdiff | 12 +++++------ .../suite/innodb/r/check_ibd_filesize,8k.rdiff | 12 +++++------ .../suite/innodb/r/check_ibd_filesize.result | 4 ++-- mysql-test/suite/innodb/t/temporary_table.test | 1 + .../suite/mariabackup/log_page_corruption.result | 24 +++++++++++----------- 7 files changed, 39 insertions(+), 38 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize,32k.rdiff b/mysql-test/suite/innodb/r/check_ibd_filesize,32k.rdiff index 6cf0fdf4159..44446602b9f 100644 --- a/mysql-test/suite/innodb/r/check_ibd_filesize,32k.rdiff +++ b/mysql-test/suite/innodb/r/check_ibd_filesize,32k.rdiff @@ -1,18 +1,18 @@ ---- check_ibd_filesize.result -+++ check_ibd_filesize.result,32k +--- mysql-test/suite/innodb/r/check_ibd_filesize.result 2022-08-16 17:28:06.462350465 +0530 ++++ mysql-test/suite/innodb/r/check_ibd_filesize.reject 2022-08-16 17:29:25.129637040 +0530 @@ -3,18 +3,12 @@ # SPACE IN 5.7 THAN IN 5.6 # CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; --# bytes: 98304 -+# bytes: 196608 +-# bytes: 65536 ++# bytes: 131072 INSERT INTO t1 SELECT * FROM seq_1_to_25000; -# bytes: 9437184 +# bytes: 786432 DROP TABLE t1; CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB; --# bytes: 98304 -+# bytes: 196608 +-# bytes: 65536 ++# bytes: 131072 INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; -# bytes: 4194304 -DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize,4k.rdiff b/mysql-test/suite/innodb/r/check_ibd_filesize,4k.rdiff index 52cd6832755..ef55ad971fe 100644 --- a/mysql-test/suite/innodb/r/check_ibd_filesize,4k.rdiff +++ b/mysql-test/suite/innodb/r/check_ibd_filesize,4k.rdiff @@ -1,17 +1,17 @@ ---- check_ibd_filesize.result -+++ check_ibd_filesize.result,4k +--- mysql-test/suite/innodb/r/check_ibd_filesize.result 2022-08-16 17:28:06.462350465 +0530 ++++ mysql-test/suite/innodb/r/check_ibd_filesize.reject 2022-08-16 17:31:39.288769153 +0530 @@ -3,18 +3,18 @@ # SPACE IN 5.7 THAN IN 5.6 # CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; --# bytes: 98304 -+# bytes: 24576 +-# bytes: 65536 ++# bytes: 16384 INSERT INTO t1 SELECT * FROM seq_1_to_25000; # bytes: 9437184 DROP TABLE t1; CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB; --# bytes: 98304 -+# bytes: 24576 +-# bytes: 65536 ++# bytes: 16384 INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; # bytes: 4194304 DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize,64k.rdiff b/mysql-test/suite/innodb/r/check_ibd_filesize,64k.rdiff index 23d9fbe608f..bcdcea31160 100644 --- a/mysql-test/suite/innodb/r/check_ibd_filesize,64k.rdiff +++ b/mysql-test/suite/innodb/r/check_ibd_filesize,64k.rdiff @@ -1,18 +1,18 @@ ---- check_ibd_filesize.result -+++ check_ibd_filesize.result,64k +--- mysql-test/suite/innodb/r/check_ibd_filesize.result 2022-08-16 17:28:06.462350465 +0530 ++++ mysql-test/suite/innodb/r/check_ibd_filesize.reject 2022-08-16 17:30:28.957174270 +0530 @@ -3,18 +3,12 @@ # SPACE IN 5.7 THAN IN 5.6 # CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; --# bytes: 98304 -+# bytes: 393216 +-# bytes: 65536 ++# bytes: 262144 INSERT INTO t1 SELECT * FROM seq_1_to_25000; -# bytes: 9437184 +# bytes: 983040 DROP TABLE t1; CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB; --# bytes: 98304 -+# bytes: 393216 +-# bytes: 65536 ++# bytes: 262144 INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; -# bytes: 4194304 -DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize,8k.rdiff b/mysql-test/suite/innodb/r/check_ibd_filesize,8k.rdiff index 17936a3def9..7b699ef4cea 100644 --- a/mysql-test/suite/innodb/r/check_ibd_filesize,8k.rdiff +++ b/mysql-test/suite/innodb/r/check_ibd_filesize,8k.rdiff @@ -1,17 +1,17 @@ ---- check_ibd_filesize.result -+++ check_ibd_filesize.result,8k +--- mysql-test/suite/innodb/r/check_ibd_filesize.result 2022-08-16 17:28:06.462350465 +0530 ++++ mysql-test/suite/innodb/r/check_ibd_filesize.reject 2022-08-16 17:31:03.516962339 +0530 @@ -3,18 +3,18 @@ # SPACE IN 5.7 THAN IN 5.6 # CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; --# bytes: 98304 -+# bytes: 49152 +-# bytes: 65536 ++# bytes: 32768 INSERT INTO t1 SELECT * FROM seq_1_to_25000; # bytes: 9437184 DROP TABLE t1; CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB; --# bytes: 98304 -+# bytes: 49152 +-# bytes: 65536 ++# bytes: 32768 INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; # bytes: 4194304 DROP TABLE t1; diff --git a/mysql-test/suite/innodb/r/check_ibd_filesize.result b/mysql-test/suite/innodb/r/check_ibd_filesize.result index a6f5fbd9387..0d224d6ac5f 100644 --- a/mysql-test/suite/innodb/r/check_ibd_filesize.result +++ b/mysql-test/suite/innodb/r/check_ibd_filesize.result @@ -3,12 +3,12 @@ # SPACE IN 5.7 THAN IN 5.6 # CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB; -# bytes: 98304 +# bytes: 65536 INSERT INTO t1 SELECT * FROM seq_1_to_25000; # bytes: 9437184 DROP TABLE t1; CREATE TABLE t1 (a INT PRIMARY KEY, b BLOB) ENGINE=InnoDB; -# bytes: 98304 +# bytes: 65536 INSERT INTO t1 SELECT seq,REPEAT('a',30000) FROM seq_1_to_20; # bytes: 4194304 DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/temporary_table.test b/mysql-test/suite/innodb/t/temporary_table.test index 5f64eb7d22b..cc290b03c34 100644 --- a/mysql-test/suite/innodb/t/temporary_table.test +++ b/mysql-test/suite/innodb/t/temporary_table.test @@ -5,6 +5,7 @@ # --source include/have_innodb.inc +--source include/innodb_page_size.inc # Embedded server does not restart of server --source include/not_embedded.inc --source include/no_valgrind_without_big.inc diff --git a/mysql-test/suite/mariabackup/log_page_corruption.result b/mysql-test/suite/mariabackup/log_page_corruption.result index 01ad4422c6a..b1dc6c8fd5f 100644 --- a/mysql-test/suite/mariabackup/log_page_corruption.result +++ b/mysql-test/suite/mariabackup/log_page_corruption.result @@ -30,13 +30,13 @@ FOUND 1 /Database page corruption detected.*/ in backup.log FOUND 1 /completed OK!/ in backup.log --- "innodb_corrupted_pages" file content: --- test/t1_corrupted -6 8 9 +4 6 7 test/t2_corrupted -7 8 10 +5 6 8 test/t4_corrupted_new 1 test/t5_corrupted_to_rename_renamed -6 +4 test/t7_corrupted_to_alter 3 ------ @@ -46,19 +46,19 @@ INSERT INTO t3_inc VALUES (3), (4), (5), (6), (7), (8), (9); # Backup must not fail, but "innodb_corrupted_pages" file must be created due to --log-innodb-page-corruption option --- "innodb_corrupted_pages" file content: --- test/t1_corrupted -6 8 9 +4 6 7 test/t1_inc_corrupted -6 8 9 +4 6 7 test/t2_corrupted -7 8 10 +5 6 8 test/t2_inc_corrupted -7 8 10 +5 6 8 test/t4_inc_corrupted_new 1 test/t5_corrupted_to_rename_renamed -6 +4 test/t5_inc_corrupted_to_rename_renamed -6 +4 test/t7_inc_corrupted_to_alter 3 ------ @@ -82,15 +82,15 @@ DROP TABLE t7_inc_corrupted_to_alter; # Full backup with --log-innodb-page-corruption --- "innodb_corrupted_pages" file content: --- test/t3 -6 8 +4 6 ------ # Extend some tablespace and corrupt extended pages for incremental backup # Incremental backup --log-innodb-page-corruption --- "innodb_corrupted_pages" file content: --- test/t3 -6 8 +4 6 test/t3_inc -6 8 +4 6 ------ # Full backup prepare # "innodb_corrupted_pages" file must not exist after successful prepare -- cgit v1.2.1 From fd0cd4801a00c61adb5ab6cbefcf360467a02f20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 22 Aug 2022 12:32:47 +0300 Subject: MDEV-13013 fixup: Adjust a test --- .../suite/innodb_zip/r/wl6347_comp_indx_stat.result | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb_zip/r/wl6347_comp_indx_stat.result b/mysql-test/suite/innodb_zip/r/wl6347_comp_indx_stat.result index bc766135e56..c48bc32d596 100644 --- a/mysql-test/suite/innodb_zip/r/wl6347_comp_indx_stat.result +++ b/mysql-test/suite/innodb_zip/r/wl6347_comp_indx_stat.result @@ -1022,7 +1022,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 122880 +The size of the tab5.ibd file: 106496 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data @@ -1329,7 +1329,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 245760 +The size of the tab5.ibd file: 212992 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data @@ -2633,7 +2633,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 122880 +The size of the tab5.ibd file: 106496 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data @@ -2942,7 +2942,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 245760 +The size of the tab5.ibd file: 212992 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data @@ -4147,7 +4147,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 122880 +The size of the tab5.ibd file: 106496 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data @@ -4435,7 +4435,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 245760 +The size of the tab5.ibd file: 212992 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data @@ -5692,7 +5692,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 122880 +The size of the tab5.ibd file: 106496 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data @@ -5999,7 +5999,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 245760 +The size of the tab5.ibd file: 212992 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data @@ -7282,7 +7282,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 122880 +The size of the tab5.ibd file: 106496 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data @@ -7589,7 +7589,7 @@ AND compress_ops BETWEEN @inl_val AND 1000 AND table_name='tab5' AND database_name='test' AND index_name like 'idx%' ; compress_stat 1 -The size of the tab5.ibd file: 245760 +The size of the tab5.ibd file: 212992 # for determintic resons simple data should be inserted. # insert some 100 records # Load the data -- cgit v1.2.1 From 6005f3c548d312f48b575961889194a0a4767ae1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Mon, 22 Aug 2022 12:33:46 +0300 Subject: MDEV-25257 follow-up: Fix a test Ever since commit 09177eadc39ae1e777ad473970456cb9dd9c3993 the test innodb.row_format_redundant cannot work when the data file was created with innodb_checksum_algorithm=full_crc32. Backport of 10.5 commit a9d0bb12e68a11c119a3534f354c7a7ef13dd5b5 --- mysql-test/suite/innodb/t/row_format_redundant.opt | 1 + 1 file changed, 1 insertion(+) create mode 100644 mysql-test/suite/innodb/t/row_format_redundant.opt (limited to 'mysql-test') diff --git a/mysql-test/suite/innodb/t/row_format_redundant.opt b/mysql-test/suite/innodb/t/row_format_redundant.opt new file mode 100644 index 00000000000..c44c611ed60 --- /dev/null +++ b/mysql-test/suite/innodb/t/row_format_redundant.opt @@ -0,0 +1 @@ +--innodb-checksum-algorithm=crc32 -- cgit v1.2.1