Repository navigation
Fix ALTER TABLE ... MODIFY SETTING name = DEFAULT being ignored - #118526
Conversation
|
Workflow [PR], commit [d68acf4] Summary: ✅
AI ReviewSummaryThis PR teaches table-level Findings❌ Blockers
Final VerdictStatus: ❌ Block
LLVM Coverage ReportMeasured on commit d68acf4.
Changed lines: Changed C/C++ lines covered: 29/30 (96.67%) · Uncovered code |
| SELECT extract(create_table_query, 'SETTINGS .*') FROM system.tables WHERE database = currentDatabase() AND name = 't_alter_modify_setting_default'; | ||
|
|
||
| SELECT '-- `MODIFY SETTING name = DEFAULT` removes the setting from the clause'; | ||
| ALTER TABLE t_alter_modify_setting_default MODIFY SETTING merge_with_ttl_timeout = DEFAULT; |
There was a problem hiding this comment.
Before this PR ALTER TABLE ... MODIFY SETTING ... = DEFAULT didn't work at all.
This line did nothing, so merge_with_ttl_timeout was still equal to a customized value (10) after this line.
Build profile diff (arm_release)Comparing ✅ No significant changes. Binary sizes
The official master build is compiled with Compile time of recompiled translation units7 translation units recompiled, 17 s compile time in total, 7 of them have a recent master baseline. |
051fe47 to
34543dc
Compare
|
@groeneai Investigate CI failures and suggest fixes |
|
@vitlibar There is exactly one red leaf at
|
| window | outcome |
|---|---|
| up to 15:46:34Z | success, 582 rows / 93 PRs, zero errors |
| 16:06:39Z to 21:30:50Z | error, 112 rows / 104 distinct PRs |
One PR (#118618, 20:46:58Z) slipped through after the break. The rows-per-PR ratio corroborates the mechanism: 6 rows per PR while healthy, 1 while broken, because the job dies before emitting its per-file measurements.
Suggested fix: nothing in your tree. The ci user's column-level SELECT on default.binary_sizes needs restoring on the CI logs cluster. No commit touched ci/jobs/build_profile_diff_job.py today (last change efe3e712, 2026-08-31), which points to a cluster-side change rather than anything in the repo. That area is @ Felixoid's (he did the column unification in #115607). Re-running will not clear it: the run on your head is already run_attempt 4.
It is also not gating you. Mergeable Check went green at 21:01:22Z and CH Inc sync is green; the only red commit status is PR, the workflow rollup that this job flips.
The reds on the previous head are resolved
05136_alter_modify_setting_default. At051fe472it failed in five flaky-check flavours (each ending inToo many test failures) and in four ordinary stateless jobs. At34543dc1it isOK50/50 in all five flaky checks, so 250 green runs. Narrowing the oracle fromextract(create_table_query, 'SETTINGS .*')toextractAllof only the two settings under test is what fixed it, and it is the right shape: the full clause also carries whatever--random-merge-tree-settingsinjected, so the old form could never have a stable reference.Integration tests (amd_asan_ubsan, db disk, old analyzer, 5/6)/test_merge_tree_hdfs::test_move_replace_partition_to_another_table. Green at the current head, but a real trunk flake rather than noise:Code: 76. DB::Exception: Unable to open HDFS file: ... error: Parent directory doesn't exist: /clickhouse/ofx. I have a fix open for it in Fix spuriousCANNOT_OPEN_FILEwhen writing to anhdfsdisk #118654, so if it reappears on a later head, that is where it is tracked.Finish Workflow/Post Hooks. The rollup of the above; green at34543dc1.
| } | ||
|
|
||
| auto & settings_from_storage = metadata.settings_changes->as<ASTSetQuery &>().changes; | ||
| resetSettings(settings_from_storage, settings_resets); |
There was a problem hiding this comment.
The main part of the fix is here - we need to reset settings not only on
ALTER TABLE ... RESET SETTINGS
but also on
ALTER TABLE ... MODIFY SETTINGS ... = DEFAULT
|
@Algunenano please take a look when you have time |
Algunenano
left a comment
There was a problem hiding this comment.
LGTM. I was uncertain if this respected compatibility (I've also been reviewing #116933) and it seems it does it correctly (by removing it).
`HDFSObjectStorage::writeObject` creates the object key's prefix directory
(`hdfsCreateDirectory`) and opens the object (`hdfsOpenFile`) in two separate
NameNode requests, with a `createHDFSFS` connect in between, while
`removeEmptiedParentDirectories` deleted that directory as soon as it became
empty: from `removeObject`, from `WriteBufferFromHDFS::removeFileOnCancel`, and
transitively from `BlobKillerThread::removeBlobsBatch`. Object keys are a
hardcoded `[a-z]{3}/[a-z]{29}`, so two unrelated blobs sharing a prefix
directory is a birthday collision among 17576 buckets rather than an exotic
case. A removal that emptied the directory inside that window made
`hdfsOpenFile` fail `verifyParentDir`, so any write to an `hdfs` disk could
fail with `Code: 76. DB::Exception: Unable to open HDFS file: ... error: Parent
directory doesn't exist`. `REPLACE PARTITION` is where CI saw it, because it is
the one step that writes a new blob per cloned part while the parts it replaced
out are being removed.
The two requests cannot be collapsed into one: libhdfs3's C entry point
hardcodes `createParent = false`
(`contrib/libhdfs3/src/client/Hdfs.cpp:698`), so there is no atomic
create-with-parents to call. And no in-process coordination can help, because
one `hdfs` root is legitimately written and reclaimed by several servers:
`allow_remote_fs_zero_copy_replication` makes multi-server access to a single
root a first-class configuration, and blob removal for such a root runs on any
replica. A bounded retry would only lower the probability, not establish the
invariant. So remove the reclamation and keep the parent-directory creation:
with nothing deleting a prefix directory, a write that has created its parent
can always open its object, in every configuration, with no new state, no lock
and no retry. This also drops one NameNode request per object deletion.
The reclamation was added to keep the NameNode namespace from growing without
bound. For the `hdfs` disk that premise does not hold: keys come from
`createObjectStorageKeyGeneratorByPrefix`, so the retained set saturates at
17576 directories per root and does not grow with data volume, roughly 2.6 MB
of NameNode heap at 150 bytes per inode, and a disk holding many blobs already
has that many live directories. ClickHouse also already retains those
directories forever for `/`-rooted HDFS storages. The one residual cost is that
`listObjects` recurses into retained empty directories, bounded by the same
17576 per root.
Two consequences that are disclosed rather than fixed here. An `hdfs` object
storage with `metadata_type = plain` takes keys from
`MetadataStorageFromPlainObjectStorage` instead, where they are logical paths of
unbounded count and the object storage is the only directory manager, so this
change does leak empty directories there; the `hdfs` disk is itself documented
unsupported (`storing-data.mdx:48`), the combination has no test configuration
anywhere under `tests/`, and I measured it already failing before this change,
at `CREATE TABLE` with `Code: 660. DB::Exception: Cannot get file info for:
.../format_version.txt`, so nothing that works today regresses.
`LocalObjectStorage` has the same create-then-reap shape, but a local root has a
single writing process, so its reclamation can be made safe by coordination; I
have no observed failure of it and left it alone.
`test_no_leftover_directories_after_removal` becomes
`test_prefix_directories_are_not_reclaimed`: it records the set of directories
present and asserts that `TRUNCATE` removes the objects and none of those
directories. `test_no_leftover_directories_after_canceled_write` becomes
`test_no_leftover_files_after_canceled_write`: it keeps every assertion about
files, which is still correct behaviour, and makes the same set comparison
across the canceled insert. Comparing sets rather than counts is what keeps both
specific, since a directory retained by an earlier test in the module cannot
satisfy either assertion. Both fail on a binary that still reclaims, with no
failpoint and no timing: the first is left with an empty directory set, and the
second loses the prefix directory of the `sizes.json` blob that `LogSink`
rewrites upfront on every insert to be able to roll back (`FileChecker::save`
writes a new blob and `replaceFile`s over the old one). The file's one
`time.sleep` poll is gone.
Both of those assertions bite on the `removeObject` site. I measured that the
`removeFileOnCancel` site has no test oracle: a binary with only the
`removeObject` reclamation deleted leaves the whole module green. That site can
only ever reclaim the prefix directory of the file the canceled write itself
created, which is never a member of a set captured before that write, so no
before/after comparison in this test can see it. It is covered by the argument
that a canceled write and a concurrent write can collide on a prefix exactly as
a removal and a write can, not by a test.
Validated with a concurrent write/remove workload on an `hdfs` disk, with the
object-key space temporarily narrowed so the prefix collision is frequent
instead of once per few hundred CI runs: 4 client failures and 10 server-log
occurrences per 640 queries with the reclamation present, 0 with it deleted,
the two arms differing only by that mechanism. Both files were run on both
binaries: `test_log_family_hdfs` is 2 failed / 3 passed before the change and 5
passed after, the two failures being exactly the two adapted tests, and
`test_merge_tree_hdfs` is 7 passed on both, including the
`test_move_replace_partition_to_another_table` that CI reported.
`test_log_family_hdfs --count 20` is 100/100.
CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118526&sha=051fe4723d3ee9e1f6145a87924182005b690534&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20db%20disk%2C%20old%20analyzer%2C%205%2F6%29
Carrier pull request whose CI produced that report (unrelated to the cause): ClickHouse#118526
Related: ClickHouse#113396
Co-Authored-By: Claude Opus 5 <[email protected]>
|
@vitlibar Re-measured
The infra failure behind it is over. Repo-wide, The two cross-PR reds from your earlier heads cannot recur on
The run on |
|
@groeneai Investigate CI failures and suggest fixes |
|
@vitlibar Both reds on
|
f4b44f1
|
@vitlibar @Algunenano — ClickGap found the following in this PR:
Close anything that's wrong or already addressed. |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fix
ALTER TABLE ... MODIFY SETTING name = DEFAULTbeing ignoredCloses #49613
Workflow [PR]
Sync PR [sync-upstream/pr/118526]
Version info
26.9.1.1091(included in26.9and later)