v6-topup-amit.patch.txt

text/plain

Filename: v6-topup-amit.patch.txt
Type: text/plain
Part: 0
Message: Re: long-standing data loss bug in initial sync of logical replication
diff --git a/src/backend/catalog/pg_publication.c b/src/backend/catalog/pg_publication.c
index a7c257a994..a274ec0f7e 100644
--- a/src/backend/catalog/pg_publication.c
+++ b/src/backend/catalog/pg_publication.c
@@ -680,8 +680,8 @@ publication_add_schema(Oid pubid, Oid schemaid, bool if_not_exists)
 											   PUBLICATION_PART_ALL);
 
 	/*
-	 * Data loss due to concurrency issues are avoided by locking the relation
-	 * in ShareRowExclusiveLock as described atop OpenTableList.
+	 * Lock the tables so that concurrent transactions don't miss replicating
+	 * the changes. See comments atop OpenTableList for further details.
 	 */
 	foreach_oid(schrelid, schemaRels)
 		LockRelationOid(schrelid, ShareRowExclusiveLock);
diff --git a/src/backend/commands/publicationcmds.c b/src/backend/commands/publicationcmds.c
index 9d9b5f6af9..95f83d5563 100644
--- a/src/backend/commands/publicationcmds.c
+++ b/src/backend/commands/publicationcmds.c
@@ -1467,8 +1467,8 @@ RemovePublicationRelById(Oid proid)
 											pubrel->prrelid);
 
 	/*
-	 * Data loss due to concurrency issues are avoided by locking the relation
-	 * in ShareRowExclusiveLock as described atop OpenTableList.
+	 * Lock the tables to avoid concurrent transactions from replicating the
+	 * changes. See comments atop OpenTableList for further details.
 	 */
 	foreach_oid(relid, relids)
 		LockRelationOid(relid, ShareRowExclusiveLock);
@@ -1540,8 +1540,8 @@ RemovePublicationSchemaById(Oid psoid)
 											   PUBLICATION_PART_ALL);
 
 	/*
-	 * Data loss due to concurrency issues are avoided by locking the relation
-	 * in ShareRowExclusiveLock as described atop OpenTableList.
+	 * Lock the tables to avoid concurrent transactions from replicating the
+	 * changes. See comments atop OpenTableList for further details.
 	 */
 	foreach_oid(schrelid, schemaRels)
 		LockRelationOid(schrelid, ShareRowExclusiveLock);