diff --git a/pgxn/neon/pagestore_smgr.c b/pgxn/neon/pagestore_smgr.c index 5b48600f28..a8dde3927a 100644 --- a/pgxn/neon/pagestore_smgr.c +++ b/pgxn/neon/pagestore_smgr.c @@ -1780,6 +1780,17 @@ neon_read_at_lsn(RelFileNode rnode, ForkNumber forkNum, BlockNumber blkno, &request_lsn); slot = GetPrfSlot(ring_index); } + else + { + /* + * Empty our reference to the prefetch buffer's hash entry. + * When we wait for prefetches, the entry reference is invalidated by + * potential updates to the hash, and when we reconnect to the + * pageserver the prefetch we're waiting for may be dropped, + * in which case we need to retry and take the branch above. + */ + entry = NULL; + } Assert(slot->my_ring_index == ring_index); Assert(MyPState->ring_last <= ring_index &&