Commit 28ad6a7f authored by Nirbhay Choubey's avatar Nirbhay Choubey

MDEV-8763: Galera tests failures with --ps-protocol

(MDEV-8617: Post-fix for 10.1)
* Reset THD's PS members before returning when node is
not ready
* Add CF_SKIP_WSREP_CHECK flag to COM_STMT_XXX commands
* Skip TO replication of COM_STMT_PREPAREs for MyISAM
* Updated tests
parent 067ed23c
...@@ -10,7 +10,7 @@ SELECT COUNT(*) = 0 FROM t2; ...@@ -10,7 +10,7 @@ SELECT COUNT(*) = 0 FROM t2;
COUNT(*) = 0 COUNT(*) = 0
1 1
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction Got one of the listed errors
SET AUTOCOMMIT=OFF; SET AUTOCOMMIT=OFF;
START TRANSACTION; START TRANSACTION;
INSERT INTO t2 VALUES (1); INSERT INTO t2 VALUES (1);
......
...@@ -3,7 +3,7 @@ SET GLOBAL wsrep_certify_nonPK = OFF; ...@@ -3,7 +3,7 @@ SET GLOBAL wsrep_certify_nonPK = OFF;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB /* Table has no primary key */; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB /* Table has no primary key */;
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
INSERT INTO t1 VALUES (1), (2); INSERT INTO t1 VALUES (1), (2);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction Got one of the listed errors
INSERT INTO t2 VALUES (1), (2); INSERT INTO t2 VALUES (1), (2);
UPDATE t2 SET f1 = 3 WHERE f1 = 1; UPDATE t2 SET f1 = 3 WHERE f1 = 1;
SELECT COUNT(*) = 0 FROM t1; SELECT COUNT(*) = 0 FROM t1;
......
...@@ -30,7 +30,7 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; ...@@ -30,7 +30,7 @@ CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
exit(0); exit(0);
EOF EOF
--error ER_UNKNOWN_COM_ERROR,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK --error ER_UNKNOWN_COM_ERROR,ER_LOCK_WAIT_TIMEOUT,ER_LOCK_DEADLOCK,ER_ERROR_DURING_COMMIT
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
--echo Resuming node_2 ... --echo Resuming node_2 ...
......
...@@ -33,7 +33,7 @@ SELECT COUNT(*) = 0 FROM t1; ...@@ -33,7 +33,7 @@ SELECT COUNT(*) = 0 FROM t1;
SELECT COUNT(*) = 0 FROM t2; SELECT COUNT(*) = 0 FROM t2;
# Not allowed # Not allowed
--error ER_LOCK_DEADLOCK --error ER_LOCK_DEADLOCK,ER_ERROR_DURING_COMMIT
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
SET AUTOCOMMIT=OFF; SET AUTOCOMMIT=OFF;
......
...@@ -16,7 +16,7 @@ CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB /* Table has no primary key */; ...@@ -16,7 +16,7 @@ CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB /* Table has no primary key */;
CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; CREATE TABLE t2 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
# All DML without a PK is rejected with an error # All DML without a PK is rejected with an error
--error ER_LOCK_DEADLOCK --error ER_LOCK_DEADLOCK,ER_ERROR_DURING_COMMIT
INSERT INTO t1 VALUES (1), (2); INSERT INTO t1 VALUES (1), (2);
# DML with a PK is allowed to proceed # DML with a PK is allowed to proceed
......
...@@ -4698,8 +4698,12 @@ restart: ...@@ -4698,8 +4698,12 @@ restart:
if (!tbl) if (!tbl)
continue; continue;
if (WSREP_ON && sqlcom_can_generate_row_events(thd) && if (WSREP_ON &&
wsrep_replicate_myisam && tables && tbl->file->ht == myisam_hton && wsrep_replicate_myisam &&
tables &&
tbl->file->ht == myisam_hton &&
sqlcom_can_generate_row_events(thd) &&
thd->get_command() != COM_STMT_PREPARE &&
tables->lock_type >= TL_WRITE_ALLOW_WRITE) tables->lock_type >= TL_WRITE_ALLOW_WRITE)
{ {
WSREP_TO_ISOLATION_BEGIN(NULL, NULL, tables); WSREP_TO_ISOLATION_BEGIN(NULL, NULL, tables);
......
...@@ -271,9 +271,6 @@ void init_update_queries(void) ...@@ -271,9 +271,6 @@ void init_update_queries(void)
server_command_flags[COM_STATISTICS]= CF_SKIP_QUERY_ID | CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK; server_command_flags[COM_STATISTICS]= CF_SKIP_QUERY_ID | CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK;
server_command_flags[COM_PING]= CF_SKIP_QUERY_ID | CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK; server_command_flags[COM_PING]= CF_SKIP_QUERY_ID | CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK;
server_command_flags[COM_STMT_PREPARE]= CF_SKIP_QUESTIONS;
server_command_flags[COM_STMT_CLOSE]= CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK;
server_command_flags[COM_STMT_RESET]= CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK;
server_command_flags[COM_QUIT]= CF_SKIP_WSREP_CHECK; server_command_flags[COM_QUIT]= CF_SKIP_WSREP_CHECK;
server_command_flags[COM_PROCESS_INFO]= CF_SKIP_WSREP_CHECK; server_command_flags[COM_PROCESS_INFO]= CF_SKIP_WSREP_CHECK;
...@@ -284,11 +281,16 @@ void init_update_queries(void) ...@@ -284,11 +281,16 @@ void init_update_queries(void)
server_command_flags[COM_END]= CF_SKIP_WSREP_CHECK; server_command_flags[COM_END]= CF_SKIP_WSREP_CHECK;
/* /*
COM_QUERY and COM_SET_OPTION are allowed to pass the early COM_xxx filter, COM_QUERY, COM_SET_OPTION and COM_STMT_XXX are allowed to pass the early
they're checked later in mysql_execute_command(). COM_xxx filter, they're checked later in mysql_execute_command().
*/ */
server_command_flags[COM_QUERY]= CF_SKIP_WSREP_CHECK; server_command_flags[COM_QUERY]= CF_SKIP_WSREP_CHECK;
server_command_flags[COM_SET_OPTION]= CF_SKIP_WSREP_CHECK; server_command_flags[COM_SET_OPTION]= CF_SKIP_WSREP_CHECK;
server_command_flags[COM_STMT_PREPARE]= CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK;
server_command_flags[COM_STMT_CLOSE]= CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK;
server_command_flags[COM_STMT_RESET]= CF_SKIP_QUESTIONS | CF_SKIP_WSREP_CHECK;
server_command_flags[COM_STMT_EXECUTE]= CF_SKIP_WSREP_CHECK;
server_command_flags[COM_STMT_SEND_LONG_DATA]= CF_SKIP_WSREP_CHECK;
/* Initialize the sql command flags array. */ /* Initialize the sql command flags array. */
memset(sql_command_flags, 0, sizeof(sql_command_flags)); memset(sql_command_flags, 0, sizeof(sql_command_flags));
...@@ -886,9 +888,9 @@ void cleanup_items(Item *item) ...@@ -886,9 +888,9 @@ void cleanup_items(Item *item)
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
#ifdef WITH_WSREP
static bool wsrep_node_is_ready(THD *thd) static bool wsrep_node_is_ready(THD *thd)
{ {
#ifdef WITH_WSREP
if (thd->variables.wsrep_on && !thd->wsrep_applier && !wsrep_ready) if (thd->variables.wsrep_on && !thd->wsrep_applier && !wsrep_ready)
{ {
my_message(ER_UNKNOWN_COM_ERROR, my_message(ER_UNKNOWN_COM_ERROR,
...@@ -896,9 +898,9 @@ static bool wsrep_node_is_ready(THD *thd) ...@@ -896,9 +898,9 @@ static bool wsrep_node_is_ready(THD *thd)
MYF(0)); MYF(0));
return false; return false;
} }
#endif
return true; return true;
} }
#endif
/** /**
Read one command from connection and execute it (query or simple command). Read one command from connection and execute it (query or simple command).
...@@ -1081,14 +1083,25 @@ bool do_command(THD *thd) ...@@ -1081,14 +1083,25 @@ bool do_command(THD *thd)
vio_description(net->vio), command, vio_description(net->vio), command,
command_name[command].str)); command_name[command].str));
/* bail out if DB snapshot has not been installed. */ #ifdef WITH_WSREP
/*
Bail out if DB snapshot has not been installed.
*/
if (!(server_command_flags[command] & CF_SKIP_WSREP_CHECK) && if (!(server_command_flags[command] & CF_SKIP_WSREP_CHECK) &&
!wsrep_node_is_ready(thd)) !wsrep_node_is_ready(thd))
{ {
thd->protocol->end_statement(); thd->protocol->end_statement();
/* Performance Schema Interface instrumentation end. */
MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
thd->m_statement_psi= NULL;
thd->m_digest= NULL;
return_value= FALSE; return_value= FALSE;
goto out; goto out;
} }
#endif
/* Restore read timeout value */ /* Restore read timeout value */
my_net_set_read_timeout(net, thd->variables.net_read_timeout); my_net_set_read_timeout(net, thd->variables.net_read_timeout);
...@@ -2637,8 +2650,8 @@ mysql_execute_command(THD *thd) ...@@ -2637,8 +2650,8 @@ mysql_execute_command(THD *thd)
} }
/* /*
Bail out if DB snapshot has not been installed. We however, Bail out if DB snapshot has not been installed. We however, allow SET,
allow SET and SHOW queries. SHOW and SELECT queries (only if wsrep_dirty_reads is set).
*/ */
if (lex->sql_command != SQLCOM_SET_OPTION && if (lex->sql_command != SQLCOM_SET_OPTION &&
!wsrep_is_show_query(lex->sql_command) && !wsrep_is_show_query(lex->sql_command) &&
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment