From 0136d7d51a9ccf0a52ffe87885f75a5fa60fb7f7 Mon Sep 17 00:00:00 2001 From: alesapin Date: Wed, 3 Mar 2021 15:29:00 +0300 Subject: [PATCH] Get rid of unused field --- src/Coordination/NuKeeperSnapshotManager.cpp | 8 +++----- src/Coordination/NuKeeperStorage.cpp | 8 ++++---- src/Coordination/NuKeeperStorage.h | 1 - 3 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/Coordination/NuKeeperSnapshotManager.cpp b/src/Coordination/NuKeeperSnapshotManager.cpp index 8a62812f28b..b3212f362ad 100644 --- a/src/Coordination/NuKeeperSnapshotManager.cpp +++ b/src/Coordination/NuKeeperSnapshotManager.cpp @@ -54,7 +54,6 @@ namespace { Coordination::write(node.data, out); Coordination::write(node.acls, out); - Coordination::write(node.ephemeral_owner, out); Coordination::write(node.is_sequental, out); Coordination::write(node.stat, out); Coordination::write(node.seq_num, out); @@ -64,7 +63,6 @@ namespace { Coordination::read(node.data, in); Coordination::read(node.acls, in); - Coordination::read(node.ephemeral_owner, in); Coordination::read(node.is_sequental, in); Coordination::read(node.stat, in); Coordination::read(node.seq_num, in); @@ -78,7 +76,7 @@ namespace SnapshotMetadataPtr deserializeSnapshotMetadata(ReadBuffer & in) { - /// FIXME (alesap) + /// FIXME double copy (alesap) std::string data; Coordination::read(data, in); auto buffer = nuraft::buffer::alloc(data.size()); @@ -140,8 +138,8 @@ SnapshotMetadataPtr NuKeeperStorageSnapshot::deserialize(NuKeeperStorage & stora NuKeeperStorage::Node node; readNode(node, in); storage.container.insertOrReplace(path, node); - if (node.ephemeral_owner != 0) - storage.ephemerals[node.ephemeral_owner].insert(path); + if (node.stat.ephemeralOwner != 0) + storage.ephemerals[node.stat.ephemeralOwner].insert(path); current_size++; } diff --git a/src/Coordination/NuKeeperStorage.cpp b/src/Coordination/NuKeeperStorage.cpp index 80b0b201b8d..90e98c2584a 100644 --- a/src/Coordination/NuKeeperStorage.cpp +++ b/src/Coordination/NuKeeperStorage.cpp @@ -137,7 +137,7 @@ struct NuKeeperStorageCreateRequest final : public NuKeeperStorageRequest { response.error = Coordination::Error::ZNONODE; } - else if (it->value.ephemeral_owner != 0) + else if (it->value.stat.ephemeralOwner != 0) { response.error = Coordination::Error::ZNOCHILDRENFOREPHEMERALS; } @@ -150,8 +150,8 @@ struct NuKeeperStorageCreateRequest final : public NuKeeperStorageRequest created_node.stat.mtime = created_node.stat.ctime; created_node.stat.numChildren = 0; created_node.stat.dataLength = request.data.length(); + created_node.stat.ephemeralOwner = request.is_ephemeral ? session_id : 0; created_node.data = request.data; - created_node.ephemeral_owner = request.is_ephemeral ? session_id : 0; created_node.is_sequental = request.is_sequential; std::string path_created = request.path; @@ -256,7 +256,7 @@ struct NuKeeperStorageRemoveRequest final : public NuKeeperStorageRequest else { auto prev_node = it->value; - if (prev_node.ephemeral_owner != 0) + if (prev_node.stat.ephemeralOwner != 0) ephemerals[session_id].erase(request.path); auto child_basename = getBaseName(it->key); @@ -273,7 +273,7 @@ struct NuKeeperStorageRemoveRequest final : public NuKeeperStorageRequest undo = [prev_node, &container, &ephemerals, session_id, path = request.path, child_basename] { - if (prev_node.ephemeral_owner != 0) + if (prev_node.stat.ephemeralOwner != 0) ephemerals[session_id].emplace(path); container.insert(path, prev_node); diff --git a/src/Coordination/NuKeeperStorage.h b/src/Coordination/NuKeeperStorage.h index 6c9e2071c09..e8814ee99b9 100644 --- a/src/Coordination/NuKeeperStorage.h +++ b/src/Coordination/NuKeeperStorage.h @@ -31,7 +31,6 @@ public: { String data; Coordination::ACLs acls{}; - int64_t ephemeral_owner = 0; bool is_sequental = false; Coordination::Stat stat{}; int32_t seq_num = 0;