Remove unnecessary mxs_log_flush_sync calls

The calls were unnecessary in the context where they were made.
This commit is contained in:
Markus Mäkelä
2018-08-10 15:06:59 +03:00
parent cb990f28dc
commit 70fa300fe1
10 changed files with 0 additions and 37 deletions

View File

@ -2248,8 +2248,6 @@ return_main:
unlink_pidfile(); unlink_pidfile();
} }
mxs_log_flush_sync();
if (daemon_mode && rc != MAXSCALE_SHUTDOWN) if (daemon_mode && rc != MAXSCALE_SHUTDOWN)
{ {
/** Notify the parent process that an error has occurred */ /** Notify the parent process that an error has occurred */

View File

@ -109,7 +109,6 @@ int main(int argc, char **argv)
rval = EXIT_FAILURE; rval = EXIT_FAILURE;
} }
mxs_log_flush_sync();
mxs_log_finish(); mxs_log_finish();
return rval; return rval;

View File

@ -192,7 +192,6 @@ int main(int argc, char **argv)
rval = EXIT_FAILURE; rval = EXIT_FAILURE;
} }
mxs_log_flush_sync();
mxs_log_finish(); mxs_log_finish();
return rval; return rval;

View File

@ -40,7 +40,6 @@
* test1 Allocate table of users and mess around with it * test1 Allocate table of users and mess around with it
* *
*/ */
int mxs_log_flush_sync(void);
static int static int
test1() test1()
{ {
@ -52,7 +51,6 @@ test1()
char* name = MXS_STRDUP_A("name"); char* name = MXS_STRDUP_A("name");
hint = hint_create_parameter(NULL, name, "value"); hint = hint_create_parameter(NULL, name, "value");
MXS_FREE(name); MXS_FREE(name);
mxs_log_flush_sync();
ss_info_dassert(NULL != hint, "New hint list should not be null"); ss_info_dassert(NULL != hint, "New hint list should not be null");
ss_info_dassert(0 == strcmp("value", (char*)hint->value), "Hint value should be correct"); ss_info_dassert(0 == strcmp("value", (char*)hint->value), "Hint value should be correct");
ss_info_dassert(0 != hint_exists(&hint, HINT_PARAMETER), "Hint of parameter type should exist"); ss_info_dassert(0 != hint_exists(&hint, HINT_PARAMETER), "Hint of parameter type should exist");
@ -61,7 +59,6 @@ test1()
{ {
hint_free(hint); hint_free(hint);
} }
mxs_log_flush_sync();
ss_dfprintf(stderr, "\t..done\n"); ss_dfprintf(stderr, "\t..done\n");
return 0; return 0;

View File

@ -76,16 +76,10 @@ int main(int argc, char* argv[])
err = MXS_ERROR("%s", logstr); err = MXS_ERROR("%s", logstr);
ss_dassert(err == 0); ss_dassert(err == 0);
err = mxs_log_flush();
ss_dassert(err == 0);
logstr = "My name is %s %d years and %d months."; logstr = "My name is %s %d years and %d months.";
err = MXS_INFO(logstr, "TraceyTracey", 3, 7); err = MXS_INFO(logstr, "TraceyTracey", 3, 7);
ss_dassert(err == 0); ss_dassert(err == 0);
err = mxs_log_flush();
ss_dassert(err == 0);
logstr = "My name is Tracey Tracey 47 years and 7 months."; logstr = "My name is Tracey Tracey 47 years and 7 months.";
err = MXS_INFO("%s", logstr); err = MXS_INFO("%s", logstr);
ss_dassert(err == 0); ss_dassert(err == 0);

View File

@ -113,7 +113,6 @@ int main(int argc, char** argv)
nanosleep(&ts1, NULL); nanosleep(&ts1, NULL);
} }
mxs_log_flush();
mxs_log_finish(); mxs_log_finish();
MXS_FREE(message); MXS_FREE(message);
return 0; return 0;

View File

