From: Robert Haas Date: Thu, 9 Dec 2021 23:15:56 +0000 (-0500) Subject: when vacuuming, handle uninitialized index pages without barfing X-Git-Url: http://git.postgresql.org/gitweb/?a=commitdiff_plain;h=ddd50d0488db184290700c644e546b217cdcc8c8;p=users%2Frhaas%2Fpostgres.git when vacuuming, handle uninitialized index pages without barfing --- diff --git a/src/backend/access/conveyor/conveyor.c b/src/backend/access/conveyor/conveyor.c index cb6adab6ce..431a01c9f8 100644 --- a/src/backend/access/conveyor/conveyor.c +++ b/src/backend/access/conveyor/conveyor.c @@ -1267,6 +1267,23 @@ ConveyorBeltClearIndexSegmentEntries(ConveyorBelt *cb, Buffer metabuffer, indexbuffer = ConveyorBeltRead(cb, indexblock, BUFFER_LOCK_EXCLUSIVE); indexpage = BufferGetPage(indexbuffer); + /* + * If an index segment page is not initialized, treat it the same + * way as if it is initialized but contains no entries. + */ + if (ConveyorBeltPageIsUnused(indexpage)) + { + if (segoff == 0) + elog(ERROR, + "conveyor belt index page at segno %u offset 0 should be initialied", + index_segment); + if (*next_index_segment != CB_INVALID_SEGMENT) + elog(ERROR, + "non-final index segment page at segno %u offset %u should be initialized", + index_segment, segoff); + return true; + } + /* * If this is the very first time we've locked an index page in this * segment, it should be the first page, and it will tell us where to