1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

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: Jan Lindström <jan.lindstrom@mariadb.com>
This commit is contained in:
Daniele Sciascia
2022-11-14 11:31:14 +01:00
committed by Jan Lindström
parent c77459f89c
commit c2fc5266ad
5 changed files with 20 additions and 8 deletions

View File

@ -19,9 +19,9 @@ SHOW STATUS LIKE 'wsrep_cluster_status';
Variable_name Value
wsrep_cluster_status Disconnected
SELECT * FROM t1;
Got one of the listed errors
ERROR 08S01: WSREP has not yet prepared node for application use
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;
SELECT * FROM t1;
i
@ -34,7 +34,7 @@ i variable_name variable_value
1 WSREP_DIRTY_READS ON
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;
Got one of the listed errors
ERROR 08S01: WSREP has not yet prepared node for application use
SELECT 1;
1
1

View File

@ -31,10 +31,10 @@ SHOW STATUS LIKE 'wsrep_ready';
# Must return 'Disconnected'
SHOW STATUS LIKE 'wsrep_cluster_status';
--error ER_UNKNOWN_COM_ERROR,1047
--error ER_UNKNOWN_COM_ERROR
SELECT * FROM t1;
--error ER_UNKNOWN_COM_ERROR,1047
--error ER_UNKNOWN_COM_ERROR
SELECT 1 FROM t1;
SET @@session.wsrep_dirty_reads=ON;
@ -46,7 +46,7 @@ SELECT i, variable_name, variable_value FROM t1, information_schema.session_vari
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;

View File

@ -1,4 +1,3 @@
GCF-336 :
GCF-582 :
GCF-810A :
GCF-810B :

View File

@ -1,11 +1,17 @@
connection node_2;
connection node_1;
connection node_2;
CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB;
SET SESSION wsrep_trx_fragment_size = 1;
SET AUTOCOMMIT=OFF;
START TRANSACTION;
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;
COUNT(*) > 0
1
connection node_1;
SELECT COUNT(*) > 0 FROM mysql.wsrep_streaming_log;
COUNT(*) > 0
1
@ -13,14 +19,19 @@ SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SELECT COUNT(*) > 0 FROM t1;
COUNT(*) > 0
1
connection node_2a;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
SET SESSION wsrep_sync_wait=0;
connection node_2;
INSERT INTO t1 VALUES (2);
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
COMMIT;
ERROR 08S01: WSREP has not yet prepared node for application use
connection node_2a;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
DROP TABLE t1;
CALL mtr.add_suppression("replication aborted");
CALL mtr.add_suppression("WSREP: fragment replication failed: 3");
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;

View File

@ -1162,7 +1162,7 @@ static bool wsrep_tables_accessible_when_detached(const TABLE_LIST *tables)
if (get_table_category(&db, &tn) < TABLE_CATEGORY_INFORMATION)
return false;
}
return true;
return tables != NULL;
}
static bool wsrep_command_no_result(char command)
@ -3716,6 +3716,8 @@ mysql_execute_command(THD *thd)
(sql_command_flags[lex->sql_command] & CF_CHANGES_DATA) == 0) &&
!wsrep_tables_accessible_when_detached(all_tables) &&
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))
{
my_message(ER_UNKNOWN_COM_ERROR,