Missing break in RelationFindReplTupleSeq
Eventually we find out that logical replication in the current version
of Postgres works significantly slower on table with replica identity
full than old pglogical implementation.
The comment to RelationFindReplTupleSeq says:
Note that this stops on the first matching tuple.
But actually this function continue traversal until end of the table
even if tuple was found.
I wonder if break; should be added to the end of for loop.
--
Konstantin Knizhnik
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
On 2020-Jan-31, Konstantin Knizhnik wrote:
Eventually we find out that logical replication in the current version of
Postgres works significantly slower on table with replica identity full than
old pglogical implementation.The comment to RelationFindReplTupleSeq says:
��� Note that this stops on the first matching tuple.
But actually this function continue traversal until end of the table even if
tuple was found.
I wonder if break; should be added to the end of for loop.
Wow, you're right, and the "break" is missing there. I propose it like
this.
--
�lvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Attachments:
fix-replident-full.patchtext/x-diff; charset=us-asciiDownload
diff --git a/src/backend/executor/execReplication.c b/src/backend/executor/execReplication.c
index 582b0cb017..30cba89da7 100644
--- a/src/backend/executor/execReplication.c
+++ b/src/backend/executor/execReplication.c
@@ -327,6 +327,9 @@ retry:
XactLockTableWait(xwait, NULL, NULL, XLTW_None);
goto retry;
}
+
+ /* Found our tuple and it's not locked */
+ break;
}
/* Found tuple, try to lock it in the lockmode. */
On 2020-Jan-31, Alvaro Herrera wrote:
On 2020-Jan-31, Konstantin Knizhnik wrote:
Eventually we find out that logical replication in the current version of
Postgres works significantly slower on table with replica identity full than
old pglogical implementation.The comment to RelationFindReplTupleSeq says:
��� Note that this stops on the first matching tuple.
But actually this function continue traversal until end of the table even if
tuple was found.
I wonder if break; should be added to the end of for loop.Wow, you're right, and the "break" is missing there. I propose it like
this.
Pushed, thanks for reporting.
I had one very strange thing happen while testing this -- I put the
tests to run in all branches in parallel, and they took about 12 minutes
to finish instead of the normal 5. I tried to repeat this result but
was unable to do so. My only hypothesis is that my laptop entered some
kind of low-performance mode.
--
�lvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services