[PATCH] update the comment in SnapshotSetCommandId
Started by Xiaoran Wangover 2 years ago1 messages
Hi,
I updated the comment in 'SnapshotSetCommandId' in this patch which specifies the reason why it
is not necessary to update 'curcid' of CatalogSnapshot.
Best regards, xiaoran
Attachments:
0001-Update-the-comment-in-SnapshotSetCommandId.patchapplication/octet-stream; name=0001-Update-the-comment-in-SnapshotSetCommandId.patchDownload
From a71977d41d4fc479b0f49ea27d0c031a395b4539 Mon Sep 17 00:00:00 2001
From: Xiaoran Wang <wxiaoran@vmware.com>
Date: Tue, 8 Aug 2023 12:50:18 +0800
Subject: [PATCH] Update the comment in 'SnapshotSetCommandId'
Specify the reason why it is not necessary to update curid of
CatalogSnapshot
---
src/backend/utils/time/snapmgr.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/backend/utils/time/snapmgr.c b/src/backend/utils/time/snapmgr.c
index 3a419e348f..64d44c4d4c 100644
--- a/src/backend/utils/time/snapmgr.c
+++ b/src/backend/utils/time/snapmgr.c
@@ -497,7 +497,12 @@ SnapshotSetCommandId(CommandId curcid)
CurrentSnapshot->curcid = curcid;
if (SecondarySnapshot)
SecondarySnapshot->curcid = curcid;
- /* Should we do the same with CatalogSnapshot? */
+
+ /*
+ * There is no need to update the curcid of CatalogSnapshot, because
+ * the CatalogSnapshot will be invalidated and recreated when updates
+ * are made to the catalog tables in the current transaction.
+ */
}
/*
--
2.39.2 (Apple Git-143)