From 83eb3e0ec9fcb730406becfe09994f3a41c1d048 Mon Sep 17 00:00:00 2001 From: Konstantin Knizhnik Date: Mon, 24 Mar 2025 10:22:43 +0200 Subject: [PATCH] Always do wait in pageserver_try_receive loop --- pgxn/neon/libpagestore.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/pgxn/neon/libpagestore.c b/pgxn/neon/libpagestore.c index 20f4d462c0..bec1e1f88e 100644 --- a/pgxn/neon/libpagestore.c +++ b/pgxn/neon/libpagestore.c @@ -1152,15 +1152,12 @@ pageserver_try_receive(shardno_t shard_no) while (true) { - if (PQisBusy(shard->conn)) + WaitEvent event; + if (WaitEventSetWait(shard->wes_read, 0, &event, 1, + WAIT_EVENT_NEON_PS_READ) != 1 + || (event.events & WL_SOCKET_READABLE) == 0) { - WaitEvent event; - if (WaitEventSetWait(shard->wes_read, 0, &event, 1, - WAIT_EVENT_NEON_PS_READ) != 1 - || (event.events & WL_SOCKET_READABLE) == 0) - { - return NULL; - } + return NULL; } rc = PQgetCopyData(shard->conn, &resp_buff.data, 1 /* async */); if (rc == 0)