Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix interactions between 'checksum_%' and '%_diffs_before_sync' variables #4381

Merged
merged 3 commits into from
Nov 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion lib/ProxySQL_Admin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8392,6 +8392,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 @@ -8406,6 +8407,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 @@ -8420,6 +8422,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 @@ -8448,6 +8451,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 @@ -8462,6 +8466,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 @@ -8476,7 +8481,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 @@ -8675,6 +8681,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 @@ -8688,6 +8695,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 @@ -8702,6 +8710,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 @@ -8715,6 +8724,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 @@ -8728,6 +8738,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 @@ -8741,6 +8752,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
Loading