summaryrefslogtreecommitdiff
path: root/storage/innobase/include
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 /storage/innobase/include
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 'storage/innobase/include')
-rw-r--r--storage/innobase/include/lock0lock.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h
index 11000620e8c..29e2aacaf5c 100644
--- a/storage/innobase/include/lock0lock.h
+++ b/storage/innobase/include/lock0lock.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2019, MariaDB Corporation.
+Copyright (c) 2017, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -1046,7 +1046,7 @@ lock_get_info(
/*******************************************************************//**
@return whether wsrep_on is true on trx->mysql_thd*/
-#define wsrep_on_trx(trx) ((trx)->mysql_thd && wsrep_on((trx)->mysql_thd))
+#define wsrep_on_trx(trx) wsrep_on((trx)->mysql_thd)
#endif /* WITH_WSREP */