Skip to content

Commit

Permalink
* The cluster template file now includes "cluster_sync_interfaces=fal…
Browse files Browse the repository at this point in the history
…se."

* In the event of any failure, it's crucial to call the cleanup function to prevent any orphaned replica instances from remaining active.
  • Loading branch information
rahim-kanji committed Apr 20, 2023
1 parent 5114069 commit f350038
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ admin_variables=
cluster_mysql_users_diffs_before_sync=3
cluster_admin_variables_diffs_before_sync=3
cluster_proxysql_servers_diffs_before_sync=3
cluster_sync_interfaces=false
}

mysql_variables=
Expand Down
14 changes: 6 additions & 8 deletions test/tap/tests/test_cluster_sync_mysql_servers-t.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ std::vector<std::vector<std::string>> queries = {
"SET mysql-monitor_enabled='false'",
"LOAD MYSQL VARIABLES TO RUNTIME",
"UPDATE global_variables SET variable_value='1' WHERE variable_name='admin-cluster_mysql_servers_sync_algorithm'",
"LOAD ADMIN VARIABLES TO RUNTIME"
"LOAD ADMIN VARIABLES TO RUNTIME",
"LOAD MYSQL SERVERS TO RUNTIME"
},
{
Expand Down Expand Up @@ -821,7 +821,7 @@ std::vector<std::vector<std::string>> queries = {
};

int main(int, char**) {
int res = 0;

CommandLine cl;
std::atomic<bool> save_proxy_stderr(false);

Expand Down Expand Up @@ -910,7 +910,6 @@ int main(int, char**) {

if (r_proxysql_nomonitor_admin == nullptr) {
fprintf(stderr, "File %s, line %d, Error: %s\n", __FILE__, __LINE__, mysql_error(r_proxysql_nomonitor_admin));
res = -1;
goto cleanup;
}

Expand All @@ -928,15 +927,13 @@ int main(int, char**) {

if (r_proxysql_withmonitor_admin == nullptr) {
fprintf(stderr, "File %s, line %d, Error: %s\n", __FILE__, __LINE__, mysql_error(r_proxysql_withmonitor_admin));
res = -1;
goto cleanup;
}

int read_only_val = -1;
int result = get_read_only_value("127.0.0.1", 13306, "root", "root", &read_only_val);
if (result != EXIT_SUCCESS) {
fprintf(stderr, "File %s, line %d, Error: `%s`\n", __FILE__, __LINE__, "Fetching read_only value from mysql server failed.");
res = -1;
goto cleanup;
}

Expand All @@ -960,21 +957,22 @@ int main(int, char**) {

if (result != EXIT_SUCCESS) {
fprintf(stderr, "File %s, line %d, Error: `%s`\n", __FILE__, __LINE__, "Failed to insert records in mysql_servers table.");
res = -1;
goto cleanup;
}

for (const auto& pre_queries : queries) {

for (const std::string& query : pre_queries) {
MYSQL_QUERY(proxy_admin, query.c_str());
if (mysql_query(proxy_admin, query.c_str())) {
fprintf(stderr, "File %s, line %d, Error: `%s`\n", __FILE__, __LINE__, mysql_error(proxy_admin));
goto cleanup;
}
}
sleep(1);

result = check_mysql_servers_sync(cl, proxy_admin, r_proxysql_withmonitor_admin, r_proxysql_nomonitor_admin);
if (result != EXIT_SUCCESS) {
fprintf(stderr, "File %s, line %d, Error: `%s`\n", __FILE__, __LINE__, "Checking mysql servers sync records failed.");
res = -1;
goto cleanup;
}
}
Expand Down

0 comments on commit f350038

Please sign in to comment.