pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: marko@joh.to
To: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #15888: Bogus "idle in transaction" state for logical decoding client after creating a slot
Date: Thu, 4 Jul 2019 13:35:12 +0900
Message-ID: <20190704043512.GK3084@paquier.xyz> (raw)
In-Reply-To: <15888-52d02086ac2085e8@postgresql.org>
References: <15888-52d02086ac2085e8@postgresql.org>

On Wed, Jul 03, 2019 at 08:03:24AM +0000, PG Bug reporting form wrote:
> Run:
> 
>   pg_recvlogical -S foo -f /dev/null -d dbname --create-slot --start
> 
> and pg_stat_activity will show something like this until that session
> disconnects:
> 
> which is quite obviously bogus.

I think that's the transaction which is started when exporting the
snapshot at logical slot creation.  Or in short:
#2  0x000055b5f8e5720f in StartTransactionCommand () at xact.c:2699
#3  0x000055b5f90fab4e in SnapBuildExportSnapshot
(builder=0x55b5fa3427b0) at snapbuild.c:575
#4  0x000055b5f90fe5df in CreateReplicationSlot (cmd=0x55b5fa2914e8)
at walsender.c:843

SnapBuildExportSnapshot() needs to keep a transaction context opened
to keep the wanted xmin around.  In PG >= 10, this problem gets
"solved" by using NOEXPORT_SNAPSHOT in the CREATE_REPLICATION_SLOT
command.  One idea would be to enforce a commit in this case from
CreateReplicationSlot/streamutil.c?  We know that pg_recvlogical is
not going to use this snapshot anyway...
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

view thread (18+ messages)  latest in thread

Message-ID: <20190704043512.GK3084@paquier.xyz>
Permalink:  ../20190704043512.GK3084@paquier.xyz/
Also on:    postgresql.org/message-id/20190704043512.GK3084@paquier.xyz

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: michael@paquier.xyz, marko@joh.to, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #15888: Bogus "idle in transaction" state for logical decoding client after creating a slot
  In-Reply-To: <20190704043512.GK3084@paquier.xyz>

* 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