Skip to content

Commit

Permalink
MDEV-7955 WSREP() appears on radar in OLTP RO
Browse files Browse the repository at this point in the history
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
  • Loading branch information
SachinSetiya committed Jan 3, 2017
1 parent d9a1a20 commit b4616c4
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion sql/sql_parse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion sql/wsrep_mysqld.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion storage/innobase/trx/trx0trx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion storage/xtradb/handler/ha_innodb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion storage/xtradb/trx/trx0trx.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b4616c4

Please sign in to comment.