Repository navigation
Conversation
|
Workflow [PR], commit [693b859] Summary: ✅
AI ReviewSummaryThis PR turns the Missing context / blind spots
Final VerdictStatus: ✅ Approve LLVM Coverage ReportMeasured on commit 693b859.
Changed lines: Changed C/C++ lines covered: 25/33 (75.76%) · Uncovered code |
6def6f6 to
40d854c
Compare
There was a problem hiding this comment.
Pull request overview
Fixes an assertion-triggering logical error in MergeTreeDeduplicationLog by ensuring the current log writer is initialized before writing, addressing the crash reported in #86189 for certain object-storage disk configurations.
Changes:
- Introduce
initCurrentWriter()to lazily open the deduplication log writer when needed. - Replace
chassert(current_writer != nullptr)inaddPart()/dropPart()with writer initialization. - Refactor writer finalization/cancellation handling in
rotate()and reuse the new initializer fromload()/rotate().
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
src/Storages/MergeTree/MergeTreeDeduplicationLog.h |
Declares initCurrentWriter() to centralize writer initialization. |
src/Storages/MergeTree/MergeTreeDeduplicationLog.cpp |
Implements initCurrentWriter() and uses it to prevent null-writer assertions during INSERT/dedup log updates. |
|
The The bug was reverted by PR #102247 (merged at ~14:48 UTC). All nessie/lakekeeper test failures between these two merges are unrelated to this PR. |
…CAL_ERROR message Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…urrent-writer-null
…licy Reproduces the storage policy shape from issue ClickHouse#86189: the deduplication log lives on the first disk of the policy (`metadata_type=plain`, which does not support writing with append), while data parts are routed to a second `local`-metadata disk. Verifies that `INSERT` with deduplication works. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Picked up this PR and pushed updates (
While validating the test I confirmed (by building Built on ARM and ran the new integration test — it passes. |
…urrent-writer-null
|
Merged Verified No unresolved review threads. This refreshes CI to clear the stale advisory status. |
…urrent-writer-null
|
Merged |
…urrent-writer-null Bring the branch up to date with master to clear unrelated red CI: the 'Fast test (arm_darwin)' failures in 01951_distributed_push_down_limit and 01952_optimize_distributed_group_by_sharding_key were a distributed query-plan regression on the old merge-base, fixed on master by the remote-plan rework in ClusterProxy/executeQuery.cpp. Master did not touch the PR's files. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…urrent-writer-null
|
Reworked the PR description to resolve the AI Review's The description now tells one consistent story matching the evidence: this is defensive hardening, not a stable-release regression fix. The Also merged |
|
Merged All four failures on the previous run were unrelated, widespread flakes (each reproduces on
No unresolved review threads; the AI Review |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered: 25/33 (75.76%) · Uncovered code |
…urrent-writer-null
|
🕵 Merged |
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Object file sizes11 object files changed (+546.26 KiB total), 5 added.
721 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only Compile time of recompiled translation units20 translation units recompiled, 147 s compile time in total, 20 of them have a recent master baseline. |
…urrent-writer-null
…urrent-writer-null
|
🕵 Merged current |
|
🕵 Merged current |
…urrent-writer-null
The AI review pointed out that the new integration test only exercised `MergeTreeDeduplicationLog::addPart`, while the fix replaces the over-strict `current_writer != nullptr` assertion in `dropPart` as well (the assertion was also reported from that path in issue ClickHouse#86189). Add a companion test that runs `ALTER TABLE ... DROP PARTITION` on the same mixed `plain` + `local` metadata policy right after a restart, so a drop is the first deduplication-log write, and check that the dropped block can be inserted again while a surviving block is still deduplicated.
Criss-cross merge (two merge bases: `5dde51d8b927` and `1a95640484605`), so the ort virtual base produced 300 spurious conflicts in files this PR does not touch. Resolved every such file to `master` verbatim and restored the `.gitmodules` entries and `contrib` submodule gitlinks that the merge silently dropped. Verified that the merged tree equals `master` plus this PR's five-file change exactly.
On the mixed `plain` + `local` metadata policy used by this test both of the obvious routes to `MergeTreeDeduplicationLog::dropPart` are rejected before they get there: `checkAlterPartitionIsPossible` refuses partition operations for a `plain`-metadata disk, and `checkMutationIsPossible` refuses mutations for a disk without hard-link support, which also rules out emptying a part so that `clearEmptyParts` drops it. `TRUNCATE` goes through `StorageMergeTree::renameAndCommitEmptyParts` and reaches `dropPart` on the same policy. Both tests pass locally.
|
🕵 Addressed the AI Review Review feedback — The verdict suggested Verified locally: Master merge. The branch was ~9 days / 4605 commits behind. This was a criss-cross merge — The previous CI run on |
…urrent-writer-null # Conflicts: # ci/jobs/llvm_coverage_job.py # ci/jobs/scripts/job_hooks/llvm_coverage_hook.py # ci/jobs/unit_tests_job.py # src/Access/Common/AccessRightsElement.h # src/Access/tests/gtest_access_rights_ops.cpp # src/Client/ConnectionEstablisher.h # src/Client/ConnectionPool.cpp # src/Client/ConnectionPool.h # src/Columns/ColumnConst.cpp # src/Common/AsyncTaskExecutor.h # src/Common/CurrentThread.cpp # src/Common/Fiber.h # src/Common/FiberStack.cpp # src/Common/LockMemoryExceptionInThread.cpp # src/Common/LockMemoryExceptionInThread.h # src/Common/MemoryTrackerBlockerInThread.cpp # src/Common/MemoryTrackerBlockerInThread.h # src/Common/OpenTelemetryTraceContext.cpp # src/Common/OptimizedRegularExpression.cpp # src/Common/PoolBase.h # src/Common/Throttler.cpp # src/Common/Throttler.h # src/Common/ZooKeeper/tests/gtest_zookeeper.cpp # src/Common/checkStackSize.cpp # src/Common/remapExecutable.cpp # src/Common/tests/gtest_optimize_re.cpp # src/DataTypes/DataTypeTuple.cpp # src/DataTypes/DataTypeTuple.h # src/DataTypes/IDataType.cpp # src/DataTypes/Serializations/ISerialization.cpp # src/DataTypes/Serializations/SerializationArray.cpp # src/DataTypes/Serializations/SerializationArrayOffsets.cpp # src/DataTypes/Serializations/SerializationArrayOffsets.h # src/DataTypes/Serializations/SerializationMap.cpp # src/DataTypes/Serializations/SerializationMapKeyValue.cpp # src/DataTypes/Serializations/SerializationMapSize.cpp # src/DataTypes/Serializations/SerializationObject.h # src/DataTypes/Serializations/SerializationObjectCombinedPath.cpp # src/DataTypes/Serializations/SerializationObjectDistinctPaths.cpp # src/DataTypes/Serializations/SerializationObjectSharedData.h # src/DataTypes/Serializations/SerializationObjectSharedDataPath.cpp # src/DataTypes/Serializations/SerializationReplicated.h # src/DataTypes/Serializations/SerializationSparse.cpp # src/DataTypes/Serializations/SerializationSparse.h # src/DataTypes/Serializations/SerializationStringSize.cpp # src/DataTypes/Serializations/SerializationSubObject.cpp # src/DataTypes/Serializations/SerializationSubObjectSharedData.cpp # src/DataTypes/Serializations/SerializationTuple.h # src/DataTypes/Serializations/SerializationVariantElementNullMap.cpp # src/DataTypes/Serializations/SerializationWrapper.cpp # src/DataTypes/Serializations/SerializationWrapper.h # src/DataTypes/tests/gtest_datatypetuple_createcolumn_detached.cpp # src/Formats/NativeReader.cpp # src/Functions/FunctionsEmbeddedDictionaries.cpp # src/Functions/endsWith.cpp # src/Functions/startsWith.cpp # src/Functions/startsWithUTF8.cpp # src/Interpreters/Access/InterpreterGrantQuery.cpp # src/Interpreters/ClusterProxy/distributedIndexAnalysis.cpp # src/Interpreters/HashTablesStatistics.h # src/Interpreters/tests/gtest_async_insert_key.cpp # src/Parsers/ASTProjectionSelectQuery.cpp # src/Parsers/ASTQueryWithTableAndOutput.cpp # src/Parsers/ASTTTLElement.cpp # src/Processors/QueryPlan/DistinctStep.h # src/Processors/TTL/TTLDeleteAlgorithm.cpp # src/Processors/Transforms/JoiningTransform.h # src/Storages/MergeTree/DeserializationPrefixesCache.cpp # src/Storages/MergeTree/IMergeTreeReader.h # src/Storages/MergeTree/MergeTreeReaderCompact.cpp # src/Storages/MergeTree/MergeTreeReaderCompact.h # src/TableFunctions/TableFunctionZeros.cpp # tests/integration/test_storage_iceberg_with_spark/test_iceberg_snapshot_reads.py # tests/integration/test_storage_s3/test.py # tests/queries/0_stateless/01780_column_sparse_full.sql # tests/queries/0_stateless/02932_refreshable_materialized_views_1.sh # tests/queries/0_stateless/03251_insert_sparse_all_formats.reference
|
🕵 Merged The merge produced criss-cross conflicts (two merge bases) in 77 files, none of them touched by this PR; all were resolved to |
…urrent-writer-null
|
🕵 Merged |
|
Is this relevant after #118089? |
|
Closing in favor of #118089, which covers the reachable part of this in the same function. Both pull requests rewrite What is left here on top of that is unreachable on current
This agrees with the description of this pull request itself (defensive hardening; the logical error is not reproducible on current If we want to keep the coverage for a storage policy that mixes |
Replace the over-strict
chassert(current_writer != nullptr)inMergeTreeDeduplicationLogwith lazy initialization of the log writer (initCurrentWriter), so the writer is opened on demand fromload,addPart, anddropPart. The write mode (append or rewrite) is chosen from whether the disk's metadata storage supports appending, which keeps the deduplication log working on storage policies that mix disks with different metadata types (e.g. aplainand alocalobject-storage metadata disk, as in the linked issue).This is defensive hardening rather than a stable-release regression fix: the
current_writer != nullptrlogical error from the linked issue is no longer reproducible on currentmaster(the existingMetadataStorageType::Plainhandling inloadalready opens the writer), so there is no user-visible misbehavior in a stable release to announce — hence theNot for changelogcategory. The change removes the remaining code path through which the assertion could be reached and adds a regression test (test_merge_tree_deduplication_mixed_metadata) covering the storage-policy shape from the issue.Closes: #86189
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not for changelog (defensive hardening: the logical error is already unreachable on current
master).Workflow [PR]
Sync PR [sync-upstream/pr/102215]