@@ -715,7 +715,7 @@ _bt_page_recyclable(Page page)
715
715
}
716
716
717
717
/*
718
- * Delete item(s) from a btree page.
718
+ * Delete item(s) from a btree page during VACUUM .
719
719
*
720
720
* This must only be used for deleting leaf items. Deleting an item on a
721
721
* non-leaf page has to be done as part of an atomic action that includes
@@ -736,7 +736,8 @@ _bt_page_recyclable(Page page)
736
736
*/
737
737
void
738
738
_bt_delitems_vacuum (Relation rel , Buffer buf ,
739
- OffsetNumber * itemnos , int nitems , BlockNumber lastBlockVacuumed )
739
+ OffsetNumber * itemnos , int nitems ,
740
+ BlockNumber lastBlockVacuumed )
740
741
{
741
742
Page page = BufferGetPage (buf );
742
743
BTPageOpaque opaque ;
@@ -771,7 +772,6 @@ _bt_delitems_vacuum(Relation rel, Buffer buf,
771
772
{
772
773
XLogRecPtr recptr ;
773
774
XLogRecData rdata [2 ];
774
-
775
775
xl_btree_vacuum xlrec_vacuum ;
776
776
777
777
xlrec_vacuum .node = rel -> rd_node ;
@@ -811,13 +811,27 @@ _bt_delitems_vacuum(Relation rel, Buffer buf,
811
811
END_CRIT_SECTION ();
812
812
}
813
813
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
+ */
814
826
void
815
827
_bt_delitems_delete (Relation rel , Buffer buf ,
816
- OffsetNumber * itemnos , int nitems , Relation heapRel )
828
+ OffsetNumber * itemnos , int nitems ,
829
+ Relation heapRel )
817
830
{
818
831
Page page = BufferGetPage (buf );
819
832
BTPageOpaque opaque ;
820
833
834
+ /* Shouldn't be called unless there's something to do */
821
835
Assert (nitems > 0 );
822
836
823
837
/* No ereport(ERROR) until changes are logged */
@@ -849,7 +863,6 @@ _bt_delitems_delete(Relation rel, Buffer buf,
849
863
{
850
864
XLogRecPtr recptr ;
851
865
XLogRecData rdata [3 ];
852
-
853
866
xl_btree_delete xlrec_delete ;
854
867
855
868
xlrec_delete .node = rel -> rd_node ;
@@ -863,8 +876,9 @@ _bt_delitems_delete(Relation rel, Buffer buf,
863
876
rdata [0 ].next = & (rdata [1 ]);
864
877
865
878
/*
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.
868
882
*/
869
883
rdata [1 ].data = (char * ) itemnos ;
870
884
rdata [1 ].len = nitems * sizeof (OffsetNumber );
0 commit comments