mirror of
https://github.com/MariaDB/server.git
synced 2026-05-06 23:25:34 +02:00
MDEV-30473 : Do not allow GET_LOCK() / RELEASE_LOCK() in cluster
If WSREP_ON=ON do not allow GET_LOCK and RELEASE_LOCK functions. Instead print clear error message.
This commit is contained in:
parent
765291d63e
commit
844ddb1109
3 changed files with 47 additions and 0 deletions
19
mysql-test/suite/galera/r/galera_locks_funcs.result
Normal file
19
mysql-test/suite/galera/r/galera_locks_funcs.result
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
connection node_2;
|
||||||
|
connection node_1;
|
||||||
|
CREATE TABLE t (c DOUBLE,c2 INT,PRIMARY KEY(c)) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t values (1,1);
|
||||||
|
SELECT GET_LOCK('a',1);
|
||||||
|
ERROR 42000: This version of MariaDB doesn't yet support 'GET_LOCK in cluster (WSREP_ON=ON)'
|
||||||
|
SHOW WARNINGS;
|
||||||
|
Level Code Message
|
||||||
|
Error 1235 This version of MariaDB doesn't yet support 'GET_LOCK in cluster (WSREP_ON=ON)'
|
||||||
|
SELECT * FROM t;
|
||||||
|
c c2
|
||||||
|
1 1
|
||||||
|
SELECT RELEASE_LOCK('a');
|
||||||
|
ERROR 42000: This version of MariaDB doesn't yet support 'RELEASE_LOCK in cluster (WSREP_ON=ON)'
|
||||||
|
SHOW WARNINGS;
|
||||||
|
Level Code Message
|
||||||
|
Error 1235 This version of MariaDB doesn't yet support 'RELEASE_LOCK in cluster (WSREP_ON=ON)'
|
||||||
|
COMMIT;
|
||||||
|
DROP TABLE t;
|
||||||
14
mysql-test/suite/galera/t/galera_locks_funcs.test
Normal file
14
mysql-test/suite/galera/t/galera_locks_funcs.test
Normal file
|
|
@ -0,0 +1,14 @@
|
||||||
|
--source include/galera_cluster.inc
|
||||||
|
|
||||||
|
CREATE TABLE t (c DOUBLE,c2 INT,PRIMARY KEY(c)) ENGINE=InnoDB;
|
||||||
|
INSERT INTO t values (1,1);
|
||||||
|
--error ER_NOT_SUPPORTED_YET
|
||||||
|
SELECT GET_LOCK('a',1);
|
||||||
|
SHOW WARNINGS;
|
||||||
|
SELECT * FROM t;
|
||||||
|
--error ER_NOT_SUPPORTED_YET
|
||||||
|
SELECT RELEASE_LOCK('a');
|
||||||
|
SHOW WARNINGS;
|
||||||
|
COMMIT;
|
||||||
|
DROP TABLE t;
|
||||||
|
|
||||||
|
|
@ -4933,6 +4933,13 @@ Create_func_get_lock Create_func_get_lock::s_singleton;
|
||||||
Item*
|
Item*
|
||||||
Create_func_get_lock::create_2_arg(THD *thd, Item *arg1, Item *arg2)
|
Create_func_get_lock::create_2_arg(THD *thd, Item *arg1, Item *arg2)
|
||||||
{
|
{
|
||||||
|
#ifdef WITH_WSREP
|
||||||
|
if (WSREP_ON && WSREP(thd))
|
||||||
|
{
|
||||||
|
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "GET_LOCK in cluster (WSREP_ON=ON)");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif /* WITH_WSREP */
|
||||||
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
|
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
|
||||||
thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
|
thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
|
||||||
return new (thd->mem_root) Item_func_get_lock(thd, arg1, arg2);
|
return new (thd->mem_root) Item_func_get_lock(thd, arg1, arg2);
|
||||||
|
|
@ -6535,6 +6542,13 @@ Create_func_release_lock Create_func_release_lock::s_singleton;
|
||||||
Item*
|
Item*
|
||||||
Create_func_release_lock::create_1_arg(THD *thd, Item *arg1)
|
Create_func_release_lock::create_1_arg(THD *thd, Item *arg1)
|
||||||
{
|
{
|
||||||
|
#ifdef WITH_WSREP
|
||||||
|
if (WSREP_ON && WSREP(thd))
|
||||||
|
{
|
||||||
|
my_error(ER_NOT_SUPPORTED_YET, MYF(0), "RELEASE_LOCK in cluster (WSREP_ON=ON)");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif /* WITH_WSREP */
|
||||||
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
|
thd->lex->set_stmt_unsafe(LEX::BINLOG_STMT_UNSAFE_SYSTEM_FUNCTION);
|
||||||
thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
|
thd->lex->uncacheable(UNCACHEABLE_SIDEEFFECT);
|
||||||
return new (thd->mem_root) Item_func_release_lock(thd, arg1);
|
return new (thd->mem_root) Item_func_release_lock(thd, arg1);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue