Repository navigation
Conversation
Three client-visible behavior changes, separated from the storage refactoring that follows: * `Set` on `/` now returns `ZBADARGUMENTS` (previously it was allowed and updated the root node). * `Check`/`CheckNotExists`/`CheckStat` on a path inside the internal `/keeper` system subtree now returns `ZBADARGUMENTS`. `Check` is allowed inside `Multi`, which must be deterministic, but internal nodes may depend on Keeper version and configuration. * Filtered `List` (`EPHEMERAL_ONLY`/`PERSISTENT_ONLY`) now checks each reported child's Read ACL even when neither stat nor data is requested, because exposing a child's `is_ephemeral` flag is also secret. Previously child ACLs were only checked when stat or data was requested. The `List` handler body is reorganized into the same name-only vs. name+stat/data branching that the later refactoring uses, but still implemented with `container`/`getChildren` lookups so that the refactoring commit becomes a pure switch to the nodes-storage abstraction.
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Step 1 of decoupling the Coordination gtests from KeeperMemoryStorage internals: replace the typed-test fixture (TestParam<TStorage, compress>) with a value-parametrized one. TestParam is now a plain struct with a non-constexpr enable_compression field, CoordinationTest derives from testing::TestWithParam<TestParam>, all TYPED_TEST become TEST_P, and a single INSTANTIATE_TEST_SUITE_P lives in gtest_coordination_common.cpp. A makeKeeperContext helper centralizes KeeperContext creation so a future TestParam field selecting the KeeperStorage implementation can be applied in one place. Storage usages temporarily point at KeeperMemoryStorage; subsequent commits replace them with KeeperStorage::create and virtual-method access. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Workflow [PR], commit [79188d6] Summary: ❌
AI ReviewSummaryThis PR splits Keeper storage into a node-storage layer plus shared request logic and rewires snapshot/stat plumbing around that refactor. Most earlier review points are fixed in the current head, but I still see two correctness blockers in the final code: snapshot serialization still consults live TTL/container bookkeeping instead of the frozen snapshot state, and the new uncommitted-node bookkeeping still relies on Findings❌ Blockers
Final VerdictStatus: |
Style check (cpp): the split left `ProfileEvents`/`ErrorCodes` extern declarations out of sync with their usage. Remove the unused `ProfileEvents::Keeper*Request`/`*ElapsedMicroseconds` declarations from `KeeperStorage.cpp` (they are used in `KeeperStorageImpl.cpp` now), remove the unused `ErrorCodes::LOGICAL_ERROR` from `KeeperCommon.cpp`, and add the missing `ErrorCodes::LOGICAL_ERROR` declaration to `KeeperMemNodesStorage.cpp`. Build (arm_tidy): the new virtual interfaces declared default arguments on virtual/override methods, which clang-tidy's `google-default-arguments` prohibits. Move the defaults to non-virtual wrappers that forward to no-default virtual `*Impl` methods (`preprocessRequest`, `getCommittedNodeSimple`, `getUncommittedNodeSimple`, `updateCommittedNode`), and drop the unused default argument on `processLocalRequests` (all callers already pass it explicitly). CI: #108583 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Replace the non-virtual NVI wrappers added in the previous commit with plain virtual methods that have no default arguments, and update every caller to pass `nullptr`/`std::nullopt`/`true`/etc. explicitly. This still satisfies clang-tidy's `google-default-arguments` (no defaults on virtual/override methods) without the extra wrapper indirection. Affects `preprocessRequest`, `getCommittedNodeSimple`, `getUncommittedNodeSimple`, and `updateCommittedNode`. CI: #108583 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Style check (cpp): the split left `ProfileEvents`/`ErrorCodes` extern declarations out of sync with their usage. Remove the unused `ProfileEvents::Keeper*Request`/`*ElapsedMicroseconds` declarations from `KeeperStorage.cpp` (they are used in `KeeperStorageImpl.cpp` now), remove the unused `ErrorCodes::LOGICAL_ERROR` from `KeeperCommon.cpp`, and add the missing `ErrorCodes::LOGICAL_ERROR` declaration to `KeeperMemNodesStorage.cpp`. Build (arm_tidy): the new virtual interfaces declared default arguments on virtual/override methods, which clang-tidy's `google-default-arguments` prohibits. Move the defaults to non-virtual wrappers that forward to no-default virtual `*Impl` methods (`preprocessRequest`, `getCommittedNodeSimple`, `getUncommittedNodeSimple`, `updateCommittedNode`), and drop the unused default argument on `processLocalRequests` (all callers already pass it explicitly). CI: #108583 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…le judged them to be too error-prone for everyone everywhere. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
antonio2368
left a comment
There was a problem hiding this comment.
Thanks for deleting my code.
I like the changes.
| static constexpr uint64_t NUM_FLAGS = 3; | ||
| static constexpr uint64_t EPHEMERAL = 1ul << 63; | ||
| static constexpr uint64_t TTL = 1ul << 62; | ||
| static constexpr uint64_t CONTAINER = 1ul << 61; | ||
| static constexpr uint64_t FLAGS_MASK = EPHEMERAL | TTL | CONTAINER; | ||
| static_assert(FLAGS_MASK == ~(~0ul >> NUM_FLAGS)); |
There was a problem hiding this comment.
I went with manual packing because manual packing would be needed for serialization anyway, and deserialization may be slightly faster if it just assigns one uint64_t without unpacking bitfields.
| { | ||
| KEEPER_STORAGE_LOCK_EXCLUSIVE(lock); | ||
| return storage->getSessionWithEphemeralNodesCount(); | ||
| return storage->getStorageStats(); |
There was a problem hiding this comment.
Exclusive lock is problematic as this is used by mntr which is used for polling readiness.
There was a problem hiding this comment.
How frequent is that? Once a second?
I'll see if I can change it to shared lock. IIRC the only problems were watch sets (would need to add yet another mutex for them) and uncommitted state (would need to either add yet another mutex or report uncommitted state stats through a different mechanism, e.g. CurrentMetrics).
There was a problem hiding this comment.
Oh, all I had to do was grab process_and_responses_lock. Did that, switched to shared lock.
There was a problem hiding this comment.
But with this lock you still are contending with process/preprocess?
There was a problem hiding this comment.
Yes, once a second the monitoring thread will wait for the current process/processLocal/preprocess call to complete and lock the mutex for a very short time. Is that a problem? Does mntr need to be available if something is broken and a request is stuck?
(With exclusive rwlock lock there was a problem that it prevents new processLocal-s from starting while waiting for the running preprocess to finish; so preprocess latency would sometimes be added to read latency. But with process_and_responses_lock no similar problem exists, I think? It's mostly a one-sided wait, delaying only the mntr thread? Assuming getStorageStats() is fast, which it seems to be, it's just a few size()s and such.)
There was a problem hiding this comment.
(If you just mean "mutex contention slow", doesn't that apply at more like 10k locks/s scale, not 1?)
There was a problem hiding this comment.
We do use it to report readiness so mntr not being available means the pod will be reported as unhealthy.
If request gets stuck I guess we can pretend this is a legit case of reporting Keeper as unhealthy.
I'm more worried if it can affect latency.
After I changed it to atomic I also changed how we count certain watches metrics which were really heavy so maybe it's okay to run it with a mutex again as all operations seem simple.
There was a problem hiding this comment.
In old old code we iterated the sessions_and_watchers map.
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 3768/4253 (88.60%) · Uncovered code |
More KeeperStorage refactoring
Changelog category (leave one):
Things needed to integrate new LSM-tree-based storage (#107261) while keeping the current in-memory implementation also available as an option. A lot of moving code around. Can be reviewed one commit at a time (at least the initial 11 commits), each commit does a different thing and leaves everything in working state. (Don't trust the AI-generated long commit messages though, they might be outdated, just the titles are correct.) (This could be a stack of 11 PRs, but stacking PRs on github is way too painful for that.)
As usual, the integration refactoring was way harder and took longer than the actual meaningful work of implementing the LSM tree etc :/
Sequence of commits:
KeeperStorage::prepare*methods are organized.)IDiskin Keeper #50098 (comment)Once this and #107261 are merged, a smaller third PR will finally integrate the two.
Version info
26.7.1.1257(included in26.7and later)