8000 Fix GCS CSEK fallback detection and kill timed-out docker exec processes by Slach · Pull Request #1621 · Altinity/clickhouse-backup · GitHub
[go: up one dir, main page]

Skip to content 8000

Fix GCS CSEK fallback detection and kill timed-out docker exec processes - #1621

Merged
Slach merged 1 commit into
masterfrom
fix/gcs-csek-not-encrypted-reason
Oct 19, 2026
Merged

Slach merged 1 commit into
masterfrom
fix/gcs-csek-not-encrypted-reason

Conversation

@Slach
@Slach Slach commented Oct 19, 2026
Copy link
Copy Markdown
Collaborator

Problem

When GCS gets a request for a plain (non-CSEK) object using a customer-supplied encryption key, it replies with the reason resourceNotEncryptedWithCustomerEncryptionKey (lowerCamelCase). Our check looked for the UpperCamelCase spelling, so it never matched. The fallback for objects that aren't encrypted never ran, and those requests failed.

Separately, in the integration tests, a docker exec that timed out only had its local client killed. The process inside the container kept running and could interfere with later tests.

Solution

  • isNotEncryptedError in pkg/storage/gcs.go now compares case-insensitively, so it matches the reason GCS actually returns.
  • DockerExecOut in test/integration/utils.go tags each exec with a unique env variable. If the exec times out, it finds and kill -9s the tagged processes inside the container, then logs what was killed.

Testing

  • Added TestGCSIsNotEncryptedError in pkg/storage/gcs_test.go. It uses a real googleapi.Error with the lowerCamelCase reason, including a wrapped error. It also checks that nil and an unrelated 404 return false.
  • The docker exec kill path has no dedicated test. TODO: confirm it in an integration run.

GCS returns the reason "resourceNotEncryptedWithCustomerEncryptionKey"
in lowerCamelCase, isNotEncryptedError matched "ResourceNot..." and
never fired. CopyObject of disk_gcs objects with a CSEK-configured
destination burned the whole retry backoff per object before falling
back to streaming, TestGCS create exceeded the 15m docker exec timeout.

Killing the `docker exec` client on timeout left clickhouse-backup
running inside the container, so the cleanup `delete local` failed on
the pid lock. DockerExecOut now tags the exec process tree with a
unique env marker and kills marked processes via /proc/*/environ on
timeout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coveralls
Copy link
Copy Markdown

Coverage Report for CI Build 39210683150

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage increased (+0.06%) to 70.265%

Details

  • Coverage increased (+0.06%) from the base build.
  • Patch coverage: 1 of 1 lines across 1 file are fully covered (100%).
  • 22 coverage regressions across 6 files.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

22 previously-covered lines in 6 files lost coverage.

File Lines Losing Coverage Coverage
pkg/backup/create.go 9 74.59%
pkg/clickhouse/clickhouse.go 5 81.13%
pkg/backup/upload.go 4 73.95%
pkg/storage/sftp.go 2 59.17%
pkg/backup/delete.go 1 74.91%
pkg/storage/gcs.go 1 58.37%

Coverage Stats

Coverage Status
Relevant Lines: 29349
Covered Lines: 20622
Line Coverage: 70.26%
Coverage Strength: 34235.98 hits per line

💛 - Coveralls

@Slach
Slach merged commit 91c7548 into master Oct 19, 2026
59 of 60 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0