Skip to content

Fsync directories on ATTACH TABLE AS [NOT] REPLICATED to survive power loss - #111507

Closed
groeneai wants to merge 2 commits into
ClickHouse:masterfrom
groeneai:groeneai/fix-111348-attach-as-replicated-metadata-fsync
Closed

groeneai wants to merge 2 commits into
ClickHouse:masterfrom
groeneai:groeneai/fix-111348-attach-as-replicated-metadata-fsync

Conversation

@groeneai

Copy link
Copy Markdown
Collaborator

Related: #111348
Related: #111405

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Fixed a rare data-loss window in ATTACH TABLE ... AS [NOT] REPLICATED on Atomic databases: the metadata .sql rename and the per-part txn_version.txt removals were not directory-fsynced, so a power loss right after the query was acknowledged could restore the old engine definition or discard committed parts. The changed directories are now fdatasync'd (when fsync_metadata is enabled).

Description

ATTACH TABLE ... AS [NOT] REPLICATED (Atomic databases only) makes two durability-relevant filesystem changes in InterpreterCreateQuery::convertMergeTreeTableIfPossible, neither of which fdatasync'd the containing directory:

  1. clearTransactionMetadata unlinks each part's txn_version.txt(.tmp) via a bare unlink().
  2. writeMetadataFile writes the new definition to a .tmp (fsyncing file content only), then replaceFile renames it to .sql.

A rename and an unlink are directory-entry changes and are not durable until the containing directory is fdatasync'd. After the client is acknowledged, a power loss can lose either one:

The fix acquires a directory sync guard on every directory whose entry the operation changes (the metadata directory for the .sql rename, and each modified part directory for the txn-file removals). Each guard fdatasyncs on scope exit, after the change, and is acquired before the destructive operation so a failure leaves the old state untouched. Gated on fsync_metadata (which already gates the file-content fsync here); a no-op on object storage.

Sibling CREATE/RENAME/ALTER/DROP DATABASE metadata commits are handled separately in #111405; the general createDirectories() ancestor-chain gap is tracked separately.

Verified in both directions via ProfileEvents['DirectorySync']: 0 on unpatched, >0 when patched with fsync_metadata=1, 0 with fsync_metadata=0. New test 04546_attach_as_replicated_metadata_fsync.

…r loss

InterpreterCreateQuery::convertMergeTreeTableIfPossible (the ATTACH TABLE ...
AS [NOT] REPLICATED engine conversion, Atomic databases only) makes two
durability-relevant filesystem changes, neither of which fdatasync'd the
containing directory:

1. clearTransactionMetadata unlinks each part's txn_version.txt(.tmp) via a
   bare unlink().
2. writeMetadataFile writes the new definition to a .tmp (fsyncing file content
   only), then replaceFile renames it to .sql.

A rename and an unlink are directory-entry changes; they are not durable until
the containing directory is fdatasync'd. After the client is acknowledged, a
power loss can lose either change:

- The .sql rename is lost, restoring the old engine definition.
- A txn_version.txt.tmp removal is lost and the .tmp file resurrects while its
  txn_version.txt is gone. VersionMetadataOnDisk::loadMetadata then reads the
  part as a rolled-back transaction (Tx::RolledBackCSN), marks it Outdated and
  discards it, losing committed data. This is the same data-loss class as
  ClickHouse#111348 and the stale-tmp case covered by test 04492.

Acquire a directory sync guard on every directory whose entry the operation
changes: the metadata directory (for the .sql rename) and each modified part
directory (for the txn-file removals). Each guard fdatasyncs on scope exit,
after the change. Guards are acquired before the destructive operation (guard
construction opens the directory and can throw), so a failure leaves the old
state untouched rather than half-converted. All gated on fsync_metadata, which
already gates the file-content fsync here; a no-op on object storage.

The sibling CREATE/RENAME/ALTER/DROP DATABASE metadata commits are handled
separately in ClickHouse#111405; the general createDirectories() ancestor-chain gap is
tracked separately.

Related: ClickHouse#111348

New test 04546_attach_as_replicated_metadata_fsync observes the directory
fsync via ProfileEvents['DirectorySync'] and checks the fsync_metadata gate.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review — adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 1 finding across 2 rounds; bounded: 1 full pass + 1 fix round + 1 delta recheck).

