v64-0002-Modify-comments.patch

application/octet-stream

Filename: v64-0002-Modify-comments.patch
Type: application/octet-stream
Part: 1
Message: Re: row filtering for logical replication

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: format-patch
Series: patch v64-0002
Subject: Modify comments.
File+
src/backend/utils/cache/relcache.c 16 18
From 26910f354365b5c4976f069f5e209867af0a86b0 Mon Sep 17 00:00:00 2001
From: Amit Kapila <akapila@postgresql.org>
Date: Fri, 14 Jan 2022 16:52:51 +0530
Subject: [PATCH v64 2/2] Modify comments.

---
 src/backend/utils/cache/relcache.c | 34 ++++++++++++++----------------
 1 file changed, 16 insertions(+), 18 deletions(-)

diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index e7aeb2cfe6..1254e5c2aa 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -275,7 +275,7 @@ static HTAB *OpClassCache = NULL;
 typedef struct rf_context
 {
 	AttrNumber	invalid_rfcolnum;	/* invalid column number */
-	Bitmapset  *bms_replident;	/* bitset of replica identity col indexes */
+	Bitmapset  *bms_replident;	/* bitset of replica identity columns */
 	bool		pubviaroot;		/* true if we are validating the parent
 								 * relation's row filter */
 	Oid			relid;			/* relid of the relation */
@@ -5536,9 +5536,11 @@ RelationGetExclusionInfo(Relation indexRelation,
 }
 
 /*
- * Check if any columns used in the row filter WHERE clause are not part of
- * REPLICA IDENTITY and save the invalid column number in
- * rf_context::invalid_rfcolnum.
+ * Returns true, if any of the columns used in row filter WHERE clause is not
+ * part of REPLICA IDENTITY, false, otherwise.
+ *
+ * Remember the invalid column number, if there is any to be later used in
+ * error message.
  */
 static bool
 rowfilter_column_walker(Node *node, rf_context *context)
@@ -5553,11 +5555,9 @@ rowfilter_column_walker(Node *node, rf_context *context)
 
 		/*
 		 * If pubviaroot is true, we are validating the row filter of the
-		 * parent table, but we can only use the bitset of replica identity
-		 * col indexes in the child table to check. So, we need to convert the
-		 * column number in the row filter expression to the child table's in
-		 * case the column order of the parent table is different from the
-		 * child table's.
+		 * parent table, but the bitmap contains the replica identity
+		 * information of the child table. So, get the column number of child
+		 * table as parent and child column order could be different.
 		 */
 		if (context->pubviaroot)
 		{
@@ -5674,10 +5674,8 @@ GetRelationPublicationInfo(Relation relation, bool validate_rowfilter)
 		ReleaseSysCache(tup);
 
 		/*
-		 * If the publication actions include UPDATE or DELETE and
-		 * validate_rowfilter flag is true, validates that any columns
-		 * referenced in the filter expression are part of REPLICA IDENTITY
-		 * index.
+		 * Check, if all columns referenced in the filter expression are part
+		 * of the REPLICA IDENTITY index or not.
 		 *
 		 * FULL means all cols are in the REPLICA IDENTITY, so all cols are
 		 * allowed in the row filter and we can skip the validation.
@@ -5694,11 +5692,11 @@ GetRelationPublicationInfo(Relation relation, bool validate_rowfilter)
 			Oid			publish_as_relid = relid;
 
 			/*
-			 * For a partition, if pubviaroot is true, check if any of the
-			 * ancestors are published. If so, note down the topmost ancestor
-			 * that is published via this publication, the row filter
-			 * expression of which will be used to filter the partition's
-			 * changes. We could have got the topmost ancestor when collecting
+			 * For a partition, if pubviaroot is true, find the topmost
+			 * ancestor that is published via this publication as we need to
+			 * use its row filter expression to filter the partition's changes.
+			 *
+			 * XXX We could have got the topmost ancestor when collecting
 			 * the publication oids, but that will make the code more
 			 * complicated.
 			 */
-- 
2.28.0.windows.1