Repository navigation
Conversation
fixEmbeddedMetadataRemote rewrites metadata/**/*.sql objects in the bucket
in place but left the .backup manifest untouched. ClickHouse 26.9.x and
26.10.1 check the object size against the manifest before reading and fail
with code 1009 S3_OBJECT_CHANGED_DURING_READ.
After the rewrite the node which executes RESTORE recalculates size and
checksum (CityHash128 over 2048 bytes blocks, as HashingReadBuffer does)
of every .sql listed in .backup and uploads the manifest back. ON CLUSTER
workers don't touch the shared manifest to avoid lost updates.
Also fix {database}/{table} substitution in fixEmbeddedMetadataSQLQuery:
they were taken from the wrong path components (metadata/<db> instead of
<db>/<table>), so every ReplicatedMergeTree() table of a database got the
same replica path and restore failed with code 253.
Test infra: 26.10 refuses unknown disk elements (code 137), drop
cache_enabled/send_metadata for 26.10+.
Fixes #1668
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1668
Problem
fixEmbeddedMetadataRemoterewritesmetadata/**/*.sqlobjects in place for embedded backups withoutembedded_backup_disk(BACKUP TO S3/GCS/Azure(url)). It doesn't update the.backupmanifest. ClickHouse 26.9.x and 26.10.1 compare the object size with the manifest before reading and fail withcode: 1009 S3_OBJECT_CHANGED_DURING_READ. ClickHouse reverted that check in 26.10.2+ (ClickHouse/ClickHouse@62eb34814e2), but the manifest still gets out of sync.Changes
pkg/backup/embedded_manifest.go: after the rewrite, the node that executes RESTORE recalculates size and checksum of every.sqllisted in.backupand uploads the manifest back. The checksum is CityHash128 v1.0.2 chained over 2048-byte blocks, the same wayHashingReadBuffercomputes it. ON CLUSTER workers don't touch the shared manifest, so concurrent writes can't overwrite each other.fixEmbeddedMetadataSQLQuery:{database}/{table}were taken from the wrong path components (metadata/<db>instead of<db>/<table>). EveryReplicatedMergeTree()table of a database got the same replica path, and restore failed withcode: 253 Replica ... already exists.dynamic_settings.shdropscache_enabled/send_metadatafor 26.10+.Tests
.backupwritten by ClickHouse 26.10, including a file larger than 2048 bytes. Manifest rewrite coversdata_file,use_baseand empty files.TestEmbeddedS3URLRewrittenMetadata:ENGINE=Replicateddatabase,ReplicatedMergeTree()without arguments, MV,create_remote/restore_remote --rmover S3 URL.TestEmbeddedS3Cleanuppasses too.TestEmbedded*suite on 26.8/26.10. 26.9/26.10 are not in the CI matrix yet.🤖 Generated with Claude Code