@ -67,23 +67,19 @@ test1()
ss_dfprintf(stderr, "testserver : creating server called MyServer"); ss_dfprintf(stderr, "testserver : creating server called MyServer");
server = server_alloc("uniquename", params.params()); server = server_alloc("uniquename", params.params());
ss_info_dassert(server, "Allocating the server should not fail"); ss_info_dassert(server, "Allocating the server should not fail");
mxs_log_flush_sync();
char buf[120]; char buf[120];
ss_dfprintf(stderr, "\t..done\nTest Parameter for Server."); ss_dfprintf(stderr, "\t..done\nTest Parameter for Server.");
ss_info_dassert(!server_get_parameter(server, "name", buf, sizeof(buf)), "Parameter should be null when not set"); ss_info_dassert(!server_get_parameter(server, "name", buf, sizeof(buf)), "Parameter should be null when not set");
server_add_parameter(server, "name", "value"); server_add_parameter(server, "name", "value");
mxs_log_flush_sync();
ss_dassert(server_get_parameter(server, "name", buf, sizeof(buf))); ss_dassert(server_get_parameter(server, "name", buf, sizeof(buf)));
ss_info_dassert(strcmp("value", buf) == 0, "Parameter should be returned correctly"); ss_info_dassert(strcmp("value", buf) == 0, "Parameter should be returned correctly");
ss_dfprintf(stderr, "\t..done\nTesting Unique Name for Server."); ss_dfprintf(stderr, "\t..done\nTesting Unique Name for Server.");
ss_info_dassert(NULL == server_find_by_unique_name("non-existent"), ss_info_dassert(NULL == server_find_by_unique_name("non-existent"),
"Should not find non-existent unique name."); "Should not find non-existent unique name.");
mxs_log_flush_sync();
ss_info_dassert(server == server_find_by_unique_name("uniquename"), "Should find by unique name."); ss_info_dassert(server == server_find_by_unique_name("uniquename"), "Should find by unique name.");
ss_dfprintf(stderr, "\t..done\nTesting Status Setting for Server."); ss_dfprintf(stderr, "\t..done\nTesting Status Setting for Server.");
status = server_status(server); status = server_status(server);
mxs_log_flush_sync();
ss_info_dassert(0 == strcmp("Running", status), "Status of Server should be Running by default."); ss_info_dassert(0 == strcmp("Running", status), "Status of Server should be Running by default.");
if (NULL != status) if (NULL != status)
{ {
@ -91,12 +87,10 @@ test1()
} }
server_set_status_nolock(server, SERVER_MASTER); server_set_status_nolock(server, SERVER_MASTER);
status = server_status(server); status = server_status(server);
mxs_log_flush_sync();
ss_info_dassert(0 == strcmp("Master, Running", status), "Should find correct status."); ss_info_dassert(0 == strcmp("Master, Running", status), "Should find correct status.");
server_clear_status_nolock(server, SERVER_MASTER); server_clear_status_nolock(server, SERVER_MASTER);
MXS_FREE(status); MXS_FREE(status);
status = server_status(server); status = server_status(server);
mxs_log_flush_sync();
ss_info_dassert(0 == strcmp("Running", status), ss_info_dassert(0 == strcmp("Running", status),
"Status of Server should be Running after master status cleared."); "Status of Server should be Running after master status cleared.");
if (NULL != status) if (NULL != status)
@ -106,7 +100,6 @@ test1()
ss_dfprintf(stderr, "\t..done\nRun Prints for Server and all Servers."); ss_dfprintf(stderr, "\t..done\nRun Prints for Server and all Servers.");
printServer(server); printServer(server);
printAllServers(); printAllServers();
mxs_log_flush_sync();
ss_dfprintf(stderr, "\t..done\nFreeing Server."); ss_dfprintf(stderr, "\t..done\nFreeing Server.");
server_free((Server*)server); server_free((Server*)server);
ss_dfprintf(stderr, "\t..done\n"); ss_dfprintf(stderr, "\t..done\n");

View File