# Sev Finding Verdict Evidence / action
1 ⚠️ The replicated-direction test asserted only DirectorySync > 0, which the metadata-directory guard alone satisfies — so removing the per-part guard would leave every assertion passing (test not live for the part-dir sync). AGREE — fixed Strengthened the test: create exactly two non-merging parts, plant txn files in each, and assert the exact DirectorySync == parts + 1 (3) for the to-replicated case and == 1 for to-not-replicated. Liveness-verified: PASSES on the fixed binary; FAILS (WRONG sync count (got 1, want 3)) on a binary with only the per-part guard removed.

Delta re-review (full scope, stateful): 0 findings.

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are terminal per finding.

Session id: cron:clickhouse-author-slot-4:20260723-001054

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. On the unpatched binary, ATTACH ... AS [NOT] REPLICATED with fsync_metadata=1 shows ProfileEvents['DirectorySync']=0 for the query every run (no directory is fdatasync'd).
b Root cause explained? convertMergeTreeTableIfPossible makes two directory-entry changes, neither directory-fsynced: clearTransactionMetadata unlinks each part's txn_version.txt(.tmp) via bare unlink(), and writeMetadataFile(tmp)+replaceFile(→.sql) renames the metadata. A rename/unlink is durable only after the containing dir is fdatasync'd. Post-ack power loss can lose either: .sql rename lost → old engine restored; a .tmp removal lost → lone txn_version.txt.tmp resurrects → loadMetadata → Tx::RolledBackCSN → part discarded → committed data lost.
c Fix matches root cause? Yes. getDirectorySyncGuard on every directory the operation changes — the metadata dir (for the .sql rename) and each modified part dir (for the txn-file removals); fdatasync on scope exit. Gated on fsync_metadata.
d Test intent preserved / new tests added? New test 04546_attach_as_replicated_metadata_fsync.sh asserts the exact DirectorySync counts (parts+metadata for to-replicated, metadata for to-not-replicated) and the fsync_metadata=0 gate. No existing test weakened.
e Both directions demonstrated? Yes. Baseline: DirectorySync=0 in all fsync_metadata=1 cases (bug). Fixed: 3 for to-replicated (2 part dirs + 1 metadata), 1 for to-not-replicated, 0 when fsync_metadata=0. Test PASSES on the fixed binary, FAILS on baseline.
f Fix is general across code paths? Yes. Both filesystem mutations of this operation are covered (metadata rename + txn removals), not just the one first noticed. The sibling CREATE/RENAME/ALTER/DROP DATABASE metadata commits are a different operation, handled in #111405 (verified: it modifies createDatabase, not convertMergeTreeTableIfPossible/clearTransactionMetadata — no overlap). The general createDirectories() ancestor-chain gap is tracked separately. Fix is at the source (missing fsync), not the downstream symptom.
g Fix generalizes across inputs? Yes. Both AS REPLICATED and AS NOT REPLICATED covered; multi-part tables (each modified part dir synced independently — count scales with part count); fsync_metadata on/off; object storage is a safe no-op (getDirectorySyncGuard returns null on non-local disks); a part with no txn files acquires no guard (lazy).
h Backward compatible? Yes. No setting default changed (fsync_metadata already defaults true), no on-disk/wire/metadata format change (only adds fdatasync on files/dirs already written), no SettingsChangesHistory.cpp change. fsync_metadata=0 behavior is byte-identical to before.
i Invariants and contracts preserved? Yes. Guards acquired before any destructive op (guard construction opens the dir and can throw → a throw leaves state unmodified); the existing fail-closed removal order (remove .tmp before the main file) is unchanged; the metadata-dir guard outlives clearTransactionMetadata so txn removals are made durable before the .sql commit's durability. No lock/concurrency change; guard dtor swallows fsync errors, matching LocalDirectorySyncGuard's existing contract.

Session id: cron:clickhouse-author-slot-4:20260723-001054

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @tuanpach @tavplubix — could you review this? ATTACH TABLE ... AS [NOT] REPLICATED on Atomic databases renames the metadata .sql and (to replicated) unlinks each part's txn_version.txt without fdatasync'ing the containing directories, so a power loss right after the ack can restore the old engine definition or resurrect a stale txn_version.txt.tmp and discard committed parts. This adds directory sync guards on those paths, gated on fsync_metadata. Sibling of #111405 (distinct function, no overlap).

@tuanpach tuanpach added the can be tested Allows running workflows for external contributors label Jul 23, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [fd4ae6f]

Summary: ❌

job_name test_name status info comment
Stress test (amd_debug) FAIL
Logical error: Inconsistent KeyCondition behavior (STID: 5182-2f27) FAIL cidb
Stress test (arm_asan_ubsan, s3) FAIL
UndefinedBehaviorSanitizer: undefined behavior (STID: 0250-4a9f) FAIL cidb

AI Review

Summary

This PR adds directory-sync guards around the metadata rename and per-part txn_version cleanup in ATTACH TABLE ... AS [NOT] REPLICATED, and the new stateless test proves the local-disk DirectorySync counts. I found one remaining correctness hole in the AS REPLICATED path on object-storage-backed tables, plus the earlier dismissed concern that fsync_metadata=1 is still best-effort because the directory-sync guard swallows sync failures.

Findings

❌ Blockers

  • [src/Interpreters/InterpreterCreateQuery.cpp:3230] ATTACH TABLE ... AS REPLICATED still does not make the txn_version.txt(.tmp) removals crash-durable on object-storage-backed tables that use local metadata storage. DiskObjectStorage inherits IDisk::getDirectorySyncGuard's nullptr default, but removeFile still commits metadata moveFile / writeFile operations in the metadata store, so a power loss after the ACK can still resurrect those files and make the part load as rolled back on restart. Suggested fix: add a durable sync/finalize path for object-storage metadata stores here, or explicitly scope the fix and user-facing claim to local/encrypted disks instead of the general ATTACH TABLE ... AS [NOT] REPLICATED path.

⚠️ Majors

  • [src/Interpreters/InterpreterCreateQuery.cpp:3159, src/Interpreters/InterpreterCreateQuery.cpp:3230] [dismissed by author -- https://github.com/Fsync directories on ATTACH TABLE AS [NOT] REPLICATED to survive power loss #111507#discussion_r3635143464] The new guards still do not make fsync_metadata=1 fail-closed on local disks, because LocalDirectorySyncGuard catches and logs fdatasync / close failures in its destructor. The query can therefore succeed even though neither the metadata rename nor the part-dir unlinks became durable. Suggested fix: expose a throwing sync / finalize path on ISyncGuard and call it before returning success.
Tests
  • ⚠️ Add a focused object-storage regression that exercises ATTACH TABLE ... AS REPLICATED through DiskObjectStorage metadata operations rather than raw path writes. The current test is explicitly no-object-storage, so it cannot prove the durability contract on that supported storage mode.
Final Verdict

Status: ⚠️ Request changes

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Jul 23, 2026
/// because guard construction can throw and must not leave a half-converted table.
SyncGuardPtr metadata_dir_sync_guard;
if (getContext()->getSettingsRef()[Setting::fsync_metadata])
metadata_dir_sync_guard = db_disk->getDirectorySyncGuard(fs::path(table_metadata_path).parent_path());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still leaves fsync_metadata=1 best-effort. On local disks getDirectorySyncGuard returns LocalDirectorySyncGuard, and its destructor catches/logs fdatasync failures instead of propagating them (src/Disks/LocalDirectorySyncGuard.cpp:39-64). So a failed directory sync here still lets ATTACH TABLE ... AS [NOT] REPLICATED succeed even though the metadata rename or the per-part txn_version.txt(.tmp) unlinks were never made durable, which is exactly the post-ack window this PR is trying to close. The new DirectorySync-count test will not catch that either, because the counter is incremented before the sync attempt. This needs a throwing directory-sync path (or an explicit sync() on the guard that is called before success is returned) rather than the destructor-only helper.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The two facts here are correct: ~LocalDirectorySyncGuard catches and logs fdatasync/close failures (src/Disks/LocalDirectorySyncGuard.cpp:39-66), and the DirectorySync ProfileEvent is incremented before the sync attempt (line 41). But making the directory fsync fail-closed here is out of scope for this fix, for three reasons.

  1. There is no throwing path to call. ISyncGuard (src/Disks/IDisk.h:126-131) exposes only a virtual destructor; the sync is intentionally in an RAII dtor, which cannot throw. A non-swallowing sync()/finalize() does not exist, so this is new shared durability infra, not a call this PR omitted.

  2. Best-effort directory fsync via the guard dtor is the codebase-wide idiom. Every getDirectorySyncGuard site relies on it the same way this PR does: MergeTreeData.cpp:11581, DataPartStorageOnDiskBase.cpp:709/1022, MergeTreeDataWriter.cpp:929, DataPartsExchange.cpp:844, VersionMetadataOnDisk.cpp:344, DistributedSink.cpp:891, DeleteBitmapFileOps.cpp:70, DistributedAsyncInsertBatch.cpp:144/171. Converting only this one call site to fail-closed would diverge from every MergeTree commit path without closing the window anywhere else.

  3. This PR's contract is that the mutated directory entries get fdatasync'd at all, which is exactly the Acknowledged DROP TABLE / RENAME TABLE / EXCHANGE TABLES on an Atomic database can silently revert after power loss: the DDL commit record is never fsynced #111348 gap: before this change the .sql rename and the per-part txn_version.txt(.tmp) unlinks were never directory-synced (DirectorySync = 0). Test 04546 asserts the sync is attempted on exactly the mutated directories (2 part dirs + 1 metadata = 3), which is the property that regressed. Note the file content in this same path is already fail-closed: writeMetadataFile (src/Databases/DatabasesCommon.cpp:344-354) calls out->sync(), and WriteBufferFromFileDescriptor::sync throws CANNOT_FSYNC on failure (src/IO/WriteBufferFromFileDescriptor.cpp:148).

Making the shared directory-sync guard fail-closed is a reasonable separate change across all durability paths, but it is not this bug and I would rather not diverge this one site. The same point was raised on the sibling PR #111423 and resolved the same way.

@tuanpach tuanpach self-assigned this Jul 23, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — 3151c88

Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Stateless tests (amd_asan_ubsan, distributed plan, parallel) — 72 rows (65x Code 241 MEMORY_LIMIT_EXCEEDED at current RSS 44.83 GiB / maximum 44.83 GiB + 7 collateral connection-reset / result-diff) host-OOM a fix task is created (investigating at full effort — fixing PR link to follow here)
Finish Workflow / Post Hooks + PR host-OOM rollup of the above same

Not PR-caused: this PR touches only src/Interpreters/InterpreterCreateQuery.cpp (ATTACH AS [NOT] REPLICATED metadata fsync) + tests/queries/0_stateless/04546_attach_as_replicated_metadata_fsync.sh. All 12 sibling stateless shards (amd_debug, amd_tsan, arm_binary parallel+sequential; amd_asan_ubsan db-disk sequential 1-3/3) passed. The failures are a host-memory-pressure burst in the single ASan-parallel shard (RSS pinned at the 44.8 GiB cap), also seen concurrently on many unrelated PRs + master; our own new 04546 test was a victim there and passed in every other shard.

Session id: cron:our-pr-ci-monitor:20260723-063000

@groeneai

Copy link
Copy Markdown
Collaborator Author

Ledger owner update for the Stateless tests (amd_asan_ubsan, distributed plan, parallel) host-OOM line (head 3151c88).

This shard's Code-241 burst is the known ASan-parallel host-memory-pressure cohort (server RSS pinned at the 44.83 GiB cap, OvercommitTracker cancelling in-flight queries), not this PR: our diff only touches the ATTACH-AS-REPLICATED metadata fsync path + its stateless test, and all 12 sibling stateless shards passed. This branch also branched from master on 2026-07-15, before the mitigation #110574 merged (2026-07-18), so it does not yet carry the concurrency/ratio fix; the fix is already on master.

No separate fix PR from us: the two right mitigations are merged (#110574 concurrency + 0.75 ratio, #110503 (total) OOM retry), master is clean (Code-241 on this shard down to ~1/day since 07-16), and the remaining structural lever is runner RAM, which is CI-infra ownership tracked in #111304. Owner of this ledger line: tracking issue #111304.

@tuanpach

Copy link
Copy Markdown
Member

@groeneai Check the CI

@groeneai

Copy link
Copy Markdown
Collaborator Author

Checked, and merged master to fix it. New head fd4ae6fb41d0cda65ba0db1f855e97b2aa394e91.

The two red checks at the old head were not this PR. Stateless tests (amd_asan_ubsan, distributed plan, parallel) had 72 failing tests, 65 of them Code: 241 (total) memory limit exceeded ... current RSS: 44.83 GiB, maximum: 44.83 GiB (the rest connection resets and result diffs from the same cap exhaustion), and Finish Workflow was its rollup. That shard's host-OOM cohort hit many unrelated PRs in the same window.

What I had missed until now is why a re-run would not have helped. CI builds the synthetic merge ref, so the failing job's binary reports Connected to server 26.7.1.1 @ 4df84d9274e8ccd71280ea7d92d65996aa4344c9, i.e. this PR merged into master as of 2026-07-23. That base already contained #110574 and #110503 and was still red. The change that actually fixes the shard is e1358bfb2f454128769533f2e6525939098e1179 (move the job from AMD_MEDIUM_CPU 64 GiB to AMD_LARGE 128 GiB, reverting the earlier concurrency cut), merged 2026-07-24, which was not an ancestor of the tested base.

Measured on live CI artifacts of two other PRs on that shard:

head without e1358bfb head with e1358bfb
runner c7i.8xlarge (64 GiB) m7i.8xlarge (128 GiB)
(total) memory limit exceeded lines 90 0

And over every CIDB row on that shard carrying (total) memory limit exceeded since that merge, partitioned by whether the tested commit contains it: 0 of 37 have the fix, 36 lack it (1 resolved to the same). So there are zero occurrences on any build that includes it, which is why merging master is the right action rather than a re-run (a re-run reuses the original build artifact and base tip).

I re-verified the fix on the merged tree rather than assuming the merge was inert:

  • The PR delta is byte-for-byte unchanged: git patch-id --stable is 1c6448f962cb17631cc031b3bea8e3e73558be78 both before and after the merge, and git diff <merge-base> HEAD is still exactly the same 3 files, +130/-3. Master had touched InterpreterCreateQuery.cpp in 19 commits, so both guards moved lines (2938 -> 3159, 3009 -> 3230), but both survive and both are still acquired before their destructive operation.
  • Rebuilt clean, and re-proved both directions: 04546 passes on the merged tree, and with only the per-part guard removed it fails with to_replicated fsync_metadata=1: WRONG sync count (got 1, want 3). Restoring the guard rebuilt to a bit-identical Build ID.

Thanks for the approval, and sorry for the noise on your side. Nothing else is outstanding on the PR from my end.

if (disk->existsFile(txn_file))
{
if (fsync_metadata && !part_dir_sync_guard)
part_dir_sync_guard = disk->getDirectorySyncGuard(part_path);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ATTACH TABLE ... AS REPLICATED is supposed to make the per-part txn_version.txt(.tmp) removals durable before the query returns, but this only happens on disks that override getDirectorySyncGuard. DiskObjectStorage inherits IDisk::getDirectorySyncGuard's nullptr default, while removeFile still commits metadata moveFile / writeFile operations on the metadata store, so a power loss after the ACK can still resurrect those files and make the part load as rolled back on restart. The new regression test is explicitly no-object-storage, so this supported surface is still both unfixed and unverified. Can we either add a real durable-sync path for object-storage metadata stores here, or scope the fix and user-facing claim to local/encrypted disks instead of the general ATTACH ... AS [NOT] REPLICATED path?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Every fact here is correct, and I verified all of them again at the current head fd4ae6fb41d0cda65ba0db1f855e97b2aa394e91: IDisk::getDirectorySyncGuard returns nullptr (src/Disks/IDisk.cpp:212-215), DiskObjectStorage has no override (grep -c getDirectorySyncGuard src/Disks/DiskObjectStorage/DiskObjectStorage.cpp = 0), and the local metadata backend issues no sync for the operations behind removeFile (grep -ci sync src/Disks/DiskObjectStorage/MetadataStorages/Local/MetadataStorageFromDiskTransactionOperations.cpp = 0; the two sync() calls in MetadataStorageFromDisk.cpp:258,280 are on the blob removal log, not on file metadata).

I am still not changing this PR, for three measured reasons.

1. This is not a regression introduced here. On master this code path issues no directory fsync at all:

$ git show origin/master:src/Interpreters/InterpreterCreateQuery.cpp | grep -c getDirectorySyncGuard
0

So the object-storage window described above is master's own current behaviour, untouched by this PR. The PR moves local and encrypted disks from 0 syncs to N and leaves object storage exactly as it was.

2. It is the wrong layer, and the right layer is already being fixed. Nothing at this call site can make an object-storage metadata store durable: getDirectorySyncGuard is an IDisk virtual, and all 21 of its invocations outside src/Disks/ (MergeTree part writes, part renames, DataPartsExchange, VersionMetadataOnDisk, the distributed async-insert queue, this one) behave identically on object storage today. The fix belongs in DiskObjectStorage plus the metadata storage, which is exactly what PR #111391 does:

  • DiskObjectStorage::getDirectorySyncGuard override, forwarding to the metadata storage (DiskObjectStorage.h:109-112)
  • IMetadataStorage::getDirectorySyncGuard plus IMetadataStorage::syncMetadataFile (IMetadataStorage.h:173-177)
  • MetadataStorageFromDisk::getDirectorySyncGuard, forwarding to the local disk holding the metadata (MetadataStorageFromDisk.cpp:86-89)

None of those primitives exist on master (git grep -l syncMetadataFile origin/master returns nothing), which is why they cannot be reached from here yet. Once #111391 lands, this call site inherits the durable path with no change to this PR, and git merge-tree --write-tree shows the two changes merge cleanly (exit 0, no conflicts). The remaining sliver after that, a disk with use_fake_transaction=false and local metadata where the guard is deliberately declined because the metadata file does not exist until commit, is tracked as a separate follow-up and is already referenced on #111391 in #111391 (comment).

3. The alternative asked for is already in the PR. The suggestion offers "or scope the fix and user-facing claim to local/encrypted disks". That is the current state: the PR description says the change is "a no-op on object storage", and the regression test carries no-object-storage with that exact justification in its header:

# no-object-storage: fsync of a directory is a local-filesystem operation; object storage
#   disks return no directory sync guard, so DirectorySync stays 0 there.

This is consistent with the earlier adjudication on this PR and with the same finding on the sibling PR #111423.

@clickhouse-gh

clickhouse-gh Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 86.30% 86.20% -0.10%
Functions 92.00% 92.00% +0.00%
Branches 78.40% 78.40% +0.00%

Changed lines: Changed C/C++ lines covered: 24/25 (96.00%) · Uncovered code

Full report · Diff report

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — fd4ae6f

Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Stress test (amd_debug) / Logical error: Inconsistent KeyCondition behavior (STID 5182-2f27) debug-only key-analysis consistency canary for a wider-typed key comparison; not reachable from this diff, which touches directory fsync on ATTACH TABLE AS [NOT] REPLICATED #109023 (ours, open)
Stress test (arm_asan_ubsan, s3) / UndefinedBehaviorSanitizer: undefined behavior at src/Functions/toStartOfInterval.cpp:293:80 (STID 0250-4a9f) signed-integer overflow in the origin overload of toStartOfInterval when the rounding offset is added back for an extreme DateTime64 origin in a non-UTC timezone #112045 (external, open)
Sync — CH Inc sync (private, not actionable)

Both owners are open, so recurrence on this branch is expected until they merge; neither is
present on this commit. The Finish Workflow aggregator finished successfully, and the two rows
above are the only failing checks (89 succeeded, 9 skipped). The host-memory failures from the
previous ledger (covering 3151c88669e2a2) are gone at this head, which now carries the runner
resize.

Session id: cron:our-pr-ci-monitor:20260727-190000

@tavplubix tavplubix closed this Jul 28, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

Closed with no comment, so rather than guess at the reason I would like to ask once.

What I checked first, in case it was superseded: on current master
git show origin/master:src/Interpreters/InterpreterCreateQuery.cpp | grep -c getDirectorySyncGuard
is still 0, and LocalDirectorySyncGuard remains the only place in src/ that increments the
DirectorySync profile event. DiskLocal::replaceFile is a bare fs::rename and
DiskLocal::removeFile a bare unlink, so ATTACH TABLE ... AS [NOT] REPLICATED still commits the
metadata .sql rename and the per-part txn_version.txt(.tmp) removals without an fdatasync of the
directories whose entries changed. So as far as I can tell the gap this addressed is still open.

Was it superseded by work I did not find, or is the approach wrong?

I am asking because the answer applies to more than this PR. Five other open PRs of mine use the same
IDisk::getDirectorySyncGuard primitive at other call sites (#111346, #111375, #111391, #111405,
#111423), and if the objection is to the primitive or to placing the guard at the interpreter layer
rather than inside the disk layer, I would rather rework or withdraw all of them now than have you
close them one at a time. If instead the objection is specific to this call site, #110863 also
modifies convertMergeTreeTableIfPossible and conflicts with this change textually, so if the intent
was to keep one PR on that function I can fold this into that one.

I am not reopening this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors pr-bugfix Pull request with bugfix, not backported by default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants