diff --git a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc index ffcfac699..1e2703849 100644 --- a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc +++ b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc @@ -403,6 +403,10 @@ bool RWSplitSession::route_session_write(GWBUF *querybuf, uint8_t command, uint3 { m_expected_responses++; } + else + { + backend->ack_write(); + } MXS_INFO("Route query to %s: %s \t%s", backend->is_master() ? "master" : "slave", @@ -1006,19 +1010,28 @@ bool RWSplitSession::handle_got_target(GWBUF* querybuf, SRWBackend& target, bool atomic_add_uint64(&m_router->stats().n_queries, 1); atomic_add_uint64(&target->server()->stats.packets, 1); - if (!m_qc.large_query() && response == mxs::Backend::EXPECT_RESPONSE) + if (!m_qc.large_query()) { - /** The server will reply to this command */ ss_dassert(target->get_reply_state() == REPLY_STATE_DONE); - target->set_reply_state(REPLY_STATE_START); - m_expected_responses++; - if (m_qc.load_data_state() == QueryClassifier::LOAD_DATA_END) + if (response == mxs::Backend::EXPECT_RESPONSE) { - /** The final packet in a LOAD DATA LOCAL INFILE is an empty packet - * to which the server responds with an OK or an ERR packet */ - ss_dassert(gwbuf_length(querybuf) == 4); - m_qc.set_load_data_state(QueryClassifier::LOAD_DATA_INACTIVE); + /** The server will reply to this command */ + target->set_reply_state(REPLY_STATE_START); + m_expected_responses++; + + if (m_qc.load_data_state() == QueryClassifier::LOAD_DATA_END) + { + /** The final packet in a LOAD DATA LOCAL INFILE is an empty packet + * to which the server responds with an OK or an ERR packet */ + ss_dassert(gwbuf_length(querybuf) == 4); + m_qc.set_load_data_state(QueryClassifier::LOAD_DATA_INACTIVE); + } + } + else + { + // The server won't respond, mark it as done + target->ack_write(); } }