Uncrustify maxscale
See script directory for method. The script to run in the top level MaxScale directory is called maxscale-uncrustify.sh, which uses another script, list-src, from the same directory (so you need to set your PATH). The uncrustify version was 0.66.
This commit is contained in:
@ -1,10 +1,12 @@
|
||||
/**
|
||||
* @file bug509.cpp regression case for bug 509 and 507 ( "Referring to a nonexisting server in servers=... doesn't even raise a warning"
|
||||
* @file bug509.cpp regression case for bug 509 and 507 ( "Referring to a nonexisting server in servers=...
|
||||
*doesn't even raise a warning"
|
||||
* and "rw-split router does not send last_insert_id() to master" )
|
||||
*
|
||||
* - "CREATE TABLE t2 (id INT(10) NOT NULL AUTO_INCREMENT, x int, PRIMARY KEY (id));",
|
||||
* - do a number of INSERTs first using RWsplit, then directly Galera nodes.
|
||||
* - do "select @@wsrep_node_address, last_insert_id();" and "select last_insert_id(), @@wsrep_node_address;" and compares results.
|
||||
* - do "select @@wsrep_node_address, last_insert_id();" and "select last_insert_id(), @@wsrep_node_address;"
|
||||
*and compares results.
|
||||
* - do "insert into t2 (x) values (i);" 1000 times and compares results of
|
||||
* "select @@wsrep_node_address, last_insert_id();" and "select last_insert_id(), @@wsrep_node_address;"
|
||||
*
|
||||
@ -12,38 +14,40 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
Kolbe Kegel 2014-09-01 14:48:12 UTC
|
||||
For some reason, the order of terms in the field list of a SELECT statement influences how the rw-split router decides where to send a statement.
|
||||
|
||||
mariadb> select @@wsrep_node_address, last_insert_id();
|
||||
+----------------------+------------------+
|
||||
| @@wsrep_node_address | last_insert_id() |
|
||||
+----------------------+------------------+
|
||||
| 192.168.30.31 | 7 |
|
||||
+----------------------+------------------+
|
||||
1 row in set (0.00 sec)
|
||||
|
||||
mariadb> select last_insert_id(), @@wsrep_node_address;
|
||||
+------------------+----------------------+
|
||||
| last_insert_id() | @@wsrep_node_address |
|
||||
+------------------+----------------------+
|
||||
| 0 | 192.168.30.33 |
|
||||
+------------------+----------------------+
|
||||
1 row in set (0.00 sec)
|
||||
Comment 1 Vilho Raatikka 2014-09-03 20:44:17 UTC
|
||||
Added code to detect last_insert_id() function and now both types of elements are routed to master and their order of appearance doesn't matter.
|
||||
*/
|
||||
* Kolbe Kegel 2014-09-01 14:48:12 UTC
|
||||
* For some reason, the order of terms in the field list of a SELECT statement influences how the rw-split
|
||||
* router decides where to send a statement.
|
||||
*
|
||||
* mariadb> select @@wsrep_node_address, last_insert_id();
|
||||
+----------------------+------------------+
|
||||
| @@wsrep_node_address | last_insert_id() |
|
||||
+----------------------+------------------+
|
||||
| 192.168.30.31 | 7 |
|
||||
+----------------------+------------------+
|
||||
| 1 row in set (0.00 sec)
|
||||
|
|
||||
| mariadb> select last_insert_id(), @@wsrep_node_address;
|
||||
+------------------+----------------------+
|
||||
| last_insert_id() | @@wsrep_node_address |
|
||||
+------------------+----------------------+
|
||||
| 0 | 192.168.30.33 |
|
||||
+------------------+----------------------+
|
||||
| 1 row in set (0.00 sec)
|
||||
| Comment 1 Vilho Raatikka 2014-09-03 20:44:17 UTC
|
||||
| Added code to detect last_insert_id() function and now both types of elements are routed to master and
|
||||
|their order of appearance doesn't matter.
|
||||
*/
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include "testconnections.h"
|
||||
|
||||
const char * sel1 = "select @@wsrep_node_address, last_insert_id();";
|
||||
const char * sel2 = "select last_insert_id(), @@wsrep_node_address;";
|
||||
const char* sel1 = "select @@wsrep_node_address, last_insert_id();";
|
||||
const char* sel2 = "select last_insert_id(), @@wsrep_node_address;";
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
TestConnections * Test = new TestConnections(argc, argv);
|
||||
TestConnections* Test = new TestConnections(argc, argv);
|
||||
Test->set_timeout(60);
|
||||
|
||||
Test->galera->connect();
|
||||
@ -57,23 +61,23 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
|
||||
Test->tprintf("Creating table\n");
|
||||
Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "DROP TABLE IF EXISTS t2;");
|
||||
Test->try_query(Test->maxscales->conn_rwsplit[0], (char*) "DROP TABLE IF EXISTS t2;");
|
||||
Test->try_query(Test->maxscales->conn_rwsplit[0],
|
||||
(char *) "CREATE TABLE t2 (id INT(10) NOT NULL AUTO_INCREMENT, x int, PRIMARY KEY (id));");
|
||||
(char*) "CREATE TABLE t2 (id INT(10) NOT NULL AUTO_INCREMENT, x int, PRIMARY KEY (id));");
|
||||
Test->tprintf("Doing INSERTs\n");
|
||||
Test->try_query(Test->maxscales->conn_rwsplit[0], (char *) "insert into t2 (x) values (1);");
|
||||
Test->try_query(Test->maxscales->conn_rwsplit[0], (char*) "insert into t2 (x) values (1);");
|
||||
|
||||
Test->try_query(Test->galera->nodes[0], (char *) "insert into t2 (x) values (2);");
|
||||
Test->try_query(Test->galera->nodes[0], (char *) "insert into t2 (x) values (3);");
|
||||
Test->try_query(Test->galera->nodes[0], (char*) "insert into t2 (x) values (2);");
|
||||
Test->try_query(Test->galera->nodes[0], (char*) "insert into t2 (x) values (3);");
|
||||
|
||||
Test->try_query(Test->galera->nodes[1], (char *) "insert into t2 (x) values (4);");
|
||||
Test->try_query(Test->galera->nodes[1], (char *) "insert into t2 (x) values (5);");
|
||||
Test->try_query(Test->galera->nodes[1], (char *) "insert into t2 (x) values (6);");
|
||||
Test->try_query(Test->galera->nodes[1], (char*) "insert into t2 (x) values (4);");
|
||||
Test->try_query(Test->galera->nodes[1], (char*) "insert into t2 (x) values (5);");
|
||||
Test->try_query(Test->galera->nodes[1], (char*) "insert into t2 (x) values (6);");
|
||||
|
||||
Test->try_query(Test->galera->nodes[2], (char *) "insert into t2 (x) values (7);");
|
||||
Test->try_query(Test->galera->nodes[2], (char *) "insert into t2 (x) values (8);");
|
||||
Test->try_query(Test->galera->nodes[2], (char *) "insert into t2 (x) values (9);");
|
||||
Test->try_query(Test->galera->nodes[2], (char *) "insert into t2 (x) values (10);");
|
||||
Test->try_query(Test->galera->nodes[2], (char*) "insert into t2 (x) values (7);");
|
||||
Test->try_query(Test->galera->nodes[2], (char*) "insert into t2 (x) values (8);");
|
||||
Test->try_query(Test->galera->nodes[2], (char*) "insert into t2 (x) values (9);");
|
||||
Test->try_query(Test->galera->nodes[2], (char*) "insert into t2 (x) values (10);");
|
||||
|
||||
Test->stop_timeout();
|
||||
Test->repl->sync_slaves();
|
||||
@ -81,15 +85,19 @@ int main(int argc, char *argv[])
|
||||
Test->tprintf("Trying \n");
|
||||
char last_insert_id1[1024];
|
||||
char last_insert_id2[1024];
|
||||
if ( (
|
||||
find_field(
|
||||
Test->maxscales->conn_rwsplit[0], sel1,
|
||||
"last_insert_id()", &last_insert_id1[0])
|
||||
!= 0 ) || (
|
||||
find_field(
|
||||
Test->maxscales->conn_rwsplit[0], sel2,
|
||||
"last_insert_id()", &last_insert_id2[0])
|
||||
!= 0 ))
|
||||
if ((
|
||||
find_field(
|
||||
Test->maxscales->conn_rwsplit[0],
|
||||
sel1,
|
||||
"last_insert_id()",
|
||||
&last_insert_id1[0])
|
||||
!= 0 ) || (
|
||||
find_field(
|
||||
Test->maxscales->conn_rwsplit[0],
|
||||
sel2,
|
||||
"last_insert_id()",
|
||||
&last_insert_id2[0])
|
||||
!= 0 ))
|
||||
{
|
||||
Test->tprintf("last_insert_id() fied not found!!\n");
|
||||
delete Test;
|
||||
@ -110,7 +118,10 @@ int main(int argc, char *argv[])
|
||||
for (int i = 100; i < iterations; i++)
|
||||
{
|
||||
Test->set_timeout(50);
|
||||
Test->add_result(execute_query(Test->maxscales->conn_rwsplit[0], "insert into t2 (x) values (%d);", i), "Query failed");
|
||||
Test->add_result(execute_query(Test->maxscales->conn_rwsplit[0],
|
||||
"insert into t2 (x) values (%d);",
|
||||
i),
|
||||
"Query failed");
|
||||
|
||||
sprintf(str1, "select * from t2 where x=%d;", i);
|
||||
|
||||
|
Reference in New Issue
Block a user