From 46484b4e118c4f508e865f0bdd3f966fed494f27 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 8 Feb 2019 14:15:34 +0200 Subject: [PATCH 1/2] MXS-2311: Write queued packet one at a time If an ignorable packet was followed by more than one queued packets, they would all get routed in the same batch. This would cause unexpected replies from the server if multiple ignorable packets were queued up. --- server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c b/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c index 2e3dfdf93..534fe9212 100644 --- a/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c +++ b/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c @@ -877,7 +877,7 @@ gw_read_and_write(DCB *dcb) if (proto->ignore_replies > 0) { /** The reply to a COM_CHANGE_USER is in packet */ - GWBUF *query = proto->stored_query; + GWBUF* query = modutil_get_next_MySQL_packet(&proto->stored_query); proto->stored_query = NULL; proto->ignore_replies--; ss_dassert(proto->ignore_replies >= 0); From 3c5dd257fd7cf30b90076dbc92ab53c544d41e72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Fri, 8 Feb 2019 15:03:06 +0200 Subject: [PATCH 2/2] MXS-2311: Test MXS-2311 in mxs827_write_timeout By repeatedly doing reads instead of one read per second, it is more likely that MXS-2311 is reproduced. This is still not a deterministic process but in theory it can reproduce the problem. --- .../cnf/maxscale.cnf.template.mxs827_write_timeout | 2 +- maxscale-system-test/mxs827_write_timeout.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/maxscale-system-test/cnf/maxscale.cnf.template.mxs827_write_timeout b/maxscale-system-test/cnf/maxscale.cnf.template.mxs827_write_timeout index 8486e5244..aa0babaad 100755 --- a/maxscale-system-test/cnf/maxscale.cnf.template.mxs827_write_timeout +++ b/maxscale-system-test/cnf/maxscale.cnf.template.mxs827_write_timeout @@ -19,7 +19,7 @@ user=maxskysql passwd=skysql router_options=slave_selection_criteria=LEAST_GLOBAL_CONNECTIONS max_slave_connections=1 -connection_keepalive=5 +connection_keepalive=1 [Read Connection Router Slave] type=service diff --git a/maxscale-system-test/mxs827_write_timeout.cpp b/maxscale-system-test/mxs827_write_timeout.cpp index 141a6837b..20b45c496 100644 --- a/maxscale-system-test/mxs827_write_timeout.cpp +++ b/maxscale-system-test/mxs827_write_timeout.cpp @@ -22,14 +22,16 @@ int main(int argc, char *argv[]) create_t1(Test->maxscales->conn_rwsplit[0]); - for (int i = 0; i < 30; i++) + Test->tprintf("Doing reads for 30 seconds"); + time_t start = time(NULL); + + while (time(NULL) - start < 30) { - Test->tprintf("Trying query %d\n", i); Test->set_timeout(10); Test->try_query(Test->maxscales->conn_rwsplit[0], "SELECT 1"); - sleep(1); } + Test->tprintf("Doing one write"); Test->try_query(Test->maxscales->conn_rwsplit[0], "INSERT INTO t1 VALUES (1, 1)"); Test->check_maxscale_alive(0);