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