• Marko Mäkelä's avatar
    MDEV-22203: WSREP_ON is unnecessarily expensive WITH_WSREP=OFF · 2c39f69d
    Marko Mäkelä authored
    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.
    2c39f69d
dict0stats_bg.cc 15.2 KB