Skip to content

MergeTree: rethrow retryable errors from checkDataPart instead of returning empty checksums - #112874

Open
arsenmuk wants to merge 4 commits into
masterfrom
arsenmuk/az-checkdatapart-rethrow
Open

arsenmuk wants to merge 4 commits into
masterfrom
arsenmuk/az-checkdatapart-rethrow

Conversation

@arsenmuk

@arsenmuk arsenmuk commented Aug 1, 2026 •

Copy link
Copy Markdown
Member

Series: #112871 -> #112874 (this), #112872, #112873, #112875, #112876

Problem. checkDataPart swallows a retryable error and returns empty checksums, so CHECK TABLE and the fetch path treat a transient failure as "verified" and can persist an empty integrity baseline. Failure scenario:

checkDataPart(): catch retryable -> return {}
  CHECK TABLE       : empty -> reports OK
  downloadPartToDisk: empty -> accepts an unverified packed part

Fix. Rethrow retryable errors so callers' retry/skip guards fire; remove the now-dead empty-checksums guard on the fetch path.

Changes.

  • Storages/MergeTree/checkDataPart: return {} -> throw on a retryable error.
  • Storages/MergeTree/DataPartsExchange: delete the now-dead empty-checksums fetch guard.
  • tests/integration/test_azure_403_handling: CHECK-TABLE-surfaces-transient test.

Changelog category (leave one):

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

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

Fixed checkDataPart swallowing a retryable error and returning empty checksums, so CHECK TABLE could report a part as OK and a fetch could accept an unverified part after a transient failure. Retryable errors are now rethrown so the check is retried later instead of masking a transient failure as verified.


Workflow [PR]
Sync PR [sync-upstream/pr/112874]

@clickhouse-gh

clickhouse-gh Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [cadcd8f]

Summary: ❌

job_name test_name status info comment
Upgrade check (amd_release) FAIL
Error message in clickhouse-server.log (see upgrade_error_messages.txt) FAIL cidb

AI Review

Summary

checkDataPart now propagates retryable verification failures, including failures reading serialization.json, so CHECK TABLE cannot report unchecked parts as valid and packed fetches fail before publication. Reviewed PR head cadcd8fad084fa335be72beece4ea34a2c1ffd5b and all prior discussion. No new actionable findings. The earlier fetch-test and metadata-exception findings are addressed; the pre-existing cancellation issue is accepted as a separate follow-up tracked in #134143.

Missing context / blind spots
  • ⚠️ The completed fast tests passed, but the current CI workflow is still running and its integration jobs are pending. Execution of the new CHECK TABLE and packed-fetch regressions remains unverified; passing results from test_azure_403_handling would close this gap. Local execution was unavailable in this review job.
Final Verdict

Status: ✅ Approve

@clickhouse-gh

clickhouse-gh Bot commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 86.50% 86.50% +0.00%
Functions 91.90% 91.90% +0.00%
Branches 78.70% 78.70% +0.00%

Changed lines: Changed C/C++ lines covered: 49/64 (76.56%) · Uncovered code

Full report · Diff report

@arsenmuk
arsenmuk force-pushed the arsenmuk/az-checkdatapart-rethrow branch from 3984cec to b622bf7 Compare August 4, 2026 11:19
@arsenmuk
arsenmuk force-pushed the arsenmuk/az-transient-not-broken-part branch from 77e50f7 to f9d6177 Compare August 5, 2026 09:25
@arsenmuk
arsenmuk force-pushed the arsenmuk/az-checkdatapart-rethrow branch from b622bf7 to 1f3b94d Compare August 5, 2026 09:49
@SmitaRKulkarni SmitaRKulkarni self-assigned this Aug 10, 2026
@arsenmuk
arsenmuk marked this pull request as ready for review August 11, 2026 14:53
@arsenmuk
arsenmuk force-pushed the arsenmuk/az-transient-not-broken-part branch from f9d6177 to 88ea678 Compare August 11, 2026 16:31
Base automatically changed from arsenmuk/az-transient-not-broken-part to master August 12, 2026 17:18
@arsenmuk
arsenmuk force-pushed the arsenmuk/az-checkdatapart-rethrow branch from 1f3b94d to 31629e0 Compare August 12, 2026 18:01
@clickhouse-gh

