summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2023-01-31 13:46:57 +0200
committerJan Lindström <jan.lindstrom@mariadb.com>2023-01-31 13:46:57 +0200
commit993332f5015c21114dd00a1d1c1750fab9930701 (patch)
tree29264add43501a22d882edf0d52cfc380d624927
parentb05218e08f45a17f46d1b73cbb9dcb2969dc04cd (diff)
downloadmariadb-git-bb-10.4-jan-galera.tar.gz
MDEV-26216 : SIGSEGV in MDL_lock::incompatible_granted_types_bitmap on HANDLER OPEN w/ duplicate table creationbb-10.4-jan-galera
HANDLER commands are not yet supported in a cluster. Return error message if user tries to use them.
-rw-r--r--mysql-test/suite/galera/r/MDEV-27713.result46
-rw-r--r--mysql-test/suite/galera/r/galera_handler.result11
-rw-r--r--mysql-test/suite/galera/t/MDEV-27713.test67
-rw-r--r--mysql-test/suite/galera/t/galera_handler.test11
-rw-r--r--sql/sql_parse.cc21
5 files changed, 43 insertions, 113 deletions
diff --git a/mysql-test/suite/galera/r/MDEV-27713.result b/mysql-test/suite/galera/r/MDEV-27713.result
deleted file mode 100644
index 14575cb484d..00000000000
--- a/mysql-test/suite/galera/r/MDEV-27713.result
+++ /dev/null
@@ -1,46 +0,0 @@
-connection node_2;
-connection node_1;
-CREATE TABLE t1 (
-f1 INT,
-f2 VARCHAR(255) PRIMARY KEY
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-INSERT INTO t1 VALUES(1, 'abc');
-connection node_1;
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES (2,'def');
-connection node_2;
-SET GLOBAL event_scheduler=ON;
-CREATE PROCEDURE update_table()
-BEGIN
-SET AUTOCOMMIT=OFF;
-DO GET_LOCK('local_lock', 0);
-SET DEBUG_SYNC = 'innodb_row_update_for_mysql_begin SIGNAL blocked WAIT_FOR continue';
-UPDATE t1 SET f2 = 'jkl' WHERE f1 != 2;
-DO RELEASE_LOCK('local_lock');
-END|
-CREATE DEFINER=current_user
-EVENT event
-ON SCHEDULE AT CURRENT_TIMESTAMP
-ON COMPLETION PRESERVE
-ENABLE
-DO CALL update_table();
-connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
-SET DEBUG_SYNC = 'now WAIT_FOR blocked';
-connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2;
-SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb";
-connection node_1;
-COMMIT;
-connection node_2b;
-SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
-SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
-connection node_2a;
-SET DEBUG_SYNC = 'now SIGNAL continue';
-connection node_2;
-SET GLOBAL event_scheduler=default;
-DROP PROCEDURE update_table;
-DROP EVENT event;
-SET DEBUG_SYNC='reset';
-SET GLOBAL debug_dbug = DEFAULT;
-connection node_1;
-DROP TABLE t1;
diff --git a/mysql-test/suite/galera/r/galera_handler.result b/mysql-test/suite/galera/r/galera_handler.result
new file mode 100644
index 00000000000..ed498d7f7cd
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_handler.result
@@ -0,0 +1,11 @@
+connection node_2;
+connection node_1;
+CREATE TABLE t1(a int not null primary key, b int, key b(b)) engine=innodb;
+INSERT INTO t1 VALUES (1,2),(2,3),(4,5);
+HANDLER t1 OPEN;
+ERROR 42000: This version of MariaDB doesn't yet support 'HANDLER OPEN in cluster (WSREP_ON=ON)'
+HANDLER t1 READ b >= (1);
+ERROR 42000: This version of MariaDB doesn't yet support 'HANDLER READ in cluster (WSREP_ON=ON)'
+HANDLER t1 CLOSE;
+ERROR 42000: This version of MariaDB doesn't yet support 'HANDLER CLOSE in cluster (WSREP_ON=ON)'
+DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/MDEV-27713.test b/mysql-test/suite/galera/t/MDEV-27713.test
deleted file mode 100644
index 4bfcd7e3d50..00000000000
--- a/mysql-test/suite/galera/t/MDEV-27713.test
+++ /dev/null
@@ -1,67 +0,0 @@
---source include/galera_cluster.inc
---source include/have_innodb.inc
---source include/have_debug.inc
---source include/have_debug_sync.inc
---source include/big_test.inc
-
-CREATE TABLE t1 (
- f1 INT,
- f2 VARCHAR(255) PRIMARY KEY
-) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-
-INSERT INTO t1 VALUES(1, 'abc');
-
---connection node_1
-SET AUTOCOMMIT=OFF;
-START TRANSACTION;
-INSERT INTO t1 VALUES (2,'def');
-
---connection node_2
-
-SET GLOBAL event_scheduler=ON;
-
-DELIMITER |;
-CREATE PROCEDURE update_table()
-BEGIN
- SET AUTOCOMMIT=OFF;
- DO GET_LOCK('local_lock', 0);
- SET DEBUG_SYNC = 'innodb_row_update_for_mysql_begin SIGNAL blocked WAIT_FOR continue';
- UPDATE t1 SET f2 = 'jkl' WHERE f1 != 2;
- DO RELEASE_LOCK('local_lock');
-END|
-DELIMITER ;|
-
-CREATE DEFINER=current_user
- EVENT event
- ON SCHEDULE AT CURRENT_TIMESTAMP
- ON COMPLETION PRESERVE
- ENABLE
- DO CALL update_table();
-
---connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2
-SET DEBUG_SYNC = 'now WAIT_FOR blocked';
-
-# Applier control thread
---connect node_2b, 127.0.0.1, root, , test, $NODE_MYPORT_2
-SET GLOBAL debug_dbug = "+d,sync.wsrep_apply_cb";
-
---connection node_1
-COMMIT;
-
-# Applier control thread
---connection node_2b
-SET DEBUG_SYNC = "now WAIT_FOR sync.wsrep_apply_cb_reached";
-SET DEBUG_SYNC = "now SIGNAL signal.wsrep_apply_cb";
-
---connection node_2a
-SET DEBUG_SYNC = 'now SIGNAL continue';
-
---connection node_2
-SET GLOBAL event_scheduler=default;
-DROP PROCEDURE update_table;
-DROP EVENT event;
-SET DEBUG_SYNC='reset';
-SET GLOBAL debug_dbug = DEFAULT;
-
---connection node_1
-DROP TABLE t1;
diff --git a/mysql-test/suite/galera/t/galera_handler.test b/mysql-test/suite/galera/t/galera_handler.test
new file mode 100644
index 00000000000..05eafabcc26
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_handler.test
@@ -0,0 +1,11 @@
+--source include/galera_cluster.inc
+
+CREATE TABLE t1(a int not null primary key, b int, key b(b)) engine=innodb;
+INSERT INTO t1 VALUES (1,2),(2,3),(4,5);
+--error ER_NOT_SUPPORTED_YET
+HANDLER t1 OPEN;
+--error ER_NOT_SUPPORTED_YET
+HANDLER t1 READ b >= (1);
+--error ER_NOT_SUPPORTED_YET
+HANDLER t1 CLOSE;
+DROP TABLE t1;
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index bb0b3ebb4da..2779d77b6b0 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -5657,6 +5657,13 @@ mysql_execute_command(THD *thd)
}
#endif
case SQLCOM_HA_OPEN:
+#ifdef WITH_WSREP
+ if (WSREP_ON && WSREP(thd))
+ {
+ my_error(ER_NOT_SUPPORTED_YET, MYF(0), "HANDLER OPEN in cluster (WSREP_ON=ON)");
+ goto error;
+ }
+#endif
DBUG_ASSERT(first_table == all_tables && first_table != 0);
if (check_table_access(thd, SELECT_ACL, all_tables, FALSE, UINT_MAX, FALSE))
goto error;
@@ -5666,10 +5673,24 @@ mysql_execute_command(THD *thd)
res= mysql_ha_open(thd, first_table, 0);
break;
case SQLCOM_HA_CLOSE:
+#ifdef WITH_WSREP
+ if (WSREP_ON && WSREP(thd))
+ {
+ my_error(ER_NOT_SUPPORTED_YET, MYF(0), "HANDLER CLOSE in cluster (WSREP_ON=ON)");
+ goto error;
+ }
+#endif
DBUG_ASSERT(first_table == all_tables && first_table != 0);
res= mysql_ha_close(thd, first_table);
break;
case SQLCOM_HA_READ:
+#ifdef WITH_WSREP
+ if (WSREP_ON && WSREP(thd))
+ {
+ my_error(ER_NOT_SUPPORTED_YET, MYF(0), "HANDLER READ in cluster (WSREP_ON=ON)");
+ goto error;
+ }
+#endif
DBUG_ASSERT(first_table == all_tables && first_table != 0);
/*
There is no need to check for table permissions here, because