summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSachin Setiya <sachinsetia1001@gmail.com>2017-01-03 10:45:55 +0530
committerSachin Setiya <sachinsetia1001@gmail.com>2017-01-03 10:45:55 +0530
commitb4616c40be00c5c8a2a73d537d676d8ddb7c84cf (patch)
treeeb1ba06298c15353f0bc3e9eb557997d7451f622
parentd9a1a201aae87a655cdf3e5a344b2265912a94a7 (diff)
downloadmariadb-git-b4616c40be00c5c8a2a73d537d676d8ddb7c84cf.tar.gz
MDEV-7955 WSREP() appears on radar in OLTP RO
This commit is for optimizing WSREP(thd) macro. #define WSREP(thd) \ (WSREP_ON && wsrep && (thd && thd->variables.wsrep_on)) In this we can safely remove wsrep and thd. We are not removing WSREP_ON because this will change WSREP(thd) behaviour. Patch Credit:- Nirbhay Choubay, Sergey Vojtovich
-rw-r--r--sql/sql_parse.cc2
-rw-r--r--sql/wsrep_mysqld.h2
-rw-r--r--storage/innobase/handler/ha_innodb.cc2
-rw-r--r--storage/innobase/trx/trx0trx.cc2
-rw-r--r--storage/xtradb/handler/ha_innodb.cc2
-rw-r--r--storage/xtradb/trx/trx0trx.cc2
6 files changed, 6 insertions, 6 deletions
diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc
index 5717c3dd6c4..4f630b68264 100644
--- a/sql/sql_parse.cc
+++ b/sql/sql_parse.cc
@@ -2624,7 +2624,7 @@ mysql_execute_command(THD *thd)
} /* endif unlikely slave */
#endif
#ifdef WITH_WSREP
- if (WSREP(thd))
+ if (wsrep && WSREP(thd))
{
/*
change LOCK TABLE WRITE to transaction
diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h
index cf549ffe544..fc4b2a452fe 100644
--- a/sql/wsrep_mysqld.h
+++ b/sql/wsrep_mysqld.h
@@ -179,7 +179,7 @@ extern wsrep_seqno_t wsrep_locked_seqno;
strcmp(wsrep_provider, WSREP_NONE))
#define WSREP(thd) \
- (WSREP_ON && wsrep && (thd && thd->variables.wsrep_on))
+ (WSREP_ON && thd->variables.wsrep_on)
#define WSREP_CLIENT(thd) \
(WSREP(thd) && thd->wsrep_client_thread)
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 3713dd959d4..b283bbda7f4 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -4103,7 +4103,7 @@ innobase_commit_low(
#ifdef WITH_WSREP
THD* thd = (THD*)trx->mysql_thd;
const char* tmp = 0;
- if (wsrep_on(thd)) {
+ if (thd && wsrep_on(thd)) {
#ifdef WSREP_PROC_INFO
char info[64];
info[sizeof(info) - 1] = '\0';
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index cde32448769..11025b4c21c 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -1349,7 +1349,7 @@ trx_commit_in_memory(
ut_ad(!trx->in_rw_trx_list);
#ifdef WITH_WSREP
- if (wsrep_on(trx->mysql_thd)) {
+ if (trx->mysql_thd && wsrep_on(trx->mysql_thd)) {
trx->lock.was_chosen_as_deadlock_victim = FALSE;
}
#endif
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 8d564df2bb3..8f51b931038 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -4742,7 +4742,7 @@ innobase_commit_low(
#ifdef WITH_WSREP
THD* thd = (THD*)trx->mysql_thd;
const char* tmp = 0;
- if (wsrep_on(thd)) {
+ if (thd && wsrep_on(thd)) {
#ifdef WSREP_PROC_INFO
char info[64];
info[sizeof(info) - 1] = '\0';
diff --git a/storage/xtradb/trx/trx0trx.cc b/storage/xtradb/trx/trx0trx.cc
index ec57a8e5c54..bdf407ff7fb 100644
--- a/storage/xtradb/trx/trx0trx.cc
+++ b/storage/xtradb/trx/trx0trx.cc
@@ -1572,7 +1572,7 @@ trx_commit_in_memory(
ut_ad(!trx->in_rw_trx_list);
#ifdef WITH_WSREP
- if (wsrep_on(trx->mysql_thd)) {
+ if (trx->mysql_thd && wsrep_on(trx->mysql_thd)) {
trx->lock.was_chosen_as_deadlock_victim = FALSE;
}
#endif