diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-04-24 16:01:10 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-04-24 16:01:10 +0300 |
commit | edd38b50f665cb419507aa09f816cddcd895dfd0 (patch) | |
tree | a21b228067d82d3db35347125b2f76cde0026e0d /sql/lock.cc | |
parent | 2c39f69d34e64a5cf94720e82e78c0ee91bd4649 (diff) | |
download | mariadb-git-edd38b50f665cb419507aa09f816cddcd895dfd0.tar.gz |
MDEV-7962 wsrep_on() takes 0.14% in OLTP RO
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 conditions thd && WSREP_ON before
calling the function.
Global_read_lock: Use WSREP_NNULL(thd) instead of wsrep_on(thd)
because we not only know the definition of THD but also that
the pointer is not null.
wsrep_open(): Use WSREP(thd) instead of wsrep_on(thd).
InnoDB: Replace thd && wsrep_on(thd) with wsrep_on(thd), now that
the condition has been merged to the definition of the macro
wsrep_on().
Diffstat (limited to 'sql/lock.cc')
-rw-r--r-- | sql/lock.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sql/lock.cc b/sql/lock.cc index 94e0d2733c7..8b8dd6fbed1 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -1,5 +1,6 @@ /* Copyright (c) 2000, 2011, Oracle and/or its affiliates. + Copyright (c) 2020, MariaDB 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 @@ -1102,13 +1103,15 @@ void Global_read_lock::unlock_global_read_lock(THD *thd) { Wsrep_server_state& server_state= Wsrep_server_state::instance(); if (server_state.state() == Wsrep_server_state::s_donor || - (wsrep_on(thd) && server_state.state() != Wsrep_server_state::s_synced)) + (WSREP_NNULL(thd) && + server_state.state() != Wsrep_server_state::s_synced)) { /* TODO: maybe redundant here?: */ wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED; server_state.resume(); } - else if (wsrep_on(thd) && server_state.state() == Wsrep_server_state::s_synced) + else if (WSREP_NNULL(thd) && + server_state.state() == Wsrep_server_state::s_synced) { server_state.resume_and_resync(); } @@ -1164,11 +1167,13 @@ bool Global_read_lock::make_global_read_lock_block_commit(THD *thd) Wsrep_server_state& server_state= Wsrep_server_state::instance(); wsrep::seqno paused_seqno; if (server_state.state() == Wsrep_server_state::s_donor || - (wsrep_on(thd) && server_state.state() != Wsrep_server_state::s_synced)) + (WSREP_NNULL(thd) && + server_state.state() != Wsrep_server_state::s_synced)) { paused_seqno= server_state.pause(); } - else if (wsrep_on(thd) && server_state.state() == Wsrep_server_state::s_synced) + else if (WSREP_NNULL(thd) && + server_state.state() == Wsrep_server_state::s_synced) { paused_seqno= server_state.desync_and_pause(); } |