Fix interactions between 'checksum_%' and '%_diffs_before_sync'

- Introduced dependency between 'checksum_variables' and their
  corresponding '%_diffs_before_sync' variable. Checksum variables being
  'false' implies a '0' value. Variable dependencies need to be
  introduced in the handler for both variables, since order can't be
  assumed.
- Added missing sets statements for 'GloProxyCluster' variables when
  updating '%_diffs_before_sync'.
- Fixed typo in 'cluster_ldap_variables_diffs_before_sync' handling,
  creating unintentional checksum resets.
pull/4381/head
Javier Jaramago Fernández 3 years ago
parent 2d0c8bf6f8
commit 437fcad1d4

@ -8390,6 +8390,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);
@ -8404,6 +8405,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);
@ -8418,6 +8420,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);
@ -8446,6 +8449,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);
@ -8460,6 +8464,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);
@ -8474,7 +8479,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);
}
@ -8673,6 +8679,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;
}
@ -8686,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_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;
}
@ -8700,6 +8708,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;
}
@ -8713,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_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;
}
@ -8726,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_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;
}
@ -8739,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_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;
}

Loading…
Cancel
Save