From 676b6238d05941156089861fe1e0f4d48f56dbd7 Mon Sep 17 00:00:00 2001 From: Antonio Andelic Date: Tue, 17 Sep 2024 10:30:39 +0200 Subject: [PATCH] Update comments --- src/Coordination/KeeperStateMachine.h | 5 ++++- src/Coordination/KeeperStorage.cpp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Coordination/KeeperStateMachine.h b/src/Coordination/KeeperStateMachine.h index 7e6830ec1ba..03204036e7e 100644 --- a/src/Coordination/KeeperStateMachine.h +++ b/src/Coordination/KeeperStateMachine.h @@ -126,8 +126,11 @@ protected: /// Mutex for snapshots mutable std::mutex snapshots_lock; + /// Lock for the storage + /// Storage works in thread-safe way ONLY for preprocessing/processing + /// In any other case, unique storage lock needs to be taken mutable SharedMutex storage_mutex; - /// Lock for storage and responses_queue. It's important to process requests + /// Lock for processing and responses_queue. It's important to process requests /// and push them to the responses queue while holding this lock. Otherwise /// we can get strange cases when, for example client send read request with /// watch and after that receive watch response and only receive response diff --git a/src/Coordination/KeeperStorage.cpp b/src/Coordination/KeeperStorage.cpp index fe7bcf71160..20049fd23e8 100644 --- a/src/Coordination/KeeperStorage.cpp +++ b/src/Coordination/KeeperStorage.cpp @@ -772,6 +772,7 @@ void KeeperStorage::UncommittedState::cleanup(int64_t commit_zxid) template void KeeperStorage::UncommittedState::rollback(int64_t rollback_zxid) { + // we can only rollback the last zxid (if there is any) std::list rollback_deltas; { std::lock_guard lock(deltas_mutex);