mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-22203: WSREP_ON is unnecessarily expensive to evaluate
This is a backport of the applicable part of commit93475aff8d
and commit2c39f69d34
from 10.4. Before 10.4 and Galera 4, WSREP_ON is a macro that points to a global Boolean variable, so it is not that expensive to evaluate, but we will add an unlikely() hint around it. WSREP_ON_NEW: Remove. This macro was introduced in commitc863159c32
when reverting WSREP_ON to its previous definition. We replace some use of WSREP_ON with WSREP(thd), like it was done in93475aff8d
. Note: the macro WSREP() in 10.1 is equivalent to WSREP_NNULL() in 10.4. Item_func_rand::seed_random(): Avoid invoking current_thd when WSREP is not enabled.
This commit is contained in:
@ -1,5 +1,5 @@
|
||||
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
|
||||
Copyright (c) 2008, 2019, MariaDB
|
||||
Copyright (c) 2008, 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
|
||||
@ -1493,7 +1493,7 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
if (parser_state.init(thd, thd->query(), thd->query_length()))
|
||||
break;
|
||||
|
||||
if (WSREP_ON)
|
||||
if (WSREP(thd))
|
||||
wsrep_mysql_parse(thd, thd->query(), thd->query_length(), &parser_state);
|
||||
else
|
||||
mysql_parse(thd, thd->query(), thd->query_length(), &parser_state);
|
||||
@ -1574,13 +1574,13 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
|
||||
*/
|
||||
statistic_increment(thd->status_var.questions, &LOCK_status);
|
||||
|
||||
if(!WSREP(thd))
|
||||
if (!WSREP(thd))
|
||||
thd->set_time(); /* Reset the query start time. */
|
||||
|
||||
parser_state.reset(beginning_of_next_stmt, length);
|
||||
/* TODO: set thd->lex->sql_command to SQLCOM_END here */
|
||||
|
||||
if (WSREP_ON)
|
||||
if (WSREP(thd))
|
||||
wsrep_mysql_parse(thd, beginning_of_next_stmt, length, &parser_state);
|
||||
else
|
||||
mysql_parse(thd, beginning_of_next_stmt, length, &parser_state);
|
||||
|
Reference in New Issue
Block a user