Repository navigation
Reorder operations in DiskAccessStorage for consistency: always modify files first - #104411
Conversation
|
Workflow [PR], commit [05844fa] Summary: ✅ AI ReviewSummaryThis PR reorders Findings❌ Blockers
Tests
ClickHouse Rules
Performance & Safety
Final Verdict
|
| /// Do removing. | ||
| memory_storage.remove(id, /* throw_if_not_exists= */ false); | ||
|
|
||
| /// Step 2: Modify files first. |
There was a problem hiding this comment.
The main idea of this PR is that we must modify files first, and internal memory storage after that - so if a failure appears while we're modifying files then the memory storage won't be modified and DiskAccessStorage will be in consistent state
08e7c2e to
b86d582
Compare
There was a problem hiding this comment.
Pull request overview
This PR adjusts DiskAccessStorage update/insert/remove flows to apply on-disk changes before mutating in-memory state, and enhances rebuild/recovery to clean up orphan .tmp files and resolve duplicate <uuid>.sql entries deterministically.
Changes:
- Reordered
insertNoLock,removeNoLock, andupdateNoLockto perform filesystem operations first, then commit tomemory_storage(with a LOGICAL_ERROR guard if invariants are violated). - Extended
reloadAllAndRebuildLists()to detect and later delete orphan<uuid>.tmpfiles and older duplicate<uuid>.sqlfiles (same entity type+name). - Added gtests covering orphan tmp cleanup and duplicate-name resolution during rebuild.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/Access/tests/gtest_disk_access_storage.cpp | Adds recovery-focused unit tests for rebuild behavior (orphan .tmp cleanup, duplicate entity name resolution). |
| src/Access/DiskAccessStorage.cpp | Reorders disk vs memory mutations for consistency; enhances rebuild to handle orphan temp files and duplicate entities. |
b86d582 to
72f1eee
Compare
72f1eee to
478f40b
Compare
478f40b to
05844fa
Compare
LLVM Coverage Report
Changed lines: 78.26% (144/184) · Uncovered code |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Reorder operations in
DiskAccessStoragefor consistency: always modify files firstVersion info
26.5.1.621