Skip to content

PostgreSQL backup tool with Point-In-Time-Recovery and restore verification

FIX (wal): Allow to save error via /complete endpoint

Rostislav Dugin0d7e147df65a
diff --git a/backend/internal/features/backups/backups/controllers/postgres_wal_controller.go b/backend/internal/features/backups/backups/controllers/postgres_wal_controller.go
index 5888651e..c18f254e 100644
--- a/backend/internal/features/backups/backups/controllers/postgres_wal_controller.go
+++ b/backend/internal/features/backups/backups/controllers/postgres_wal_controller.go
@@ -222,6 +222,14 @@ func (c *PostgreWalBackupController) CompleteFullBackupUpload(ctx *gin.Context)
return
}
+ if request.Error == nil && (request.StartSegment == "" || request.StopSegment == "") {
+ ctx.JSON(
+ http.StatusBadRequest,
+ gin.H{"error": "startSegment and stopSegment are required when no error is provided"},
+ )
+ return
+ }
+
if err := c.walService.FinalizeBasebackup(
database,
request.BackupID,
diff --git a/backend/internal/features/backups/backups/dto/dto.go b/backend/internal/features/backups/backups/dto/dto.go
index bd969c03..fa5564c5 100644
--- a/backend/internal/features/backups/backups/dto/dto.go
+++ b/backend/internal/features/backups/backups/dto/dto.go
@@ -84,7 +84,7 @@ type UploadBasebackupResponse struct {
type FinalizeBasebackupRequest struct {
BackupID uuid.UUID `json:"backupId" binding:"required"`
- StartSegment string `json:"startSegment" binding:"required"`
- StopSegment string `json:"stopSegment" binding:"required"`
+ StartSegment string `json:"startSegment"`
+ StopSegment string `json:"stopSegment"`
Error *string `json:"error"`
}