@@ -715,7 +715,7 @@ _bt_page_recyclable(Page page)
715715}
716716
717717/*
718- * Delete item(s) from a btree page.
718+ * Delete item(s) from a btree page during VACUUM .
719719 *
720720 * This must only be used for deleting leaf items. Deleting an item on a
721721 * non-leaf page has to be done as part of an atomic action that includes
@@ -736,7 +736,8 @@ _bt_page_recyclable(Page page)
736736 */
737737void
738738_bt_delitems_vacuum (Relation rel , Buffer buf ,
739- OffsetNumber * itemnos , int nitems , BlockNumber lastBlockVacuumed )
739+ OffsetNumber * itemnos , int nitems ,
740+ BlockNumber lastBlockVacuumed )
740741{
741742 Page page = BufferGetPage (buf );
742743 BTPageOpaque opaque ;
@@ -771,7 +772,6 @@ _bt_delitems_vacuum(Relation rel, Buffer buf,
771772 {
772773 XLogRecPtr recptr ;
773774 XLogRecData rdata [2 ];
774-
775775 xl_btree_vacuum xlrec_vacuum ;
776776
777777 xlrec_vacuum .node = rel -> rd_node ;
@@ -811,13 +811,27 @@ _bt_delitems_vacuum(Relation rel, Buffer buf,
811811 END_CRIT_SECTION ();
812812}
813813
814+ /*
815+ * Delete item(s) from a btree page during single-page cleanup.
816+ *
817+ * As above, must only be used on leaf pages.
818+ *
819+ * This routine assumes that the caller has pinned and locked the buffer.
820+ * Also, the given itemnos *must* appear in increasing order in the array.
821+ *
822+ * This is nearly the same as _bt_delitems_vacuum as far as what it does to
823+ * the page, but the WAL logging considerations are quite different. See
824+ * comments for _bt_delitems_vacuum.
825+ */
814826void
815827_bt_delitems_delete (Relation rel , Buffer buf ,
816- OffsetNumber * itemnos , int nitems , Relation heapRel )
828+ OffsetNumber * itemnos , int nitems ,
829+ Relation heapRel )
817830{
818831 Page page = BufferGetPage (buf );
819832 BTPageOpaque opaque ;
820833
834+ /* Shouldn't be called unless there's something to do */
821835 Assert (nitems > 0 );
822836
823837 /* No ereport(ERROR) until changes are logged */
@@ -849,7 +863,6 @@ _bt_delitems_delete(Relation rel, Buffer buf,
849863 {
850864 XLogRecPtr recptr ;
851865 XLogRecData rdata [3 ];
852-
853866 xl_btree_delete xlrec_delete ;
854867
855868 xlrec_delete .node = rel -> rd_node ;
@@ -863,8 +876,9 @@ _bt_delitems_delete(Relation rel, Buffer buf,
863876 rdata [0 ].next = & (rdata [1 ]);
864877
865878 /*
866- * We need the target-offsets array whether or not we store the to
867- * allow us to find the latestRemovedXid on a standby server.
879+ * We need the target-offsets array whether or not we store the whole
880+ * buffer, to allow us to find the latestRemovedXid on a standby
881+ * server.
868882 */
869883 rdata [1 ].data = (char * ) itemnos ;
870884 rdata [1 ].len = nitems * sizeof (OffsetNumber );
0 commit comments