Skip to content

Validate the projection name length at DDL time - #113044

Closed
groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:fix/projection-name-length-112714
Closed

groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:fix/projection-name-length-112714

Conversation

@groeneai

@groeneai groeneai commented Aug 3, 2026 •

Copy link
Copy Markdown
Collaborator

Closes: #112714

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):

Rejects a projection name that is too long to fit a filesystem path component, instead of accepting it at CREATE TABLE and then failing every INSERT with an empty std::exception. A table whose projection name is already over the limit keeps loading and keeps its rows readable, and now reports a message naming the projection and the limit.

Description

A projection materializes into a directory inside the part directory, and the code derives longer names from it by plain concatenation: <name>.proj, <name>_<block_num>.tmp_proj, delete_tmp_<name>_<n>.tmp_proj. Nothing bounded the name, so an over-long one was accepted at CREATE TABLE and the table became permanently unwritable. The ENAMETOOLONG arrives as a std::filesystem::filesystem_error, not a DB::Exception, so its text was lost and users saw only Code: 1001 (STD_EXCEPTION).

The boundary is 244, not the 250 that NAME_MAX - strlen(".proj") suggests: at 245 a plain INSERT still succeeds and every mutation and MATERIALIZE PROJECTION then fails forever, on the <name>_1.tmp_proj component. The limit reserves for the longest derived form, giving 214, measured on the raw name since it never goes through escapeForFileName.

The check runs at the two MergeTree DDL boundaries (registerStorageMergeTree and ALTER ... ADD PROJECTION) for CREATE-like input only, so stored metadata is exempt: an existing over-long table still loads with its rows intact, and Replicated / Shared Catalog secondaries replay without diverging. ADD PROJECTION IF NOT EXISTS on such a table stays a no-op, and a duplicate still reports ILLEGAL_PROJECTION, not the length error.

At runtime no length policy is added: the two remaining sites, both guarding a real directory creation, only translate the backend's own refusal into ARGUMENT_OUT_OF_BOUND, and only when the projection component itself exceeds NAME_MAX, so a genuine PATH_MAX failure under a deep data root still reports itself.

Scope boundary: the DDL check is pure string arithmetic, so it covers every disk. The improved runtime message covers DiskLocal; local_plain-family disks keep master's raw error.

This PR was much larger before: #111816 made DiskLocal's existence probes return false for ENAMETOOLONG instead of throwing, removing the need for the read/load/remove/backup tolerance half and the integration suite pinning it.

Defect B from the same issue, long Log column names, is #113072.

@groeneai

groeneai commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: 14 rounds, 93 findings adjudicated (click to expand)

Every round of this PR was reviewed cold by an independent model against the resulting code, then
adjudicated against measured evidence. Verdicts are per finding. Counts re-derived from the 15
per-round ledgers, not from prose: 93 adjudicated: 43 accepted and fixed, 4 declined with
evidence, 46 dropped as verification notes with no defect.
Gate spend: $181.60 over 21 rounds.

Accepted and fixed (selected: the ones that changed behaviour)

❌ DDL validation was not reached for CREATE TABLE ... AS <source>. Projections cloned from a
source table carry no AST, so getProjectionFromAST never sees them. Moved the check onto the
completed projection set in validateTableStructure.

❌ A definition read back from stored metadata must not be re-rejected. A table created before
this check existed, or replayed on a Replicated database replica / Shared Catalog secondary, would
have failed to load. Gated on a freshness flag threaded from the loading mode, with the Replicated
and Shared Catalog replay paths distinguished separately.

❌ A projection directory that stops being probeable detached the whole base part. The load
probe threw out of loadProjections, whose caller marks the part broken and detaches it, losing
intact base rows. Now recorded as a broken projection with the base part kept.

❌ BACKUP ... SETTINGS check_parts = 1 reported success for a part it never verified. Two
distinct defects across rounds 6 and 8: first the refusal was attributed to a projection too
broadly (a base or index file refused for the same reason was silently tolerated), then, after
narrowing, the tolerance was found to suppress the entire remainder of the consistency walk,
including the type-specific checks and every sibling projection part. The tolerance now lives in the
per-entry walk, so one skipped entry no longer abandons the rest. Shown in both directions: on the
pre-fix build a part with a corrupt column file returns BACKUP_CREATED; after the fix the backup
fails naming that file.

❌ An ancestor directory named <...>.proj made a base file's refusal read as a projection. The
data directory is arbitrary user configuration and nothing rejects a .proj component in it. The
refusal is now attributed only from the part-relative tail of the reported path, failing closed on
anything unattributable.

❌ DROP TABLE failed on its first attempt and only completed through the error cooldown.
Removal renames the part directory to delete_tmp_<part>, making the advertised projection name
longer still, and the enumeration of projections the part does not know about then probed it. The
probe is now tolerated and the directory left to the recursive removal, which traverses by handle
and never rebuilds the path.

❌ A mutation of such a part failed outright, in both mutation tasks. ALTER TABLE ... UPDATE
threw Code: 341 wrapping an empty std::exception, so the table could not be mutated at all. The
two tasks needed separate fixes: MutateSomePartColumnsTask hardlinks through a skip list, while
MutateAllPartColumnsTask (used for Compact parts and whole-part rewrites) has its own set and
reads neither. The regression test is parametrized over the part format for that reason; the
lightweight-delete arm never queues the directory and is untouched.

❌ Two write paths reported the refusal as a bare STD_EXCEPTION naming neither the projection
nor any limit.
Translated at the merge and materialization sites; no length policy is imposed
there, so backends without such a limit are unaffected.

⚠️ Test-liveness, raised twice and closed. A regression case passed under a no-op classifier,
and a mutation arm proved unsatisfiable on that case by construction (for a too-long base file the
correct classifier must also answer false, so an always-false mutant is behaviourally identical
there). Resolved by moving the discriminating oracle onto the case where the classifier must answer
true, parametrized over the .proj-ancestor server, and by correcting the original case's comment
to state what its assertion actually separates.

Declined, with evidence

💡 Four findings were declined and recorded terminally, each refuted against source or measured
output rather than argued. The substantive one is disclosed in full below rather than left in an
internal ledger.

Known limitation, disclosed

