@@ -343,7 +343,7 @@ static int open_table(THD *thd, const LEX_CSTRING *schema_name,
343
343
(thd->get_stmt_da ()->sql_errno () == ER_QUERY_INTERRUPTED));
344
344
345
345
if (interrupted ||
346
- !open_n_lock_single_table (thd, table_list, table_list-> lock_type , flags))
346
+ !open_n_lock_single_table (thd, table_list, lock_type, flags))
347
347
{
348
348
close_thread_tables (thd);
349
349
DBUG_RETURN (1 );
@@ -805,11 +805,17 @@ int Wsrep_schema::store_view(THD* thd, const Wsrep_view& view)
805
805
#ifdef WSREP_SCHEMA_MEMBERS_HISTORY
806
806
TABLE* members_history_table= 0 ;
807
807
#endif /* WSREP_SCHEMA_MEMBERS_HISTORY */
808
+ Query_tables_list query_tables_list_backup;
808
809
809
810
Wsrep_schema_impl::wsrep_off wsrep_off (thd);
810
811
Wsrep_schema_impl::binlog_off binlog_off (thd);
811
812
Wsrep_schema_impl::sql_safe_updates sql_safe_updates (thd);
812
813
814
+ /*
815
+ Backup and restore the query table list changes.
816
+ */
817
+ thd->lex ->reset_n_backup_query_tables_list (&query_tables_list_backup);
818
+
813
819
if (trans_begin (thd, MYSQL_START_TRANS_OPT_READ_WRITE))
814
820
{
815
821
WSREP_ERROR (" Failed to start transaction for store view" );
@@ -925,6 +931,7 @@ int Wsrep_schema::store_view(THD* thd, const Wsrep_view& view)
925
931
thd->release_transactional_locks ();
926
932
927
933
out_not_started:
934
+ thd->lex ->restore_backup_query_tables_list (&query_tables_list_backup);
928
935
DBUG_RETURN (ret);
929
936
}
930
937
@@ -949,11 +956,17 @@ Wsrep_view Wsrep_schema::restore_view(THD* thd, const Wsrep_id& own_id) const {
949
956
int proto_ver= 0 ;
950
957
wsrep_cap_t capabilities= 0 ;
951
958
std::vector<Wsrep_view::member> members;
959
+ Query_tables_list query_tables_list_backup;
952
960
953
961
// we don't want causal waits for reading non-replicated private data
954
962
int const wsrep_sync_wait_saved= thd->variables .wsrep_sync_wait ;
955
963
thd->variables .wsrep_sync_wait = 0 ;
956
964
965
+ /*
966
+ Backup and restore the query table list changes.
967
+ */
968
+ thd->lex ->reset_n_backup_query_tables_list (&query_tables_list_backup);
969
+
957
970
if (trans_begin (thd, MYSQL_START_TRANS_OPT_READ_ONLY)) {
958
971
WSREP_ERROR (" wsrep_schema::restore_view(): Failed to start transaction" );
959
972
goto out;
@@ -1068,12 +1081,14 @@ Wsrep_view Wsrep_schema::restore_view(THD* thd, const Wsrep_id& own_id) const {
1068
1081
os << " Restored cluster view:\n " << ret_view;
1069
1082
WSREP_INFO (" %s" , os.str ().c_str ());
1070
1083
}
1084
+ thd->lex ->restore_backup_query_tables_list (&query_tables_list_backup);
1071
1085
DBUG_RETURN (ret_view);
1072
1086
}
1073
1087
else
1074
1088
{
1075
1089
WSREP_ERROR (" wsrep_schema::restore_view() failed." );
1076
1090
Wsrep_view ret_view;
1091
+ thd->lex ->restore_backup_query_tables_list (&query_tables_list_backup);
1077
1092
DBUG_RETURN (ret_view);
1078
1093
}
1079
1094
}
@@ -1460,6 +1475,7 @@ int Wsrep_schema::replay_transaction(THD* orig_thd,
1460
1475
{
1461
1476
DBUG_ENTER (" Wsrep_schema::replay_transaction" );
1462
1477
DBUG_ASSERT (!fragments.empty ());
1478
+ Query_tables_list query_tables_list_backup;
1463
1479
1464
1480
THD *thd= new THD (next_thread_id (), true );
1465
1481
if (!thd)
@@ -1471,7 +1487,13 @@ int Wsrep_schema::replay_transaction(THD* orig_thd,
1471
1487
thd->thread_stack = (orig_thd ? orig_thd->thread_stack : (char *) &thd);
1472
1488
wsrep_assign_from_threadvars (thd);
1473
1489
1490
+
1491
+ /*
1492
+ Backup and restore the query table list changes.
1493
+ */
1494
+ orig_thd->lex ->reset_n_backup_query_tables_list (&query_tables_list_backup);
1474
1495
int ret= ::replay_transaction (thd, orig_thd, rli, ws_meta, fragments);
1496
+ orig_thd->lex ->restore_backup_query_tables_list (&query_tables_list_backup);
1475
1497
1476
1498
delete thd;
1477
1499
DBUG_RETURN (ret);
@@ -1774,6 +1796,7 @@ void Wsrep_schema::store_allowlist(std::vector<std::string>& ip_allowlist)
1774
1796
TABLE* allowlist_table= 0 ;
1775
1797
TABLE_LIST allowlist_table_l;
1776
1798
int error;
1799
+
1777
1800
Wsrep_schema_impl::init_stmt (thd);
1778
1801
if (Wsrep_schema_impl::open_for_write (thd, allowlist_table_str.c_str (),
1779
1802
&allowlist_table_l))
0 commit comments