From ede52c8af9f1f0069d53efc413e444e878ad671b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 9 Oct 2017 14:05:38 +0300 Subject: [PATCH] Add OK packet processing test Added a test case which exercises the OK packet handling in readwritesplit. --- maxscale-system-test/CMakeLists.txt | 3 +++ maxscale-system-test/large_insert_hang.cpp | 28 ++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 maxscale-system-test/large_insert_hang.cpp diff --git a/maxscale-system-test/CMakeLists.txt b/maxscale-system-test/CMakeLists.txt index 62ab25737..8c3a53585 100644 --- a/maxscale-system-test/CMakeLists.txt +++ b/maxscale-system-test/CMakeLists.txt @@ -295,6 +295,9 @@ add_test_script(load_balancing_pers10 load_balancing load_pers10 LABELS readwrit # Test with extremely big blob inserting add_test_executable(longblob.cpp longblob longblob LABELS readwritesplit readconnroute UNSTABLE HEAVY REPL_BACKEND) +# Check that inserts of specific size don't cause a hang +add_test_executable(large_insert_hang.cpp large_insert_hang replication LABELS readwritesplit REPL_BACKEND) + # Test with extremely big blob inserting/selecting with > 16 mb data blocks add_test_executable(mxs1110_16mb.cpp mxs1110_16mb longblob_filters LABELS readwritesplit readconnroute HEAVY REPL_BACKEND) diff --git a/maxscale-system-test/large_insert_hang.cpp b/maxscale-system-test/large_insert_hang.cpp new file mode 100644 index 000000000..26075a3ca --- /dev/null +++ b/maxscale-system-test/large_insert_hang.cpp @@ -0,0 +1,28 @@ +/** + * Check that the OK packet flags are read correctly + */ + +#include "testconnections.h" + +int main(int argc, char *argv[]) +{ + TestConnections test(argc, argv); + test.set_timeout(60); + + test.connect_maxscale(); + test.try_query(test.conn_rwsplit, "CREATE OR REPLACE TABLE test.t1(id int)"); + + std::stringstream ss; + ss << "INSERT INTO test.t1 VALUES (0)"; + + for (int i = 0; i < 2299; i++) + { + ss << ",(" << i << ")"; + } + + test.try_query(test.conn_rwsplit, query.str().c_str()); + test.try_query(test.conn_rwsplit, "DROP TABLE test.t1"); + test.close_maxscale_connections(); + + return test.global_result; +}