pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Konstantin Knizhnik <k.knizhnik@postgrespro.ru>
Cc: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
Subject: Re: Missing break in RelationFindReplTupleSeq
Date: Fri, 31 Jan 2020 10:58:31 -0300
Message-ID: <20200131135831.GA1550@alvherre.pgsql> (raw)
In-Reply-To: <379743f6-ae91-b866-f7a2-5624e6d2b0a4@postgrespro.ru>

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.patch (text/x-diff, 435B) download 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. */

view thread (3+ messages)  latest in thread

Message-ID: <20200131135831.GA1550@alvherre.pgsql>
Permalink:  ../20200131135831.GA1550@alvherre.pgsql/
Also on:    postgresql.org/message-id/20200131135831.GA1550@alvherre.pgsql

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-hackers@postgresql.org
  Cc: alvherre@2ndquadrant.com, k.knizhnik@postgrespro.ru
  Subject: Re: Missing break in RelationFindReplTupleSeq
  In-Reply-To: <20200131135831.GA1550@alvherre.pgsql>
  References: <379743f6-ae91-b866-f7a2-5624e6d2b0a4@postgrespro.ru> <20200131135831.GA1550@alvherre.pgsql>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox