From aa586e6e18d4ecf999f593eb6983aa3b94892758 Mon Sep 17 00:00:00 2001
From: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Date: Mon, 31 Aug 2026 18:08:41 +0000
Subject: [PATCH v2 2/2] Fix repack decoding worker startup wait event.

The backend running REPACK CONCURRENTLY waits for its decoding
worker to initialize logical decoding, but reported that wait as
REPACK_WORKER_EXPORT, which describes waiting for an output file
and is misleading here. Report it as the existing
BGWORKER_STARTUP event instead, as parallel query and others do,
so pg_stat_activity shows what the backend is really waiting for
without adding a new wait event.

Author: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Reviewed-by: Antonin Houska <ah@cybertec.at>
Discussion: https://postgr.es/m/CALj2ACVAxA9HxvFe8HSspTJ-UO4Aoz%3DkuQdZBeLrod0gqUxH3g%40mail.gmail.com
Backpatch-through: 19
---
 src/backend/commands/repack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/backend/commands/repack.c b/src/backend/commands/repack.c
index 02b8f3b07ec..046bcafd067 100644
--- a/src/backend/commands/repack.c
+++ b/src/backend/commands/repack.c
@@ -3731,7 +3731,7 @@ start_repack_decoding_worker(Oid relid)
 					errmsg("postmaster exited during REPACK command"));
 
 		(void) WaitLatch(MyLatch, WL_LATCH_SET | WL_EXIT_ON_PM_DEATH, -1,
-						 WAIT_EVENT_REPACK_WORKER_EXPORT);
+						 WAIT_EVENT_BGWORKER_STARTUP);
 		ResetLatch(MyLatch);
 	}
 }
-- 
2.47.3