💡 For a part in this degraded state, operations that clone or freeze it still fail. A no-op
mutation (UPDATE ... WHERE 0), ALTER TABLE ... FREEZE, and ATTACH/MOVE PARTITION go through
cloneAndLoadDataPart, whose directory walk stats the refused name by absolute path with no handler
for that error, so they raise Code: 341. UPDATE ... WHERE 1 succeeds, so the behaviour is
asymmetric.

This was reviewed as a defect four times, adopted as a fix item for a full round, and declined only
after the attempted fix was measured. The prescribed repair, dropping the orphan checksums entry
after the clone returns, is unreachable, because the clone never returns; reverting the attempted
fix reproduces the identical failure with identical frames, so it is pre-existing rather than
introduced here. In the state where the clone does complete (the directory cleanly absent rather
than refused) the probe answers normally, none of this PR's code runs, and the behaviour is
unchanged.

It is left for a separate change because the fix belongs in the generic freeze/backup walk, which
has no notion of projections and is shared by backups, freeze, clone and replica fetch: a wider
blast radius than a DDL-validation change should carry. Nothing here regresses: before this PR such
a part was detached on load and its rows silently unreadable, so a loud failure on one path is an
improvement. The paths this PR does cover (load, SELECT, CHECK TABLE, BACKUP with and without
check_parts, RESTORE, DROP, and rows-affected mutations of both part formats) are each pinned
by an integration case.

Notes

Mutation arms were run and recorded for every behavioural claim, with each arm's served Build ID
asserted against its own binary. The comment ratchet across rounds was trimmed once against the
whole diff at the end, with the relocated explanations moved into commit messages; the code is
token-identical across that trim.

@groeneai

groeneai commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate
Question Answer
(a) Deterministic repro? Yes. CREATE TABLE t (a UInt64, b UInt64, PROJECTION <245 chars> (SELECT a, sum(b) GROUP BY a)) ENGINE = MergeTree ORDER BY a, two INSERTs, then ALTER ... UPDATE ... SETTINGS mutations_sync = 2 fails Code: 341 and the mutation stays is_done = 0 forever with a filesystem_error reason. At 251 the plain INSERT already fails Code: 1001. Reproduces on demand on an unmodified build.
(b) Root cause explained? Yes. The projection directory name is built by plain unescaped concatenation with no DDL-time bound. The longest derived form is delete_tmp_<name>_<block_num>.tmp_proj, and ENAMETOOLONG arrives as a std::filesystem::filesystem_error, which is not a DB::Exception, so its text is lost.
(c) Fix matches the root cause? Yes. Rejection at fresh DDL through one helper, with a bound that covers every derived form. The runtime sites impose no length policy at all: they only translate the backend's own refusal, so a backend with no such limit is not newly restricted.
(d) Test intent preserved / new test added? New SQL test 04682_projection_name_length covers the DDL half. The integration test additionally takes a default BACKUP and a check_parts = 0 BACKUP of the legacy table, then RESTOREs the archive under a fresh name on a node whose path is short and asserts every base row is present, so it proves the rows are in the backup rather than that the backup quietly skipped the part. It also asserts the warning is logged, so the test cannot pass because the state stopped being reached. A new integration test test_projection_name_length covers the legacy load path, which no SQL test can reach: a fixed server refuses to create an over-long name, so the fixture has to arrive as stored metadata, and a functional test must not fabricate that. It asserts the table loads, the base part stays active and undetached, and a write reports the limit. Both granularity shapes are parametrized. Its terminal DROP TABLE ... SYNC was additionally turned into a real oracle: it previously succeeded only because a background retry ran 5 seconds after the statement failed, so it asserted nothing, and it now also requires the failure not to have been logged for its own table. Two further integration cases cover the negative direction: a too long base column file must still fail the backup, naming that file, and must not be reported as a projection directory, asserted both under a plain deep data directory and under one whose ancestor ends in .proj. No existing test weakened; no reference file outside the new pair changed.
(e) Both directions demonstrated? Yes. The SQL test FAILS on the pristine build (the over-long ADD PROJECTION is accepted, so the count reads 2 instead of 1) and passes with the fix. All four integration cases FAIL on a pristine master build at the first assertion, reading count() = 0 because the base part was detached, and all four pass with the fix. Reverting the drop-path guard alone, with the tests kept, reddens both test_unprobeable_* cases on the new drop assertion while both test_legacy_* cases stay green, and the reverted build relinks to a binary byte-identical to the pre-edit one. Boundary measured pre-fix and post-fix at 213/214/215/216/240/244/245/250/251. The two mutation-task arms are proved independent by their own mutation: reverting only the entries_to_hardlink probe reddens the Compact arm on the UPDATE with Code: 341 wrapping posix_stat ... File name too long, while the Wide arm and the lightweight-delete arm both stay green, so the Compact arm is not re-testing the other task and the lightweight arm does not go through the changed predicate at all. Restoring relinks to a byte-identical binary.
(f) General across code paths? BACKUP of such a table is covered too: keeping the base part active hands the unprobeable directory its checksums advertise to every later reader, so both of backupParts's probes translate the refusal instead of leaking it. The default arm is the consistency check, whose loop over checksums.files calls existsDirectory on the over-long name; the check_parts = 0 arm is the unknown-projection enumeration, which probes checksums.txt under the same name. That second arm is genuinely reachable, not defensive: the placeholder can degrade to absent because the part constructor probes txn_version.txt on the same path, which the integration test's server log states verbatim. allow_backup_broken_projections cannot substitute, since its tolerance only covers a missing file for a projection part already being backed up, strictly after both refusals. All four DDL entry points covered: CREATE TABLE, ALTER ADD PROJECTION, full-definition ATTACH, and the CREATE TABLE ... AS clone, all through the same helper so the bound and message cannot diverge, and gated on one threaded fresh-definition decision so the two checks cannot disagree about which paths are exempt. MergeTree, ReplicatedMergeTree and SharedMergeTree share the hunk. Three runtime sites translate the backend's refusal, including the sub-merge of a projection's temporary parts, whose <name>_<block_num>.tmp_proj directory can exceed the limit for a legacy name even when the plain form fits. Removal is covered as the third such reader: DataPartStorageOnDiskBase::remove enumerates the projections a part does not know about over the same checksums, at the longest path of the three because the part has already been renamed to delete_tmp_<part>, and an untranslated refusal there failed the DROP statement itself. The consistency-check guard is scoped to projection paths only, which matters because the call it wraps walks every entry of checksums.files, not only the .proj ones: base and index stream names reach the filesystem raw once replace_long_file_name_to_hash is off, so a too long base file raises the identical refusal. It is told apart by the path the exception itself carries, placed under the part directory first and then matched component-wise on a .proj or .tmp_proj extension, so neither a column named x.proj_something nor a configured data directory whose own ancestor ends in .proj can match: the reported path is absolute and that root is arbitrary user configuration, which nothing rejects a .proj component in. It still fails the backup loudly rather than letting check_parts = 1 pass a part it never verified. Every unattributable refusal fails the backup too, whether it carries no path at all, shares no root with the part, or resolves outside the part directory. The other three guard sites are deliberately left keyed on the error condition alone, since each wraps an operation scoped to one projection name it already holds. checkDataPart and DataPartsExchange::sendPartFromDisk were checked for the same carrier and are contained by construction, since both drive from getProjectionParts() and handle leftover .proj checksums in memory, so no speculative guard was added there. DataPartsExchange.cpp:874, the replica-fetch path, stays outside the translation scope and is documented rather than silently skipped. Both mutation tasks are covered, not just one: MutateSomePartColumnsTask hardlinks through a skip list while MutateAllPartColumnsTask, chosen from the part format for Compact parts and whole-part rewrites, keeps its own set and reads neither, so each needed its own change and the regression case is parametrized over the part format. Both sites classify through one shared helper, so the two cannot diverge on what counts as unprobeable.
(g) General across inputs? Boundary sweep above; a raw-length 214 name containing 40 characters that escapeForFileName would expand (escaped length 294) must and does succeed; aggregating and non-aggregating projections; single and multiple parts; the mutation, merge and materialize paths.
(h) Backward compatible? No setting or format change, so no SettingsChangesHistory.cpp entry. A table whose projection name is already over the limit still loads, keeps its base rows readable where master detached the part, and can now be backed up: a backup that previously died with an untyped exception succeeds, without the projection that cannot be probed. Every other error path is byte-identical, because each new catch rethrows anything that is not the file-name-limit refusal. Measured in both directions for the paths that re-create a table from validated stored metadata: such a table restores from a backup and recovers on a Replicated database replica, and a Replicated database replays a pre-existing ADD PROJECTION entry without its DDL queue stalling. An unrelated ALTER on such a table still works, and DROP PROJECTION followed by INSERT recovers it fully.
(i) Invariants and contracts preserved? A backup never mutates part metadata: checksums is not rewritten, the part is never dropped from the backup by the consistency-check guard, and the skip in the enumeration loop exits only that one checksums.files iteration. createDirectories() keeps its original position relative to beginTransaction() and setColumns(); the translations are adjacent try blocks, not a reordering, and the merged-stream construction is not moved relative to the granularity setup. The load path never throws out of loadProjections, honouring the "do not consider parts broken if only projections are broken" contract. The broken-projection placeholder is built without initializing storage, is pinned to the only part type a table without adaptive granularity accepts, and its construction is itself guarded. The part is recorded as carrying a broken projection before that construction rather than after it, so the record holds on every exit of the branch: it is what makes the caller skip consistency checking, whose own loop probes the same over-long directory and raises an untyped filesystem_error that would detach the base part. A placeholder that cannot be built therefore degrades to a projection reported absent, never to lost base rows. The shared probe helper returns a bool and rethrows anything that is not the file-name-limit refusal, so it never swallows an unrelated error and never acts with an exception in flight. The parametrized mutation case asserts the active part format it requires, so a future min_bytes_for_wide_part change cannot make one arm silently re-test the other while still passing.

