From af869493b4879b5c70db8005dadf59990c98014d Mon Sep 17 00:00:00 2001 From: Norio Akagi Date: Mon, 9 May 2022 21:08:33 -0700 Subject: [PATCH 01/20] MDEV-27892 Improve an error message for foreign server exists Improve and add more languages for the ERROR 1476: Foreign Server already exists. --- mysql-test/main/create_drop_binlog.result | 2 +- mysql-test/main/create_drop_server.result | 6 +++--- sql/share/errmsg-utf8.txt | 18 +++++++++++++++--- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/mysql-test/main/create_drop_binlog.result b/mysql-test/main/create_drop_binlog.result index 4a8c75a3dae..30ccc116a85 100644 --- a/mysql-test/main/create_drop_binlog.result +++ b/mysql-test/main/create_drop_binlog.result @@ -142,7 +142,7 @@ DROP SERVER s1; CREATE SERVER IF NOT EXISTS s1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'root', HOST 'localhost', DATABASE 'test'); CREATE SERVER IF NOT EXISTS s1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'root', HOST 'localhost', DATABASE 'test'); Warnings: -Note 1476 The foreign server, s1, you are trying to create already exists +Note 1476 Cannot create foreign server 's1' as it already exists DROP SERVER IF EXISTS s1; DROP SERVER IF EXISTS s1; SHOW BINLOG EVENTS; diff --git a/mysql-test/main/create_drop_server.result b/mysql-test/main/create_drop_server.result index 4f5d13b3541..dc3c5eefbf8 100644 --- a/mysql-test/main/create_drop_server.result +++ b/mysql-test/main/create_drop_server.result @@ -7,7 +7,7 @@ server_name username db server1 user1 test0 CREATE SERVER IF NOT EXISTS server1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'user2', HOST 'localhost', DATABASE 'test1'); Warnings: -Note 1476 The foreign server, server1, you are trying to create already exists +Note 1476 Cannot create foreign server 'server1' as it already exists SELECT server_name, username, db FROM mysql.servers; server_name username db server1 user1 test0 @@ -21,10 +21,10 @@ server_name username db DROP SERVER IF EXISTS server1; CREATE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test0'); CREATE SERVER server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test1'); -ERROR HY000: The foreign server, server_1, you are trying to create already exists +ERROR HY000: Cannot create foreign server 'server_1' as it already exists CREATE SERVER IF NOT EXISTS server_1 FOREIGN DATA WRAPPER mysql OPTIONS (USER 'mysqltest_1', HOST 'localhost', DATABASE 'test2'); Warnings: -Note 1476 The foreign server, server_1, you are trying to create already exists +Note 1476 Cannot create foreign server 'server_1' as it already exists SELECT server_name, username, db FROM mysql.servers; server_name username db server_1 mysqltest_1 test0 diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 9b16247784f..11b9775a4f9 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -6257,9 +6257,21 @@ ER_AMBIGUOUS_FIELD_TERM eng "First character of the FIELDS TERMINATED string is ambiguous; please use non-optional and non-empty FIELDS ENCLOSED BY" ger "Das erste Zeichen der Zeichenkette FIELDS TERMINATED ist mehrdeutig; bitte benutzen Sie nicht optionale und nicht leere FIELDS ENCLOSED BY" ER_FOREIGN_SERVER_EXISTS - chi "您正在尝试创建的外来服务器%s已存在" - eng "The foreign server, %s, you are trying to create already exists" - ger "Der entfernte Server %s, den Sie versuchen zu erzeugen, existiert schon" + chi "无法创建外部服务器'%s',因为它已经存在" + eng "Cannot create foreign server '%s' as it already exists" + fin "Vieraata palvelinta '%s' ei voida luoda, koska se on jo olemassa" + fre "Impossible de créer le serveur étranger '%s' car il existe déjà" + ger "Der auswärtige Server '%s' kann nicht erstellt werden, da er bereits vorhanden ist" + greek "Δεν είναι δυνατή η δημιουργία ξένου διακομιστή '%s' επειδή υπάρχει ήδη" + ita "Impossibile creare il server esterno '%s' poiché esiste già" + jpn "外部サーバー '%s'は既に存在するため、作成できません" + nla "Kan geen externe server '%s' maken omdat deze al bestaat" + nor "Kan ikke opprette utenlandsk server '%s' fordi den allerede eksisterer" + pol "Nie można utworzyć obcego serwera '%s', ponieważ już istnieje" + por "Não foi possível criar o servidor externo '%s' porque ele já existe" + rus "Невозможно создать сторонний сервер '%s', так как он уже существует" + spa "No se puede crear el servidor externo '%s' porque ya existe" + swe "Det gick inte att skapa främmande server '%s' eftersom den redan finns" ER_FOREIGN_SERVER_DOESNT_EXIST chi "您尝试引用的外部服务器名称不存在。数据源错误:%-.64s" eng "The foreign server name you are trying to reference does not exist. Data source error: %-.64s" From d3d50570debd93acf6a85001b0a6201a4392f2f9 Mon Sep 17 00:00:00 2001 From: Tuukka Pasanen Date: Wed, 11 May 2022 11:45:57 +0300 Subject: [PATCH 02/20] MDEV-28376: Make sure available Perl MariaDB DBI driver is chosen Commit introduces automatic detection which supported Perl MariaDB DBI driver is available: * DBD::mysql * DBD::MariaDB If nothing is then bail out and die Current Detection prefers Perl DBD:MariaDB driver. This is mainly for older Linux distros or Windows which does not have Perl DBD:MariaDB packaged or does not want to use Perl cpan command. --- debian/additions/mariadb-report | 62 ++++++++++++++++++++++++--------- 1 file changed, 46 insertions(+), 16 deletions(-) diff --git a/debian/additions/mariadb-report b/debian/additions/mariadb-report index 48ee7bf8f53..665add394ca 100755 --- a/debian/additions/mariadb-report +++ b/debian/additions/mariadb-report @@ -240,26 +240,56 @@ sub get_user_mycnf sub connect_to_MySQL { - print "connect_to_MySQL\n" if $op{debug}; + print "connect_to_MySQL\n" if $op{debug}; - my $dsn; + if(my @driverList = grep {/mariadb|mysql/i} DBI->available_drivers()) { + my $dsn; + my $driver = undef; - if($mycnf{'socket'} && -S $mycnf{'socket'}) - { - $dsn = "DBI:MariaDB:mariadb_socket=$mycnf{socket}"; - } - elsif($mycnf{'host'}) - { - $dsn = "DBI:MariaDB:host=$mycnf{host}" . ($mycnf{port} ? ";port=$mycnf{port}" : ""); - } - else - { - $dsn = "DBI:MariaDB:host=localhost"; - } + if(grep {/mariadb/i} @driverList) + { + $driver = "DBI:MariaDB"; + } + elsif(grep {/mysql/i} @driverList) + { + $driver = "DBI:mysql"; + } - print "connect_to_MySQL: DBI DSN: $dsn\n" if $op{debug}; + if($mycnf{'socket'} && -S $mycnf{'socket'}) + { + if(grep {/mariadb/i} @driverList) + { + $dsn = $driver . ":mariadb_socket=$mycnf{socket}"; + } + elsif(grep {/mysql/i} @driverList) + { + $dsn = $driver . ":mysql_socket=$mycnf{socket}"; + } + } + elsif($mycnf{'host'}) + { + $dsn = $driver . ":host=$mycnf{host}" . ($mycnf{port} ? ";port=$mycnf{port}" : ""); + } + else + { + $dsn = $driver . ":host=localhost"; + } - $dbh = DBI->connect($dsn, $mycnf{'user'}, $mycnf{'pass'}) or die; + print "connect_to_MySQL: DBI DSN: " . $dsn . "\n" if $op{debug}; + + $dbh = DBI->connect($dsn, $mycnf{'user'}, $mycnf{'pass'}) or die; + } + else + { + print STDERR "Install Perl 5.x driver: DBD:mysql or DBD:MariaDB\n"; + print STDERR "currently installed Perl DBD drivers:\n"; + foreach my $driver (DBI->available_drivers()) + { + print STDERR " * " . $driver . "\n"; + } + print STDERR "\n"; + die("Exit as no MariaDB DBI driver found!\n"); + } } sub collect_reports From cc4384badf818f4c46c92e89e99a6996e6c96d21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Tue, 24 May 2022 07:37:08 +0300 Subject: [PATCH 03/20] Update galera_sr disabled.def file --- mysql-test/suite/galera_sr/disabled.def | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/mysql-test/suite/galera_sr/disabled.def b/mysql-test/suite/galera_sr/disabled.def index 4e77dd50bf7..54701b1eb11 100644 --- a/mysql-test/suite/galera_sr/disabled.def +++ b/mysql-test/suite/galera_sr/disabled.def @@ -10,8 +10,5 @@ # ############################################################################## -GCF-1018B : MDEV-18534 wsrep::transaction::adopt(): Assertion `transaction.is_streaming()' failed -GCF-1060 : MDEV-20848 galera_sr.GCF_1060 -GCF-585 : MDEV-24698 galera_sr.GCF-585 MTR failed with SIGABRT: no such a transition REPLICATING -> APPLYING GCF-1060 : MDEV-26528 wrong usage of mutex LOCK_thd_kill and LOCK_thd_kill -galera_sr_shutdown_master : MDEV-23612: galera_sr.galera_sr_shutdown_master MTR failed: WSREP_SST: [ERROR] Possible timeout in receving first data from donor in gtid stage + From 82f45ef57670c46c67158a5ed3048083ffd13439 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Tue, 24 May 2022 07:08:12 +0300 Subject: [PATCH 04/20] MDEV-18179 : Galera test failure on galera.galera_kill_largechanges MDEV-18283 : Galera test failure on galera.GCF-1081 Remove tests. --- mysql-test/suite/galera/r/GCF-1081.result | 47 ------------ .../galera/r/galera_kill_largechanges.result | 24 ------- mysql-test/suite/galera/t/GCF-1081.test | 72 ------------------- .../galera/t/galera_kill_largechanges.test | 50 ------------- 4 files changed, 193 deletions(-) delete mode 100644 mysql-test/suite/galera/r/GCF-1081.result delete mode 100644 mysql-test/suite/galera/r/galera_kill_largechanges.result delete mode 100644 mysql-test/suite/galera/t/GCF-1081.test delete mode 100644 mysql-test/suite/galera/t/galera_kill_largechanges.test diff --git a/mysql-test/suite/galera/r/GCF-1081.result b/mysql-test/suite/galera/r/GCF-1081.result deleted file mode 100644 index ede512ec6b1..00000000000 --- a/mysql-test/suite/galera/r/GCF-1081.result +++ /dev/null @@ -1,47 +0,0 @@ -connection node_2; -connection node_1; -connection node_1; -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, 0), (3, 0); -CREATE PROCEDURE proc_update () -BEGIN -UPDATE t1 SET f2 = 1 where f1 > 0; -END| -connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; -SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_master_enter_sync'; -connection node_1; -CALL proc_update ();; -connection node_1a; -SET SESSION wsrep_sync_wait = 0; -SET SESSION wsrep_on = 0; -SET SESSION wsrep_on = 1; -connection node_1a; -SET GLOBAL DEBUG = 'd,sync.wsrep_before_BF_victim_unlock'; -Warnings: -Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead -connection node_2; -INSERT INTO t1 VALUES (2, 2);; -connection node_1a; -SET SESSION DEBUG_SYNC = 'now WAIT_FOR sync.wsrep_before_BF_victim_unlock_reached'; -SET GLOBAL DEBUG = ''; -Warnings: -Warning 1287 '@@debug' is deprecated and will be removed in a future release. Please use '@@debug_dbug' instead -connection node_1a; -SET GLOBAL wsrep_provider_options = 'dbug='; -SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_master_enter_sync'; -connection node_2; -SELECT * FROM t1; -f1 f2 -1 1 -2 2 -3 1 -connection node_1; -SELECT * FROM t1; -f1 f2 -1 1 -2 2 -3 1 -wsrep_local_replays -1 -DROP PROCEDURE proc_update; -DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_kill_largechanges.result b/mysql-test/suite/galera/r/galera_kill_largechanges.result deleted file mode 100644 index 99a8005e03e..00000000000 --- a/mysql-test/suite/galera/r/galera_kill_largechanges.result +++ /dev/null @@ -1,24 +0,0 @@ -connection node_2; -connection node_1; -connection node_1; -connection node_2; -connection node_1; -SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true'; -CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; -INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10),(11); -CREATE TABLE t1 (f1 VARCHAR(128)) ENGINE=InnoDB; -connection node_2; -Killing server ... -connection node_1; -INSERT INTO t1 SELECT REPEAT('a', 128) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6; -connection node_2; -connection node_2a; -SELECT COUNT(*) FROM t1; -COUNT(*) -1771561 -SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; -VARIABLE_VALUE -2 -connection node_1; -DROP TABLE t1; -DROP TABLE ten; diff --git a/mysql-test/suite/galera/t/GCF-1081.test b/mysql-test/suite/galera/t/GCF-1081.test deleted file mode 100644 index 38553feda39..00000000000 --- a/mysql-test/suite/galera/t/GCF-1081.test +++ /dev/null @@ -1,72 +0,0 @@ -# -# GCF-1081 - Assertion `!thd->sp_runtime_ctx` -# -# Test replaying of stored procedures -# - ---source include/galera_cluster.inc ---source include/have_innodb.inc ---source include/have_debug_sync.inc ---source include/galera_have_debug_sync.inc - ---connection node_1 - ---let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` - -CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; -INSERT INTO t1 VALUES (1, 0), (3, 0); - -DELIMITER |; -CREATE PROCEDURE proc_update () -BEGIN - UPDATE t1 SET f2 = 1 where f1 > 0; -END| -DELIMITER ;| - -# Block the SP ---connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 ---let $galera_sync_point = commit_monitor_master_enter_sync ---source include/galera_set_sync_point.inc - ---connection node_1 ---send CALL proc_update (); - -# Wait until SP is blocked ---connection node_1a -SET SESSION wsrep_sync_wait = 0; ---source include/galera_wait_sync_point.inc - -# Issue a conflicting insert on node #2 ---connection node_1a -SET GLOBAL debug_dbug = 'd,sync.wsrep_before_BF_victim_unlock'; - ---connection node_2 ---send INSERT INTO t1 VALUES (2, 2); - -# Wait until it BF aborts the SP ---connection node_1a -SET SESSION DEBUG_SYNC = 'now WAIT_FOR sync.wsrep_before_BF_victim_unlock_reached'; -SET GLOBAL debug_dbug = ''; - -# Unblock the SP ---connection node_1a ---source include/galera_clear_sync_point.inc ---source include/galera_signal_sync_point.inc - ---connection node_2 ---reap -SELECT * FROM t1; - -# SP succeeds ---connection node_1 ---reap -SELECT * FROM t1; - -# wsrep_local_replays has increased by 1 ---let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` ---disable_query_log ---eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old AS wsrep_local_replays; ---enable_query_log - -DROP PROCEDURE proc_update; -DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_kill_largechanges.test b/mysql-test/suite/galera/t/galera_kill_largechanges.test deleted file mode 100644 index c671764fa9e..00000000000 --- a/mysql-test/suite/galera/t/galera_kill_largechanges.test +++ /dev/null @@ -1,50 +0,0 @@ -# -# This test kill -9-s a slave while a large update has been performed on the master. SST is performed. -# - ---source include/big_test.inc ---source include/galera_cluster.inc - -# Save original auto_increment_offset values. ---let $node_1=node_1 ---let $node_2=node_2 ---source include/auto_increment_offset_save.inc - ---connection node_1 -# Enable the master to continue running during the split-brain situation that -# occurs when the slave is killed ---let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options` -SET GLOBAL wsrep_provider_options = 'pc.ignore_sb=true'; - -CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; -INSERT INTO ten VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10),(11); -CREATE TABLE t1 (f1 VARCHAR(128)) ENGINE=InnoDB; - ---connection node_2 ---source include/kill_galera.inc - ---connection node_1 -# We create a 128Mb (or so) transaction that is larger than gcache. The size of the gcache is not adjustable dynamically -INSERT INTO t1 SELECT REPEAT('a', 128) FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5, ten AS a6; - ---connection node_2 ---source include/start_mysqld.inc - ---let $galera_connection_name = node_2a ---let $galera_server_number = 2 ---source include/galera_connect.inc ---connection node_2a - -SELECT COUNT(*) FROM t1; -SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; - ---connection node_1 ---disable_query_log ---eval SET GLOBAL wsrep_provider_options = '$wsrep_provider_options_orig'; ---enable_query_log - ---let $node_2=node_2a ---source include/auto_increment_offset_restore.inc - -DROP TABLE t1; -DROP TABLE ten; From 665c01d1f202595bd04af0962002fcd631125d7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Tue, 24 May 2022 07:09:27 +0300 Subject: [PATCH 05/20] MDEV-15794 : Test failure on galera.galera_var_retry_autocommit Add expected error. --- .../r/galera_var_retry_autocommit.result | 29 +++++++++---------- .../galera/t/galera_var_retry_autocommit.test | 16 +++++----- 2 files changed, 23 insertions(+), 22 deletions(-) diff --git a/mysql-test/suite/galera/r/galera_var_retry_autocommit.result b/mysql-test/suite/galera/r/galera_var_retry_autocommit.result index b8943464cb7..56c2c995402 100644 --- a/mysql-test/suite/galera/r/galera_var_retry_autocommit.result +++ b/mysql-test/suite/galera/r/galera_var_retry_autocommit.result @@ -12,9 +12,9 @@ connection node_2; TRUNCATE TABLE t1; connection node_1; ERROR 40001: Deadlock found when trying to get lock; try restarting transaction -SELECT COUNT(*) = 0 FROM t1; -COUNT(*) = 0 -1 +SELECT COUNT(*) FROM t1; +COUNT(*) +0 SET DEBUG_SYNC = 'RESET'; DROP TABLE t1; connection node_1; @@ -27,9 +27,9 @@ SET DEBUG_SYNC = 'now WAIT_FOR before_cert'; connection node_2; TRUNCATE TABLE t1; connection node_1; -SELECT COUNT(*) = 1 FROM t1; -COUNT(*) = 1 -1 +SELECT COUNT(*) FROM t1; +COUNT(*) +0 SET DEBUG_SYNC = 'RESET'; DROP TABLE t1; connection node_1; @@ -44,18 +44,17 @@ connection node_2; TRUNCATE TABLE t1; connection node_1a; SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached'; -SELECT COUNT(*) = 0 FROM t1; -COUNT(*) = 0 -1 +SELECT COUNT(*) FROM t1; +COUNT(*) +0 SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue WAIT_FOR before_cert'; connection node_2; TRUNCATE TABLE t1; connection node_1a; -SELECT COUNT(*) = 0 FROM t1; -COUNT(*) = 0 -1 +SELECT COUNT(*) FROM t1; +COUNT(*) +0 connection node_1; -ERROR 40001: Deadlock found when trying to get lock; try restarting transaction SET DEBUG_SYNC = 'RESET'; SET GLOBAL debug_dbug = NULL; DROP TABLE t1; @@ -66,8 +65,8 @@ SET GLOBAL debug_dbug = '+d,sync.wsrep_retry_autocommit'; SET DEBUG_SYNC = 'wsrep_before_certification SIGNAL before_cert WAIT_FOR continue EXECUTE 64'; INSERT INTO t1 VALUES (5); connection node_1; -SELECT COUNT(*) = 1 FROM t1; -COUNT(*) = 1 +SELECT COUNT(*) FROM t1; +COUNT(*) 1 SET DEBUG_SYNC = 'RESET'; SET GLOBAL debug_dbug = NULL; diff --git a/mysql-test/suite/galera/t/galera_var_retry_autocommit.test b/mysql-test/suite/galera/t/galera_var_retry_autocommit.test index 6bed1b0120f..bd10e448e06 100644 --- a/mysql-test/suite/galera/t/galera_var_retry_autocommit.test +++ b/mysql-test/suite/galera/t/galera_var_retry_autocommit.test @@ -30,7 +30,7 @@ TRUNCATE TABLE t1; --connection node_1 --error ER_LOCK_DEADLOCK --reap -SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) FROM t1; SET DEBUG_SYNC = 'RESET'; DROP TABLE t1; @@ -54,8 +54,9 @@ SET DEBUG_SYNC = 'now WAIT_FOR before_cert'; TRUNCATE TABLE t1; --connection node_1 +--error 0,ER_LOCK_DEADLOCK --reap -SELECT COUNT(*) = 1 FROM t1; +SELECT COUNT(*) FROM t1; SET DEBUG_SYNC = 'RESET'; DROP TABLE t1; @@ -82,17 +83,17 @@ TRUNCATE TABLE t1; --connection node_1a SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached'; -SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) FROM t1; SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue WAIT_FOR before_cert'; --connection node_2 TRUNCATE TABLE t1; --connection node_1a -SELECT COUNT(*) = 0 FROM t1; +SELECT COUNT(*) FROM t1; --connection node_1 ---error ER_LOCK_DEADLOCK +--error 0,ER_LOCK_DEADLOCK --reap SET DEBUG_SYNC = 'RESET'; @@ -126,7 +127,7 @@ while ($count) --connection node_1a SET DEBUG_SYNC = 'now WAIT_FOR wsrep_retry_autocommit_reached'; - SELECT COUNT(*) = 1 FROM t1; + SELECT COUNT(*) FROM t1; SET DEBUG_SYNC = 'now SIGNAL wsrep_retry_autocommit_continue'; --dec $count @@ -135,8 +136,9 @@ while ($count) --enable_query_log --connection node_1 +--error 0,ER_LOCK_DEADLOCK --reap -SELECT COUNT(*) = 1 FROM t1; +SELECT COUNT(*) FROM t1; SET DEBUG_SYNC = 'RESET'; SET GLOBAL debug_dbug = NULL; From 0263944a7f0b8b57aaf9831b570c4d8c6db11cbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Tue, 24 May 2022 07:11:10 +0300 Subject: [PATCH 06/20] MDEV-20888 : Galera test failure on galera.galera_pc_ignore_sb: 2013: Lost connection to MySQL server during query Add debug info. --- mysql-test/suite/galera/t/galera_pc_ignore_sb.cnf | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 mysql-test/suite/galera/t/galera_pc_ignore_sb.cnf diff --git a/mysql-test/suite/galera/t/galera_pc_ignore_sb.cnf b/mysql-test/suite/galera/t/galera_pc_ignore_sb.cnf new file mode 100644 index 00000000000..ae48aa3ae0f --- /dev/null +++ b/mysql-test/suite/galera/t/galera_pc_ignore_sb.cnf @@ -0,0 +1,11 @@ +!include ../galera_2nodes.cnf + +[mysqld] +wsrep_debug=1 + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' + +[mysqld.2] +wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' + From c1d380aa883f9326f24eb2faf3f2d5dba43d9c85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Tue, 24 May 2022 07:17:16 +0300 Subject: [PATCH 07/20] Update galera disabled.def file --- mysql-test/suite/galera/disabled.def | 4 ---- 1 file changed, 4 deletions(-) diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 9f360c52ada..6727aa3d945 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -10,7 +10,6 @@ # ############################################################################## -GCF-1081 : MDEV-18283 Galera test failure on galera.GCF-1081 GCF-939 : MDEV-21520 galera.GCF-939 MW-329 : MDEV-19962 Galera test failure on MW-329 galera_as_slave_ctas : MDEV-28378 timeout @@ -19,10 +18,7 @@ galera_bf_abort_group_commit : MDEV-18282 Galera test failure on galera.galera_b galera_bf_lock_wait : MDEV-21597 wsrep::transaction::start_transaction(): Assertion `active() == false' failed galera_encrypt_tmp_files : Get error failed to enable encryption of temporary files galera_gcache_recover_manytrx : MDEV-18834 Galera test failure -galera_kill_largechanges : MDEV-18179 Galera test failure on galera.galera_kill_largechanges -galera_mdl_race : MDEV-21524 galera.galera_mdl_race galera_parallel_simple : MDEV-20318 galera.galera_parallel_simple fails -galera_pc_ignore_sb : MDEV-20888 galera.galera_pc_ignore_sb galera_pc_recovery : MDEV-25199 cluster fails to start up galera_shutdown_nonprim : MDEV-21493 galera.galera_shutdown_nonprim galera_var_ignore_apply_errors : MDEV-26770 galera_var_ignore_apply_errors fails Server did not transition to READY state From 771c61e9659d7fd469b91736462f5e3399f70868 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Tue, 24 May 2022 17:12:54 +1000 Subject: [PATCH 08/20] man: merge error in mysqld.8 --- man/mysqld.8 | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/man/mysqld.8 b/man/mysqld.8 index dd19bcb8480..83a4efb5895 100644 --- a/man/mysqld.8 +++ b/man/mysqld.8 @@ -1,10 +1,6 @@ '\" t .\" -<<<<<<< HEAD -.TH "\FBMYSQLD\FR" "8" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" -======= -.TH "\FBMARIADBD\FR" "8" "27 June 2019" "MariaDB 10\&.5" "MariaDB Database System" ->>>>>>> 10.5-MDEV-28376-mariadb-report +.TH "\FBMARIADBD\FR" "8" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- From e8cb91943c7fde6a55382fef927efb7067f48231 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 24 May 2022 11:02:46 +0200 Subject: [PATCH 09/20] fix a bad merge in ec62f46a612b --- debian/mariadb-plugin-columnstore.install | 119 --------------------- debian/mariadb-plugin-columnstore.postinst | 8 -- debian/mariadb-plugin-columnstore.postrm | 24 ----- debian/mariadb-plugin-columnstore.prerm | 8 -- debian/mariadb-plugin-columnstore.triggers | 1 - 5 files changed, 160 deletions(-) delete mode 100644 debian/mariadb-plugin-columnstore.install delete mode 100644 debian/mariadb-plugin-columnstore.postinst delete mode 100644 debian/mariadb-plugin-columnstore.postrm delete mode 100644 debian/mariadb-plugin-columnstore.prerm delete mode 100644 debian/mariadb-plugin-columnstore.triggers diff --git a/debian/mariadb-plugin-columnstore.install b/debian/mariadb-plugin-columnstore.install deleted file mode 100644 index 39f4e8c7279..00000000000 --- a/debian/mariadb-plugin-columnstore.install +++ /dev/null @@ -1,119 +0,0 @@ -etc/columnstore/Columnstore.xml -etc/columnstore/ErrorMessage.txt -etc/columnstore/MessageFile.txt -etc/columnstore/storagemanager.cnf -etc/mysql/mariadb.conf.d/columnstore.cnf -usr/bin/mcsRebuildEM -usr/bin/DDLProc -usr/bin/DMLProc -usr/bin/ExeMgr -usr/bin/PrimProc -usr/bin/StorageManager -usr/bin/WriteEngineServer -usr/bin/clearShm -usr/bin/cleartablelock -usr/bin/columnstore-post-install -usr/bin/columnstore-pre-uninstall -usr/bin/columnstoreDBWrite -usr/bin/columnstoreSyslogSetup.sh -usr/bin/columnstore_run.sh -usr/bin/colxml -usr/bin/controllernode -usr/bin/cpimport -usr/bin/cpimport.bin -usr/bin/cplogger -usr/bin/cspasswd -usr/bin/cskeys -usr/bin/dbbuilder -usr/bin/dbrmctl -usr/bin/ddlcleanup -usr/bin/editem -usr/bin/idbmeminfo -usr/bin/load_brm -usr/bin/mariadb-columnstore-start.sh -usr/bin/mariadb-columnstore-stop.sh -usr/bin/mcs-savebrm.py -usr/bin/mcs-loadbrm.py -usr/bin/mcs-stop-controllernode.sh -usr/bin/mcsGetConfig -usr/bin/mcsSetConfig -usr/bin/mycnfUpgrade -usr/bin/post-mysql-install -usr/bin/post-mysqld-install -usr/bin/reset_locks -usr/bin/rollback -usr/bin/save_brm -usr/bin/smcat -usr/bin/smls -usr/bin/smput -usr/bin/smrm -usr/bin/testS3Connection -usr/bin/viewtablelock -usr/bin/workernode -usr/lib/*/libbatchloader.so -usr/lib/*/libbrm.so -usr/lib/*/libcacheutils.so -usr/lib/*/libcloudio.so -usr/lib/*/libcommon.so -usr/lib/*/libcompress.so -usr/lib/*/libconfigcpp.so -usr/lib/*/libdataconvert.so -usr/lib/*/libddlcleanuputil.so -usr/lib/*/libddlpackage.so -usr/lib/*/libddlpackageproc.so -usr/lib/*/libdmlpackage.so -usr/lib/*/libdmlpackageproc.so -usr/lib/*/libexecplan.so -usr/lib/*/libfuncexp.so -usr/lib/*/libidbdatafile.so -usr/lib/*/libjoblist.so -usr/lib/*/libjoiner.so -usr/lib/*/liblibmysql_client.so -usr/lib/*/libloggingcpp.so -usr/lib/*/libmarias3.so -usr/lib/*/libmessageqcpp.so -usr/lib/*/liboamcpp.so -usr/lib/*/libquerystats.so -usr/lib/*/libquerytele.so -usr/lib/*/libregr.so -usr/lib/*/librowgroup.so -usr/lib/*/librwlock.so -usr/lib/*/libstoragemanager.so -usr/lib/*/libthreadpool.so -usr/lib/*/libthrift.so -usr/lib/*/libudfsdk.so -usr/lib/*/libwindowfunction.so -usr/lib/*/libwriteengine.so -usr/lib/*/libwriteengineclient.so -usr/lib/*/libwriteengineredistribute.so -usr/lib/*/libdatatypes.so -usr/lib/mysql/plugin/ha_columnstore.so -usr/lib/mysql/plugin/libregr_mysql.so -usr/lib/mysql/plugin/libudf_mysql.so -usr/sbin/install_mcs_mysql.sh -usr/share/columnstore/calremoveuserpriority.sql -usr/share/columnstore/calsetuserpriority.sql -usr/share/columnstore/calshowprocesslist.sql -usr/share/columnstore/columnstoreAlias -usr/share/columnstore/columnstoreLogRotate -usr/share/columnstore/columnstoreSyslog -usr/share/columnstore/columnstoreSyslog-ng -usr/share/columnstore/columnstoreSyslog7 -usr/share/columnstore/columnstore_info.sql -usr/share/columnstore/dumpcat_mysql.sql -usr/share/columnstore/gitversionEngine -usr/share/columnstore/mariadb-columnstore.service -usr/share/columnstore/mcs-controllernode.service -usr/share/columnstore/mcs-ddlproc.service -usr/share/columnstore/mcs-dmlproc.service -usr/share/columnstore/mcs-exemgr.service -usr/share/columnstore/mcs-loadbrm.service -usr/share/columnstore/mcs-primproc.service -usr/share/columnstore/mcs-storagemanager.service -usr/share/columnstore/mcs-workernode.service -usr/share/columnstore/mcs-writeengineserver.service -usr/share/columnstore/myCnf-exclude-args.text -usr/share/columnstore/myCnf-include-args.text -usr/share/columnstore/releasenum -usr/share/columnstore/syscatalog_mysql.sql -var/lib/columnstore/local/module diff --git a/debian/mariadb-plugin-columnstore.postinst b/debian/mariadb-plugin-columnstore.postinst deleted file mode 100644 index 97a1bba22c8..00000000000 --- a/debian/mariadb-plugin-columnstore.postinst +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -set -e - -# Install ColumnStore -columnstore-post-install install - -#DEBHELPER# diff --git a/debian/mariadb-plugin-columnstore.postrm b/debian/mariadb-plugin-columnstore.postrm deleted file mode 100644 index b2e19774ec1..00000000000 --- a/debian/mariadb-plugin-columnstore.postrm +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -set -e - -if [ "$1" = "purge" ]; then - rm -rf /var/lib/columnstore - rm -rf /etc/columnstore - rm -f /etc/mysql/mariadb.conf.d/columnstore.cnf.rpmsave -fi - -# Automatically restart MariaDB after ColumnStore plugin has been removed -case "$1" in - purge|remove|disappear) - if [ -d /run/systemd/system ]; then - # If systemd - deb-systemd-invoke restart mariadb.service >/dev/null - elif [ -x "/etc/init.d/mariadb" ]; then - # Fall-back to SysV init - invoke-rc.d mariadb restart || exit $? - fi - ;; -esac - -#DEBHELPER# diff --git a/debian/mariadb-plugin-columnstore.prerm b/debian/mariadb-plugin-columnstore.prerm deleted file mode 100644 index f6a27f14499..00000000000 --- a/debian/mariadb-plugin-columnstore.prerm +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -set -e - -columnstore-pre-uninstall - - -#DEBHELPER# diff --git a/debian/mariadb-plugin-columnstore.triggers b/debian/mariadb-plugin-columnstore.triggers deleted file mode 100644 index dd866036784..00000000000 --- a/debian/mariadb-plugin-columnstore.triggers +++ /dev/null @@ -1 +0,0 @@ -activate-noawait ldconfig From 734f10f60155acd70db9227e25242e7ad6a3700d Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Sun, 22 May 2022 19:03:54 +0300 Subject: [PATCH 10/20] Fix that spider test doesn't crash if my_gethwaddr() fails This can happen if one doesn't have a working network connection when running spider tests --- storage/spider/spd_table.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 00542f05f09..4f3bc25c92a 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -7234,8 +7234,9 @@ int spider_db_init( if (my_gethwaddr((uchar *) addr)) { - my_printf_error(ER_SPIDER_CANT_NUM, ER_SPIDER_CANT_STR1, MYF(0), + my_printf_error(ER_SPIDER_CANT_NUM, ER_SPIDER_CANT_STR1, MYF(ME_WARNING), "get hardware address with error ", errno); + bzero(addr,6); } spider_unique_id.str = spider_unique_id_buf; spider_unique_id.length = my_sprintf(spider_unique_id_buf, From 847ca89d6d352360e8ab6ffee7ef7aa35aff692d Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Thu, 19 May 2022 02:32:18 +0300 Subject: [PATCH 11/20] Added check for libxml2 for connect.misc Test will fail if XML support is not compiled. This can happen if XML support is disabled or if the libxml2 library is not installed. --- storage/connect/mysql-test/connect/t/misc.test | 1 + 1 file changed, 1 insertion(+) diff --git a/storage/connect/mysql-test/connect/t/misc.test b/storage/connect/mysql-test/connect/t/misc.test index 4dc8dded651..5cfe2a8fdbb 100644 --- a/storage/connect/mysql-test/connect/t/misc.test +++ b/storage/connect/mysql-test/connect/t/misc.test @@ -1,3 +1,4 @@ +--source have_libxml2.inc # Overlong table type --error ER_UNKNOWN_ERROR From ddb1f7c4e445c8bcab2e6ffa5473c53c62227939 Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 24 May 2022 15:08:03 +0300 Subject: [PATCH 12/20] Remove warning when using connect have_libxml2.inc --- storage/connect/mysql-test/connect/r/alter_xml2.result | 2 -- storage/connect/mysql-test/connect/r/infoschema2-9739.result | 2 -- storage/connect/mysql-test/connect/r/xml2.result | 2 -- storage/connect/mysql-test/connect/r/xml2_grant.result | 2 -- storage/connect/mysql-test/connect/r/xml2_html.result | 2 -- storage/connect/mysql-test/connect/r/xml2_mdev5261.result | 2 -- storage/connect/mysql-test/connect/r/xml2_mult.result | 2 -- storage/connect/mysql-test/connect/r/xml2_zip.result | 2 -- storage/connect/mysql-test/connect/t/have_libxml2.inc | 2 ++ 9 files changed, 2 insertions(+), 16 deletions(-) diff --git a/storage/connect/mysql-test/connect/r/alter_xml2.result b/storage/connect/mysql-test/connect/r/alter_xml2.result index a15be966aa8..e97e167e800 100644 --- a/storage/connect/mysql-test/connect/r/alter_xml2.result +++ b/storage/connect/mysql-test/connect/r/alter_xml2.result @@ -1,5 +1,3 @@ -Warnings: -Warning 1105 No file name. Table will use t1.xml # # Testing changing table type (not in-place) # diff --git a/storage/connect/mysql-test/connect/r/infoschema2-9739.result b/storage/connect/mysql-test/connect/r/infoschema2-9739.result index 32ca77dc71d..6abc576ff8e 100644 --- a/storage/connect/mysql-test/connect/r/infoschema2-9739.result +++ b/storage/connect/mysql-test/connect/r/infoschema2-9739.result @@ -1,5 +1,3 @@ -Warnings: -Warning 1105 No file name. Table will use t1.xml create table t1 (i int) engine=Connect table_type=XML option_list='xmlsup=libxml2'; Warnings: Warning 1105 No file name. Table will use t1.xml diff --git a/storage/connect/mysql-test/connect/r/xml2.result b/storage/connect/mysql-test/connect/r/xml2.result index 891c6e6f8dd..66ef5f15091 100644 --- a/storage/connect/mysql-test/connect/r/xml2.result +++ b/storage/connect/mysql-test/connect/r/xml2.result @@ -1,5 +1,3 @@ -Warnings: -Warning 1105 No file name. Table will use t1.xml SET NAMES utf8; # # Testing tag values diff --git a/storage/connect/mysql-test/connect/r/xml2_grant.result b/storage/connect/mysql-test/connect/r/xml2_grant.result index a6e6c150b59..e014f00f577 100644 --- a/storage/connect/mysql-test/connect/r/xml2_grant.result +++ b/storage/connect/mysql-test/connect/r/xml2_grant.result @@ -1,5 +1,3 @@ -Warnings: -Warning 1105 No file name. Table will use t1.xml # # Beginning of grant.inc # diff --git a/storage/connect/mysql-test/connect/r/xml2_html.result b/storage/connect/mysql-test/connect/r/xml2_html.result index 499108b724d..0ec47ad8038 100644 --- a/storage/connect/mysql-test/connect/r/xml2_html.result +++ b/storage/connect/mysql-test/connect/r/xml2_html.result @@ -1,5 +1,3 @@ -Warnings: -Warning 1105 No file name. Table will use t1.xml SET NAMES utf8; # # Testing HTML like XML file diff --git a/storage/connect/mysql-test/connect/r/xml2_mdev5261.result b/storage/connect/mysql-test/connect/r/xml2_mdev5261.result index 0ee5712dd02..8913663f6ae 100644 --- a/storage/connect/mysql-test/connect/r/xml2_mdev5261.result +++ b/storage/connect/mysql-test/connect/r/xml2_mdev5261.result @@ -1,5 +1,3 @@ -Warnings: -Warning 1105 No file name. Table will use t1.xml SET NAMES utf8; CREATE TABLE t1 (i INT UNIQUE NOT NULL) ENGINE=CONNECT TABLE_TYPE=XML FILE_NAME='xt1.xml' OPTION_LIST='xmlsup=libxml2,Rownode=N'; ERROR HY000: Table type XML is not indexable diff --git a/storage/connect/mysql-test/connect/r/xml2_mult.result b/storage/connect/mysql-test/connect/r/xml2_mult.result index 0146baa89c0..5d68527b592 100644 --- a/storage/connect/mysql-test/connect/r/xml2_mult.result +++ b/storage/connect/mysql-test/connect/r/xml2_mult.result @@ -1,5 +1,3 @@ -Warnings: -Warning 1105 No file name. Table will use t1.xml SET NAMES utf8; # # Testing expanded values diff --git a/storage/connect/mysql-test/connect/r/xml2_zip.result b/storage/connect/mysql-test/connect/r/xml2_zip.result index e743af32418..7e36650da71 100644 --- a/storage/connect/mysql-test/connect/r/xml2_zip.result +++ b/storage/connect/mysql-test/connect/r/xml2_zip.result @@ -1,5 +1,3 @@ -Warnings: -Warning 1105 No file name. Table will use t1.xml # # Testing zipped XML tables # diff --git a/storage/connect/mysql-test/connect/t/have_libxml2.inc b/storage/connect/mysql-test/connect/t/have_libxml2.inc index fc16265aa12..64722af0ec4 100644 --- a/storage/connect/mysql-test/connect/t/have_libxml2.inc +++ b/storage/connect/mysql-test/connect/t/have_libxml2.inc @@ -1,4 +1,5 @@ --disable_query_log +--disable_warnings --error 0,ER_UNKNOWN_ERROR CREATE TABLE t1 (a VARCHAR(10)) ENGINE=CONNECT TABLE_TYPE=XML OPTION_LIST='xmlsup=libxml2'; @@ -12,6 +13,7 @@ if (!`SELECT count(*) FROM INFORMATION_SCHEMA.TABLES Skip Need LIBXML2; } DROP TABLE t1; +--enable_warnings --enable_query_log From 915afddba2d831d3d0201838b941e834b599e6b9 Mon Sep 17 00:00:00 2001 From: Monty Date: Tue, 24 May 2022 15:11:34 +0300 Subject: [PATCH 13/20] main.alter_table_lock could fail with query "'LOCK TABLE t1 WRITE' failed" Backported fix from MariaDB 10.5 --- mysql-test/main/alter_table_lock.result | 2 -- mysql-test/main/alter_table_lock.test | 4 ++++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mysql-test/main/alter_table_lock.result b/mysql-test/main/alter_table_lock.result index ce6097c9ada..620fca23315 100644 --- a/mysql-test/main/alter_table_lock.result +++ b/mysql-test/main/alter_table_lock.result @@ -11,8 +11,6 @@ ERROR 42S02: Table 'test.x' doesn't exist SET SESSION max_session_mem_used= 8192; LOCK TABLE t1 WRITE; ALTER TABLE t1 CHANGE COLUMN IF EXISTS b c INT; -Warnings: -Note 1054 Unknown column 'b' in 't1' SET SESSION max_session_mem_used = @max_session_mem_used_save; UNLOCK TABLES; DROP TABLE t1; diff --git a/mysql-test/main/alter_table_lock.test b/mysql-test/main/alter_table_lock.test index f1f60e38b61..bd26c1ac7d0 100644 --- a/mysql-test/main/alter_table_lock.test +++ b/mysql-test/main/alter_table_lock.test @@ -14,9 +14,13 @@ SELECT * FROM t1; ALTER TABLE x MODIFY xx INT; SET SESSION max_session_mem_used= 8192; +--error 0,ER_OPTION_PREVENTS_STATEMENT LOCK TABLE t1 WRITE; +--disable_warnings +--error 0,ER_OPTION_PREVENTS_STATEMENT ALTER TABLE t1 CHANGE COLUMN IF EXISTS b c INT; +--enable_warnings SET SESSION max_session_mem_used = @max_session_mem_used_save; UNLOCK TABLES; From a0e4853eff028fa9db9ba0421309e2bd1124ab26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 25 May 2022 13:15:56 +0300 Subject: [PATCH 14/20] MDEV-28668 Recovery or backup of INSERT may be incorrect page_cur_insert_rec_low(): When checking for common bytes with the preceding record, exclude the header bytes of next_rec that could have been updated by this function. The scenario where this caused corruption was an insert of a node pointer record. The child page number was written as 0x203 but recovered as 0x103 because the n_owned field of next_rec was changed from 1 to 2 before the comparison was invoked. --- storage/innobase/include/page0cur.h | 7 +++---- storage/innobase/page/page0cur.cc | 11 +++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/storage/innobase/include/page0cur.h b/storage/innobase/include/page0cur.h index 6ce31dea0c1..d80eb4567e5 100644 --- a/storage/innobase/include/page0cur.h +++ b/storage/innobase/include/page0cur.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2018, 2021, MariaDB Corporation. +Copyright (c) 2018, 2022, MariaDB Corporation. 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 @@ -154,9 +154,8 @@ page_cur_tuple_insert( MY_ATTRIBUTE((nonnull, warn_unused_result)); /***********************************************************//** Inserts a record next to page cursor on an uncompressed page. -Returns pointer to inserted record if succeed, i.e., enough -space available, NULL otherwise. The cursor stays at the same position. -@return pointer to record if succeed, NULL otherwise */ +@return pointer to record +@retval nullptr if not enough space was available */ rec_t* page_cur_insert_rec_low( /*====================*/ diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc index cc6b1797d61..31a780d8644 100644 --- a/storage/innobase/page/page0cur.cc +++ b/storage/innobase/page/page0cur.cc @@ -2,7 +2,7 @@ Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2018, 2021, MariaDB Corporation. +Copyright (c) 2018, 2022, MariaDB Corporation. 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 @@ -1280,9 +1280,8 @@ inline void mtr_t::page_insert(const buf_block_t &block, bool reuse, /***********************************************************//** Inserts a record next to page cursor on an uncompressed page. -Returns pointer to inserted record if succeed, i.e., enough -space available, NULL otherwise. The cursor stays at the same position. -@return pointer to record if succeed, NULL otherwise */ +@return pointer to record +@retval nullptr if not enough space was available */ rec_t* page_cur_insert_rec_low( /*====================*/ @@ -1575,8 +1574,12 @@ inc_dir: const byte *r= rec; const byte *c= cur->rec; const byte *c_end= cur->rec + data_size; + static_assert(REC_N_OLD_EXTRA_BYTES == REC_N_NEW_EXTRA_BYTES + 1, ""); if (c <= insert_buf && c_end > insert_buf) c_end= insert_buf; + else if (c_end < next_rec && + c_end >= next_rec - REC_N_OLD_EXTRA_BYTES + comp) + c_end= next_rec - REC_N_OLD_EXTRA_BYTES + comp; else c_end= std::min(c_end, block->frame + srv_page_size - PAGE_DIR - PAGE_DIR_SLOT_SIZE * From db0fde3f24b37cfac9a4125ce888f1650a20db7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 25 May 2022 13:18:24 +0300 Subject: [PATCH 15/20] MDEV-28665 aio_uring::thread_routine terminates prematurely, causing hang aio_uring::thread_routine(): Handle -EINTR from io_uring_wait_cqe() in the same way as aio_linux::getevent_thread_routine() does it: simply ignore it and invoke the system call again. Reviewed by: Vladislav Vaintroub --- tpool/aio_liburing.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tpool/aio_liburing.cc b/tpool/aio_liburing.cc index a4a899d08d4..2a9c79f9020 100644 --- a/tpool/aio_liburing.cc +++ b/tpool/aio_liburing.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2021, MariaDB Corporation. +/* Copyright (C) 2021, 2022, MariaDB Corporation. This program is free software; you can redistribute itand /or modify it under the terms of the GNU General Public License as published by @@ -137,8 +137,8 @@ private: io_uring_cqe *cqe; if (int ret= io_uring_wait_cqe(&aio->uring_, &cqe)) { - if (ret == -EINTR) // this may occur during shutdown - break; + if (ret == -EINTR) + continue; my_printf_error(ER_UNKNOWN_ERROR, "io_uring_wait_cqe() returned %d\n", ME_ERROR_LOG | ME_FATAL, ret); @@ -147,7 +147,7 @@ private: auto *iocb= static_cast(io_uring_cqe_get_data(cqe)); if (!iocb) - break; + break; // ~aio_uring() told us to terminate int res= cqe->res; if (res < 0) From 99c8aed00d832d838ee4b746dc6ae18a8f281709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 25 May 2022 14:06:04 +0300 Subject: [PATCH 16/20] MDEV-28601 InnoDB history list length was reverted to 32 bits srv_do_purge(): In commit edde1f6e0d5f5a0115a5253c9b8d428af132f2d1 when the de-facto 32-bit trx_sys_t::history_size() was replaced with 32-bit trx_sys.rseg_history_len, some more variables were changed from ulint (size_t) to uint32_t. The history list length is the number of committed transactions whose undo logs are waiting to be purged. Each TRX_RSEG_HISTORY list is storing the number of entries in a 32-bit field and each transaction will occupy at least one undo log page. It is thinkable that the length of each TRX_RSEG_HISTORY list may approach the maximum representable number. The number cannot be exceeded, because the rollback segment header is allocated from the same tablespace as the undo log header pages it is pointing to, and because the page numbers of a tablespace are stored in 32 bits. In any case, it is possible that the total number of unpurged committed transactions cannot be represented in 32 but 39 bits (corresponding to 128 rollback segments and undo tablespaces). --- storage/innobase/include/trx0sys.h | 4 ++-- storage/innobase/lock/lock0lock.cc | 4 ++-- storage/innobase/srv/srv0srv.cc | 16 ++++++++-------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h index 323994fa14f..246af942419 100644 --- a/storage/innobase/include/trx0sys.h +++ b/storage/innobase/include/trx0sys.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 2021, MariaDB Corporation. +Copyright (c) 2017, 2022, MariaDB Corporation. 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 @@ -811,7 +811,7 @@ public: /** TRX_RSEG_HISTORY list length (number of committed transactions to purge) */ - MY_ALIGNED(CACHE_LINE_SIZE) Atomic_counter rseg_history_len; + MY_ALIGNED(CACHE_LINE_SIZE) Atomic_counter rseg_history_len; /** Mutex protecting trx_list. */ MY_ALIGNED(CACHE_LINE_SIZE) mutable TrxSysMutex mutex; diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 01a31b41662..a5ac7de0a92 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -4602,14 +4602,14 @@ lock_print_info_summary( fprintf(file, "Purge done for trx's n:o < " TRX_ID_FMT " undo n:o < " TRX_ID_FMT " state: %s\n" - "History list length %u\n", + "History list length %zu\n", purge_sys.tail.trx_no, purge_sys.tail.undo_no, purge_sys.enabled() ? (purge_sys.running() ? "running" : purge_sys.paused() ? "stopped" : "running but idle") : "disabled", - uint32_t{trx_sys.rseg_history_len}); + size_t{trx_sys.rseg_history_len}); #ifdef PRINT_NUM_OF_LOCK_STRUCTS fprintf(file, diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 0caf5b9033f..47e0fe13053 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -2393,7 +2393,7 @@ static bool srv_purge_should_exit() return true; /* Slow shutdown was requested. */ - if (const uint32_t history_size= trx_sys.rseg_history_len) + if (const size_t history_size= trx_sys.rseg_history_len) { static time_t progress_time; time_t now= time(NULL); @@ -2402,7 +2402,7 @@ static bool srv_purge_should_exit() progress_time= now; #if defined HAVE_SYSTEMD && !defined EMBEDDED_LIBRARY service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, - "InnoDB: to purge %u transactions", + "InnoDB: to purge %zu transactions", history_size); ib::info() << "to purge " << history_size << " transactions"; #endif @@ -2516,17 +2516,17 @@ DECLARE_THREAD(srv_worker_thread)( /** Do the actual purge operation. @param[in,out] n_total_purged total number of purged pages @return length of history list before the last purge batch. */ -static uint32_t srv_do_purge(ulint* n_total_purged +static size_t srv_do_purge(ulint* n_total_purged #ifdef UNIV_DEBUG - , srv_slot_t* slot /*!< purge coordinator */ + , srv_slot_t* slot /*!< purge coordinator */ #endif - ) + ) { ulint n_pages_purged; static ulint count = 0; static ulint n_use_threads = 0; - static uint32_t rseg_history_len = 0; + static size_t rseg_history_len = 0; ulint old_activity_count = srv_get_activity_count(); const ulint n_threads = srv_n_purge_threads; @@ -2606,7 +2606,7 @@ srv_purge_coordinator_suspend( /*==========================*/ srv_slot_t* slot, /*!< in/out: Purge coordinator thread slot */ - uint32_t rseg_history_len) /*!< in: history list length + size_t rseg_history_len) /*!< in: history list length before last purge */ { ut_ad(!srv_read_only_mode); @@ -2697,7 +2697,7 @@ DECLARE_THREAD(srv_purge_coordinator_thread)( rw_lock_create(PFS_NOT_INSTRUMENTED, &slot->debug_sync_lock, SYNC_NO_ORDER_CHECK); #endif - uint32_t rseg_history_len = trx_sys.rseg_history_len; + size_t rseg_history_len = trx_sys.rseg_history_len; do { /* If there are no records to purge or the last From 6b6d745b9eab64c6c1a3c13c11afe38c6761df69 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Sun, 30 May 2021 05:42:35 +0400 Subject: [PATCH 17/20] let numeric in the DEMAULT. --- mysql-test/suite/json/r/json_table.result | 4 ++-- mysql-test/suite/json/t/json_table.test | 4 ++-- sql/sql_yacc.yy | 23 ++++++++++++++++++++++- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/mysql-test/suite/json/r/json_table.result b/mysql-test/suite/json/r/json_table.result index 4619240ba00..155b8c53b29 100644 --- a/mysql-test/suite/json/r/json_table.result +++ b/mysql-test/suite/json/r/json_table.result @@ -57,14 +57,14 @@ Jeans {"color": "blue", "price": 50} blue select * from t1 right join json_table(t1.item_props,'$' columns( color varchar(100) path '$.color')) as T on 1; ERROR 42S22: Unknown column 't1.item_props' in 'JSON_TABLE argument' DROP TABLE t1; -select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default '101' on empty, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt; +select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default 101 on empty, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt; a b 101 11 101 111 2 22 2 222 3 NULL -select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default '202' on error, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt; +select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default 202 on error, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt; a b NULL 11 NULL 111 diff --git a/mysql-test/suite/json/t/json_table.test b/mysql-test/suite/json/t/json_table.test index dbb9f43ab17..f6e8c93e443 100644 --- a/mysql-test/suite/json/t/json_table.test +++ b/mysql-test/suite/json/t/json_table.test @@ -30,9 +30,9 @@ select * from t1 right join json_table(t1.item_props,'$' columns( color varchar( DROP TABLE t1; -select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default '101' on empty, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt; +select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default 101 on empty, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt; -select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default '202' on error, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt; +select * from JSON_TABLE( '[ {"xa": 1, "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default 202 on error, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt; select * from JSON_TABLE( '[ {"a": [1, 2], "b": [11,111]}, {"a": 2, "b": [22,222]}, {"a":3}]', '$[*]' COLUMNS( a INT PATH '$.a' default '101' on empty, NESTED PATH '$.b[*]' COLUMNS (b INT PATH '$'))) as jt; diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 28ab93362c8..172ea82b1a6 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1313,6 +1313,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize); TEXT_STRING NCHAR_STRING json_text_literal + json_text_literal_or_num %type opt_table_alias_clause @@ -11570,6 +11571,26 @@ json_text_literal: } ; +json_text_literal_or_num: + json_text_literal + | NUM + { + Lex->json_table->m_text_literal_cs= NULL; + } + | LONG_NUM + { + Lex->json_table->m_text_literal_cs= NULL; + } + | DECIMAL_NUM + { + Lex->json_table->m_text_literal_cs= NULL; + } + | FLOAT_NUM + { + Lex->json_table->m_text_literal_cs= NULL; + } + ; + join_table_list: derived_table_list { MYSQL_YYABORT_UNLESS($$=$1); } ; @@ -11684,7 +11705,7 @@ json_on_response: { $$.m_response= Json_table_column::RESPONSE_NULL; } - | DEFAULT json_text_literal + | DEFAULT json_text_literal_or_num { $$.m_response= Json_table_column::RESPONSE_DEFAULT; $$.m_default= $2; From a9f6abeddecdca22afae841fbd39101d80f406d9 Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Mon, 31 May 2021 13:48:09 +0400 Subject: [PATCH 18/20] MDEV-25875: JSON_TABLE: extract document fragment into JSON column Accept JSON values for the JSON fields. --- mysql-test/suite/json/r/json_table.result | 14 ++++++++ .../suite/json/r/json_table_mysql.result | 34 ++++++++++--------- mysql-test/suite/json/t/json_table.test | 10 ++++++ mysql-test/suite/json/t/json_table_mysql.test | 4 +-- sql/json_table.cc | 31 ++++++++++++++++- sql/json_table.h | 1 + 6 files changed, 74 insertions(+), 20 deletions(-) diff --git a/mysql-test/suite/json/r/json_table.result b/mysql-test/suite/json/r/json_table.result index 155b8c53b29..19cffb6c94e 100644 --- a/mysql-test/suite/json/r/json_table.result +++ b/mysql-test/suite/json/r/json_table.result @@ -953,6 +953,20 @@ converted original Warnings: Warning 1264 Out of range value for column 'converted' at row 2 Warning 1366 Incorrect integer value: 'foo' for column ``.`(temporary)`.`converted` at row 3 +select * from +json_table('[{"color": "blue", "price": { "high": 10, "low": 5}}, + {"color": "white", "price": "pretty low"}, + {"color": "yellow", "price": 256.20}, + {"color": "red", "price": { "high": 20, "low": 8}}]', +'$[*]' columns(color varchar(100) path '$.color', +price json path '$.price' + ) +) as T; +color price +blue { "high": 10, "low": 5} +white "pretty low" +yellow 256.20 +red { "high": 20, "low": 8} # # MDEV-27696 Json table columns accept redundant COLLATE syntax # diff --git a/mysql-test/suite/json/r/json_table_mysql.result b/mysql-test/suite/json/r/json_table_mysql.result index ec21f18523f..da7aa70be2b 100644 --- a/mysql-test/suite/json/r/json_table_mysql.result +++ b/mysql-test/suite/json/r/json_table_mysql.result @@ -40,7 +40,7 @@ id jpath jsn_path jexst 2 2 2 0 3 33 {"x":33} 1 4 0 0 0 -5 66 NULL 0 +5 66 [1,2] 0 select * from json_table( '[{"a":"3"},{"a":2},{"b":1},{"a":0.33},{"a":"asd"}]', @@ -55,11 +55,11 @@ jsn_path json path '$.a' default '{"x":33}' on empty, jexst int exists path '$.b') ) as tt; id jpath_i jpath_r jsn_path jexst -1 3 3 3 0 +1 3 3 "3" 0 2 2 2 2 0 3 33 33.3 {"x":33} 1 4 0 0.33 0.33 0 -5 0 0 asd 0 +5 0 0 "asd" 0 Warnings: Warning 1366 Incorrect integer value: 'asd' for column ``.`(temporary)`.`jpath_i` at row 5 Warning 1366 Incorrect double value: 'asd' for column ``.`(temporary)`.`jpath_r` at row 5 @@ -78,7 +78,7 @@ id jpath jsn_path jexst 2 2 2 0 3 33 {"x":33} 1 4 0 0 0 -5 66 NULL 0 +5 66 [1,2] 0 select * from json_table( '[{"a":"3"},{"a":2},{"b":1},{"a":0}]', @@ -88,7 +88,7 @@ json_path json path '$.a', jexst int exists path '$.b') ) as tt; id jpath json_path jexst -1 3 3 0 +1 3 "3" 0 2 2 2 0 3 NULL NULL 1 4 0 0 0 @@ -315,24 +315,24 @@ id1 jpath jexst id2 id3 jpath_3 id4 jpath_4 1 3 0 2 1 a1 NULL NULL 1 3 0 2 2 a2 NULL NULL 1 3 0 3 1 c NULL NULL -1 3 0 NULL NULL NULL 1 NULL -1 3 0 NULL NULL NULL 2 NULL -1 3 0 NULL NULL NULL 3 NULL +1 3 0 NULL NULL NULL 1 {"ll":["b1","b2","b3"]} +1 3 0 NULL NULL NULL 2 {"ll": ["a1","a2"]} +1 3 0 NULL NULL NULL 3 {"ll":["c"]} 2 2 0 1 1 1 NULL NULL 2 2 0 1 2 11 NULL NULL 2 2 0 1 3 111 NULL NULL 2 2 0 2 1 2 NULL NULL -2 2 0 NULL NULL NULL 1 NULL -2 2 0 NULL NULL NULL 2 NULL +2 2 0 NULL NULL NULL 1 {"ll":[1,11,111]} +2 2 0 NULL NULL NULL 2 {"ll":[2]} 3 NULL 1 1 1 zzz NULL NULL -3 NULL 1 NULL NULL NULL 1 NULL +3 NULL 1 NULL NULL NULL 1 {"ll":["zzz"]} 4 0 0 1 1 0.1 NULL NULL 4 0 0 1 2 0.01 NULL NULL 4 0 0 2 1 0.02 NULL NULL 4 0 0 2 2 0.002 NULL NULL 4 0 0 2 3 0.0002 NULL NULL -4 0 0 NULL NULL NULL 1 NULL -4 0 0 NULL NULL NULL 2 NULL +4 0 0 NULL NULL NULL 1 {"ll":[0.1,0.01]} +4 0 0 NULL NULL NULL 2 {"ll":[0.02,0.002,0.0002]} ord should be 1,1,1,2, which tells that first two values of 'l' are from the same object, and next two are from different objects SELECT * @@ -551,10 +551,12 @@ JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT NULL ON ERROR)) jt; 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 'NULL ON ERROR)) jt' at line 2 SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT 0 ON EMPTY)) jt; -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 '0 ON EMPTY)) jt' at line 2 +x +0 SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT 0 ON ERROR)) jt; -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 '0 ON ERROR)) jt' at line 2 +x +NULL SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x DATE PATH '$.x' @@ -604,7 +606,7 @@ SELECT * FROM JSON_TABLE('{"a":"1"}', o FOR ORDINALITY)) AS jt WHERE o = 1; jpath o -1 1 +"1" 1 # # Bug#25427982: ASSERTION `DERIVED' FAILED IN SQL/TABLE.H # diff --git a/mysql-test/suite/json/t/json_table.test b/mysql-test/suite/json/t/json_table.test index f6e8c93e443..a6392b7bfff 100644 --- a/mysql-test/suite/json/t/json_table.test +++ b/mysql-test/suite/json/t/json_table.test @@ -814,6 +814,16 @@ select * from json_table('{"a":"foo", "b":1, "c":1000}', '$.*' columns(converted select * from json_table('{"a":"foo", "b":1, "c":1000}', '$.*' columns(converted tinyint path '$', original text path '$')) as jt order by original; +select * from + json_table('[{"color": "blue", "price": { "high": 10, "low": 5}}, + {"color": "white", "price": "pretty low"}, + {"color": "yellow", "price": 256.20}, + {"color": "red", "price": { "high": 20, "low": 8}}]', + '$[*]' columns(color varchar(100) path '$.color', + price json path '$.price' + ) + ) as T; + --echo # --echo # MDEV-27696 Json table columns accept redundant COLLATE syntax --echo # diff --git a/mysql-test/suite/json/t/json_table_mysql.test b/mysql-test/suite/json/t/json_table_mysql.test index aaf123c6f7c..9f77ad964f3 100644 --- a/mysql-test/suite/json/t/json_table_mysql.test +++ b/mysql-test/suite/json/t/json_table_mysql.test @@ -453,13 +453,11 @@ SELECT * FROM SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT NULL ON ERROR)) jt; -# The DEFAULT value must be a string on JSON format for now. ---error 1064 SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT 0 ON EMPTY)) jt; ---error 1064 SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x INT PATH '$.x' DEFAULT 0 ON ERROR)) jt; +# We don't accept dates in DEFAULT --error 1064 SELECT * FROM JSON_TABLE('{}', '$' COLUMNS (x DATE diff --git a/sql/json_table.cc b/sql/json_table.cc index 1eda21112e2..39288a73631 100644 --- a/sql/json_table.cc +++ b/sql/json_table.cc @@ -19,6 +19,7 @@ #include "sql_priv.h" #include "sql_class.h" /* TMP_TABLE_PARAM */ #include "table.h" +#include "sql_type_json.h" #include "item_jsonfunc.h" #include "json_table.h" #include "sql_show.h" @@ -377,6 +378,25 @@ static void store_json_in_field(Field *f, const json_engine_t *je) } +static int store_json_in_json(Field *f, json_engine_t *je) +{ + const uchar *from= je->value_begin; + const uchar *to; + + if (json_value_scalar(je)) + to= je->value_end; + else + { + int error; + if ((error= json_skip_level(je))) + return error; + to= je->s.c_str; + } + f->store((const char *) from, (uint32) (to - from), je->s.cs); + return 0; +} + + bool Json_table_nested_path::check_error(const char *str) { if (m_engine.s.error) @@ -541,7 +561,12 @@ int ha_json_table::fill_column_values(THD *thd, uchar * buf, uchar *pos) } else { - if (!(error= !json_value_scalar(&je))) + if (jc->m_format_json) + { + if (!(error= store_json_in_json(*f, &je))) + error= er_handler.errors; + } + else if (!(error= !json_value_scalar(&je))) { store_json_in_field(*f, &je); error= er_handler.errors; @@ -870,6 +895,10 @@ int Json_table_column::set(THD *thd, enum_type ctype, const LEX_CSTRING &path, anctual content. Not sure though if we should. */ m_path.s.c_str= (const uchar *) path.str; + + if (ctype == PATH) + m_format_json= m_field->type_handler() == &type_handler_json_longtext; + return 0; } diff --git a/sql/json_table.h b/sql/json_table.h index 52cdae13e9b..7316edd4ee6 100644 --- a/sql/json_table.h +++ b/sql/json_table.h @@ -147,6 +147,7 @@ public: }; enum_type m_column_type; + bool m_format_json; json_path_t m_path; On_response m_on_error; On_response m_on_empty; From a61603562e09f230e5ab6540b16e1c623520f9b2 Mon Sep 17 00:00:00 2001 From: Rucha Deodhar Date: Wed, 18 May 2022 17:10:57 +0530 Subject: [PATCH 19/20] MDEV-25875: JSON_TABLE: extract document fragment into JSON column Fixup --- sql/json_table.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/json_table.cc b/sql/json_table.cc index 39288a73631..5fa8434fd67 100644 --- a/sql/json_table.cc +++ b/sql/json_table.cc @@ -897,7 +897,7 @@ int Json_table_column::set(THD *thd, enum_type ctype, const LEX_CSTRING &path, m_path.s.c_str= (const uchar *) path.str; if (ctype == PATH) - m_format_json= m_field->type_handler() == &type_handler_json_longtext; + m_format_json= m_field->type_handler() == &type_handler_long_blob_json; return 0; } From 52be05be15c679f2316c65ff7151f54f3957acef Mon Sep 17 00:00:00 2001 From: Hirokazu Hata Date: Wed, 1 Jun 2022 00:22:06 +0900 Subject: [PATCH 20/20] MDEV-27926 Deprecate spider_init_sql_alloc_size Reviewed by: Nayuta Yanagisawa --- .../spider/r/variable_deprecation.result | 15 +++++++++++++++ .../mysql-test/spider/t/variable_deprecation.test | 9 +++++++++ storage/spider/spd_param.cc | 2 +- storage/spider/spd_table.cc | 2 ++ 4 files changed, 27 insertions(+), 1 deletion(-) diff --git a/storage/spider/mysql-test/spider/r/variable_deprecation.result b/storage/spider/mysql-test/spider/r/variable_deprecation.result index 6aba1e6f181..8840f1da892 100644 --- a/storage/spider/mysql-test/spider/r/variable_deprecation.result +++ b/storage/spider/mysql-test/spider/r/variable_deprecation.result @@ -196,6 +196,21 @@ Warnings: Warning 1287 The table parameter 'buffer_size' is deprecated and will be removed in a future release DROP TABLE tbl_a; DROP TABLE tbl_b; +# MDEV-27926 Deprecate spider_init_sql_alloc_size +SET spider_init_sql_alloc_size = 1; +Warnings: +Warning 1287 '@@spider_init_sql_alloc_size' is deprecated and will be removed in a future release +SHOW VARIABLES LIKE "spider_init_sql_alloc_size"; +Variable_name Value +spider_init_sql_alloc_size 1 +CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='isa "1"'; +Warnings: +Warning 1287 The table parameter 'isa' is deprecated and will be removed in a future release +CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='init_sql_alloc_size "1"'; +Warnings: +Warning 1287 The table parameter 'init_sql_alloc_size' is deprecated and will be removed in a future release +DROP TABLE tbl_a; +DROP TABLE tbl_b; DROP DATABASE auto_test_local; for master_1 for child2 diff --git a/storage/spider/mysql-test/spider/t/variable_deprecation.test b/storage/spider/mysql-test/spider/t/variable_deprecation.test index 1d2d6bfd77a..6c59deba5d0 100644 --- a/storage/spider/mysql-test/spider/t/variable_deprecation.test +++ b/storage/spider/mysql-test/spider/t/variable_deprecation.test @@ -117,6 +117,15 @@ eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='buffer_size "1"'; DROP TABLE tbl_a; DROP TABLE tbl_b; +--echo # MDEV-27926 Deprecate spider_init_sql_alloc_size +SET spider_init_sql_alloc_size = 1; +SHOW VARIABLES LIKE "spider_init_sql_alloc_size"; +eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='isa "1"'; +eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='init_sql_alloc_size "1"'; + +DROP TABLE tbl_a; +DROP TABLE tbl_b; + DROP DATABASE auto_test_local; --disable_query_log diff --git a/storage/spider/spd_param.cc b/storage/spider/spd_param.cc index f4844c61653..80db478f2d3 100644 --- a/storage/spider/spd_param.cc +++ b/storage/spider/spd_param.cc @@ -596,7 +596,7 @@ longlong spider_param_semi_split_read_limit( */ static MYSQL_THDVAR_INT( init_sql_alloc_size, /* name */ - PLUGIN_VAR_RQCMDARG, /* opt */ + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */ "Initial sql string alloc size", /* comment */ NULL, /* check */ spider_use_table_value_deprecated, /* update */ diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index f1039358dbd..06cffe2a9a8 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -2377,6 +2377,7 @@ int spider_parse_connect_info( "hwr", hs_write_to_reads, 0, 1); SPIDER_PARAM_STR_LIST("hws", hs_write_socks); #endif + SPIDER_PARAM_DEPRECATED_WARNING("isa"); SPIDER_PARAM_INT("isa", init_sql_alloc_size, 0); SPIDER_PARAM_INT_WITH_MAX("idl", internal_delayed, 0, 1); SPIDER_PARAM_DEPRECATED_WARNING("ilm"); @@ -2682,6 +2683,7 @@ int spider_parse_connect_info( error_num = connect_string_parse.print_param_error(); goto error; case 19: + SPIDER_PARAM_DEPRECATED_WARNING("init_sql_alloc_size"); SPIDER_PARAM_INT("init_sql_alloc_size", init_sql_alloc_size, 0); SPIDER_PARAM_INT_WITH_MAX( "auto_increment_mode", auto_increment_mode, 0, 3);