From 2af221df1814b629f7ad750c15e7c2d2a4f5952f Mon Sep 17 00:00:00 2001 From: zhanglistar Date: Sat, 11 Dec 2021 22:24:59 +0800 Subject: [PATCH] 1. update node size in set processor. --- src/Coordination/KeeperStorage.cpp | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/Coordination/KeeperStorage.cpp b/src/Coordination/KeeperStorage.cpp index 146cb162cbd..93e4aecc1be 100644 --- a/src/Coordination/KeeperStorage.cpp +++ b/src/Coordination/KeeperStorage.cpp @@ -133,21 +133,6 @@ static bool fixupACL( return valid_found; } -//uint64_t KeeperStorage::Node::sizeInBytes() const -//{ -// uint64_t total_size{0}; -// for (const auto & child : children) -// total_size += child.size(); -// -// total_size += data.size(); -// -// total_size += sizeof(acl_id); -// total_size += sizeof(is_sequental); -// total_size += sizeof(stat); -// total_size += sizeof(seq_num); -// return total_size; -//} - static KeeperStorage::ResponsesForSessions processWatchesImpl(const String & path, KeeperStorage::Watches & watches, KeeperStorage::Watches & list_watches, Coordination::Event event_type) { KeeperStorage::ResponsesForSessions result; @@ -625,11 +610,11 @@ struct KeeperStorageSetRequestProcessor final : public KeeperStorageRequestProce auto itr = container.updateValue(request.path, [zxid, request] (KeeperStorage::Node & value) { - value.data = request.data; value.stat.version++; value.stat.mzxid = zxid; value.stat.mtime = std::chrono::system_clock::now().time_since_epoch() / std::chrono::milliseconds(1); value.stat.dataLength = request.data.length(); + value.size_bytes += request.data.size() - value.data.size(); value.data = request.data; });