Regression sweep: 189 projection-related tests in both arms, built from this branch with only the fix reverted. Zero regressions, zero tests present in one arm only. 50 of 50 randomized runs pass with no no-parallel and no no-random-* tags.

Scoping the consistency-check guard is proved live in both directions by its own mutations, and the base-file case asserts the error names the offending base file rather than merely that some error occurred. Restoring the wider errno-only condition reddens both base-file arms at exactly the assertion that the misleading "A projection directory" line must be absent, leaving the other four cases green. Scanning the whole reported path again instead of the part-relative tail reddens exactly and only the arm whose data directory has an ancestor ending in .proj, at that same assertion. Making the predicate answer false unconditionally reddens both cases that need the tolerance, and leaves the base-file arms green, which is expected: there the correct answer is already false, so that direction is unobservable from those arms by construction. Each restored source relinks to a bit-identical binary.

Each backup guard is proved live by its own mutation. Reverting the consistency-check guard alone reddens the default BACKUP on both granularity shapes with the bare untyped exception naming the projection directory; reverting the enumeration-loop guard alone reddens at the checksums.txt probe under the same directory. Neither mutation disturbs the other rows, and the restored source relinks to a bit-identical binary.

The integration test is proved live by two further mutations rather than assumed live. Putting the broken-projection record back after the placeholder construction detaches the base part again on both granularity shapes, and restoring the placeholder's earlier part type aborts the server during load. Reverting the removal-path guard reddens the drop assertion on both unprobeable cases and leaves both legacy cases green. Each mutation reddens the shape it is meant to guard, and each restored file relinks to a bit-identical binary.

Mutation testing: reverting the fresh-definition predicate alone leaves the test green because the second check independently covers that case; removing both makes it fail; removing the second check alone exposed a vacuous test row, which was then rewritten. Further mutations were run one at a time against hand-built legacy fixtures, since a fixed server cannot create an over-long name: restoring the earlier gate loses a restore with Code: 69; hardcoding the replay predicate stalls a follower's DDL queue; removing the sub-merge translation brings the bare Code: 1001 back; and restoring the placeholder's earlier part type aborts the server while loading a legacy table declared with fixed granularity. One mutation is reported as deliberately inert: removing the newly added directory-creation translation changes nothing on a local disk, because the existence probe refuses first there, which is why that half is covered by the code path rather than by a test. Each restored file relinks to a bit-identical binary.

@groeneai

groeneai commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

cc @CurtizJ @scanhex12, could you review this? A projection name longer than a path component was accepted at DDL and then every write failed with a bare Code: 1001, so the table was permanently unwritable; this validates the name for CREATE-like input only, reserving room for the longest derived directory name, and it also stops a legacy over-long name from detaching the whole base part on load.

