Commit de55a7d1 authored by Sergei Golubchik's avatar Sergei Golubchik

Allow table-less selects even when wsrep is not ready

It doesn't make sense to allow selects from I_S but disallow selects
that don't use any tables at all, because any (disallowed) select that
doesn't use tables can be made allowed by adding
"FROM I_S.COLLATIONS LIMIT 1" to the end.

And it break mysql-test rather badly, even check-testcase.test
fails on its first `SELECT '$tmp' = 'No such row'`

This reverts 9a896148, c5dd2abf, and 33028f7c:
Refs: MW-245 - changed logic so that in non primary node it is possible to do SET + SHOW + SELECT from information and pfs schema, when dirty reads are not enabled - however, non table selects are not allowed (e.g. SELECT 1)
Refs MW-245 - logic was wrong in detecting if queries are allowed in non primary node. it allowed select with no table list to execute even if dirty reads was not specified
Refs: MW-245 - Adjust tests to account for the new behavior.
parent b6e2973e
...@@ -30,9 +30,9 @@ SET @@session.wsrep_dirty_reads=OFF; ...@@ -30,9 +30,9 @@ 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;
ERROR 08S01: WSREP has not yet prepared node for application use ERROR 08S01: WSREP has not yet prepared node for application use
SELECT 1; SELECT 1;
ERROR 08S01: WSREP has not yet prepared node for application use 1
1
USE information_schema; USE information_schema;
ERROR 08S01: WSREP has not yet prepared node for application use
SELECT * FROM information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads"; SELECT * FROM information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads";
VARIABLE_NAME VARIABLE_VALUE VARIABLE_NAME VARIABLE_VALUE
WSREP_DIRTY_READS OFF WSREP_DIRTY_READS OFF
......
...@@ -51,7 +51,7 @@ INSERT INTO t1 VALUES (1),(2),(3),(4),(5); ...@@ -51,7 +51,7 @@ INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
--let $value = query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1) --let $value = query_get_value(SHOW SLAVE STATUS, Last_SQL_Error, 1)
--connection node_3 --connection node_3
--disable_query_log --disable_query_log
--eval SELECT "$value" IN ("Error 'WSREP has not yet prepared node for application use' on query. Default database: 'test'. Query: 'BEGIN'", "Node has dropped from cluster") AS expected_error --eval SELECT "$value" IN ("Error 'Unknown command' on query. Default database: 'test'. Query: 'BEGIN'", "Node has dropped from cluster") AS expected_error
--enable_query_log --enable_query_log
# Step #4. Bring back the async slave and restart replication # Step #4. Bring back the async slave and restart replication
...@@ -85,9 +85,8 @@ DROP TABLE t1; ...@@ -85,9 +85,8 @@ DROP TABLE t1;
STOP SLAVE; STOP SLAVE;
RESET SLAVE ALL; RESET SLAVE ALL;
CALL mtr.add_suppression("Slave SQL: Error 'WSREP has not yet prepared node for application use' on query"); CALL mtr.add_suppression("Slave SQL: Error 'Unknown command' on query");
CALL mtr.add_suppression("Slave: WSREP has not yet prepared node for application use Error_code: 1047"); CALL mtr.add_suppression("Slave: Unknown command Error_code: 1047");
CALL mtr.add_suppression("TORDERED} returned -107 \\(Transport endpoint is not connected\\)");
CALL mtr.add_suppression("Transport endpoint is not connected"); CALL mtr.add_suppression("Transport endpoint is not connected");
CALL mtr.add_suppression("Slave SQL: Error in Xid_log_event: Commit could not be completed, 'Deadlock found when trying to get lock; try restarting transaction', Error_code: 1213"); CALL mtr.add_suppression("Slave SQL: Error in Xid_log_event: Commit could not be completed, 'Deadlock found when trying to get lock; try restarting transaction', Error_code: 1213");
CALL mtr.add_suppression("Slave SQL: Node has dropped from cluster, Error_code: 1047"); CALL mtr.add_suppression("Slave SQL: Node has dropped from cluster, Error_code: 1047");
......
...@@ -47,10 +47,8 @@ SET @@session.wsrep_dirty_reads=OFF; ...@@ -47,10 +47,8 @@ SET @@session.wsrep_dirty_reads=OFF;
--error ER_UNKNOWN_COM_ERROR --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;
--error ER_UNKNOWN_COM_ERROR
SELECT 1; SELECT 1;
--error ER_UNKNOWN_COM_ERROR
USE information_schema; USE information_schema;
SELECT * FROM information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads"; SELECT * FROM information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads";
......
...@@ -893,7 +893,6 @@ void cleanup_items(Item *item) ...@@ -893,7 +893,6 @@ void cleanup_items(Item *item)
#ifdef WITH_WSREP #ifdef WITH_WSREP
static bool wsrep_tables_accessible_when_detached(const TABLE_LIST *tables) static bool wsrep_tables_accessible_when_detached(const TABLE_LIST *tables)
{ {
bool has_tables = false;
for (const TABLE_LIST *table= tables; table; table= table->next_global) for (const TABLE_LIST *table= tables; table; table= table->next_global)
{ {
TABLE_CATEGORY c; TABLE_CATEGORY c;
...@@ -906,9 +905,8 @@ static bool wsrep_tables_accessible_when_detached(const TABLE_LIST *tables) ...@@ -906,9 +905,8 @@ static bool wsrep_tables_accessible_when_detached(const TABLE_LIST *tables)
{ {
return false; return false;
} }
has_tables = true;
} }
return has_tables; return true;
} }
#endif /* WITH_WSREP */ #endif /* WITH_WSREP */
#ifndef EMBEDDED_LIBRARY #ifndef EMBEDDED_LIBRARY
......
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