Repository navigation
Move the async distributed INSERT directory name test to the integration suite - #117284
Conversation
04725_distributed_async_insert_long_directory_name needs an async distributed
INSERT directory name longer than NAME_MAX. It produced that length by making
the destination host 242-250 bytes long, which cannot resolve.
In the upgrade check every DROP is a no-op (tests/clickhouse-test adds
--fake-drop whenever --upgrade-check is set), so the four Remote tables survive
into the post-upgrade server. Attaching ENGINE = Remote builds a Cluster
unconditionally, which resolves each address; the failure is swallowed but
logged through tryLogCurrentException("Cluster") at Error priority. The
post-upgrade log scan then reports four unallowlisted lines:
<Error> Cluster: Code: 198. DB::NetException: Not found address of host: ...
Keep the destination addresses as IPv4 literals, which return from
resolveIPAddressImpl before hostByName is ever called, and carry the required
length in the user name instead: it is equally part of the directory name built
by Cluster::Address::toFullString and equally settable from Remote() DDL. One
shared 233-byte user with 127.0.0.10 / 127.0.0.100 / 127.0.0.1 reproduces the
same four name lengths (255 accepted, 256 rejected, 254 plus 256, 268), so every
assertion and the whole .reference stay byte-identical.
at_limit and over_limit share that user and differ by exactly one escaped host
byte, so the pair is a two-sided pin: a one-byte drift in the user literal makes
one of them fail. Both boundaries were re-checked by mutating the NAME_MAX
predicate one byte in each direction; the test reddens for both.
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 3 findings) plus a cold review
Severity: ❌ blocker / Independently checked while reviewing, since these are what the change rests on:
Session id: cron:clickhouse-review-slot-49:20260831-073800 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-40:20260831-065400 |
|
Workflow [PR], commit [df5eb9e] Summary: ✅ AI ReviewSummaryThis PR removes the old stateless Final Verdict✅ No new findings. |
|
cc @devcrafter, could you review this? Test-only: |
| -- An async INSERT into a Distributed/Remote table spools blocks into a directory named after the | ||
| -- destination address, so a name over NAME_MAX (255) must be a user error, not a bare std::exception. | ||
| -- The port is spelled out in every address so the name length does not depend on the server's config. | ||
| -- The addresses are IP literals because attaching a Remote table resolves them, and an unresolvable |
There was a problem hiding this comment.
This fixes the 04725 carrier, but the same upgrade-check false-red still exists in the previous-release suite through 01083_expressions_in_engine_arguments.sql. 26.8 still has CREATE TABLE rich_syntax AS remote('localhos{x|y|t}', ...), and on restart DatabaseOnDisk re-executes that as_table_function; parseRemoteFunctionArguments expands it to localhosx|localhosy|localhost, then Cluster::Address::getResolvedAddress logs the same Cluster: Code: 198. DB::NetException: Not found address of host lines for the two unresolved names. The upgrade scrub only allowlists Azure DNS failures, so after this PR the same post-upgrade log leaf can still go red when 01083 is part of the old-suite run. Could you make that persisted remote(...) fixture upgrade-safe too, for example by switching it to IP literals the same way as 04725?
There was a problem hiding this comment.
Confirmed, and it is already in the PR description: 01083_expressions_in_engine_arguments persists an AS remote('localhos{x|y|t}', ...) proxy that resolves its addresses on attach. I measured that before publishing: a restart leaks two unmasked lines, for localhosx and localhosy, since localhost itself resolves. I am not changing that fixture here, for three measured reasons.
-
It has never produced this failure. Over 90 days, 0 CIDB rows carry
localhosxorlocalhosyin any check. The04725hosts have 6, all inside the last 24 hours, 0 on master. In the two most recent runs where this leaf went red on the04725signature,04725ran and01083_expressions_in_engine_argumentsdid not, andupgrade_error_messages.txtholds nolocalhosline even in the run whose file has 310 error lines. -
The brace pattern is another test's frozen expected output.
01083_expressions_in_engine_arguments.reference:8storesAS remote(\'localhos{x|y|t}\', cluster(...))verbatim, and{x|y|t}is theparseRemoteFunctionArgumentsexpansion that test covers. Switching it to IP literals rewrites that reference and removes the coverage, which is a call for its owner rather than for a CI-hygiene PR. -
Widening the scrub would invert this fix.
upgrade_runner.sh:589masksAzure::Storage::StorageException.*Not found address of host, and the comment at:384states it deliberately requires the Azure exception type and the DNS error together, "so non-Azure DNS errors are not masked". A class match onCluster:.*Not found address of hostwould hide a genuine post-upgrade failure to resolve cluster peers, which is exactly the signal this PR restores.
To be exact about the residual rather than to claim it away: the check runs roughly a third of the suite per run, 4812 of 14343 distinct test files in the run I measured, so 01083 is latent rather than unreachable. At 0 occurrences in 90 days I am not editing another owner's fixture on this PR.
There was a problem hiding this comment.
Correction to my reply above. I declined an allow-list entry there and I have now added one, so I would rather state what changed than leave the record inconsistent.
Two things I had wrong.
The fixture rewrite in this pull request cannot clear the red on its own. upgrade_runner.sh runs the tests from a clone of the previous release tag, v26.8.1.2041-lts in the failing job's own log, not from the tree under test, so the 04725 that executes is the copy frozen in that tag. Neither this pull request nor a backport of it changes that copy; only a newer release does. The log scan does come from the tree under test, so an entry there applies at once.
The entry I declined is also not the entry I added. I argued against masking Cluster:.*Not found address of host as a class, which would hide a genuine failure to resolve a cluster peer, and that is still true. The new entry additionally requires a first host label of 64 or more identical characters, which is past the 63 octets RFC 1035 permits a label and a shape no deployment uses.
Measured against the scanner extracted from that file and the log lines of eight real occurrences: 32 of 32 fixture lines excluded, 96 unrelated lines untouched, 7 of the 8 left with an empty file. A 68 character label that is not a repeated run, a 63 character run, and the same run reported by a different logger all stay visible.
I have still left 01083 alone, for the reasons in my earlier reply.
The fixture rewrite in this PR removes the unresolvable hostnames from 04725 on master, but the upgrade check does not run the tests from the tree under test. upgrade_runner.sh clones the previous release by its tag (--branch=$previous_release_tag) and runs clickhouse-test --queries="previous_release_repository/tests/queries", so the 04725 that executes is the copy frozen inside v26.8.1.2041-lts. That tag is immutable, so neither this PR nor a backport of it can change the test the check actually runs; the fixture fix only takes effect once a newer release becomes the previous release. The log scan, by contrast, comes from the tree under test (stress_job.py sets run_script to /repo/tests/docker_scripts/upgrade_runner.sh), so an exclusion added here takes effect immediately, for every tree that carries it. The exclusion requires the Cluster logger, Code: 198, and a first host label of 64 or more identical characters. That is past the 63 octets RFC 1035 permits a label, and the repeated-character shape is not one any deployment uses, so a genuine post-upgrade failure to resolve a cluster peer still fails this job. Matching the repeated run rather than the letters keeps the entry off the specific literals: tests/ spells the same fixture idiom with c and x runs elsewhere. Measured against the scanner extracted from this file and the log lines of eight real carrier runs: 32 of 32 fixture lines are excluded, the 96 unrelated mutation-class lines in the same set are untouched, and 7 of the 8 carriers produce an empty upgrade_error_messages.txt (the eighth keeps only those mutation-class lines). Widening the threshold, dropping the repeated-run requirement, or corrupting either anchor all change the result, and hosts that merely look unusual stay visible: a 68-character label that is not a repeated run, a label of two 40-character runs, a 63-character run, and the same run reported by a different logger. This supersedes my earlier reply on this PR declining an allowlist entry. That reply argued against masking Cluster:.*Not found address of host as a class, which would indeed hide real peer-resolution failures. That is still the wrong entry and it is not this one. The reply was also written on the assumption that the fixture fix would reach the check, which the tag measurement above refutes.
|
Yes. For the record the guard is on the whole directory name, So in this PR:
The |
…ation suite The limit applies to the whole spool directory name, `user[:password]@host:port#default_database`, so `04725_distributed_async_insert_long_directory_name` had to take its length from a field a stateless test can lengthen. `Cluster::Address::default_database` is only ever assigned from `<remote_servers>` (`Cluster.cpp:122`), and the `Address` constructor that `Remote()` and `remote()` reach never sets it, so the test used the host rather than the database name of the reproducer in ClickHouse#112719. Remove that test and cover a long `default_database` in `test_distributed_format`, beside the two cases already there. The new case keeps the assertions only the stateless test had: 255 bytes accepted and 256 rejected, the message not disclosing the password, and the compact format unaffected. All three are pinned by the length the message reports, and each of the three fixture clusters was mutated by one byte, or by dropping the password, to confirm the test reddens. Its remaining assertion, that a destination rejected for being too long leaves no directory behind for an earlier and shorter destination of the same shard, moves into the mixed-cluster test: with `prefer_localhost_replica = 0` that shard queues two destinations instead of writing locally. The compact-format INSERT that follows queues exactly two directories for the same table, so the zero above is measured rather than assumed. The upgrade log-scan entry stays for now: that job clones the previous release's suite by tag, so the removed test still runs there.
@groeneai then do it |
| # `Azure::Storage::StorageException.*Not found address of host` is a transient Azure blob DNS resolution failure | ||
| # for `openbucketforpublicci.blob.core.windows.net`. Filtered via regex in the secondary pipe below to match | ||
| # both the Azure SDK exception type AND the DNS error together, so non-Azure DNS errors are not masked. | ||
| # `Cluster` + `Code: 198` + a first host label of one repeated character is the deliberately unresolvable |
There was a problem hiding this comment.
It is needed until 26.9 is out.
This job never runs master's copy of the suite: upgrade_runner.sh:44 clones the previous release by tag, and :148 runs clickhouse-test --queries="previous_release_repository/tests/queries". The previous release of a 26.9.1 build is 26.8, and 04725 is in it: present in v26.8.1.2041-lts and v26.8.2.7-lts, absent in v26.7.6.57-stable and earlier. That is also why the red appeared when it did. v26.8.1.2041-lts was published 2026-08-30T13:47Z, the first CIDB row for this signature is 2026-08-30T22:36Z, and there are 35 rows over 35 distinct PRs since, with none in the 11 days before.
So the deletion fixes master but not the tree this job upgrades from, and the entry is what clears the red now. It expires by itself once a release cut after this merge becomes the previous one, which is 26.9; that branch is not cut yet. The comment in the diff records the condition.
The pattern requires the Cluster logger, Code: 198, and a first host label of 64 or more identical characters, which is past the 63 octets RFC 1035 allows a label, so a genuine failure to resolve a cluster peer still fails the job.
If you would rather this PR not touch the file, say so and I will drop the hunk. The cost is that the log scan keeps failing on unrelated PRs until 26.9 ships.
There was a problem hiding this comment.
@groeneai then we should backport this PR to the 26.8 release?
There was a problem hiding this comment.
Yes, and it is better than the answer I gave above, because it retires the entry sooner.
tests/ci/get_previous_release_tag.py::find_previous_release sorts releases newest first and takes the first one below the server version that has an uploaded clickhouse-common-static_*.deb, so a 26.9.1 build upgrades from the newest 26.8.x. Today that is v26.8.2.7-lts, which still carries 04725. With the deletion backported, the next 26.8 point release will not, and from the moment it is published this job stops running the test at all, so the upgrade_runner.sh hunk can be dropped without waiting for 26.9 to be cut.
On the 26.8 branch itself that hunk is inert: a 26.8.x build upgrades from 26.7.x, and neither 04725 nor DistributedSink::checkDirectoryNameLengths exists there. It is harmless to carry along, and v26.8-must-backport is the right label and currently the only one needed, since 26.8 is the newest release branch.
The integration test is safe there too: src/Storages/Distributed/DistributedSink.cpp is byte identical on 26.8 and master, guard and both call sites, so its assertions on the exact message text hold.
One thing to expect. Applying this diff onto 26.8 leaves a single conflict, in tests/integration/test_distributed_format/test.py: 26.8 does not have the block #116301 added at the end of that file, and the new test goes next to it, so the incoming block is the resolution. The other four paths apply cleanly. I will resolve the cherry-pick when it opens.
There was a problem hiding this comment.
Reading that as the cherry-pick: I will resolve it as soon as the robot opens it, which is after this merges. Nothing else is pending on the backport itself, since the v26.8-must-backport label you applied is all it needs.
If you meant drop the upgrade_runner.sh hunk from this PR instead, say so and I will push that. It only becomes unnecessary once a 26.8 point release without 04725 is published, and the newest today is v26.8.2.7-lts, which still ships the test, so dropping it now brings the Cluster / Code: 198 reds back on unrelated PRs until then.
|
Done in 73ec7c3.
Verified against a debug build: the whole module passes, 13 tests. Each new cluster was then mutated by one byte, and the password dropped from the third, and every arm reddens; dropping the password makes the same 242 byte name acceptable, which is what shows the password is measured. The compact format INSERT after the no directory assertion queues exactly two directories for that table, so the zero is measured rather than assumed. The |
13c33af
Cherry pick #117284 to 26.8: Move the async distributed INSERT directory name test to the integration suite
… name test to the integration suite
Backport #117284 to 26.8: Move the async distributed INSERT directory name test to the integration suite
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Related: #112719
Related: #113083
Upgrade check (amd_release)'sError message in clickhouse-server.logleaf fails on four lines likeThey come from
04725_distributed_async_insert_long_directory_name, which needs an async INSERT directory name overNAME_MAXand took that length from a 250 byte host.--fake-dropmakes everyDROPa no-op, so itsRemotetables reach the post-upgrade server, where attaching one resolves each address and logs the failure atError.Two changes:
The test is removed and its coverage moves to
tests/integration/test_distributed_format. The limit applies to the whole name,user[:password]@host:port#default_database, andCluster::Address::default_databaseis only ever assigned from<remote_servers>(Cluster.cpp:122), so a stateless test could lengthen only the user, the password or the host. A configured cluster can use the long database name of the reproducer in 112719 instead. The new case keeps what only the stateless test had: 255 bytes accepted and 256 rejected, the message not disclosing the password, and the compact format unaffected. Its fourth assertion, that a rejected destination leaves no directory behind for an earlier one in the same shard, moves into the mixed-cluster test next to it.An exclusion in the scan, because 1 alone cannot clear the red:
upgrade_runner.shruns the tests from a clone of the previous release tag, so the copy it executes is the one frozen inv26.8.1.2041-lts, which nothing here can touch. The entry requires theClusterlogger,Code: 198, and a first host label of 64 or more identical characters, which exceeds the 63 octets RFC 1035 permits; against eight real occurrences it excluded 32 of 32 fixture lines and left 96 unrelated ones visible. It can go once a release without the test is the previous one.Failing check: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=111708&sha=81c79d32dc61180db04e7c3b380e233f4cc36d7b&name_0=PR&name_1=Upgrade%20check%20%28amd_release%29
Workflow [PR]
Sync PR [sync-upstream/pr/117284]
Version info
26.9.1.556(included in26.9and later)26.8.3.19