From f379f225fa427851f36bff2306996138e1d1a23b Mon Sep 17 00:00:00 2001 From: Antonio Andelic Date: Mon, 23 May 2022 06:48:39 +0000 Subject: [PATCH] Add ephemerals on preprocess --- src/Coordination/KeeperStorage.cpp | 13 +++++-------- src/Coordination/KeeperStorage.h | 2 -- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/src/Coordination/KeeperStorage.cpp b/src/Coordination/KeeperStorage.cpp index 92ea208d57b..c63aefb99af 100644 --- a/src/Coordination/KeeperStorage.cpp +++ b/src/Coordination/KeeperStorage.cpp @@ -421,7 +421,6 @@ Coordination::Error KeeperStorage::commit(int64_t commit_zxid, int64_t session_i std::move(operation.data), operation.stat, operation.is_sequental, - operation.is_ephemeral, std::move(operation.acls), session_id)) onStorageInconsistency(); @@ -503,9 +502,8 @@ bool KeeperStorage::createNode( String data, const Coordination::Stat & stat, bool is_sequental, - bool is_ephemeral, Coordination::ACLs node_acls, - int64_t session_id) + int64_t /*session_id*/) { auto parent_path = parentPath(path); auto node_it = container.find(parent_path); @@ -533,9 +531,6 @@ bool KeeperStorage::createNode( auto child_path = getBaseName(map_key->getKey()); container.updateValue(parent_path, [child_path](KeeperStorage::Node & parent) { parent.addChild(child_path); }); - if (is_ephemeral) - ephemerals[session_id].emplace(path); - addDigest(map_key->getMapped()->value, map_key->getKey().toView()); return true; }; @@ -740,7 +735,7 @@ struct KeeperStorageCreateRequestProcessor final : public KeeperStorageRequestPr new_deltas.emplace_back( std::move(path_created), zxid, - KeeperStorage::CreateNodeDelta{stat, request.is_ephemeral, request.is_sequential, std::move(node_acls), request.data}); + KeeperStorage::CreateNodeDelta{stat, request.is_sequential, std::move(node_acls), request.data}); int32_t parent_cversion = request.parent_cversion; @@ -760,6 +755,9 @@ struct KeeperStorageCreateRequestProcessor final : public KeeperStorageRequestPr ++node.stat.numChildren; }}); + if (request.is_ephemeral) + storage.ephemerals[session_id].emplace(path_created); + digest = storage.calculateNodesDigest(digest, new_deltas); return new_deltas; } @@ -1776,7 +1774,6 @@ void KeeperStorage::preprocessRequest( } new_digest = calculateNodesDigest(new_digest, new_deltas); - return; } diff --git a/src/Coordination/KeeperStorage.h b/src/Coordination/KeeperStorage.h index c0111cd390c..c7edd95da4b 100644 --- a/src/Coordination/KeeperStorage.h +++ b/src/Coordination/KeeperStorage.h @@ -146,7 +146,6 @@ public: struct CreateNodeDelta { Coordination::Stat stat; - bool is_ephemeral; bool is_sequental; Coordination::ACLs acls; String data; @@ -266,7 +265,6 @@ public: String data, const Coordination::Stat & stat, bool is_sequental, - bool is_ephemeral, Coordination::ACLs node_acls, int64_t session_id);