summaryrefslogtreecommitdiff
path: root/sql/wsrep_mysqld.cc
diff options
context:
space:
mode:
authorTeemu Ollakka <teemu.ollakka@galeracluster.com>2015-03-11 13:04:00 +0200
committerNirbhay Choubey <nirbhay@mariadb.com>2015-05-08 17:41:07 -0400
commit2df5ff2691a80873f44e779658c9a5d41c6c7e13 (patch)
tree3efde73f9e7ede6536449dd7b792e83bdebcc792 /sql/wsrep_mysqld.cc
parentc16ec074196aee32326a8015f49c0b8bae25111f (diff)
downloadmariadb-git-2df5ff2691a80873f44e779658c9a5d41c6c7e13.tar.gz
refs codership/mysql-wsrep#90 - fixed race in OSU
Make sure that thd uses the same method to begin and end OSU operation.
Diffstat (limited to 'sql/wsrep_mysqld.cc')
-rw-r--r--sql/wsrep_mysqld.cc27
1 files changed, 21 insertions, 6 deletions
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 7cfde65ebf1..f1a91f40e1e 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -1393,6 +1393,12 @@ int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_,
}
/*
+ Save current global value into thd to persist the used method
+ even if global wsrep_OSU_method_options changes during isolation
+ */
+ thd->wsrep_OSU_method= wsrep_OSU_method_options;
+
+ /*
It makes sense to set auto_increment_* to defaults in TOI operations.
Must be done before wsrep_TOI_begin() since Query_log_event encapsulating
TOI statement and auto inc variables for wsrep replication is constructed
@@ -1407,19 +1413,23 @@ int wsrep_to_isolation_begin(THD *thd, char *db_, char *table_,
if (thd->variables.wsrep_on && thd->wsrep_exec_mode==LOCAL_STATE)
{
- switch (wsrep_OSU_method_options) {
+ switch (thd->wsrep_OSU_method) {
case WSREP_OSU_TOI: ret = wsrep_TOI_begin(thd, db_, table_,
table_list); break;
case WSREP_OSU_RSU: ret = wsrep_RSU_begin(thd, db_, table_); break;
+ default:
+ WSREP_ERROR("Unsupported OSU method: %lu", thd->wsrep_OSU_method);
+ ret= -1;
+ break;
}
switch (ret) {
case 0: thd->wsrep_exec_mode= TOTAL_ORDER; break;
- case 1:
- /* TOI replication skipped, treat as success */
- ret = 0;
+ case 1:
+ /* TOI replication skipped, treat as success */
+ ret = 0;
break;
case -1:
- /* TOI replication failed, treat as error */
+ /* TOI replication failed, treat as error */
break;
}
}
@@ -1430,13 +1440,18 @@ void wsrep_to_isolation_end(THD *thd)
{
if (thd->wsrep_exec_mode == TOTAL_ORDER)
{
- switch(wsrep_OSU_method_options)
+ switch(thd->wsrep_OSU_method)
{
case WSREP_OSU_TOI: wsrep_TOI_end(thd); break;
case WSREP_OSU_RSU: wsrep_RSU_end(thd); break;
+ default:
+ WSREP_WARN("Unsupported wsrep OSU method at isolation end: %lu",
+ thd->wsrep_OSU_method);
+ break;
}
wsrep_cleanup_transaction(thd);
}
+ thd->wsrep_OSU_method= WSREP_OSU_NONE;
}
#define WSREP_MDL_LOG(severity, msg, req, gra) \