Skip to content

Commit

Permalink
Merge pull request #4381 from sysown/v2.x-depr_checksum_vars_fix
Browse files Browse the repository at this point in the history
Fix interactions between 'checksum_%' and '%_diffs_before_sync' variables
  • Loading branch information
renecannao authored Nov 17, 2023
2 parents b6deb15 + a8446de commit e997f6b
Show file tree
Hide file tree
Showing 2 changed files with 270 additions and 60 deletions.
14 changes: 13 additions & 1 deletion lib/ProxySQL_Admin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8404,6 +8404,7 @@ bool ProxySQL_Admin::set_variable(char *name, char *value, bool lock) { // this
if (!strcasecmp(name,"cluster_mysql_query_rules_diffs_before_sync")) {
int intv=atoi(value);
if (intv >= 0 && intv <= 1000) {
intv = checksum_variables.checksum_mysql_query_rules ? intv : 0;
if (variables.cluster_mysql_query_rules_diffs_before_sync == 0 && intv != 0) {
proxy_info("Re-enabled previously disabled 'admin-cluster_admin_variables_diffs_before_sync'. Resetting global checksums to force Cluster re-sync.\n");
GloProxyCluster->Reset_Global_Checksums(lock);
Expand All @@ -8418,6 +8419,7 @@ bool ProxySQL_Admin::set_variable(char *name, char *value, bool lock) { // this
if (!strcasecmp(name,"cluster_mysql_servers_diffs_before_sync")) {
int intv=atoi(value);
if (intv >= 0 && intv <= 1000) {
intv = checksum_variables.checksum_mysql_servers ? intv : 0;
if (variables.cluster_mysql_servers_diffs_before_sync == 0 && intv != 0) {
proxy_info("Re-enabled previously disabled 'admin-cluster_mysql_servers_diffs_before_sync'. Resetting global checksums to force Cluster re-sync.\n");
GloProxyCluster->Reset_Global_Checksums(lock);
Expand All @@ -8432,6 +8434,7 @@ bool ProxySQL_Admin::set_variable(char *name, char *value, bool lock) { // this
if (!strcasecmp(name,"cluster_mysql_users_diffs_before_sync")) {
int intv=atoi(value);
if (intv >= 0 && intv <= 1000) {
intv = checksum_variables.checksum_mysql_users ? intv : 0;
if (variables.cluster_mysql_users_diffs_before_sync == 0 && intv != 0) {
proxy_info("Re-enabled previously disabled 'admin-cluster_mysql_users_diffs_before_sync'. Resetting global checksums to force Cluster re-sync.\n");
GloProxyCluster->Reset_Global_Checksums(lock);
Expand Down Expand Up @@ -8460,6 +8463,7 @@ bool ProxySQL_Admin::set_variable(char *name, char *value, bool lock) { // this
if (!strcasecmp(name,"cluster_mysql_variables_diffs_before_sync")) {
int intv=atoi(value);
if (intv >= 0 && intv <= 1000) {
intv = checksum_variables.checksum_mysql_variables ? intv : 0;
if (variables.cluster_mysql_variables_diffs_before_sync == 0 && intv != 0) {
proxy_info("Re-enabled previously disabled 'admin-cluster_mysql_variables_diffs_before_sync'. Resetting global checksums to force Cluster re-sync.\n");
GloProxyCluster->Reset_Global_Checksums(lock);
Expand All @@ -8474,6 +8478,7 @@ bool ProxySQL_Admin::set_variable(char *name, char *value, bool lock) { // this
if (!strcasecmp(name,"cluster_admin_variables_diffs_before_sync")) {
int intv=atoi(value);
if (intv >= 0 && intv <= 1000) {
intv = checksum_variables.checksum_admin_variables ? intv : 0;
if (variables.cluster_admin_variables_diffs_before_sync == 0 && intv != 0) {
proxy_info("Re-enabled previously disabled 'admin-cluster_admin_variables_diffs_before_sync'. Resetting global checksums to force Cluster re-sync.\n");
GloProxyCluster->Reset_Global_Checksums(lock);
Expand All @@ -8488,7 +8493,8 @@ bool ProxySQL_Admin::set_variable(char *name, char *value, bool lock) { // this
if (!strcasecmp(name,"cluster_ldap_variables_diffs_before_sync")) {
int intv=atoi(value);
if (intv >= 0 && intv <= 1000) {
if (variables.cluster_ldap_variables_save_to_disk == 0 && intv != 0) {
intv = checksum_variables.checksum_ldap_variables ? intv : 0;
if (variables.cluster_ldap_variables_diffs_before_sync == 0 && intv != 0) {
proxy_info("Re-enabled previously disabled 'admin-cluster_ldap_variables_diffs_before_sync'. Resetting global checksums to force Cluster re-sync.\n");
GloProxyCluster->Reset_Global_Checksums(lock);
}
Expand Down Expand Up @@ -8687,6 +8693,7 @@ bool ProxySQL_Admin::set_variable(char *name, char *value, bool lock) { // this
if (strcasecmp(value,"false")==0 || strcasecmp(value,"0")==0) {
checksum_variables.checksum_mysql_query_rules=false;
variables.cluster_mysql_query_rules_diffs_before_sync = 0;
__sync_lock_test_and_set(&GloProxyCluster->cluster_mysql_query_rules_diffs_before_sync, 0);
proxy_warning("Disabling deprecated 'admin-checksum_mysql_query_rules', setting 'admin-cluster_mysql_query_rules_diffs_before_sync=0'\n");
return true;
}
Expand All @@ -8700,6 +8707,7 @@ bool ProxySQL_Admin::set_variable(char *name, char *value, bool lock) { // this
if (strcasecmp(value,"false")==0 || strcasecmp(value,"0")==0) {
checksum_variables.checksum_mysql_servers=false;
variables.cluster_mysql_servers_diffs_before_sync = 0;
__sync_lock_test_and_set(&GloProxyCluster->cluster_mysql_servers_diffs_before_sync, 0);
proxy_warning("Disabling deprecated 'admin-checksum_mysql_servers', setting 'admin-cluster_mysql_servers_diffs_before_sync=0'\n");
return true;
}
Expand All @@ -8714,6 +8722,7 @@ bool ProxySQL_Admin::set_variable(char *name, char *value, bool lock) { // this
if (strcasecmp(value,"false")==0 || strcasecmp(value,"0")==0) {
checksum_variables.checksum_mysql_users=false;
variables.cluster_mysql_users_diffs_before_sync = 0;
__sync_lock_test_and_set(&GloProxyCluster->cluster_mysql_users_diffs_before_sync, 0);
proxy_warning("Disabling deprecated 'admin-checksum_mysql_users', setting 'admin-cluster_mysql_users_diffs_before_sync=0'\n");
return true;
}
Expand All @@ -8727,6 +8736,7 @@ bool ProxySQL_Admin::set_variable(char *name, char *value, bool lock) { // this
if (strcasecmp(value,"false")==0 || strcasecmp(value,"0")==0) {
checksum_variables.checksum_mysql_variables=false;
variables.cluster_mysql_variables_diffs_before_sync = 0;
__sync_lock_test_and_set(&GloProxyCluster->cluster_mysql_variables_diffs_before_sync, 0);
proxy_warning("Disabling deprecated 'admin-checksum_mysql_variables', setting 'admin-cluster_mysql_variables_diffs_before_sync=0'\n");
return true;
}
Expand All @@ -8740,6 +8750,7 @@ bool ProxySQL_Admin::set_variable(char *name, char *value, bool lock) { // this
if (strcasecmp(value,"false")==0 || strcasecmp(value,"0")==0) {
checksum_variables.checksum_admin_variables=false;
variables.cluster_admin_variables_diffs_before_sync = 0;
__sync_lock_test_and_set(&GloProxyCluster->cluster_admin_variables_diffs_before_sync, 0);
proxy_warning("Disabling deprecated 'admin-checksum_admin_variables', setting 'admin-cluster_admin_variables_diffs_before_sync=0'\n");
return true;
}
Expand All @@ -8753,6 +8764,7 @@ bool ProxySQL_Admin::set_variable(char *name, char *value, bool lock) { // this
if (strcasecmp(value,"false")==0 || strcasecmp(value,"0")==0) {
checksum_variables.checksum_ldap_variables=false;
variables.cluster_ldap_variables_diffs_before_sync = 0;
__sync_lock_test_and_set(&GloProxyCluster->cluster_ldap_variables_diffs_before_sync, 0);
proxy_warning("Disabling deprecated 'admin-checksum_ldap_variables', setting 'admin-cluster_ldap_variables_diffs_before_sync=0'\n");
return true;
}
Expand Down
Loading

0 comments on commit e997f6b

Please sign in to comment.