Skip to content

Commit

Permalink
Code cleanup in MySQL_Thread::refresh_variables()
Browse files Browse the repository at this point in the history
Use macros to avoid repeating variable name and strings with the variable name.

Because this commit avoids duplications of name and literals, this commit also renames:
mysql_thread___monitor_groupreplication_max_transaction_behind_for_read_only
to:
mysql_thread___monitor_groupreplication_max_transactions_behind_for_read_only
  • Loading branch information
renecannao committed May 6, 2024
1 parent 321774f commit 9283cd2
Show file tree
Hide file tree
Showing 3 changed files with 220 additions and 177 deletions.
4 changes: 2 additions & 2 deletions include/proxysql_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ __thread int mysql_thread___monitor_groupreplication_healthcheck_interval;
__thread int mysql_thread___monitor_groupreplication_healthcheck_timeout;
__thread int mysql_thread___monitor_groupreplication_healthcheck_max_timeout_count;
__thread int mysql_thread___monitor_groupreplication_max_transactions_behind_count;
__thread int mysql_thread___monitor_groupreplication_max_transaction_behind_for_read_only;
__thread int mysql_thread___monitor_groupreplication_max_transactions_behind_for_read_only;
__thread int mysql_thread___monitor_galera_healthcheck_interval;
__thread int mysql_thread___monitor_galera_healthcheck_timeout;
__thread int mysql_thread___monitor_galera_healthcheck_max_timeout_count;
Expand Down Expand Up @@ -1087,7 +1087,7 @@ extern __thread int mysql_thread___monitor_replication_lag_count;
extern __thread int mysql_thread___monitor_groupreplication_healthcheck_interval;
extern __thread int mysql_thread___monitor_groupreplication_healthcheck_timeout;
extern __thread int mysql_thread___monitor_groupreplication_healthcheck_max_timeout_count;
extern __thread int mysql_thread___monitor_groupreplication_max_transaction_behind_for_read_only;
extern __thread int mysql_thread___monitor_groupreplication_max_transactions_behind_for_read_only;
extern __thread int mysql_thread___monitor_groupreplication_max_transactions_behind_count;
extern __thread int mysql_thread___monitor_galera_healthcheck_interval;
extern __thread int mysql_thread___monitor_galera_healthcheck_timeout;
Expand Down
8 changes: 4 additions & 4 deletions lib/MySQL_HostGroups_Manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2866,8 +2866,8 @@ void MySQL_HostGroups_Manager::group_replication_lag_action(
MyHGC* myhgc = nullptr;

if (
mysql_thread___monitor_groupreplication_max_transaction_behind_for_read_only == 0 ||
mysql_thread___monitor_groupreplication_max_transaction_behind_for_read_only == 2 ||
mysql_thread___monitor_groupreplication_max_transactions_behind_for_read_only == 0 ||
mysql_thread___monitor_groupreplication_max_transactions_behind_for_read_only == 2 ||
enable
) {
if (read_only == false) {
Expand All @@ -2877,8 +2877,8 @@ void MySQL_HostGroups_Manager::group_replication_lag_action(
}

if (
mysql_thread___monitor_groupreplication_max_transaction_behind_for_read_only == 1 ||
mysql_thread___monitor_groupreplication_max_transaction_behind_for_read_only == 2 ||
mysql_thread___monitor_groupreplication_max_transactions_behind_for_read_only == 1 ||
mysql_thread___monitor_groupreplication_max_transactions_behind_for_read_only == 2 ||
enable
) {
myhgc = MyHGM->MyHGC_find(reader_hostgroup);
Expand Down
Loading

0 comments on commit 9283cd2

Please sign in to comment.