Commit c2fc5266 authored by Daniele Sciascia's avatar Daniele Sciascia Committed by Jan Lindström

MDEV-29880 Galera test failure on GCF-336

Fix `wsrep_table_accessible_when_detached()` so that commands that
access no tables are rejected while a node is disconnected from a
cluster.
Reviewed-by: default avatarJan Lindström <jan.lindstrom@mariadb.com>
parent c77459f8
...@@ -19,9 +19,9 @@ SHOW STATUS LIKE 'wsrep_cluster_status'; ...@@ -19,9 +19,9 @@ SHOW STATUS LIKE 'wsrep_cluster_status';
Variable_name Value Variable_name Value
wsrep_cluster_status Disconnected wsrep_cluster_status Disconnected
SELECT * FROM t1; SELECT * FROM t1;
Got one of the listed errors ERROR 08S01: WSREP has not yet prepared node for application use
SELECT 1 FROM t1; SELECT 1 FROM t1;
Got one of the listed errors ERROR 08S01: WSREP has not yet prepared node for application use
SET @@session.wsrep_dirty_reads=ON; SET @@session.wsrep_dirty_reads=ON;
SELECT * FROM t1; SELECT * FROM t1;
i i
...@@ -34,7 +34,7 @@ i variable_name variable_value ...@@ -34,7 +34,7 @@ i variable_name variable_value
1 WSREP_DIRTY_READS ON 1 WSREP_DIRTY_READS ON
SET @@session.wsrep_dirty_reads=OFF; SET @@session.wsrep_dirty_reads=OFF;
SELECT i, variable_name, variable_value FROM t1, information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads" AND i = 1; SELECT i, variable_name, variable_value FROM t1, information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads" AND i = 1;
Got one of the listed errors ERROR 08S01: WSREP has not yet prepared node for application use
SELECT 1; SELECT 1;
1 1
1 1
......
...@@ -31,10 +31,10 @@ SHOW STATUS LIKE 'wsrep_ready'; ...@@ -31,10 +31,10 @@ SHOW STATUS LIKE 'wsrep_ready';
# Must return 'Disconnected' # Must return 'Disconnected'
SHOW STATUS LIKE 'wsrep_cluster_status'; SHOW STATUS LIKE 'wsrep_cluster_status';
--error ER_UNKNOWN_COM_ERROR,1047 --error ER_UNKNOWN_COM_ERROR
SELECT * FROM t1; SELECT * FROM t1;
--error ER_UNKNOWN_COM_ERROR,1047 --error ER_UNKNOWN_COM_ERROR
SELECT 1 FROM t1; SELECT 1 FROM t1;
SET @@session.wsrep_dirty_reads=ON; SET @@session.wsrep_dirty_reads=ON;
...@@ -46,7 +46,7 @@ SELECT i, variable_name, variable_value FROM t1, information_schema.session_vari ...@@ -46,7 +46,7 @@ SELECT i, variable_name, variable_value FROM t1, information_schema.session_vari
SET @@session.wsrep_dirty_reads=OFF; SET @@session.wsrep_dirty_reads=OFF;
--error ER_UNKNOWN_COM_ERROR,1047 --error ER_UNKNOWN_COM_ERROR
SELECT i, variable_name, variable_value FROM t1, information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads" AND i = 1; SELECT i, variable_name, variable_value FROM t1, information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads" AND i = 1;
......
GCF-336 :
GCF-582 : GCF-582 :
GCF-810A : GCF-810A :
GCF-810B : GCF-810B :
......
connection node_2;
connection node_1;
connection node_2;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
SET SESSION wsrep_trx_fragment_size = 1; SET SESSION wsrep_trx_fragment_size = 1;
SET AUTOCOMMIT=OFF; SET AUTOCOMMIT=OFF;
START TRANSACTION; START TRANSACTION;
INSERT INTO t1 VALUES (1); INSERT INTO t1 VALUES (1);
connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
connection node_2a;
SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
COUNT(*) > 0 COUNT(*) > 0
1 1
connection node_1;
SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log; SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
COUNT(*) > 0 COUNT(*) > 0
1 1
...@@ -13,14 +19,19 @@ SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED; ...@@ -13,14 +19,19 @@ SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT COUNT(*) > 0 FROM t1; SELECT COUNT(*) > 0 FROM t1;
COUNT(*) > 0 COUNT(*) > 0
1 1
connection node_2a;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
SET SESSION wsrep_sync_wait=0; SET SESSION wsrep_sync_wait=0;
connection node_2;
INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (2);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
COMMIT; COMMIT;
ERROR 08S01: WSREP has not yet prepared node for application use ERROR 08S01: WSREP has not yet prepared node for application use
connection node_2a;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0'; SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
DROP TABLE t1; DROP TABLE t1;
CALL mtr.add_suppression("replication aborted"); CALL mtr.add_suppression("replication aborted");
CALL mtr.add_suppression("WSREP: fragment replication failed: 3"); CALL mtr.add_suppression("WSREP: fragment replication failed: 3");
CALL mtr.add_suppression("WSREP: failed to send SR rollback for "); CALL mtr.add_suppression("WSREP: failed to send SR rollback for ");
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connection node_3;
...@@ -1162,7 +1162,7 @@ static bool wsrep_tables_accessible_when_detached(const TABLE_LIST *tables) ...@@ -1162,7 +1162,7 @@ static bool wsrep_tables_accessible_when_detached(const TABLE_LIST *tables)
if (get_table_category(&db, &tn) < TABLE_CATEGORY_INFORMATION) if (get_table_category(&db, &tn) < TABLE_CATEGORY_INFORMATION)
return false; return false;
} }
return true; return tables != NULL;
} }
static bool wsrep_command_no_result(char command) static bool wsrep_command_no_result(char command)
...@@ -3716,6 +3716,8 @@ mysql_execute_command(THD *thd) ...@@ -3716,6 +3716,8 @@ mysql_execute_command(THD *thd)
(sql_command_flags[lex->sql_command] & CF_CHANGES_DATA) == 0) && (sql_command_flags[lex->sql_command] & CF_CHANGES_DATA) == 0) &&
!wsrep_tables_accessible_when_detached(all_tables) && !wsrep_tables_accessible_when_detached(all_tables) &&
lex->sql_command != SQLCOM_SET_OPTION && lex->sql_command != SQLCOM_SET_OPTION &&
lex->sql_command != SQLCOM_CHANGE_DB &&
!(lex->sql_command == SQLCOM_SELECT && !all_tables) &&
!wsrep_is_show_query(lex->sql_command)) !wsrep_is_show_query(lex->sql_command))
{ {
my_message(ER_UNKNOWN_COM_ERROR, my_message(ER_UNKNOWN_COM_ERROR,
......
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