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:
@ -8,63 +8,67 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
Kolbe Kegel 2014-09-01 14:45:56 UTC
|
||||
After inserting a row via the rw-split router, a call to last_insert_id() can go to a slave, producing bad results.
|
||||
|
||||
mariadb> select * from t1;
|
||||
+----+
|
||||
| id |
|
||||
+----+
|
||||
| 1 |
|
||||
| 4 |
|
||||
+----+
|
||||
2 rows in set (0.00 sec)
|
||||
|
||||
mariadb> insert into t1 values ();
|
||||
Query OK, 1 row affected (0.00 sec)
|
||||
|
||||
mariadb> select * from t1;
|
||||
+----+
|
||||
| id |
|
||||
+----+
|
||||
| 1 |
|
||||
| 4 |
|
||||
| 7 |
|
||||
+----+
|
||||
3 rows in set (0.00 sec)
|
||||
|
||||
mariadb> select last_insert_id();
|
||||
+------------------+
|
||||
| last_insert_id() |
|
||||
+------------------+
|
||||
| 0 |
|
||||
+------------------+
|
||||
1 row in set (0.00 sec)
|
||||
|
||||
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)
|
||||
Comment 1 Vilho Raatikka 2014-09-01 17:51:45 UTC
|
||||
last_inserted_id() belongs to UNKNOWN_FUNC class to which many read-only system functions belong too. Thus last_inserted_id() was routed to any slave.
|
||||
|
||||
Unfortunately I can't confirm wrong behavior since running the same sequence generates same output when connected directly to MariaDB backend. Perhaps there is something required for the table t1 which is not included here?
|
||||
Comment 2 Vilho Raatikka 2014-09-01 20:01:35 UTC
|
||||
An autoincrement attribute was missing.
|
||||
*/
|
||||
* Kolbe Kegel 2014-09-01 14:45:56 UTC
|
||||
* After inserting a row via the rw-split router, a call to last_insert_id() can go to a slave, producing bad
|
||||
* results.
|
||||
*
|
||||
* mariadb> select * from t1;
|
||||
+----+
|
||||
| id |
|
||||
+----+
|
||||
| 1 |
|
||||
| 4 |
|
||||
+----+
|
||||
| 2 rows in set (0.00 sec)
|
||||
|
|
||||
| mariadb> insert into t1 values ();
|
||||
| Query OK, 1 row affected (0.00 sec)
|
||||
|
|
||||
| mariadb> select * from t1;
|
||||
+----+
|
||||
| id |
|
||||
+----+
|
||||
| 1 |
|
||||
| 4 |
|
||||
| 7 |
|
||||
+----+
|
||||
| 3 rows in set (0.00 sec)
|
||||
|
|
||||
| mariadb> select last_insert_id();
|
||||
+------------------+
|
||||
| last_insert_id() |
|
||||
+------------------+
|
||||
| 0 |
|
||||
+------------------+
|
||||
| 1 row in set (0.00 sec)
|
||||
|
|
||||
| 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)
|
||||
| Comment 1 Vilho Raatikka 2014-09-01 17:51:45 UTC
|
||||
| last_inserted_id() belongs to UNKNOWN_FUNC class to which many read-only system functions belong too. Thus
|
||||
|last_inserted_id() was routed to any slave.
|
||||
|
|
||||
| Unfortunately I can't confirm wrong behavior since running the same sequence generates same output when
|
||||
|connected directly to MariaDB backend. Perhaps there is something required for the table t1 which is not
|
||||
|included here?
|
||||
| Comment 2 Vilho Raatikka 2014-09-01 20:01:35 UTC
|
||||
| An autoincrement attribute was missing.
|
||||
*/
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include "testconnections.h"
|
||||
|
||||
const char * sel1 = "select last_insert_id(), @@server_id";
|
||||
const char* sel1 = "select last_insert_id(), @@server_id";
|
||||
|
||||
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->repl->connect();
|
||||
@ -79,12 +83,12 @@ int main(int argc, char *argv[])
|
||||
|
||||
Test->tprintf("Creating table\n");
|
||||
fflush(stdout);
|
||||
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");
|
||||
fflush(stdout);
|
||||
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->stop_timeout();
|
||||
Test->repl->sync_slaves();
|
||||
@ -93,15 +97,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,
|
||||
"@@server_id", &last_insert_id1[0])
|
||||
!= 0 ) || (
|
||||
find_field(
|
||||
Test->repl->nodes[0], sel1,
|
||||
"@@server_id", &last_insert_id2[0])
|
||||
!= 0 ))
|
||||
if ((
|
||||
find_field(
|
||||
Test->maxscales->conn_rwsplit[0],
|
||||
sel1,
|
||||
"@@server_id",
|
||||
&last_insert_id1[0])
|
||||
!= 0 ) || (
|
||||
find_field(
|
||||
Test->repl->nodes[0],
|
||||
sel1,
|
||||
"@@server_id",
|
||||
&last_insert_id2[0])
|
||||
!= 0 ))
|
||||
{
|
||||
Test->tprintf("@@server_id fied not found!!\n");
|
||||
delete Test;
|
||||
|
||||
Reference in New Issue
Block a user