summaryrefslogtreecommitdiff
path: root/sql/wsrep_thd.cc
diff options
context:
space:
mode:
authorNirbhay Choubey <nirbhay@skysql.com>2014-03-25 14:42:15 -0400
committerNirbhay Choubey <nirbhay@skysql.com>2014-03-25 14:42:15 -0400
commit3088d52c20eca10e5b8689648edef8f7fd49830a (patch)
treefc75c000b47e753c04cb2c74e48d8b74d22a509f /sql/wsrep_thd.cc
parent3c0b3babd9fdaa6d6697289368022cc152c77593 (diff)
downloadmariadb-git-3088d52c20eca10e5b8689648edef8f7fd49830a.tar.gz
bzr merge -r3933..3945 codership/5.5 (Non-InnoDB changes only).
Diffstat (limited to 'sql/wsrep_thd.cc')
-rw-r--r--sql/wsrep_thd.cc62
1 files changed, 43 insertions, 19 deletions
diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc
index 2e1e86f2f30..e68120ee779 100644
--- a/sql/wsrep_thd.cc
+++ b/sql/wsrep_thd.cc
@@ -473,27 +473,51 @@ void wsrep_create_rollbacker()
}
extern "C"
-int wsrep_thd_is_brute_force(void *thd_ptr)
+my_bool wsrep_thd_is_BF(void *thd_ptr, my_bool sync)
+{
+ my_bool status = FALSE;
+ if (thd_ptr)
+ {
+ THD* thd = (THD*)thd_ptr;
+ if (sync) mysql_mutex_lock(&thd->LOCK_wsrep_thd);
+
+ status = ((thd->wsrep_exec_mode == REPL_RECV) ||
+ (thd->wsrep_exec_mode == TOTAL_ORDER));
+ if (sync) mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
+ }
+ return status;
+}
+
+extern "C"
+my_bool wsrep_thd_is_BF_or_commit(void *thd_ptr, my_bool sync)
{
- /*
- Brute force:
- Appliers and replaying are running in REPL_RECV mode. TOI statements
- in TOTAL_ORDER mode. Locally committing transaction that has got
- past wsrep->pre_commit() without error is running in LOCAL_COMMIT mode.
-
- Everything else is running in LOCAL_STATE and should not be considered
- brute force.
- */
- if (thd_ptr) {
- switch (((THD *)thd_ptr)->wsrep_exec_mode) {
- case LOCAL_STATE: return 0;
- case REPL_RECV: return 1;
- case TOTAL_ORDER: return 2;
- case LOCAL_COMMIT: return 3;
- }
- DBUG_ASSERT(0);
+ bool status = FALSE;
+ if (thd_ptr)
+ {
+ THD* thd = (THD*)thd_ptr;
+ if (sync) mysql_mutex_lock(&thd->LOCK_wsrep_thd);
+
+ status = ((thd->wsrep_exec_mode == REPL_RECV) ||
+ (thd->wsrep_exec_mode == TOTAL_ORDER) ||
+ (thd->wsrep_exec_mode == LOCAL_COMMIT));
+ if (sync) mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
}
- return 0;
+ return status;
+}
+
+extern "C"
+my_bool wsrep_thd_is_local(void *thd_ptr, my_bool sync)
+{
+ bool status = FALSE;
+ if (thd_ptr)
+ {
+ THD* thd = (THD*)thd_ptr;
+ if (sync) mysql_mutex_lock(&thd->LOCK_wsrep_thd);
+
+ status = (thd->wsrep_exec_mode == LOCAL_STATE);
+ if (sync) mysql_mutex_unlock(&thd->LOCK_wsrep_thd);
+ }
+ return status;
}
extern "C"