Repository navigation
Conversation
|
Workflow [PR], commit [e847b06] Summary: ✅
AI ReviewSummaryThis PR refactors Findings❌ Blockers
Final VerdictStatus: ❌ Block Minimum required action: restore release-build consistency checks for update/data/ACL/remove delta application before merging. |
| if (operation.version != -1 && operation.version != node_it->value.stats.version) | ||
| onStorageInconsistency("Node to be updated has invalid version"); | ||
| if constexpr (std::same_as<DeltaType, UpdateNodeStatDelta>) | ||
| chassert(operation.old_stats.version == node_it->value.stats.version); |
There was a problem hiding this comment.
commit still needs to fail closed in release builds when a preprocessed delta no longer matches committed state. chassert is compiled out outside debug/sanitizer builds, so a stale UpdateNodeStatDelta or UpdateNodeDataDelta would now keep applying over the mismatched node; the SetACLDelta branch below also decrements operation.old_acl_id even if the node currently has a different ACL, corrupting the ACL usage map. This used to call onStorageInconsistency for the version mismatch. Please keep a release check here and in the SetACLDelta branch before mutating the node; the heavier data comparison can stay debug-only if needed.
| @@ -1635,8 +1389,7 @@ bool KeeperStorage<Container>::removeNode(const std::string & path, int32_t vers | |||
| if (node_it == container.end()) | |||
| return false; | |||
|
|
|||
| if (version != -1 && version != node_it->value.stats.version) | |||
| return false; | |||
| chassert(version == node_it->value.stats.version); | |||
There was a problem hiding this comment.
RemoveNodeDelta needs the same release-build fail-closed check as the update and ACL branches. Before this PR, removeNode returned false when the committed version no longer matched the preprocessed remove; now the only version guard is this chassert, which is compiled out in release builds. If a stale remove delta reaches commit after the node was changed or recreated, release builds will delete the current node and decrement its ACL/ephemeral state instead of reporting storage inconsistency. Please keep a runtime version check here, or in the caller, before mutating the node.
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 1069/1239 (86.28%) | Lost baseline coverage (was covered on master, now uncovered in this PR): 25 line(s) · Uncovered code |
|
I have ancient ZooKeeper data with some of znodes created in 2016 and then migrated to Keeper by clickhouse-keeper-converter. |
…id carries it Keeper returned ZNOAUTH for every request on a node whose acl_id is nonzero but whose ACL list resolves to empty. ZNOAUTH is in isHardwareError, so the client tore down the shared Keeper session and every replicated table reconnect-looped; the reporter of ClickHouse#117603 measured 11,493,573 KEEPER_EXCEPTION in 58 minutes on a cluster upgraded from 26.5 to 26.6, with no Keeper authentication configured. ClickHouse#106412 rewrote checkACL to take an ACLId instead of a path and, in doing so, replaced the semantic test const auto node_acls = getNodeACLs(...); if (node_acls.empty()) return true; with the representational if (acl_id == 0) return true; Those two agree only while a nonzero id implies a non-empty list. ACLMap:: convertACLs, the only way a running Keeper assigns an id, maintains that by returning 0 for an empty list, and its three production callers are the only assignment sites. ACLMap::addMapping does not maintain it: it stores whatever (id, acls) pair it is handed, and deserializeACLMap passes a ZooKeeper snapshot's ACL cache through verbatim. Such an entry then round-trips through every later Keeper snapshot via getMapping, and its usage count keeps removeUnusedACLs from collecting it. Restoring the emptiness test after the id is resolved reinstates the pre-26.6 behaviour at the predicate where it was lost, so all fourteen checkACL call sites, checkCommittedACL and KeeperStateMachine recover at once. The acl_id == 0 fast path is kept: convertNumber is an out-of-line call returning ACLs by value and the zero case is the common one on a per-request predicate. The alternative of normalizing at load time (mapping an empty list down to id 0 and rewriting referencing nodes) was rejected: it hides the trigger rather than fixing the semantics, silently rewrites an operator's persisted ACL ids and the acl_id column of system.keeper_storage, and needs three coordinated sites because dropping the mapping alone makes the per-node addUsage throw. The change cannot widen access. A non-empty list the session does not satisfy is still refused, and no live Keeper can mint a nonzero-empty id to exploit it. An empty ACL list already means unrestricted elsewhere: fixupACL drops a world:anyone entry whose permissions are ACL::All, so an ordinary create with the wide-open ACL also ends up at id 0. Nothing is mutated, so there is no digest impact (acl_id is not hashed by KeeperNodeStats::calculateDigest), no snapshot format change and no setting change. The regression test builds the state through ACLMap::addMapping, which is the surface deserialization uses; it is unreachable from the client API, since convertACLs can never produce it, so no SQL test can express it. It also asserts that a nonzero id whose non-empty ACL list the session cannot satisfy is still refused, which fails if the fix is widened past emptiness. Co-Authored-By: Claude Opus 5 <[email protected]>
Changelog category (leave one):
Partly to improve performance, partly to prepare for trying out a different storage implementation or two.
KeeperStorage's request preprocessing was split into 3 steps:
This PR merges them all into one step with one node lookup.
checkAuthandapplyDeltaare removed and their logic is moved in intopreprocess/preprocessLocal. Uncommitted state mutations are moved into a group of functions likeprepareCreateNode,prepareUpdateNodeStat, etc, to make it easier to try a different underlying storage implementation later (I have specific plans for that).When applying snapshot received from leader, KeeperServer reapplied Deltas instead of re-preprocessing requests. It's more efficient, but (1) requires deltas to be transferable between KeeperStorage instances (I'd like to try a KeeperStorage implementation that doesn't have that property), (2) requires code for applying deltas separately from producing them (which this PR removes as mentioned above). This PR changes it to preprocess requests instead, reusing code with preprocessing uncommitted requests on startup.
preprocess/processfor read requests was weird: it did some small fraction of error checks inpreprocessinstead of just leavingpreprocessno-op and makingprocessandprocessLocalthe same. This added a bunch of code for seemingly no gain. This PR removespreprocessfor read requests, removesprocessImpl, and makes read requests'processcallprocessLocal.Version info
26.6.1.1012