mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
MDEV-24912 : Assertion `state() == s_executing
|| state() == s_prepared || state() == s_committing || state() == s_must_abort || state() == s_replaying' failed. CACHE INDEX and LOAD INDEX INTO CACHE are local operations. Therefore, do not replicate them with Galera. Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
This commit is contained in:
parent
952f06aa8b
commit
8a5a07f09a
4 changed files with 125 additions and 1 deletions
49
mysql-test/suite/galera/r/galera_cache_index.result
Normal file
49
mysql-test/suite/galera/r/galera_cache_index.result
Normal file
|
@ -0,0 +1,49 @@
|
|||
connection node_2;
|
||||
connection node_1;
|
||||
CREATE TABLE t1 (c1 int, UNIQUE INDEX (c1)) engine=innodb;
|
||||
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
|
||||
CREATE TABLE t2 (c1 int);
|
||||
INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
|
||||
CREATE TEMPORARY TABLE t1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2) INSERT_METHOD=LAST;
|
||||
CACHE INDEX t1,t2 IN default;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 assign_to_keycache Error Table 't1' is differently defined or of non-MyISAM type or doesn't exist
|
||||
test.t1 assign_to_keycache error Corrupt
|
||||
test.t2 assign_to_keycache note The storage engine for the table doesn't support assign_to_keycache
|
||||
LOAD INDEX INTO CACHE t1,t2;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 preload_keys Error Table 't1' is differently defined or of non-MyISAM type or doesn't exist
|
||||
test.t1 preload_keys error Corrupt
|
||||
test.t2 preload_keys note The storage engine for the table doesn't support preload_keys
|
||||
DROP TEMPORARY TABLE t1;
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (c1 int, UNIQUE INDEX (c1)) engine=MyISAM;
|
||||
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
|
||||
CREATE TABLE t2 (c1 int, UNIQUE INDEX (c1)) engine=MyISAM;
|
||||
INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
|
||||
CREATE TEMPORARY TABLE t1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2) INSERT_METHOD=LAST;
|
||||
CACHE INDEX t1,t2 IN default;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 assign_to_keycache Error Table 't1' is differently defined or of non-MyISAM type or doesn't exist
|
||||
test.t1 assign_to_keycache error Corrupt
|
||||
test.t2 assign_to_keycache status OK
|
||||
LOAD INDEX INTO CACHE t1,t2;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 preload_keys Error Table 't1' is differently defined or of non-MyISAM type or doesn't exist
|
||||
test.t1 preload_keys error Corrupt
|
||||
test.t2 preload_keys status OK
|
||||
DROP TEMPORARY TABLE t1;
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 (c1 int, UNIQUE INDEX (c1)) engine=MyISAM;
|
||||
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
|
||||
CREATE TABLE t2 (c1 int, UNIQUE INDEX (c1)) engine=MyISAM;
|
||||
INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
|
||||
CACHE INDEX t1,t2 IN default;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 assign_to_keycache status OK
|
||||
test.t2 assign_to_keycache status OK
|
||||
LOAD INDEX INTO CACHE t1,t2;
|
||||
Table Op Msg_type Msg_text
|
||||
test.t1 preload_keys status OK
|
||||
test.t2 preload_keys status OK
|
||||
DROP TABLE t1,t2;
|
29
mysql-test/suite/galera/t/galera_cache_index.test
Normal file
29
mysql-test/suite/galera/t/galera_cache_index.test
Normal file
|
@ -0,0 +1,29 @@
|
|||
--source include/galera_cluster.inc
|
||||
|
||||
CREATE TABLE t1 (c1 int, UNIQUE INDEX (c1)) engine=innodb;
|
||||
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
|
||||
CREATE TABLE t2 (c1 int);
|
||||
INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
|
||||
CREATE TEMPORARY TABLE t1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2) INSERT_METHOD=LAST;
|
||||
CACHE INDEX t1,t2 IN default;
|
||||
LOAD INDEX INTO CACHE t1,t2;
|
||||
DROP TEMPORARY TABLE t1;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
CREATE TABLE t1 (c1 int, UNIQUE INDEX (c1)) engine=MyISAM;
|
||||
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
|
||||
CREATE TABLE t2 (c1 int, UNIQUE INDEX (c1)) engine=MyISAM;
|
||||
INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
|
||||
CREATE TEMPORARY TABLE t1 (c1 INT) ENGINE=MRG_MyISAM UNION=(t1,t2) INSERT_METHOD=LAST;
|
||||
CACHE INDEX t1,t2 IN default;
|
||||
LOAD INDEX INTO CACHE t1,t2;
|
||||
DROP TEMPORARY TABLE t1;
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
CREATE TABLE t1 (c1 int, UNIQUE INDEX (c1)) engine=MyISAM;
|
||||
INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
|
||||
CREATE TABLE t2 (c1 int, UNIQUE INDEX (c1)) engine=MyISAM;
|
||||
INSERT INTO t2 VALUES (1),(2),(3),(4),(5);
|
||||
CACHE INDEX t1,t2 IN default;
|
||||
LOAD INDEX INTO CACHE t1,t2;
|
||||
DROP TABLE t1,t2;
|
|
@ -33,6 +33,10 @@
|
|||
#include "sql_admin.h"
|
||||
#include "sql_statistics.h"
|
||||
#include "wsrep_mysqld.h"
|
||||
#ifdef WITH_WSREP
|
||||
#include "wsrep_trans_observer.h"
|
||||
#endif
|
||||
|
||||
/* Prepare, run and cleanup for mysql_recreate_table() */
|
||||
|
||||
static bool admin_recreate_table(THD *thd, TABLE_LIST *table_list,
|
||||
|
@ -437,6 +441,32 @@ dbug_err:
|
|||
return open_error;
|
||||
}
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
/** RAII class for temporarily disable wsrep_on in the connection. */
|
||||
class Disable_wsrep_on_guard
|
||||
{
|
||||
public:
|
||||
/**
|
||||
@param thd - pointer to the context of connection in which
|
||||
wsrep_on mode needs to be disabled.
|
||||
@param disable - true if wsrep_on should be disabled
|
||||
*/
|
||||
explicit Disable_wsrep_on_guard(THD *thd, bool disable)
|
||||
: m_thd(thd), m_orig_wsrep_on(thd->variables.wsrep_on)
|
||||
{
|
||||
if (disable)
|
||||
thd->variables.wsrep_on= false;
|
||||
}
|
||||
|
||||
~Disable_wsrep_on_guard()
|
||||
{
|
||||
m_thd->variables.wsrep_on= m_orig_wsrep_on;
|
||||
}
|
||||
private:
|
||||
THD* m_thd;
|
||||
bool m_orig_wsrep_on;
|
||||
};
|
||||
#endif /* WITH_WSREP */
|
||||
|
||||
/*
|
||||
RETURN VALUES
|
||||
|
@ -473,6 +503,18 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||
DBUG_ENTER("mysql_admin_table");
|
||||
DBUG_PRINT("enter", ("extra_open_options: %u", extra_open_options));
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
/*
|
||||
CACHE INDEX and LOAD INDEX INTO CACHE statements are
|
||||
local operations. Do not replicate them with Galera
|
||||
*/
|
||||
const bool disable_wsrep_on= (WSREP(thd) &&
|
||||
(lex->sql_command == SQLCOM_ASSIGN_TO_KEYCACHE ||
|
||||
lex->sql_command == SQLCOM_PRELOAD_KEYS));
|
||||
|
||||
Disable_wsrep_on_guard wsrep_on_guard(thd, disable_wsrep_on);
|
||||
#endif /* WITH_WSREP */
|
||||
|
||||
field_list.push_back(item= new (thd->mem_root)
|
||||
Item_empty_string(thd, "Table",
|
||||
NAME_CHAR_LEN * 2), thd->mem_root);
|
||||
|
@ -535,7 +577,6 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables,
|
|||
? MDL_SHARED_NO_READ_WRITE
|
||||
: lock_type >= TL_WRITE_ALLOW_WRITE
|
||||
? MDL_SHARED_WRITE : MDL_SHARED_READ);
|
||||
|
||||
if (thd->check_killed())
|
||||
{
|
||||
open_error= false;
|
||||
|
|
|
@ -193,6 +193,11 @@ static inline bool wsrep_run_commit_hook(THD* thd, bool all)
|
|||
wsrep_is_active(thd), wsrep_is_real(thd, all),
|
||||
wsrep_has_changes(thd), wsrep_thd_is_applying(thd),
|
||||
wsrep_is_ordered(thd)));
|
||||
|
||||
/* skipping non-wsrep threads */
|
||||
if (!WSREP(thd))
|
||||
DBUG_RETURN(false);
|
||||
|
||||
/* Is MST commit or autocommit? */
|
||||
bool ret= wsrep_is_active(thd) && wsrep_is_real(thd, all);
|
||||
/* Do not commit if we are aborting */
|
||||
|
|
Loading…
Reference in a new issue