From dc4086b18286128b8f486fbfc0880ae97e72447a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 2 May 2018 15:13:47 +0300 Subject: [PATCH] MXS-1828: Create test case Created a test case that performs two LOAD DATA LOCAL INFILE statements in one query. Currently, the test will fail as the issue is not resolved. --- maxscale-system-test/CMakeLists.txt | 4 +++ .../mxs1828_double_local_infile.cpp | 36 +++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 maxscale-system-test/mxs1828_double_local_infile.cpp diff --git a/maxscale-system-test/CMakeLists.txt b/maxscale-system-test/CMakeLists.txt index 1dd9147e5..c141c9b1d 100644 --- a/maxscale-system-test/CMakeLists.txt +++ b/maxscale-system-test/CMakeLists.txt @@ -705,6 +705,10 @@ add_test_executable(mxs1808_long_data.cpp mxs1808_long_data replication LABELS r # https://jira.mariadb.org/browse/MXS-1824 add_test_executable(mxs1824_double_cursor.cpp mxs1824_double_cursor replication LABELS readwritesplit REPL_BACKEND) +# MXS-1828: Multiple LOAD DATA LOCAL INFILE commands in one query cause a hang +# https://jira.mariadb.org/browse/MXS-1828 +add_test_executable(mxs1828_double_local_infile.cpp mxs1828_double_local_infile replication LABELS readwritesplit REPL_BACKEND) + # MXS-1831: No error on invalid monitor parameter alteration # https://jira.mariadb.org/browse/MXS-1831 add_test_executable(mxs1831_unknown_param.cpp mxs1831_unknown_param replication LABELS REPL_BACKEND) diff --git a/maxscale-system-test/mxs1828_double_local_infile.cpp b/maxscale-system-test/mxs1828_double_local_infile.cpp new file mode 100644 index 000000000..89cb0391c --- /dev/null +++ b/maxscale-system-test/mxs1828_double_local_infile.cpp @@ -0,0 +1,36 @@ +/** + * MXS-1828: Multiple LOAD DATA LOCAL INFILE commands in one query cause a hang + * + * https://jira.mariadb.org/browse/MXS-1828 + */ + +#include "testconnections.h" +#include + +using namespace std; + +int main(int argc, char** argv) +{ + TestConnections test(argc, argv); + + const char* query = "LOAD DATA LOCAL INFILE './data.csv' INTO TABLE test.t1"; + const char* filename = "./data.csv"; + + unlink(filename); + ofstream file(filename); + + file << "1\n2\n3" << endl; + + test.set_timeout(30); + test.maxscales->connect(); + test.try_query(test.maxscales->conn_rwsplit[0], "CREATE TABLE test.t1(id INT)"); + test.try_query(test.maxscales->conn_rwsplit[0], "%s;%s", query, query); + + Row row = get_row(test.maxscales->conn_rwsplit[0], "SELECT COUNT(*) FROM test.t1"); + test.assert(!row.empty() && row[0] == "6", "Both queries should be executed"); + test.try_query(test.maxscales->conn_rwsplit[0], "DROP TABLE test.t1"); + test.maxscales->disconnect(); + + unlink(filename); + return test.global_result; +}