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;