Skip to content

Cherry pick #125026 to 26.10: Log a lost Iceberg metadata commit race at Debug, not Error - #130155

Merged
robot-clickhouse-ci-1 merged 8 commits into
backport/26.10/125026from
cherrypick/26.10/125026
Nov 9, 2026
Merged

robot-clickhouse-ci-1 merged 8 commits into
backport/26.10/125026from
cherrypick/26.10/125026

Conversation

@robot-ch-test-poll2

Copy link
Copy Markdown
Contributor

Original pull-request #125026

Do not merge this PR manually

This pull-request is a first step of an automated backporting.
It contains changes similar to calling git cherry-pick locally.
If you intend to continue backporting the changes, then resolve all conflicts if any.
Otherwise, if you do not want to backport them, then just close this pull-request.

The check results does not matter at this step - you can safely ignore them.

Before you resolve anything

Conflicts are often caused by a prerequisite change that has not been backported yet, rather than by a real divergence. The bot re-tries this cherry-pick against the release branch on every run, so if that is the case here it will merge itself as soon as the prerequisite lands, and you will see a comment saying so. Manual resolution is only needed while the conflict persists.

Troubleshooting

If the conflicts were resolved in a wrong way

If this cherry-pick PR is completely screwed by a wrong conflicts resolution, and you want to recreate it:

  • delete the pr-cherrypick label from the PR
  • delete this branch from the repository

You also need to check the Original pull-request for pr-backports-created label, and delete if it's presented there

The PR source

The PR is created in the CI job

groeneai and others added 7 commits October 10, 2026 01:29
Each sink of a parallel INSERT into an Iceberg table commits its own
snapshot, so with max_insert_threads > 1 the sinks race for the same
metadata version. The loser's conditional write fails with
FILE_ALREADY_EXISTS (local, If-None-Match), STALE_VERSION (local,
If-Match) or an S3 412 PreconditionFailed, and the caller retries on
the next version. writeMetadataFile and tryWriteVersionHintFile logged
that expected outcome with tryLogCurrentException, i.e. at Error with a
stack trace, which reaches the client's stderr with
send_logs_level=warning and fails stateless tests such as
05325_iceberg_mixed_format_top_k_dynamic_filtering ("having stderror"),
although the INSERT succeeds and the data is correct.

Classify such a failure with one helper, isConditionalWriteConflict,
and log only that case at Debug, keeping every other failure at Error.
This matches the REST catalog commit path (409 is logged at Debug) and
the S3 layer, which already logs a 412 at Info (#99371). Control flow
is unchanged. IcebergMetadata::createInitial reuses the helper for its
CREATE ... IF NOT EXISTS race; its behaviour is identical because that
write is If-None-Match only.

The new test runs parallel INSERTs (8 sinks, 10 INSERTs, version hint
off and on) and fails on every run without the change.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…-cas-debug-log

# Conflicts:
#	src/Storages/ObjectStorage/DataLakes/Iceberg/Utils.cpp
…g-log

Log a lost Iceberg metadata commit race at Debug, not Error
@robot-ch-test-poll2 robot-ch-test-poll2 added pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only! do not test disable testing on pull request labels Nov 8, 2026
Resolve the conflict in Iceberg/Utils.cpp: both regions came from #125406
(`READONLY`, `isRefusedWrite`, `isKnownAbsent`), which is not on 26.10. Keep
the 26.10 side and add only #125026's own lines (the three error codes and
`isConditionalWriteConflict`). Per file, the change against 26.10 is the same
set of added and removed lines as #125026's diff against master.

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

groeneai commented Nov 8, 2026

Copy link
Copy Markdown
Collaborator

The only conflict is in Iceberg/Utils.cpp, and both conflicting regions belong to #125406 (READONLY, isRefusedWrite, isKnownAbsent), which is not on 26.10. I kept the 26.10 side and added only #125026's lines (the three error codes and isConditionalWriteConflict), so writeMetadataFile keeps the 26.10 UNSUPPORTED_METHOD rethrow. Per file, the change against backport/26.10/125026 is the same set of added and removed lines as #125026's diff on master (5 files, +67/-7). git merge -X ours would bring in #125406's two helpers, which are unused on 26.10 (-Wunused-function), and -X theirs drops the isConditionalWriteConflict definition.

On the 26.10 tree (debug, clang-22), 05355_iceberg_parallel_insert_commit_conflict passed 40 of 50 runs with random settings; the other 10 died in setup on session_timezone = 'zoneinfo/UTC', which my local tz data lacks. The same tree without the src/ change fails it in 23 of 30 runs, with <Error> ... writeMetadataFile ... Code: 504 on stderr.

I cannot push to cherrypick/26.10/125026. The merge is on my fork and its first parent is this PR's head cfd94299bdb8, so applying it is a fast-forward:

git fetch https://github.com/groeneai/ClickHouse.git resolve-26.10-cherrypick-125026
git push origin FETCH_HEAD:cherrypick/26.10/125026

@alexey-milovidov

Copy link
Copy Markdown
Member

🕵 Thanks @groeneai. I checked the merge 50eef530b459 and pushed it to cherrypick/26.10/125026. It is a fast-forward: its parents are cfd94299bdb8 and backport/26.10/125026 at bd6466d10701. Against the backport base it changes only the 5 files from #125026, with the same +67/-7 lines. STALE_VERSION is defined on 26.10. Utils.cpp and IcebergMetadata.cpp both pass a -fsyntax-only check on the merged tree.

@robot-clickhouse-ci-1
robot-clickhouse-ci-1 merged commit 1d3ac11 into backport/26.10/125026 Nov 9, 2026
2 checks passed
@robot-clickhouse-ci-1
robot-clickhouse-ci-1 deleted the cherrypick/26.10/125026 branch November 9, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not test disable testing on pull request pr-cherrypick Cherry-pick of merge-commit before backporting. Do not use manually - automated use only!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants