From ef3136c5c9427dd2bfe9164ca7dafdf9e862c334 Mon Sep 17 00:00:00 2001 From: Niclas Antti Date: Wed, 19 Jun 2019 00:37:06 +0300 Subject: [PATCH] MXS-2555 Fix split packet bug in smart session. The test failed to notice that the split request session was left in a bad state after the split query had (succesfully) finished. --- server/modules/routing/smartrouter/smartsession.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/server/modules/routing/smartrouter/smartsession.cc b/server/modules/routing/smartrouter/smartsession.cc index 037dda1d1..47f17f038 100644 --- a/server/modules/routing/smartrouter/smartsession.cc +++ b/server/modules/routing/smartrouter/smartsession.cc @@ -451,7 +451,7 @@ bool SmartRouterSession::write_to_all(GWBUF* pBuf, Mode mode) auto& cluster = *it; cluster.tracker = maxsql::PacketTracker(pBuf); cluster.is_replying_to_client = false; - auto pBuf_send = (std::next(it) == end(m_clusters)) ? pBuf : gwbuf_clone(pBuf); + auto pBuf_send = (next(it) == end(m_clusters)) ? pBuf : gwbuf_clone(pBuf); if (!cluster.pDcb->func.write(cluster.pDcb, pBuf_send)) { success = false; @@ -484,7 +484,9 @@ bool SmartRouterSession::write_split_packets(GWBUF* pBuf) { auto& cluster = **it; - auto pBuf_send = (std::next(it) == end(active)) ? pBuf : gwbuf_clone(pBuf); + cluster.tracker.update_request(pBuf); + + auto pBuf_send = (next(it) == end(active)) ? pBuf : gwbuf_clone(pBuf); if (!cluster.pDcb->func.write(cluster.pDcb, pBuf_send)) { success = false;