From b1859cc7a52775062b30260b7a486b0e62fbcad9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 21 Sep 2017 22:50:31 +0300 Subject: [PATCH] Speed up lots_of_rows The test inserted 200k rows with autocommit enabled which made it very slow. Wrapping the inserts inside a transaction gives the test a significant speed boost. --- maxscale-system-test/lots_of_rows.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/maxscale-system-test/lots_of_rows.cpp b/maxscale-system-test/lots_of_rows.cpp index 67de39828..29e9c0a44 100644 --- a/maxscale-system-test/lots_of_rows.cpp +++ b/maxscale-system-test/lots_of_rows.cpp @@ -17,18 +17,22 @@ int main(int argc, char *argv[]) Test->connect_maxscale(); create_t1(Test->conn_rwsplit); - Test->tprintf("INSERTing data\n"); + Test->tprintf("INSERTing data"); + + Test->try_query(Test->conn_rwsplit, "BEGIN"); for (int i = 0; i < 2000; i++) { Test->set_timeout(20); create_insert_string(sql, 100, i); Test->try_query(Test->conn_rwsplit, sql); } - Test->tprintf("done, sleeping\n"); + Test->try_query(Test->conn_rwsplit, "COMMIT"); + + Test->tprintf("done, syncing slaves"); Test->stop_timeout(); - sleep(20); - Test->tprintf("Trying SELECT\n"); - Test->set_timeout(30); + Test->repl->sync_slaves(); + Test->tprintf("Trying SELECT"); + Test->set_timeout(60); Test->try_query(Test->conn_rwsplit, (char *) "SELECT * FROM t1"); Test->check_maxscale_alive();