Repository navigation
Conversation
The MarkCache insertion key in MergeTreeMarksLoader::loadMarksSync / loadMarksAsync was built from IDataPartStorage::getFullPath(), while eviction in IMergeTreeDataPart::removeMarksFromCache() builds it from getRelativePathOfActivePart(). getFullPath() changes when a part is moved between disks or detached, so the two keys diverge and the inserted entry is never freed on part removal. A later part reusing the same on-disk directory can then be served the stale marks of a differently-shaped part, which trips the "Number of marks N is not divisible by number of columns in mark M" LOGICAL_ERROR in the MergeTreeMarksGetter constructor (most easily hit via prewarm-on-fetch, which eagerly loads marks for every freshly downloaded part). Use the active-part path for the insertion key so it matches eviction. This is the same class of bug fixed for the primary-index and vector-similarity index caches in de320f1. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Workflow [PR], commit [5d8c7b6] Summary: ❌
AI ReviewSummaryThis PR changes Tests
Final VerdictStatus: Minimum required action: add regression coverage for the |
| /// columns M" check in MergeTreeMarksGetter. Same class of bug as the index caches (de320f18af0). | ||
| auto key = MarkCache::hash( | ||
| data_part_storage->getDiskName() + ":" | ||
| + (fs::path(data_part_storage->getFullRootPath()) / data_part_reader->getPartName() / mrk_path).string()); |
There was a problem hiding this comment.
Because this PR is a Bug Fix, the cache-key invariant needs regression coverage. The current change has no test that loads marks for a part whose storage path differs from its eventual active path and then verifies removeMarksFromCache evicts the inserted MarkCache key; changing either side of the key back to getFullPath would still pass. Please add a focused stateless/integration test, or a small unit test around key construction, that reproduces the stale MarkCache entry across move/detach or prewarm-on-fetch and proves stale marks are not served.
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 11/11 (100.00%) | Lost baseline coverage: none · Uncovered code |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Fix a rare
Number of marks N is not divisible by number of columns in mark Mlogical error caused by the mark cache serving a stale entry after a part was moved between disks or detached.The mark-cache insert key (
MergeTreeMarksLoader) usedgetFullPath(), while eviction (removeMarksFromCache) usesgetRelativePathOfActivePart().getFullPath()changes when a part is moved between disks or detached, so the keys diverge and the entry is never freed on removal; a later part reusing the directory can then be served stale, wrong-shaped marks and trip the divisibility check inMergeTreeMarksGetter.Fix: key the insert on the active-part path so it matches eviction. Same fix as
de320f18af0(index caches).