mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
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.
This commit is contained in:
@@ -13,7 +13,7 @@ enum Wsrep_service_key_type
|
||||
|
||||
#else
|
||||
|
||||
/* Copyright (c) 2015 MariaDB Corporation Ab
|
||||
/* Copyright (c) 2015, 2020, MariaDB Corporation Ab
|
||||
2018 Codership Oy <info@codership.com>
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -97,7 +97,7 @@ extern struct wsrep_service_st {
|
||||
#define wsrep_is_wsrep_xid(X) wsrep_service->wsrep_is_wsrep_xid_func(X)
|
||||
#define wsrep_xid_seqno(X) wsrep_service->wsrep_xid_seqno_func(X)
|
||||
#define wsrep_xid_uuid(X) wsrep_service->wsrep_xid_uuid_func(X)
|
||||
#define wsrep_on(X) wsrep_service->wsrep_on_func(X)
|
||||
#define wsrep_on(X) WSREP_ON && wsrep_service->wsrep_on_func(X)
|
||||
#define wsrep_prepare_key_for_innodb(A,B,C,D,E,F,G) wsrep_service->wsrep_prepare_key_for_innodb_func(A,B,C,D,E,F,G)
|
||||
#define wsrep_thd_LOCK(T) wsrep_service->wsrep_thd_LOCK_func(T)
|
||||
#define wsrep_thd_UNLOCK(T) wsrep_service->wsrep_thd_UNLOCK_func(T)
|
||||
|
Reference in New Issue
Block a user