Skip to content

Fix backup lock file check errors handling - #113637

Merged
kirillshokhin merged 1 commit into
masterfrom
fix-backup-lock-file-reported-error
Aug 11, 2026
Merged

kirillshokhin merged 1 commit into
masterfrom
fix-backup-lock-file-reported-error

Conversation

@kirillshokhin

@kirillshokhin kirillshokhin commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

BackupImpl::checkLockFile verifies that the current backup owns the lock file. However, any errors while accessing the file (e.g. missing AWS S3 access rights) contents were treated as a content mismatch error, thus resulting in misleading errors returned to the client.

This commit propagates exceptions thrown at the lower levels to the caller, thus preserving the root cause error.
If the throw_if_failed is set to false, exceptions are logged and swallowed, and checkLockFile returns false, maintaining the invariant "if !throw_if_failed -> no exceptions are thrown".

Closes: #84298, #65965

Changelog category (leave one):

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

Changelog entry

Backups now report the underlying lock-file access error instead of incorrectly reporting a concurrent backup when the destination storage cannot read the .lock file.

Version info

  • Merged into: 26.8.1.1168 (included in 26.8 and later)

`BackupImpl::checkLockFile` verifies that the current backup owns the
lock file. However, any errors while accessing the file (e.g. missing
AWS S3 access rights) contents were treated as a content mismatch error,
thus resulting in misleading errors returned to the client.

This commit propagates exceptions thrown at the lower levels to the
caller, thus preserving the root cause error.
If the `throw_if_failed` is set to false, exceptions are logged and
swallowed, and `checkLockFile` returns false, maintaining the
invariant "if !throw_if_failed -> no exceptions are thrown".
@CLAassistant

CLAassistant commented Aug 6, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@clickhouse-gh

clickhouse-gh Bot commented Aug 6, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [634533f]

Summary: ✅


AI Review

Summary

This PR changes BackupImpl::checkLockFile and BackupWriterDefault::fileContentsEqual so backup lock-file access failures are propagated instead of being misreported as BACKUP_ALREADY_EXISTS, and it adds focused unit coverage for both the throwing and non-throwing paths. I did not find a code-level correctness, safety, or test-coverage issue in the current diff.

PR Metadata
  • Changelog category should be Bug Fix, not Not for changelog: this is a user-visible fix for BACKUP on supported releases and it closes two user reports.
  • Changelog entry is required if the category is corrected. Suggested replacement: Backups now report the underlying lock-file access error instead of incorrectly reporting a concurrent backup when the destination storage cannot read the .lock file.
Final Verdict

✅ No code-level blockers or majors found in the current diff. The only issue I found is the PR metadata: the changelog should describe this as a Bug Fix.

LLVM Coverage Report

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

Changed lines: Changed C/C++ lines covered: 84/96 (87.50%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-not-for-changelog This PR should not be mentioned in the changelog label Aug 6, 2026
@kirillshokhin kirillshokhin removed the pr-not-for-changelog This PR should not be mentioned in the changelog label Aug 6, 2026
@kirillshokhin

Copy link
Copy Markdown
Contributor Author

Looks like Temporary part ... already added is a known issue, and a fix PR is already open: #110916

@jkartseva jkartseva self-assigned this Aug 6, 2026

@jkartseva jkartseva left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM; let's decide if we want to GC the orphaned .lock file.

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

Labels

pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bad error message, if lock file is not accessible due S3 policies

4 participants