Remove visibility check code in aocs compaction
Since we have already checked the visibility during scan tuples
in aocs compaction, the visibility check code in aocs compaction
is unnecessary and can be removed.
@@ -217,11 +217,9 @@ AOCSSegmentFileFullCompaction(Relation aorel,
TupleDesc tupDesc;
TupleTableSlot *slot;
int compact_segno;
- int64 movedTupleCount = 0;
ResultRelInfo *resultRelInfo;
MemTupleBinding *mt_bind;
EState *estate;
- AOTupleId *aoTupleId;
int64 tupleCount = 0;
int64 tuplePerPage = INT_MAX;
@@ -274,20 +272,15 @@ AOCSSegmentFileFullCompaction(Relation aorel,
{
CHECK_FOR_INTERRUPTS();
- aoTupleId = (AOTupleId *) &slot->tts_tid;
- if (AppendOnlyVisimap_IsVisible(&scanDesc->visibilityMap, aoTupleId))
- {
+ /*
+ * AppendOnlyVisimap_IsVisible() has already been called in aocs_getnext().
+ */
+ Assert(AppendOnlyVisimap_IsVisible(&scanDesc->visibilityMap,
+ (AOTupleId *) &slot->tts_tid));
AOCSMoveTuple(slot,
insertDesc,
resultRelInfo,
estate);
- movedTupleCount++;
- }
- else
- {
- /* Tuple is invisible and needs to be dropped */
- AppendOnlyThrowAwayTuple(aorel, slot, mt_bind);
- }
/*
* Check for vacuum delay point after approximatly a var block
@@ -316,7 +309,7 @@ AOCSSegmentFileFullCompaction(Relation aorel,
elogif(Debug_appendonly_print_compaction, LOG,
"Finished compaction: "
"AO segfile %d, relation %s, moved tuple count " INT64_FORMAT,
- compact_segno, relname, movedTupleCount);
+ compact_segno, relname, tupleCount);
AppendOnlyVisimap_Finish(&visiMap, NoLock);
