Format all files

Formatted all files with uncrustify.
This commit is contained in:
Markus Mäkelä 2018-10-29 14:06:58 +02:00
parent 8d1b26060a
commit 906d8cee5b
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
9 changed files with 46 additions and 40 deletions

View File

@ -8,6 +8,6 @@
char virtual_ip[16];
char* print_version_string(TestConnections* Test);
void configure_keepalived(TestConnections* Test, char* keepalived_file);
void stop_keepalived(TestConnections* Test);
void stop_keepalived(TestConnections* Test);
#endif // KEEPALIVED_FUNC_H

View File

@ -43,7 +43,7 @@ int check_conf(TestConnections& test, int blocked_node)
for (int i = 0; i < 2; i++)
{
if ( i != blocked_node)
if (i != blocked_node)
{
test.tprintf("Checking data from node %d (%s)\n", i, test.repl->IP[i]);
test.set_timeout(100);
@ -63,7 +63,7 @@ int check_conf(TestConnections& test, int blocked_node)
return global_result;
}
int main(int argc, char *argv[])
int main(int argc, char* argv[])
{
TestConnections test(argc, argv);
@ -72,19 +72,19 @@ int main(int argc, char *argv[])
test.repl->set_repl_user();
test.start_mm(0); // first node - slave, second - master
test.start_mm(0); // first node - slave, second - master
test.set_timeout(120);
test.maxscales->get_maxadmin_param(0, (char *) "show server server1", (char *) "Status:", maxadmin_result);
test.maxscales->get_maxadmin_param(0, (char*) "show server server1", (char*) "Status:", maxadmin_result);
test.tprintf("node0 %s\n", maxadmin_result);
if (strstr(maxadmin_result, "Slave, Running") == NULL )
if (strstr(maxadmin_result, "Slave, Running") == NULL)
{
test.add_result(1, "Node0 is not slave, status is %s\n", maxadmin_result);
}
test.set_timeout(120);
test.maxscales->get_maxadmin_param(0, (char *) "show server server2", (char *) "Status:", maxadmin_result);
test.maxscales->get_maxadmin_param(0, (char*) "show server server2", (char*) "Status:", maxadmin_result);
test.tprintf("node1 %s\n", maxadmin_result);
if (strstr(maxadmin_result, "Master, Running") == NULL )
if (strstr(maxadmin_result, "Master, Running") == NULL)
{
test.add_result(1, "Node1 is not master, status is %s\n", maxadmin_result);
}
@ -97,9 +97,9 @@ int main(int argc, char *argv[])
test.stop_timeout();
test.maxscales->wait_for_monitor();
test.set_timeout(120);
test.maxscales->get_maxadmin_param(0, (char *) "show server server1", (char *) "Status:", maxadmin_result);
test.maxscales->get_maxadmin_param(0, (char*) "show server server1", (char*) "Status:", maxadmin_result);
printf("node0 %s\n", maxadmin_result);
if (strstr(maxadmin_result, "Down") == NULL )
if (strstr(maxadmin_result, "Down") == NULL)
{
test.add_result(1, "Node0 is not down, status is %s\n", maxadmin_result);
}
@ -116,9 +116,9 @@ int main(int argc, char *argv[])
test.tprintf("Block master\n");
test.repl->block_node(1);
test.maxscales->wait_for_monitor();
test.maxscales->get_maxadmin_param(0, (char *) "show server server2", (char *) "Status:", maxadmin_result);
test.maxscales->get_maxadmin_param(0, (char*) "show server server2", (char*) "Status:", maxadmin_result);
printf("node1 %s\n", maxadmin_result);
if (strstr(maxadmin_result, "Down") == NULL )
if (strstr(maxadmin_result, "Down") == NULL)
{
test.add_result(1, "Node1 is not down, status is %s\n", maxadmin_result);
}
@ -126,7 +126,7 @@ int main(int argc, char *argv[])
test.set_timeout(120);
test.repl->connect();
execute_query(test.repl->nodes[0], (char *) "SET GLOBAL READ_ONLY=OFF");
execute_query(test.repl->nodes[0], (char*) "SET GLOBAL READ_ONLY=OFF");
test.repl->close_connections();
test.maxscales->wait_for_monitor();
@ -141,7 +141,7 @@ int main(int argc, char *argv[])
test.set_timeout(120);
printf("Make node 2 slave\n");
test.repl->connect();
execute_query(test.repl->nodes[1], (char *) "SET GLOBAL READ_ONLY=ON");
execute_query(test.repl->nodes[1], (char*) "SET GLOBAL READ_ONLY=ON");
test.repl->close_connections();
test.maxscales->wait_for_monitor();
@ -150,16 +150,16 @@ int main(int argc, char *argv[])
test.add_result(check_conf(test, 2), "Configuration broken\n");
test.set_timeout(60);
test.maxscales->get_maxadmin_param(0, (char *) "show server server2", (char *) "Status:", maxadmin_result);
test.maxscales->get_maxadmin_param(0, (char*) "show server server2", (char*) "Status:", maxadmin_result);
printf("node1 %s\n", maxadmin_result);
if (strstr(maxadmin_result, "Slave, Running") == NULL )
if (strstr(maxadmin_result, "Slave, Running") == NULL)
{
test.add_result(1, "Node1 is not slave, status is %s\n", maxadmin_result);
}
test.set_timeout(60);
test.maxscales->get_maxadmin_param(0, (char *) "show server server1", (char *) "Status:", maxadmin_result);
test.maxscales->get_maxadmin_param(0, (char*) "show server server1", (char*) "Status:", maxadmin_result);
test.tprintf("node0 %s\n", maxadmin_result);
if (strstr(maxadmin_result, "Master, Running") == NULL )
if (strstr(maxadmin_result, "Master, Running") == NULL)
{
test.add_result(1, "Node0 is not master, status is %s\n", maxadmin_result);
}

View File

@ -59,8 +59,8 @@ void test_sleep(int seconds)
// The amount of time slept between various operations that are
// expected to take some time before becoming visible.
const int HEARTBEAT_PERIOD = 2; // Seconds
const int REPLICATION_SLEEP = 6; // Seconds
const int HEARTBEAT_PERIOD = 2; // Seconds
const int REPLICATION_SLEEP = 6; // Seconds
string get_gtid_current_pos(TestConnections& test, MYSQL* pMysql)
{
@ -247,7 +247,7 @@ void select(TestConnections& test, MYSQL* pSlave)
bool insert_select(TestConnections& test, MYSQL* pSlave, MYSQL* pMaster)
{
insert(test, pMaster);
test_sleep(REPLICATION_SLEEP); // To ensure that the insert reaches the slave.
test_sleep(REPLICATION_SLEEP); // To ensure that the insert reaches the slave.
select(test, pSlave);
return test.global_result == 0;
@ -334,7 +334,7 @@ void restore_server_ids(TestConnections& test, const map<int, string>& server_id
{
for_each(server_ids_by_index.begin(),
server_ids_by_index.end(),
[&test] (const pair<int, string>& server_id_by_index) {
[&test](const pair<int, string>& server_id_by_index) {
test.try_query(test.galera->nodes[server_id_by_index.first],
"set GLOBAL server_id=%s", server_id_by_index.second.c_str());
});
@ -345,9 +345,9 @@ void restart_slave(TestConnections& test, MYSQL* pSlave)
{
Row row;
auto replication_failed = [] (const std::string& column) {
return column.find("Got fatal error") != string::npos;
};
auto replication_failed = [](const std::string& column) {
return column.find("Got fatal error") != string::npos;
};
cout << "Stopping slave." << endl;
test.try_query(pSlave, "STOP SLAVE");
@ -404,7 +404,6 @@ bool test_multiple_masters(TestConnections& test, MYSQL* pSlave)
return test.global_result == 0;
}
}
int main(int argc, char* argv[])
@ -419,7 +418,7 @@ int main(int argc, char* argv[])
if (!dont_setup_galera)
{
setup_galera(test);
test.galera->start_replication(); // Causes restart.
test.galera->start_replication(); // Causes restart.
}
const char* zValue;
@ -441,7 +440,7 @@ int main(int argc, char* argv[])
if (setup_server_ids(test, &server_ids_by_index))
{
for (Approach approach : { Approach::GTID, Approach::FILE_POS } )
for (Approach approach : {Approach::GTID, Approach::FILE_POS})
{
inserted_rows = 0;
@ -483,7 +482,7 @@ int main(int argc, char* argv[])
{
if (setup_blr(test, pMaxscale, gtid, approach))
{
int slave_index = test.repl->N - 1; // We use the last slave.
int slave_index = test.repl->N - 1; // We use the last slave.
Mariadb_nodes& ms = *test.repl;
ms.connect(slave_index);

View File

@ -21,7 +21,8 @@ int main(int argc, char** argv)
test.maxscales->connect();
Row server1 = get_row(test.maxscales->conn_rwsplit[0], "SELECT @@server_id, @@last_insert_id, id FROM test.t1");
Row server1 = get_row(test.maxscales->conn_rwsplit[0],
"SELECT @@server_id, @@last_insert_id, id FROM test.t1");
Row server2 = get_row(test.maxscales->conn_rwsplit[0], "SELECT @@server_id, id FROM test.t2");
Row server3 = get_row(test.maxscales->conn_rwsplit[0], "SELECT @@server_id, id FROM test.t3");
Row server4 = get_row(test.maxscales->conn_rwsplit[0], "SELECT @@server_id, id FROM test.t4");
@ -29,10 +30,14 @@ int main(int argc, char** argv)
test.maxscales->disconnect();
test.repl->connect();
test.expect(server1[0] == test.repl->get_server_id_str(0), "First query without hint should go to server1, the master");
test.expect(server2[0] == test.repl->get_server_id_str(1), "Second query without hint should go to server2, the slave");
test.expect(server3[0] == test.repl->get_server_id_str(2), "First query with hint should go to server3, the first unmonitored server");
test.expect(server4[0] == test.repl->get_server_id_str(3), "Second query with hint should go to server4, the second unmonitored server");
test.expect(server1[0] == test.repl->get_server_id_str(0),
"First query without hint should go to server1, the master");
test.expect(server2[0] == test.repl->get_server_id_str(1),
"Second query without hint should go to server2, the slave");
test.expect(server3[0] == test.repl->get_server_id_str(2),
"First query with hint should go to server3, the first unmonitored server");
test.expect(server4[0] == test.repl->get_server_id_str(3),
"Second query with hint should go to server4, the second unmonitored server");
test.repl->disconnect();
return test.global_result;

View File

@ -626,7 +626,9 @@ void TestConnections::process_template(int m, const char* template_name, const c
if (backend_ssl)
{
ss << " -e \"s|type=server|type=server\\nssl=required\\nssl_cert=/###access_homedir###/certs/client-cert.pem\\nssl_key=/###access_homedir###/certs/client-key.pem\\nssl_ca_cert=/###access_homedir###/certs/ca.pem|g\" ";
ss
<<
" -e \"s|type=server|type=server\\nssl=required\\nssl_cert=/###access_homedir###/certs/client-cert.pem\\nssl_key=/###access_homedir###/certs/client-key.pem\\nssl_ca_cert=/###access_homedir###/certs/ca.pem|g\" ";
}
ss << " -e \"s/###threads###/" << threads << "/\" ";

View File

@ -2516,7 +2516,7 @@ static int handle_global_item(const char* name, const char* value)
if (gateway.writeq_high_water < MIN_WRITEQ_HIGH_WATER)
{
MXS_WARNING("The specified writeq high water mark %lu, is smaller "
"than the minimum allowed size %lu. Changing to minimum.",
"than the minimum allowed size %lu. Changing to minimum.",
gateway.writeq_high_water,
MIN_WRITEQ_HIGH_WATER);
gateway.writeq_high_water = MIN_WRITEQ_HIGH_WATER;
@ -2534,7 +2534,7 @@ static int handle_global_item(const char* name, const char* value)
if (gateway.writeq_low_water < MIN_WRITEQ_LOW_WATER)
{
MXS_WARNING("The specified writeq low water mark %lu, is smaller "
"than the minimum allowed size %lu. Changing to minimum.",
"than the minimum allowed size %lu. Changing to minimum.",
gateway.writeq_low_water,
MIN_WRITEQ_LOW_WATER);
gateway.writeq_low_water = MIN_WRITEQ_LOW_WATER;

View File

@ -367,7 +367,7 @@ bool monitor_add_server(MXS_MONITOR* mon, SERVER* server)
db->next = NULL;
db->mon_err_count = 0;
db->log_version_err = true;
// Pretend disk space was just checked.
// Pretend disk space was just checked.
db->disk_space_checked = maxscale::MonitorInstance::get_time_ms();

View File

@ -93,7 +93,7 @@ Service* service_alloc(const char* name, const char* router, MXS_CONFIG_PARAMETE
return NULL;
}
Service* service = new( std::nothrow) Service(name, router, params);
Service* service = new(std::nothrow) Service(name, router, params);
if (service == nullptr)
{

View File

@ -1471,7 +1471,7 @@ bool MariaDBServer::promote(ClusterOperation& op)
else if (op.type == OperationType::FAILOVER)
{
stopped = remove_slave_conns(op, {*master_conn});
master_conn = NULL; // The connection pointed to may no longer exist.
master_conn = NULL; // The connection pointed to may no longer exist.
}
if (stopped)