summaryrefslogtreecommitdiff
path: root/sql/wsrep_mysqld.cc
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-04-24 15:25:39 +0300
committerMarko Mäkelä <marko.makela@mariadb.com>2020-04-24 15:25:39 +0300
commit2c39f69d34e64a5cf94720e82e78c0ee91bd4649 (patch)
tree5592450d8d717529c7e9d1e27ef534a821793946 /sql/wsrep_mysqld.cc
parent93475aff8de80a0ef53cbee924bcb70de6e86f2c (diff)
downloadmariadb-git-2c39f69d34e64a5cf94720e82e78c0ee91bd4649.tar.gz
MDEV-22203: WSREP_ON is unnecessarily expensive WITH_WSREP=OFF
If the server is compiled WITH_WSREP=OFF, we should avoid evaluating conditions on a global variable that is constant. WSREP_ON_: Renamed from WSREP_ON. Defined only WITH_WSREP=ON. WSREP_ON: Defined as unlikely(WSREP_ON_). wsrep_on(): Defined as WSREP_ON && wsrep_service->wsrep_on_func(). The reason why we have wsrep_on() at all is that the macro WSREP(thd) depends on the definition of THD, and that is intentionally an opaque data type for InnoDB. So, we cannot avoid invoking wsrep_on(), but we can evaluate the less expensive condition WSREP_ON before calling the function.
Diffstat (limited to 'sql/wsrep_mysqld.cc')
-rw-r--r--sql/wsrep_mysqld.cc5
1 files changed, 1 insertions, 4 deletions
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index c1a289cf685..14be333c107 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -770,10 +770,7 @@ int wsrep_init()
global_system_variables.wsrep_on= 1;
- if (wsrep_provider && strcmp(wsrep_provider, WSREP_NONE))
- WSREP_ON= true;
- else
- WSREP_ON= false;
+ WSREP_ON_= wsrep_provider && strcmp(wsrep_provider, WSREP_NONE);
if (wsrep_gtid_mode && opt_bin_log && !opt_log_slave_updates)
{