From 590615df66405c5c575fb817aec87a7e0d09d14f Mon Sep 17 00:00:00 2001 From: Alexander Tokmakov Date: Tue, 13 Jul 2021 22:01:43 +0300 Subject: [PATCH] fix --- src/Common/ZooKeeper/ZooKeeperCommon.cpp | 21 ++++++++----------- src/Common/ZooKeeper/ZooKeeperImpl.cpp | 6 ++++++ src/Core/ya.make | 4 ---- .../0_stateless/01158_zookeeper_log.sql | 1 + 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/Common/ZooKeeper/ZooKeeperCommon.cpp b/src/Common/ZooKeeper/ZooKeeperCommon.cpp index 40a04acaebb..f96d29d3290 100644 --- a/src/Common/ZooKeeper/ZooKeeperCommon.cpp +++ b/src/Common/ZooKeeper/ZooKeeperCommon.cpp @@ -587,11 +587,9 @@ void ZooKeeperMultiRequest::createLogElements(LogElements & elems) const elems.back().requests_size = requests.size(); for (const auto & request : requests) { - auto * req = dynamic_cast(request.get()); - assert(req); - assert(!req->xid || req->xid == xid); - req->xid = xid; - req->createLogElements(elems); + auto & req = dynamic_cast(*request); + assert(!req.xid || req.xid == xid); + req.createLogElements(elems); } } @@ -662,13 +660,12 @@ void ZooKeeperMultiResponse::fillLogElements(LogElements & elems, size_t idx) co ZooKeeperResponse::fillLogElements(elems, idx); for (const auto & response : responses) { - auto * resp = dynamic_cast(response.get()); - assert(resp); - assert(!resp->xid || resp->xid == xid); - assert(!resp->zxid || resp->zxid == zxid); - resp->xid = xid; - resp->zxid = zxid; - resp->fillLogElements(elems, ++idx); + auto & resp = dynamic_cast(*response); + assert(!resp.xid || resp.xid == xid); + assert(!resp.zxid || resp.zxid == zxid); + resp.xid = xid; + resp.zxid = zxid; + resp.fillLogElements(elems, ++idx); } } diff --git a/src/Common/ZooKeeper/ZooKeeperImpl.cpp b/src/Common/ZooKeeper/ZooKeeperImpl.cpp index 853e67f2165..05893d42fb6 100644 --- a/src/Common/ZooKeeper/ZooKeeperImpl.cpp +++ b/src/Common/ZooKeeper/ZooKeeperImpl.cpp @@ -1008,6 +1008,12 @@ void ZooKeeper::pushRequest(RequestInfo && info) throw Exception("xid equal to close_xid", Error::ZSESSIONEXPIRED); if (info.request->xid < 0) throw Exception("XID overflow", Error::ZSESSIONEXPIRED); + + if (auto * multi_request = dynamic_cast(info.request.get())) + { + for (auto & request : multi_request->requests) + dynamic_cast(*request).xid = multi_request->xid; + } } /// We must serialize 'pushRequest' and 'finalize' (from sendThread, receiveThread) calls diff --git a/src/Core/ya.make b/src/Core/ya.make index 6946d7a47bb..d1e352ee846 100644 --- a/src/Core/ya.make +++ b/src/Core/ya.make @@ -31,10 +31,6 @@ SRCS( MySQL/PacketsProtocolText.cpp MySQL/PacketsReplication.cpp NamesAndTypes.cpp - PostgreSQL/Connection.cpp - PostgreSQL/PoolWithFailover.cpp - PostgreSQL/Utils.cpp - PostgreSQL/insertPostgreSQLValue.cpp PostgreSQLProtocol.cpp QueryProcessingStage.cpp Settings.cpp diff --git a/tests/queries/0_stateless/01158_zookeeper_log.sql b/tests/queries/0_stateless/01158_zookeeper_log.sql index 2186fa60346..f3f1980b5a2 100644 --- a/tests/queries/0_stateless/01158_zookeeper_log.sql +++ b/tests/queries/0_stateless/01158_zookeeper_log.sql @@ -1,5 +1,6 @@ drop table if exists rmt; create table rmt (n int) engine=ReplicatedMergeTree('/test/01158/{database}/rmt', '1') order by n; +system sync replica rmt; insert into rmt values (1); insert into rmt values (1); system flush logs;