You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by yj...@apache.org on 2025/01/02 03:12:42 UTC
(cloudberry) 34/41: Check with assert if AO table's toast table kept existing relfrozenxid unchanged. (#13499)
This is an automated email from the ASF dual-hosted git repository.
yjhjstz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git
commit f770fbb757c0714333812e975f88e51158d2ea35
Author: Aegeaner <gj...@vmware.com>
AuthorDate: Tue Nov 15 10:25:00 2022 +0800
Check with assert if AO table's toast table kept existing relfrozenxid unchanged. (#13499)
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.
---
src/backend/commands/cluster.c | 32 ++++++++++++++++++--------------
1 file changed, 18 insertions(+), 14 deletions(-)
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 0517912ffd..bdb03c7691 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -1393,20 +1393,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 */
-#ifdef USE_ASSERT_CHECKING
- /*
- * 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.
- *
- * assert, if the frozenXid is invalid, it must be AO table.
- */
- bool isAO1 = (relform1->relam == AO_ROW_TABLE_AM_OID);
- bool isAO2 = (relform2->relam == AO_ROW_TABLE_AM_OID);
- if (!TransactionIdIsNormal(frozenXid))
- Assert(isAO1 && isAO2);
-#endif
swap_relation_files(relform1->reltoastrelid,
relform2->reltoastrelid,
target_is_pg_class,
@@ -1453,6 +1439,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
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org