@@ -79,6 +79,13 @@ static void AppendOnlyVisimap_Find(
7979 AppendOnlyVisimap * visiMap ,
8080 AOTupleId * tupleId );
8181
82+ static void AppendOnlyVisimapDelete_Stash (
83+ AppendOnlyVisimapDelete * visiMapDelete );
84+
85+ static void AppendOnlyVisimapDelete_Find (
86+ AppendOnlyVisimapDelete * visiMapDelete ,
87+ AOTupleId * aoTupleId );
88+
8289/*
8390 * Finishes the visimap operations.
8491 * No other function should be called with the given
@@ -238,6 +245,30 @@ AppendOnlyVisimap_Store(
238245
239246}
240247
248+ /*
249+ * If the tuple is not in the current visimap range, the current visimap entry
250+ * is stashed away and the correct one is loaded or read from the spill file.
251+ */
252+ void
253+ AppendOnlyVisimapDelete_LoadTuple (AppendOnlyVisimapDelete * visiMapDelete ,
254+ AOTupleId * aoTupleId )
255+ {
256+ Assert (visiMapDelete );
257+ Assert (visiMapDelete -> visiMap );
258+ Assert (aoTupleId );
259+
260+ /* if the tuple is already covered, we are done */
261+ if (AppendOnlyVisimapEntry_CoversTuple (& visiMapDelete -> visiMap -> visimapEntry ,
262+ aoTupleId ))
263+ return ;
264+
265+ /* if necessary persist the current entry before moving. */
266+ if (AppendOnlyVisimapEntry_HasChanged (& visiMapDelete -> visiMap -> visimapEntry ))
267+ AppendOnlyVisimapDelete_Stash (visiMapDelete );
268+
269+ AppendOnlyVisimapDelete_Find (visiMapDelete , aoTupleId );
270+ }
271+
241272/*
242273 * Deletes all visibility information for the given segment file.
243274 */
@@ -670,11 +701,8 @@ AppendOnlyVisimapDelete_Stash(
670701
671702/*
672703 * Hides a given tuple id.
673- * If the tuple is not in the current visimap range, the current
674- * visimap entry is stashed away and the correct one is loaded or
675- * read from the spill file.
676704 *
677- * Then, the bit of the tuple is set .
705+ * Loads the entry for aoTupleId and sets the visibility bit for it .
678706 *
679707 * Should only be called when in-order delete of tuples can
680708 * be guranteed. This means that the tuples are deleted in increasing order.
@@ -685,32 +713,18 @@ AppendOnlyVisimapDelete_Stash(
685713TM_Result
686714AppendOnlyVisimapDelete_Hide (AppendOnlyVisimapDelete * visiMapDelete , AOTupleId * aoTupleId )
687715{
688- AppendOnlyVisimap * visiMap ;
689-
690716 Assert (visiMapDelete );
717+ Assert (visiMapDelete -> visiMap );
691718 Assert (aoTupleId );
692719
693720 elogif (Debug_appendonly_print_visimap , LOG ,
694721 "Append-only visi map delete: Hide tuple "
695722 "(tupleId) = %s" ,
696723 AOTupleIdToString (aoTupleId ));
697724
698- visiMap = visiMapDelete -> visiMap ;
699- Assert (visiMap );
700-
701- if (!AppendOnlyVisimapEntry_CoversTuple (& visiMap -> visimapEntry ,
702- aoTupleId ))
703- {
704- /* if necessary persist the current entry before moving. */
705- if (AppendOnlyVisimapEntry_HasChanged (& visiMap -> visimapEntry ))
706- {
707- AppendOnlyVisimapDelete_Stash (visiMapDelete );
708- }
709-
710- AppendOnlyVisimapDelete_Find (visiMapDelete , aoTupleId );
711- }
725+ AppendOnlyVisimapDelete_LoadTuple (visiMapDelete , aoTupleId );
712726
713- return AppendOnlyVisimapEntry_HideTuple (& visiMap -> visimapEntry , aoTupleId );
727+ return AppendOnlyVisimapEntry_HideTuple (& visiMapDelete -> visiMap -> visimapEntry , aoTupleId );
714728}
715729
716730static void
0 commit comments