summaryrefslogtreecommitdiff
path: root/sql/wsrep_var.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_var.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_var.cc')
-rw-r--r--sql/wsrep_var.cc9
1 files changed, 3 insertions, 6 deletions
diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc
index a484f8bf113..64362d1c9e2 100644
--- a/sql/wsrep_var.cc
+++ b/sql/wsrep_var.cc
@@ -88,13 +88,10 @@ static bool refresh_provider_options()
}
}
-static void wsrep_set_wsrep_on(void)
+static void wsrep_set_wsrep_on()
{
- if (global_system_variables.wsrep_on && wsrep_provider &&
- strcmp(wsrep_provider, WSREP_NONE))
- WSREP_ON= true;
- else
- WSREP_ON= false;
+ WSREP_ON_= global_system_variables.wsrep_on && wsrep_provider &&
+ strcmp(wsrep_provider, WSREP_NONE);
}
/* This is intentionally declared as a weak global symbol, so that