@ -45,26 +45,20 @@ static int test1()
ss_dfprintf(stderr, ss_dfprintf(stderr,
"testusers : Initialise the user table."); "testusers : Initialise the user table.");
users = users_alloc(); users = users_alloc();
mxs_log_flush_sync();
ss_info_dassert(NULL != users, "Allocating user table should not return NULL."); ss_info_dassert(NULL != users, "Allocating user table should not return NULL.");
ss_dfprintf(stderr, "\t..done\nAdd a user"); ss_dfprintf(stderr, "\t..done\nAdd a user");
rv = users_add(users, "username", "authorisation", USER_ACCOUNT_ADMIN); rv = users_add(users, "username", "authorisation", USER_ACCOUNT_ADMIN);
mxs_log_flush_sync();
ss_info_dassert(rv, "Should add one user"); ss_info_dassert(rv, "Should add one user");
rv = users_auth(users, "username", "authorisation"); rv = users_auth(users, "username", "authorisation");
mxs_log_flush_sync();
ss_info_dassert(rv, "Fetch valid user must not return NULL"); ss_info_dassert(rv, "Fetch valid user must not return NULL");
rv = users_auth(users, "username", "newauth"); rv = users_auth(users, "username", "newauth");
mxs_log_flush_sync();
ss_info_dassert(rv == 0, "Fetch invalid user must return NULL"); ss_info_dassert(rv == 0, "Fetch invalid user must return NULL");
ss_dfprintf(stderr, "\t..done\nAdd another user"); ss_dfprintf(stderr, "\t..done\nAdd another user");
rv = users_add(users, "username2", "authorisation2", USER_ACCOUNT_ADMIN); rv = users_add(users, "username2", "authorisation2", USER_ACCOUNT_ADMIN);
mxs_log_flush_sync();
ss_info_dassert(rv, "Should add one user"); ss_info_dassert(rv, "Should add one user");
ss_dfprintf(stderr, "\t..done\nDelete a user."); ss_dfprintf(stderr, "\t..done\nDelete a user.");
rv = users_delete(users, "username"); rv = users_delete(users, "username");
mxs_log_flush_sync();
ss_info_dassert(rv, "Should delete just one user"); ss_info_dassert(rv, "Should delete just one user");
ss_dfprintf(stderr, "\t..done\nDump users table."); ss_dfprintf(stderr, "\t..done\nDump users table.");
@ -79,7 +73,6 @@ static int test1()
ss_dfprintf(stderr, "\t..done\nFree user table."); ss_dfprintf(stderr, "\t..done\nFree user table.");
users_free(users); users_free(users);
mxs_log_flush_sync();
ss_dfprintf(stderr, "\t..done\n"); ss_dfprintf(stderr, "\t..done\n");
return 0; return 0;

View File

@ -159,7 +159,6 @@ int main(int argc, char **argv)
printf("ERROR: Failed to open binlog file %s: %s.\n", printf("ERROR: Failed to open binlog file %s: %s.\n",
path, strerror(errno)); path, strerror(errno));
MXS_FREE(inst); MXS_FREE(inst);
mxs_log_flush_sync();
mxs_log_finish(); mxs_log_finish();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -186,7 +185,6 @@ int main(int argc, char **argv)
if (set_encryption_options(inst, key_file, aes_algo)) if (set_encryption_options(inst, key_file, aes_algo))
{ {
MXS_FREE(inst); MXS_FREE(inst);
mxs_log_flush_sync();
mxs_log_finish(); mxs_log_finish();
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
@ -203,21 +201,16 @@ int main(int argc, char **argv)
blr_read_events_all_events(inst, &binlog_file, BLR_CHECK_ONLY); blr_read_events_all_events(inst, &binlog_file, BLR_CHECK_ONLY);
binlog_file.fix = true; binlog_file.fix = true;
mxs_log_flush_sync();
} }
/* Now read/check/fix the binary log */ /* Now read/check/fix the binary log */
int ret = blr_read_events_all_events(inst, &binlog_file, debug_out | report_header); int ret = blr_read_events_all_events(inst, &binlog_file, debug_out | report_header);
mxs_log_flush_sync();
MXS_NOTICE("Check retcode: %i, Binlog Pos = %lu", ret, inst->binlog_position); MXS_NOTICE("Check retcode: %i, Binlog Pos = %lu", ret, inst->binlog_position);
close(inst->binlog_fd); close(inst->binlog_fd);
MXS_FREE(inst); MXS_FREE(inst);
mxs_log_flush_sync();
mxs_log_finish(); mxs_log_finish();
return ret; return ret;

View File

@ -162,7 +162,6 @@ int main(int argc, char **argv)
inst = static_cast<ROUTER_INSTANCE*>(MXS_CALLOC(1, sizeof(ROUTER_INSTANCE))); inst = static_cast<ROUTER_INSTANCE*>(MXS_CALLOC(1, sizeof(ROUTER_INSTANCE)));
if (inst == NULL) if (inst == NULL)
{ {
mxs_log_flush_sync();
mxs_log_finish(); mxs_log_finish();
return 1; return 1;
@ -884,7 +883,6 @@ int main(int argc, char **argv)
return 1; return 1;
} }
mxs_log_flush_sync();
mxs_log_finish(); mxs_log_finish();
MXS_FREE(inst->user); MXS_FREE(inst->user);
MXS_FREE(inst->password); MXS_FREE(inst->password);