Skip to content

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

FIX (backend): Wait for pg_receivewal's own backend on the slot in the idle WAL stream test, since the backend creating the slot holds it first

Rostislav Dugin9b1a4897f08f
diff --git a/backend/internal/features/backups/backups/usecases/physical/postgresql/wal_stream_test.go b/backend/internal/features/backups/backups/usecases/physical/postgresql/wal_stream_test.go
index 096c1010..095f7591 100644
--- a/backend/internal/features/backups/backups/usecases/physical/postgresql/wal_stream_test.go
+++ b/backend/internal/features/backups/backups/usecases/physical/postgresql/wal_stream_test.go
@@ -769,7 +769,9 @@ func waitForAttachedReceiverPID(t *testing.T, adminConn *pgx.Conn, slotName stri
require.Eventually(t, func() bool {
slotState, err := InspectSlot(t.Context(), adminConn, slotName)
- if err != nil || slotState == nil || slotState.ActivePID == nil {
+ // While the slot is being created, the creating backend holds it, so an active PID alone
+ // can belong to that backend rather than to pg_receivewal.
+ if err != nil || slotState == nil || !isOwnedReceiverBackend(slotState) {
return false
}