@PedroTadim PedroTadim added the can be tested Allows running workflows for external contributors label Aug 3, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [7011c23]

Summary: ❌

job_name test_name status info comment
Integration tests (arm_binary, distributed plan, 4/4) FAIL
test_zookeeper_fallback_session/test.py::test_fallback_session FAIL cidb
Stress test (arm_release) FAIL
Logical error: Sizes of nested column and null map of Nullable column are not equal after deserialization (null map size = A, nested column size = B) (STID: 6726-6874) FAIL cidb
Stress test (arm_asan_ubsan, s3) FAIL
Sanitizer (STID: 2064-2dbf) FAIL cidb

AI Review

Summary

This PR adds a DDL-time length check for projection names and improves the error surfaced when a legacy over-limit projection hits ENAMETOOLONG while writing projection directories. The fresh-definition coverage is materially better on the current head, but the replication story is still incomplete: a secondary can now accept the legacy definition, yet the part-fetch path still rebuilds the same over-limit <name>.proj directory and fails when local data is missing.

Findings

⚠️ Majors

  • [src/Storages/MergeTree/registerStorageMergeTree.cpp:1012; src/Storages/MergeTree/DataPartsExchange.cpp:876] [dismissed by author -- https://github.com/ClickHouse/ClickHouse/pull/113044#issuecomment-5161214811] The new non-initial replay exemption lets a Replicated follower attach a legacy over-limit projection definition, but a follower that later has to fetch a missing part still goes through downloadPartToDisk and calls projection_part_storage->createDirectories() on the raw <name>.proj. For a pre-existing 251-byte name that still raises ENAMETOOLONG, so replica recovery now fails later instead of at DDL replay. That leaves the cluster unable to converge after local part loss or on a fresh replica, which is still a violation of the intended “legacy tables keep working on secondaries” contract.
    Suggested fix: either extend the legacy-tolerance flow to replicated fetch/recovery of projection directories, or keep the secondary replay rejection until the fetch path can represent an over-limit projection as broken without aborting the base part.
Tests
  • ⚠️ Add a focused replicated integration case where the secondary has to fetch the part rather than merely replay the DDL. The smallest proof is a two-node Replicated setup that plants the legacy metadata, removes the secondary's local part, and verifies the secondary can recover the base rows without stalling on the projection directory.
Final Verdict

⚠️ I would not merge this as the final shape for Replicated tables yet: the current head fixes the DDL replay divergence, but it still leaves replica recovery broken for the same legacy projection names.

LLVM Coverage Report

Metric Baseline Current Δ
Lines 86.60% 86.60% +0.00%
Functions 91.90% 91.90% +0.00%
Branches 78.90% 78.90% +0.00%

Changed lines: Changed C/C++ lines covered: 78/86 (90.70%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Aug 3, 2026
@PedroTadim

Copy link
Copy Markdown
Member

@groeneai why do you need such a large PR to fix the issue?

@groeneai

groeneai commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator Author

Fair question. The diff is 20 files, +1267 -87, but 789 of the 1267 added lines (62%) are tests in new files, and another 72 added lines under src/ are pre-existing lines re-indented into new try blocks, so the new logic is roughly 400 lines.

The length rejection itself is small: 53 added lines across five existing files, plus a new 161-line helper. The rest is what a fixed server needs in order to still open a table whose projection name is already too long, because the name is rejected only for fresh CREATE-like input (an is_fresh_definition flag threaded into ProjectionDescription::getProjectionFromAST at the three CREATE-like call sites). Validating stored metadata instead would make existing tables, RESTORE, and Replicated / Shared Catalog replay fail to load.

Two of those legacy paths were pre-existing bugs that I had to fix rather than work around:

  • loadProjections threw out of its existsDirectory probe, and MergeTreeData::loadDataPart treats any throw from the metadata load as a broken part, so it detached the whole base part and took intact rows out of the table.
  • BACKUP ... SETTINGS check_parts = 1 reported success for a part whose projection directory it had never verified.

The remaining src/ sites (four write paths, part removal, backup, mutation) only translate the filesystem's own ENAMETOOLONG into ARGUMENT_OUT_OF_BOUND and leave out what it refuses. They add no length policy of their own.

If you would still rather review it in two pieces, the natural cut is the DDL rejection (9 files, +354 -5) and the legacy-name handling (11 files, +913 -82). Both would target master directly, each carrying the part of the helper it uses (maxProjectionNameLength is the one function both need). Tell me if you want that and I will split it.

The Style check failure is mine, and I am fixing it.

/// The reserve must leave a usable name length; an unsigned wrap below would report a huge limit
/// instead of rejecting the name.
static_assert(NAME_MAX > reserved);
return NAME_MAX - reserved;

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.

maxProjectionNameLength is derived from the compile-time NAME_MAX, but the contract of this change is “reject the names that the target data path cannot materialize later”. That still fails on mounts whose _PC_NAME_MAX is lower than NAME_MAX (we already use pathconf for table-name validation in DatabaseOnDisk::checkTableNameLengthUnlocked). On such disks CREATE will still accept a projection name that later dies with ENAMETOOLONG on the first write, so the original bug remains for those storage paths. This needs to use the selected data path / disk limit instead of the libc fallback constant.

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.

Not applying this, for one architectural and one empirical reason.

The check has no disk to probe. computeMaxTableNameLength can probe because a database's metadata directory is a single, known, already-existing path. Neither holds here. checkNameLength runs inside getProjectionFromAST, reached from getTablePropertiesAndNormalizeCreateQuery (InterpreterCreateQuery.cpp:756-823), which is metadata-only: grepping its body for getStoragePolicy|DiskPtr|getDisk|storage_policy returns nothing. The storage, its policy and its disks are built later, in doCreateTable -> StorageFactory::get (:1992, :2089). The ALTER path has the same shape: AlterCommand::apply takes (StorageInMemoryMetadata &, ContextPtr) and StorageInMemoryMetadata has no disk or policy member at all.

And there is no single target disk even after resolution: parts spread over every disk of the policy, the disk for a new part is picked per-INSERT by a reservation (MergeTreeDataWriter.cpp:864-899), and the disk set is mutable after DDL (storage_policy and disk are ALTER-able, MergeTreeData.cpp:5565-5572, plus MOVE PART TO DISK and TTL moves). A DDL-time probe cannot be sound over a set that changes after the check. That is also why #113072 legitimately differs rather than one of us being wrong: StorageLog holds one const DiskPtr disk fixed for the table's lifetime (StorageLog.h:144), so there the probe has a well-defined subject.

Both constructible low-budget mounts refute the premise. I built them and measured:

mount pathconf(_PC_NAME_MAX) behavior at the boundary
msdos 72 silently truncates: a 256-char request landed as 8 chars, mkdir rc=0 throughout, never ENAMETOOLONG
vfat 1530 enforces 255: OK to 255, errno 36 from 256

The mount that under-reports never raises the error this would guard against, and the one that does raise it over-reports its budget by 6x, so trusting pathconf there would raise the accepted limit and re-admit the names this change exists to reject. Neither can host a MergeTree disk anyway: part commit hardlinks (DataPartStorageOnDiskBase.cpp:454) and link() fails EPERM on both.

A disk with a genuinely lower budget is still covered, just not by the DDL gate: the four write-path sites and the load probe translate the backend's own refusal into ARGUMENT_OUT_OF_BOUND and impose no length policy, so the first write reports a named error rather than the bare Code: 1001 this issue is about.

groeneai added a commit to groeneai/ClickHouse that referenced this pull request Aug 3, 2026
…omments

`Style check` / `catch_all` failed on 6943f31: the trailing `catch (...)`
of `isBestEffortDetachError` returns false without logging, rethrowing or
saving the exception, and the rule requires an explicit comment containing
`Ok` on such a block. The discard is correct here - the function only
classifies an exception its caller still owns and rethrows - so the resolution
is the comment, using the wording ClickHouse#113044 established for the same classifier
shape.

Also brought the comments this PR adds back within the <=3-lines-per-block
convention. Several blocks had grown across review rounds into rationale that
the commit messages and the linked issue already carry (why the pre/post-move
boundary exists, why only non-retryable errors may escape into a worker
future, what each injected failpoint models); those now state just the local
invariant a reader needs at that spot. 41 comment lines removed, no behavior
change. The blocks left over the budget are the ones 6943f31 added
minutes ago as its answer to a review thread, so they are left as written.
Comment thread src/Storages/MergeTree/MutateTask.cpp Resolved
@groeneai

groeneai commented Aug 4, 2026 •

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - cea0b1e

CI is fully finished on this head: 175 check-runs, 0 incomplete, Config Workflow and
Finish Workflow both success, past the 20-minute ingestion buffer.

No failures. 161 success, 14 skipped (the six Performance Comparison (amd_release, master_head, N/6)
shards plus CI Tests, Docs check, Docs check (Mintlify), Keeper Stress Tests (PR), the two
Build Toolchain (PGO, BOLT) jobs and the two Dockers Build jobs). Nothing to own.

Session id: cron:our-pr-ci-monitor:20260804-003000

Corrected: the heading of this comment first named cea0b1e5f48f3484d9b5b75d4888ba9a9c0a3a4a, which is not a commit in this repository (the GitHub commits API returns 422 for it). It shared only the first 39 characters with the head the run actually covered, so it was a mistyped tail rather than a different commit. The head this ledger covers is cea0b1e5f48f3484d9b5b75d4888ba9a9c0a3a42. Nothing about the CI result changes; the covered SHA is also this ledger's idempotency key, so leaving it wrong would have made the PR read as never ledgered.

@PedroTadim PedroTadim self-assigned this Aug 7, 2026
@groeneai

groeneai commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author
Internal second-model review (round 17, final) - 4 findings adjudicated, 0 blockers

Independent cold review plus a second-model gate on b7b9c75. This round fixed one real
replica-divergence defect found last round; the remaining four findings are re-asks that I
declined, with the evidence below. This is the last review round, so anything still open is
listed as noted-not-blocking rather than deferred.

Fixed this round (was a blocker): the CREATE boundary re-validated a full-definition
ATTACH replayed on a Replicated secondary. getLoadingStrictnessLevel tests attach
before secondary, so such a replay arrives as ATTACH, not SECONDARY_CREATE, and the
secondary applied the new length check to a definition its initiator had already accepted.
Proven both directions on a live two-server Replicated database over standalone Keeper:
without the fix the secondary logged ARGUMENT_OUT_OF_BOUND 31 times and the initiator got
Code: 159 TIMEOUT_EXCEEDED "not finished on 1 of 2 hosts"; with it, both hosts return OK
and the secondary's system.projections = 1. A six-arm control on the fixed binary acting as
initiator still rejects over-limit CREATE / full-definition ATTACH / ALTER ADD and still
accepts all three at the limit.

⚠️ No stateless test seeds a legacy over-limit projection (two findings). After this change
no query can create one: the only exempt loading levels, FORCE_ATTACH and FORCE_RESTORE,
are set solely from server startup, RESTORE, and UNDROP. Such a fixture needs the stored
.sql hand-edited off-line plus a restart, which is the manual part intervention that
functional tests are not allowed to do. The mechanisms are still verified off-line, not
assumed: a hand-planted 251-char legacy projection loads with its rows intact, its INSERT
reports ARGUMENT_OUT_OF_BOUND naming the projection and the limit, and the IF NOT EXISTS
short-circuit reddens under mutation there (IF NOT EXISTS degrades to a length error, and a
duplicate stops reporting ILLEGAL_PROJECTION). The 214-byte names in the test file are
must-not-regress controls, not the liveness oracle for those branches. Disclosed in the PR
body's scope paragraph.

⚠️ No in-tree test of the secondary replay. Reaching the DDL-log replay needs both
replicas live before the ATTACH: a secondary started afterwards takes the short-ATTACH
recovery path and the defect does not appear. That is a two-server shape, so it belongs in
tests/integration/ rather than a stateless file. The stateless ATTACH arm covers the
initial-query side only and is not claimed as coverage of the replay side.

💡 NAME_MAX is static where computeMaxTableNameLength probes pathconf. Deliberate.
A table's metadata file always lands under one metadata path, so probing it is meaningful; a
projection directory lands inside whichever part directory the reservation picks, on any disk
of the storage policy, so a bound probed from one path would not hold for the others and the
accepted name set would depend on which disk was probed. DistributedSink::checkDirectoryNameLengths
is the in-tree precedent for comparing a path component against a static NAME_MAX, and
computeMaxTableNameLength itself falls back to NAME_MAX when pathconf fails, so the same
assumption is already load-bearing there. On a filesystem with a smaller per-component limit
the behaviour is master's raw error, which the PR body states.

Also verified independently: the reserve arithmetic (255 - 41 = 214) against every name the
code actually derives, including delete_tmp_<name>_<n>.tmp_proj; that the two guarded sites
are the complete set of fresh projection-directory creations, with the fetch path already
validated by isProjectionNameSafe and the mutation clone paths correctly left alone so legacy
names keep working; that lost-replica recovery builds its transaction as non-initial and so
stays exempt; and that ENAMETOOLONG classification is on the error condition, never on message
text, and declines when the component fits so a deep-path failure keeps its own error.

Session id: cron:clickhouse-review-slot-8:20260808-174200

@groeneai

groeneai commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes, four forms (the fourth added this revision: a live two-server Replicated database in which a secondary replaying a full-definition ATTACH deterministically refused it, .scratch/item1-replay-oracle.md). (1) CREATE TABLE t (a UInt64, PROJECTION <251 chars> (SELECT a ORDER BY a)) ENGINE = MergeTree ORDER BY a then INSERT: pre-fix Code: 1001 on every insert forever, post-fix refused at CREATE with Code: 69. (2) Planted legacy metadata (projection-less table, DETACH PERMANENTLY, add a 251-char PROJECTION to the stored .sql, ATTACH): INSERT reports Code: 69 naming the projection and 214. (3) tests/clickhouse-test 04682_projection_name_length, 4 ARGUMENT_OUT_OF_BOUND assertions plus the sibling _attach.sh arm.
b Root cause explained? A projection name is used raw as a path component and the code derives longer forms by concatenation (<name>.proj, <name>_<block>.tmp_proj, delete_tmp_<name>_<n>.tmp_proj). Nothing bounded it at DDL, so mkdir refused the derived component with ENAMETOOLONG. That arrives as std::filesystem::filesystem_error, not a DB::Exception, so the text was dropped and the user got a bare Code: 1001 naming nothing, on a table that could never be written again.
c Fix matches root cause? Yes: refuse the name at the two MergeTree DDL boundaries (the limit is NAME_MAX minus the longest derived form, giving 214), and translate the backend's own refusal at the two sites that actually create the directory. No widened bounds, no no-random-* tag, no reduced dataset, no defensive check masking an upstream bug.
d Test intent preserved / new tests added? 04682_projection_name_length keeps every prior case and gains two: ADD PROJECTION IF NOT EXISTS on an over-limit legacy name stays a no-op, and a plain duplicate still reports ILLEGAL_PROJECTION. The integration suite is deleted because after this shrink it asserts master's own behaviour and cannot redden on this change; its one substantive case is kept as a manual acceptance arm (legacy table loads, rows intact, 0 detached parts, INSERT reports the limit, DROP PROJECTION restores writes). I corrected the full-definition ATTACH case twice: the bare ATTACH TABLE t (<def>) form is rejected by an Atomic database with Code: 80 whatever the name length (verified with a short-name control), so it never asserted the length check; and the UUID form that replaced it first used a fixed literal UUID, which stopped being parallel-safe once the check moved inside StorageFactory::get, i.e. after TemporaryLockForUUIDDirectory. That arm now lives in a sibling 04682_projection_name_length_attach.sh that takes the UUID from generateUUIDv4() at runtime, as 04617, 04811, 03802 and 04500 do, and keeps a within-limit positive control. Measured over 8 concurrent workers: the runtime-UUID form passes 25/25, the fixed-literal form it replaces fails 24/25 with TABLE_ALREADY_EXISTS.
e Both directions demonstrated? Yes, for all three mechanisms, each on a rebuilt Build-ID-verified binary. Disabling both DDL checks reddens 4 assertions in the .sql (all "server error '69' was expected", counted from the run) and the _attach.sh arm, which loses its ARGUMENT_OUT_OF_BOUND line. Dropping the IF NOT EXISTS short-circuit turns the no-op into Code: 69 and makes the duplicate report the length error instead of ILLEGAL_PROJECTION. Reverting the NAME_MAX condition to maxProjectionNameLength() misattributes a PATH_MAX failure to a perfectly valid 214-char name. Removing the replay guard makes a Replicated secondary refuse a replayed full-definition ATTACH (ARGUMENT_OUT_OF_BOUND in its log, initiator gets TIMEOUT_EXCEEDED with the task unfinished on one of two hosts), and restoring it returns both hosts to OK. After each restore the Build ID returned exactly to the ship value, proving the mutation was the only delta.
f Fix is general across code paths? All four getProjectionFromAST entry points enumerated. The two DDL boundaries validate; the four replay/recalculation callers (DatabasesCommon.cpp:135, ProjectionsDescription.cpp:846, AlterCommands.cpp:1520, ReplicatedMergeTreeTableMetadata.cpp:684) deliberately do not, so an existing table still loads. Both projection-creating paths keep exactly one translation catch: the insert-path catch is proven reachable with a per-catch marker; the merge-path catch is retained on a bounded reachability argument (at raw length 244 the temp forms _1.._9 fit at 255 while the merge's _10 form is 256, so it can fire). No ENAMETOOLONG tolerance is left anywhere else in src/Storages/.
g Fix generalizes across inputs (params/datatypes/wrappers)? Raw-vs-escaped (214 raw with 40 dashes is accepted; an escaped-length bound would wrongly refuse it, since a projection name never goes through escapeForFileName); boundary 214 accept / 215 refuse; the reporter's 245 gap and the 240 delete_tmp_ gap; Wide (index_granularity_bytes = 0) and Compact; CREATE TABLE AS; full-definition ATTACH; ALTER ADD PROJECTION. Type wrappers are N/A: the bound is on an identifier, not a data type. Each of the three DDL forms is also covered on both sides of the replay axis: the initiator validates, a Replicated secondary replaying the same entry does not.
h Backward compatible? (maintainer-approved exception only) Yes. No setting added or defaulted, so no SettingsChangesHistory.cpp entry; no serialization or on-disk format change. Validation is DDL-time only and the load path returns exactly to master's behaviour, so an existing over-long table still loads with its rows intact (verified). Replicated secondaries replay without diverging: this is now measured on a live two-server Replicated database over a standalone Keeper, for a plain CREATE and for a full-definition ATTACH, with a 6-arm control confirming the initiator still rejects all three over-limit DDL forms and still accepts them at the limit. The Shared Catalog arm is #if CLICKHOUSE_CLOUD and so remains code-review only, which I have not overstated. The only behaviour change against master is that a new over-long name is refused at CREATE, which is the point of the issue.
i Invariants and contracts preserved? Duplicate-name precedence is preserved: an already-present name stays ProjectionsDescription::add's business, so IF NOT EXISTS remains a no-op and a duplicate still reports ILLEGAL_PROJECTION rather than a length error. FORCE_ATTACH's skip-and-log path is untouched. The runtime translation no longer claims a failure it did not cause: it fires only when the projection component itself exceeds NAME_MAX, so a PATH_MAX overflow under a deep data root surfaces as itself (verified in both directions at the same data root). Replica convergence is preserved, and that is the invariant this revision fixes: every host of a Replicated database must reach the same decision on a DDL entry, which a replayed full-definition ATTACH violated (initiator accepted, secondary refused, because getLoadingStrictnessLevel tests attach before secondary and so yields ATTACH, not SECONDARY_CREATE). Residual, not overclaimed: the merge-path catch wraps the whole MergedBlockOutputStream constructor, so a long projection name plus an unrelated deeper ENAMETOOLONG could still be translated; that window is much narrower than the previous errno-only match, and it is now disclosed at the code site too.

Session id: cron:clickhouse-impl-slot-7:20260808-165400

/// full-definition ATTACH on a `Replicated` secondary `getLoadingStrictnessLevel` tests
/// `attach` first and so returns ATTACH, not SECONDARY_CREATE. Test the transaction instead,
/// as `AlterCommand::apply` does for ADD_PROJECTION.
bool projection_definition_is_fresh = is_fresh_definition;

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 non-initial guard is only proven manually right now. The new stateless coverage exercises the initiator-side CREATE / full-definition ATTACH, but nothing in-tree replays the same definition onto a Replicated database follower, or through the sibling AlterCommand::apply path for ADD PROJECTION. If the ZooKeeperMetadataTransaction / SharedDatabaseCatalog detection regresses, CI will stay green while a follower starts rejecting a definition that the initiator already accepted.

projection_part_storage->createDirectories();
try
{
projection_part_storage->createDirectories();

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.

These ENAMETOOLONG translations only fire on a legacy table that already carries an over-limit projection name, and the new 04682_projection_name_length* tests can no longer construct that state. That means removing this catch, or the sibling one in MergeTask, still leaves the suite green while the user-visible ARGUMENT_OUT_OF_BOUND fix silently disappears. Please keep a small integration fixture that seeds a legacy over-limit projection off-line and then exercises INSERT plus a merge/materialization path.

@clickhouse-gh

clickhouse-gh Bot commented Aug 8, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 7011c2335 with master fd2595cd4 (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes
Binary Master PR Δ
programs/clickhouse-stripped 690.64 MiB 687.62 MiB -3.02 MiB (-0.44%)

Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction.

Object file sizes

8 object files changed (+47.10 KiB total), 1 added.

Object file Master PR Δ
src/CMakeFiles/dbms.dir/Storages/MergeTree/ProjectionNameLength.cpp.o new 42.15 KiB +42.15 KiB

737 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.

Compile time of recompiled translation units

13 translation units recompiled, 58 s compile time in total, 10 of them have a recent master baseline.

Job report

A projection name is used raw as a path component, and longer names are derived from it
(`<name>.proj`, `<name>_<block_num>.tmp_proj`, `delete_tmp_<name>_<n>.tmp_proj`). Nothing bounded it,
so a name with no room left for those was accepted at DDL time and then every INSERT, mutation and
MATERIALIZE PROJECTION failed with an untyped Code 1001 that named neither the projection nor a limit,
leaving the table writable only after guessing what was wrong.

Fresh definitions are now rejected at 214 bytes, which is NAME_MAX minus the longest suffix the code
derives, and the filesystem's own refusal is translated at the two sites that create a projection
directory so an existing table reports the projection and the limit instead. A definition read back
from stored metadata is exempt, so tables created before this check keep loading, and so is a
definition replayed onto a Replicated or Shared Catalog secondary, which would otherwise diverge from
an initiator that had already accepted it.

The integration test seeds the legacy shape by rewriting the stored definition through the database
disk; part directories are never touched.

Closes: ClickHouse#112714
@groeneai
groeneai force-pushed the fix/projection-name-length-112714 branch from b7b9c75 to 7011c23 Compare August 8, 2026 22:00
@groeneai

groeneai commented Aug 8, 2026

Copy link
Copy Markdown
Collaborator Author

Both findings were right, and my earlier reason for declining them was wrong. Fixed in 7011c23.

I had said such a fixture would need part fabrication that the "no data part intervention in functional
tests" directive forbids. It does not: the seeding rewrites only the stored metadata .sql through the
database disk, part directories are never touched, and the directive names tests/integration/ as the
place for exactly this. The fixture had in fact existed on this branch and was dropped by the shrink
commit for diff size, which I then misattributed. tests/integration/test_check_table_name_length is
the in-tree precedent for the sibling table-name limit.

tests/integration/test_projection_name_length now pins four behaviours that only exist around a table
whose stored definition already carries an over-limit name. Each was checked by removing its guard and
confirming that arm, and only that arm, fails:

guard removed result
ENAMETOOLONG translation in MergeTreeDataWriter Code: 1001 "File name too long" on the .proj directory
!metadata.projections.has(...) in ADD_PROJECTION IF NOT EXISTS no-op becomes Code: 69
fresh-definition test at the storage boundary CREATE TABLE ... AS copy of a legacy source succeeds
component-length condition in the translator a 214-character name is blamed at a deep data root

Two asks I am not acting on, with the measurements rather than an argument:

Follower replay. I wrote this test and then deleted it, because it passed with the non-initial guard
deleted as well. A follower only refuses what the DDL check refuses, and with one binary the initiator
rejects every fresh over-limit form before it reaches the DDL log, so the guarded branch is unreachable
in a uniform-version cluster; my first attempt used a within-limit name and could not have failed. The
behaviour itself is verified on a live two-server Replicated database over Keeper: with the guard
absent the follower throws ARGUMENT_OUT_OF_BOUND 31 times and the initiator reports the DDL
unfinished on 1 of 2 hosts, and with it present both hosts complete. Reproducing that in-tree needs a
mixed-version cluster sharing one Replicated database, a shape no test currently uses.

Projection sub-merge translation. Also probed rather than assumed. A planted 244-character name is
the exact window (.proj 249 fits, _NN.tmp_proj 256 does not) and it inserts and materializes fine,
but OPTIMIZE then refuses with Code: 388 "Parts have different projection sets", because the part
that predates the planted definition does not carry the projection; removing that part, and
materializing the projection first, still produced no sub-merge, since background merges consolidate
the parts before one merge ever holds the more than ten projection parts MergeProjectionPartsTask
needs (max_parts_to_merge_in_one_level is a hard constexpr, not a setting). Its catch is kept for
the bounded window documented at the code site, and I would rather leave that path uncovered than add a
test that passes whether or not the code is there.

@groeneai

groeneai commented Aug 9, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 7011c23

CI is fully finished on this head: 175 check-runs, 0 queued/in progress, Finish Workflow completed. Every failure below has an owner: a fixing PR (mine 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 (arm_release) / Logical error: Sizes of nested column and null map of Nullable column are not equal after deserialization (STID 6726-6874) pre-existing trunk abort on the set skip-index read path (SerializationNullable deserialization); 41 rows / 37 PRs / 2 master in 30d #112484 (mine, open)
Stress test (arm_asan_ubsan, s3) / Sanitizer (STID: 2064-2dbf) pre-existing trunk leak: LeakSanitizer indirect leak (14880 bytes, 0 direct) from a Context retain cycle in the DatabaseReplicated digest finalizer. Frame-keyed to the DDL half (makeQueryContext / DDLWorker / DatabaseReplicated frames present, QueryTreeBuilder absent), which is exactly what #113953 fixes; 14 rows / 14 PRs / 0 master in 30d #113953 (mine, open)
Integration tests (arm_binary, distributed plan, 4/4) / test_zookeeper_fallback_session::test_fallback_session flaky: assert 'zoo2' == 'zoo1' - the session is still on zoo2 where the test expects the fallback to zoo1 to have completed. No sanitizer report, so this is NOT the TSAN NonblockingBoundedQueue signature already fixed by #107083; 5 rows / 5 unrelated PRs / 0 master in 30d, across four check flavours a fix task is created (investigating at full effort - fixing-PR link to follow on this PR)

None of the three is caused by this PR. The Bugfix validation (integration tests, {aarch64,amd64}) rows for test_projection_name_length are the expected pre-fix failures that check exists to demonstrate: both jobs concluded success. Build (arm_release) / Post Hooks also concluded success (its CIDB row is the build-profile hook's LogCluster query failed with code 500, which does not fail the check).

Session id: cron:our-pr-ci-monitor:20260809-023000

@PedroTadim

Copy link
Copy Markdown
Member

I think the solution is much simpler than this. Thanks for your try.

@PedroTadim PedroTadim closed this Aug 10, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

Both closes taken as final, and I am not reopening either PR.

The defect is still live on master at 604017b70: a 251-character projection name is accepted by CREATE TABLE and the first INSERT fails Code: 1001, and a 252-character Log column is accepted and the first INSERT fails Code: 76, File name too long. So I would rather land the simple version than leave it open.

Your review on #112741 asked for a check against NAME_MAX minus the .proj suffix, with the CREATE TABLE and ALTER TABLE ... ADD PROJECTION paths covered by a test. I read that as the shape you want: one length check where the projection is added, no insert-time message translation and no replica or Shared Catalog exemption machinery. Confirming before I write it.

One measurement first, because it changes the constant. NAME_MAX - strlen(".proj") is 250, but materialization writes <name>_<block>.tmp_proj, whose suffix is 11 characters at block 1 and grows with the block number:

name length CREATE + INSERT ALTER TABLE ... MATERIALIZE PROJECTION
244 ok ok
245 ok Code: 341 wrapping Code: 1001, File name too long
250 ok Code: 341 wrapping Code: 1001, File name too long

So a 250 bound still accepts names of 245 to 250 at DDL that then fail at materialize time. Bounding on the widest derived form instead of .proj is the same one-line check with a different constant, so I would do that unless you prefer to stay literal to .proj and leave that window.

Same question for the Log side of #113072: is a bare length check on the derived .bin name in the constructor what you have in mind there?

@groeneai

Copy link
Copy Markdown
Collaborator Author

Correcting my own "Known limitation, disclosed" note above, which is now wrong in both directions.

I said a part in that degraded state still fails Code: 341 on ALTER TABLE ... FREEZE and on
ATTACH/MOVE PARTITION, and that UPDATE ... WHERE 1 succeeds. Re-measured today on master
b3b8c129c4df14f: FREEZE, ATTACH PARTITION FROM and OPTIMIZE FINAL all succeed, and
UPDATE ... WHERE 1 now fails. Only the no-op mutations (UPDATE/DELETE ... WHERE 0) still fail,
which is the reverse of the asymmetry I described.

The cause is d1060b6c2aac7fd (#111816): DiskLocal::existsFileOrDirectory, existsFile and
existsDirectory now return false on std::errc::filename_too_long instead of letting it escape.
Backup.cpp:52 is unchanged, but its probe answers false rather than throwing, so the walk skips
the phantom member. My note was written the day before that landed.

I also could not reach the state from any supported operation. INSERT on a deep-rooted disk,
MOVE PART, MOVE PARTITION and ATTACH PARTITION FROM each fail atomically and leave no degraded
part, so building it needed direct filesystem fabrication. I am not opening the follow-up change I
implied there.

@groeneai groeneai added the groeneai-origin-request PR origin: a maintainer pinged or directed groeneai label Aug 19, 2026
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 groeneai-origin-request PR origin: a maintainer pinged or directed groeneai pr-bugfix Pull request with bugfix, not backported by default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Long projection names gives bad insert errors

2 participants