feat: import missing backup records from S3-compatible object storage#2333
Open
qqkzlm wants to merge 1 commit intoWei-Shaw:mainfrom
Open
feat: import missing backup records from S3-compatible object storage#2333qqkzlm wants to merge 1 commit intoWei-Shaw:mainfrom
qqkzlm wants to merge 1 commit intoWei-Shaw:mainfrom
Conversation
Contributor
|
All contributors have signed the CLA. ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
Author
|
recheck |
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.
feat: import missing backup records from S3-compatible object storage
Summary
Add an admin-triggered workflow to rebuild missing official backup records from S3-compatible object storage.
This fixes cases where backup files already exist in the configured backup bucket/prefix, but corresponding
backup_recordsrows are missing after migration, manual upload, old deployments, or database recovery.Changes
GET /api/v1/admin/backups/import-preview.POST /api/v1/admin/backups/import..sql.gzbackup objects and skip records that already exist.status=completed,backup_type=postgres, andtriggered_by=imported.file_name,s3_key,size_bytes, and fallback timestamps from object last modified time.expires_atfor imported records based on the current backup retention policy.pg_dumpandpsqlto runtime Docker images and make restore fail fast withON_ERROR_STOP=1.Tests
go test -tags unit ./internal/service -run 'TestBackupService_ImportMissingBackups|TestBackupService_ImportMissingBackups_BackfillsImportedExpiry|TestCleanupOldBackups_KeepsImportedRecords|TestStartRestore_Async|TestStartRestore_AsyncFailure' -vdocker build --target frontend-builder -f Dockerfile .docker build -f Dockerfile .docker build -f deploy/Dockerfile .docker build -f backend/Dockerfile backendManual Verification
backup_records.psqlto the runtime image.