Skip to content

Commit 3496e92

Browse files
committed
Replace archive-push test with direct WAL switch trigger
1 parent f03aeb5 commit 3496e92

1 file changed

Lines changed: 4 additions & 20 deletions

File tree

scripts/backup-functions.sh

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -431,28 +431,12 @@ EOF
431431
return 1
432432
fi
433433

434-
# Test archive-push manually with a dummy WAL file
435-
log "INFO" "Testing archive-push functionality..."
436-
437-
# Create a dummy WAL file for testing
438-
test_wal_file="/tmp/test_wal_segment"
439-
echo "dummy wal content for testing" > "$test_wal_file"
440-
441-
# Test the archive-push command
442-
if su-exec postgres bash -c "export PGBACKREST_STANZA=\"${stanza_name}\" && pgbackrest --stanza=\"${stanza_name}\" archive-push \"$test_wal_file\""; then
443-
log "INFO" "Archive-push test successful"
444-
else
445-
log "ERROR" "Archive-push test failed"
446-
# Show more details about the failure
447-
log "ERROR" "Testing archive-push with debug output..."
448-
su-exec postgres bash -c "export PGBACKREST_STANZA=\"${stanza_name}\" && pgbackrest --stanza=\"${stanza_name}\" --log-level-console=debug archive-push \"$test_wal_file\"" || true
449-
fi
450-
451-
# Clean up test file
452-
rm -f "$test_wal_file"
453-
454434
# Force a WAL switch to trigger archiving
455435
log "INFO" "Forcing WAL switch to trigger archiving..."
436+
if ! su-exec postgres psql -d "$pg_database" -c "SELECT pg_switch_wal();" 2>/dev/null; then
437+
log "WARN" "Failed to force WAL switch, but continuing..."
438+
fi
439+
log "INFO" "Forcing WAL switch to trigger archiving..."
456440
if ! su-exec postgres psql -d "$pg_database" -c "SELECT pg_switch_wal();"; then
457441
log "WARN" "Failed to force WAL switch, but continuing..."
458442
fi

0 commit comments

Comments
 (0)