Check with assert if AO table's toast table kept existing relfrozenxid unchanged.
CLUSTER operation on append-optimized tables does not compute freeze limit
(frozenXid) because AO tables do not have relfrozenxid.  The toast tables
need to keep existing relfrozenxid value unchanged in this case.
@@ -1434,15 +1434,6 @@ swap_relation_files(Oid r1, Oid r2, bool target_is_pg_class,
if (relform1->reltoastrelid && relform2->reltoastrelid)
{
/* Recursively swap the contents of the toast tables */
- /*
- * CLUSTER operation on append-optimized tables does not
- * compute freeze limit (frozenXid) because AO tables do not
- * have relfrozenxid. The toast tables need to keep existing
- * relfrozenxid value unchanged in this case.
- *
- * GPDB_12_MERGE_FIXME: If the above argument is correct,
- * figure out a way check it with an assert.
- */
swap_relation_files(relform1->reltoastrelid,
relform2->reltoastrelid,
target_is_pg_class,
@@ -1489,6 +1480,24 @@ swap_relation_files(Oid r1, Oid r2, bool target_is_pg_class,
}
}
+#ifdef USE_ASSERT_CHECKING
+ /*
+ * Check with assert if AO table's toast table kept existing relfrozenxid unchanged.
+ *
+ * CLUSTER operation on append-optimized tables does not
+ * compute freeze limit (frozenXid) because AO tables do not
+ * have relfrozenxid. The toast tables need to keep existing
+ * relfrozenxid value unchanged in this case.
+ */
+ if (swap_toast_by_content
+ && frozenXid == InvalidTransactionId
+ && relform1->relkind == RELKIND_TOASTVALUE
+ && relform2->relkind == RELKIND_TOASTVALUE)
+ {
+ Assert(relform1->relfrozenxid == relform2->relfrozenxid);
+ }
+#endif
+
/*
* If we're swapping two toast tables by content, do the same for their
* valid index. The swap can actually be safely done only if the relations
