From dd944c7302ca0803f805ce4a4b31587a58d4ad04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 20 Jun 2019 08:18:36 +0300 Subject: [PATCH 1/3] MXS-2568: Always enable LOCAL INFILE for testing The automatic detection of LOCAL INFILE added in connector-c 3.0.9 requires that the option is enabled explicitly. --- maxscale-system-test/mariadb_func.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maxscale-system-test/mariadb_func.cpp b/maxscale-system-test/mariadb_func.cpp index 2a3c0b047..b814347d2 100644 --- a/maxscale-system-test/mariadb_func.cpp +++ b/maxscale-system-test/mariadb_func.cpp @@ -50,6 +50,9 @@ MYSQL* open_conn_db_flags(int port, set_ssl(conn); } + // MXS-2568: This fixes mxs1828_double_local_infile + mysql_optionsv(conn, MYSQL_OPT_LOCAL_INFILE, (void*)"1"); + mysql_real_connect(conn, ip.c_str(), user.c_str(), @@ -81,6 +84,9 @@ MYSQL* open_conn_db_timeout(int port, mysql_options(conn, MYSQL_OPT_READ_TIMEOUT, &timeout); mysql_options(conn, MYSQL_OPT_WRITE_TIMEOUT, &timeout); + // MXS-2568: This fixes mxs1828_double_local_infile + mysql_optionsv(conn, MYSQL_OPT_LOCAL_INFILE, (void*)"1"); + if (ssl) { set_ssl(conn); From 7673ee685d17570c581d3b78b07df9838f62e470 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 20 Jun 2019 08:51:55 +0300 Subject: [PATCH 2/3] Distinguish stopped and finished workers By having a separate FINISHED state and a STOPPED state, it is possible to know at which point in the worker's lifetime an event is done. Posting of messages before a worker is started is allowed but posting them after the worker has stopped is not. This fixes avrorouter related failures and all other failures that stem from worker messages being ignored at startup. --- maxutils/maxbase/include/maxbase/worker.hh | 3 ++- maxutils/maxbase/src/worker.cc | 8 ++++---- server/core/monitor.cc | 6 +++++- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/maxutils/maxbase/include/maxbase/worker.hh b/maxutils/maxbase/include/maxbase/worker.hh index 5412bf4f8..88525ea7e 100644 --- a/maxutils/maxbase/include/maxbase/worker.hh +++ b/maxutils/maxbase/include/maxbase/worker.hh @@ -300,7 +300,8 @@ public: IDLE, POLLING, PROCESSING, - ZPROCESSING + ZPROCESSING, + FINISHED }; enum execute_mode_t diff --git a/maxutils/maxbase/src/worker.cc b/maxutils/maxbase/src/worker.cc index 5c6cb2172..e1231b251 100644 --- a/maxutils/maxbase/src/worker.cc +++ b/maxutils/maxbase/src/worker.cc @@ -523,9 +523,9 @@ bool Worker::post_message(uint32_t msg_id, intptr_t arg1, intptr_t arg2) // TODO: Enable and fix this in develop and/or 2.4: The deletion of rworker_local is done after the // workers have stopped and it triggers this assertion. - // mxb_assert(state() != Worker::STOPPED); + // mxb_assert(state() != Worker::FINISHED); - if (state() != Worker::STOPPED) + if (state() != Worker::FINISHED) { MessageQueue::Message message(msg_id, arg1, arg2); rval = m_pQueue->post(message); @@ -536,7 +536,7 @@ bool Worker::post_message(uint32_t msg_id, intptr_t arg1, intptr_t arg2) void Worker::run(mxb::Semaphore* pSem) { - mxb_assert(m_state == STOPPED); + mxb_assert(m_state == STOPPED || m_state == FINISHED); this_thread.pCurrent_worker = this; if (pre_run()) @@ -550,7 +550,7 @@ void Worker::run(mxb::Semaphore* pSem) poll_waitevents(); - m_state = STOPPED; + m_state = FINISHED; post_run(); MXB_INFO("Worker %p has shut down.", this); diff --git a/server/core/monitor.cc b/server/core/monitor.cc index 1d2fb6828..a96816507 100644 --- a/server/core/monitor.cc +++ b/server/core/monitor.cc @@ -2566,7 +2566,11 @@ bool MonitorInstance::start(const MXS_CONFIG_PARAMETER* pParams) // not exist during program start/stop. mxb_assert(mxs_rworker_get_current() == NULL || mxs_rworker_get_current() == mxs_rworker_get(MXS_RWORKER_MAIN)); - mxb_assert(Worker::state() == Worker::STOPPED); + + // This can be a bit confusing as the workers are considered to be "finished" when the stop processing. A + // better distinction between workers that temporarily stop and permanently stop should be implemented. + mxb_assert(Worker::state() == Worker::STOPPED || Worker::state() == Worker::FINISHED); + mxb_assert(monitor_state() == MONITOR_STATE_STOPPED); mxb_assert(m_thread_running.load() == false); From 301b1b63abd6a19dd766ddd5f452a107ea92c6d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Thu, 20 Jun 2019 09:17:31 +0300 Subject: [PATCH 3/3] MXS-2569: Always terminate schemas with newlines If the stored file didn't have a newline in the schema, the schema and the first row would be on the same line. --- server/modules/routing/avrorouter/avro_client.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/server/modules/routing/avrorouter/avro_client.cc b/server/modules/routing/avrorouter/avro_client.cc index 1ff7a2515..a847353e6 100644 --- a/server/modules/routing/avrorouter/avro_client.cc +++ b/server/modules/routing/avrorouter/avro_client.cc @@ -586,6 +586,8 @@ GWBUF* read_avro_json_schema(std::string avrofile, std::string dir) std::stringstream ss; ss << file.rdbuf(); std::string text = ss.str(); + mxs::rtrim(text); + text += '\n'; mxs::Buffer buffer(std::vector(text.begin(), text.end())); rval = buffer.release(); }