clickhouse-gh Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Commit cadcd8fad084fa335be72beece4ea34a2c1ffd5b was not compared: the CI logs cluster did not answer (the endpoint never became ready: the readiness probe timed out: HTTPSConnectionPool(host='t6h0zvqlg…).

See the job log for details.

@arsenmuk
arsenmuk force-pushed the arsenmuk/az-checkdatapart-rethrow branch from 108526d to 575f60c Compare August 17, 2026 13:01
…urning empty checksums

The packed replica-fetch path (DataPartsExchange::downloadPartToDisk) calls checkDataPart at
:971 to recompute and verify the archive checksums. Make checkDataPart rethrow a retryable
error instead of returning empty checksums, so the receiver retries the fetch rather than
publishing an unverified part, and drop the now-dead empty-checksums fetch guard.

An Azure HTTP failpoint cannot isolate that line: on a packed fetch the archive-index read, the
metadata reads and checkDataPart's own read all hit the same random-key data.packed blob via
open-ended GETs, so a 403 fails the first (index) read before checkDataPart runs. Add a scoped
code failpoint check_data_part_retryable_error inside checkDataPart that throws a retryable
Poco::TimeoutException after the part is on disk, plus a two-node packed-fetch test. The test
proves the fetch actually reached checkDataPart's retryable path by waiting for the injected
error on the receiver's system.replication_queue (num_tries / last_exception) -- not merely that
the part stayed unpublished, which a stalled queue would also satisfy -- and lowers
max_postpone_time_for_failed_replicated_fetches_ms so the failed fetch retries converge quickly.
@arsenmuk
arsenmuk force-pushed the arsenmuk/az-checkdatapart-rethrow branch from 575f60c to e1c93b3 Compare August 18, 2026 10:20
@clickhouse-gh clickhouse-gh Bot added the comp-mergetree MergeTree* family: parts, merges, primary index, column statistics, background data transformation. label Sep 4, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Dear @SmitaRKulkarni, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself.

@Avogar Avogar self-assigned this Sep 28, 2026
@Avogar

Avogar commented Oct 21, 2026

Copy link
Copy Markdown
Member

@arsenmuk sorry for waiting, was busy with other tasks. It looks good, let's finish

@clickhouse-gh clickhouse-gh Bot added comp-part-formats Formats of MergeTree data parts in the public repository, that is how a part is laid out on disk ... and removed comp-mergetree MergeTree* family: parts, merges, primary index, column statistics, background data transformation. labels Nov 19, 2026
…tapart-rethrow

# Conflicts:
#	tests/integration/test_azure_403_handling/test.py
@arsenmuk

Copy link
Copy Markdown
Member Author

@Avogar @SmitaRKulkarni thank you very much for taking a look, and sorry for my delay of getting back. The change is now updated

@clickhouse-gh

clickhouse-gh Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

Dear @Avogar, you haven't been active on this PR for 30 days. You will be unassigned. Will you continue working on it? If so, please feel free to reassign yourself.

@arsenmuk

Copy link
Copy Markdown
Member Author

@groeneai merge latest master and resole conflicts

@groeneai

Copy link
Copy Markdown
Collaborator

I can't push to arsenmuk/az-checkdatapart-rethrow: my account has read-only access to this repository. I did the merge locally against master 937a58961b9, and it is a single trivial conflict:

  • src/Storages/MergeTree/checkDataPart.cpp, in the inner checkDataPart right after Poco::Logger * log = ...: keep both blocks, your check_data_part_retryable_error failpoint first, then master's auto read_file = ... lambda (added by Check data parts on local disks with O_DIRECT #133447, the O_DIRECT part check). They are independent insertions at the same line.

Everything else merges cleanly. With that resolution, git diff origin/master is exactly this PR's current diff (same 4 files, +120/-26), and checkDataPart.cpp, DataPartsExchange.cpp, ReplicatedMergeTreePartCheckThread.cpp and FailPoint.cpp compile.

One non-conflicting interaction: #133447 added /// Empty checksums: the check stopped at a retryable error. above the !checked_checksums.empty() guard in ReplicatedMergeTreePartCheckThread::checkPartImpl. With this PR a retryable error throws, so empty checksums only mean the check was cancelled. The guard is still correct (the cancelled path returns before using it); only that comment becomes stale.

…tapart-rethrow

# Conflicts:
#	src/Storages/MergeTree/checkDataPart.cpp

This branch has not been deployed

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

Labels

comp-part-formats Formats of MergeTree data parts in the public repository, that is how a part is laid out on disk ... pr-bugfix Pull request with bugfix, not backported by default

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants