pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Andres Freund <andres@anarazel.de>
Cc: Tomas Vondra <tomas.vondra@2ndquadrant.com>
Cc: Andrey Salnikov <andrey.salnikov@dataegret.com>
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #16125: Crash of PostgreSQL's wal sender during logical replication
Date: Wed, 27 Nov 2019 14:59:35 -0300
Message-ID: <20191127175935.GA20945@alvherre.pgsql> (raw)
In-Reply-To: <20191119232849.qhtuhq4udrqrz4he@alap3.anarazel.de>

On 2019-Nov-19, Andres Freund wrote:

> > > 2525:rmgr: Heap        len (rec/tot):   1671/  1671, tx: 1667601530, lsn: 25EE/D66F5508, prev 25EE/D66F54C8, desc: INSERT off 2, blkref #0: rel 1663/13018/88964792 blk 18475
> > > 2532:rmgr: Heap        len (rec/tot):     54/    54, tx: 1667601530, lsn: 25EE/D66F7EF0, prev 25EE/D66F7EA0, desc: DELETE off 2 , blkref #0: rel 1663/13018/88964792 blk 18475

> > So, this DELETE change triggers the issue. If I understand it correctly,
> > that means the transaction locked the tuple and then deleted it. But I
> > don't see any record about the lock.
> 
> Hm. I don't think it necessarily means that. compute_new_xmax_infomask(), when
> called from heap_delete(), will e.g. set HEAP_KEYS_UPDATED when
> 
> 	if (old_infomask & HEAP_XMAX_INVALID)
> 
> is true. Which is the most common case. I actually find it *more*
> curious to *not* see that for a delete. I've not traced fully through
> it, yet.
> 
> 
> Alvaro, it's not clear to me whether the the multixact codepaths in
> compute_new_xmax_infomask() actually work as expected for deletes.

So, what's really happening here is heap_insert(speculative) followed by
heap_abort_speculative().  That seems to explain the above WAL sequence.
I *think* the speculative insertion code in reorderbuffer simply delays
the tuple insertion until it is confirmed; so this sequence would result
in nothing at all happening at ReorderBufferCommit.  Unless something
has messed up the state somehow.

-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services





view thread (17+ messages)  latest in thread

Message-ID: <20191127175935.GA20945@alvherre.pgsql>
Permalink:  ../20191127175935.GA20945@alvherre.pgsql/
Also on:    postgresql.org/message-id/20191127175935.GA20945@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-bugs@postgresql.org
  Cc: alvherre@2ndquadrant.com, andres@anarazel.de, tomas.vondra@2ndquadrant.com, andrey.salnikov@dataegret.com
  Subject: Re: BUG #16125: Crash of PostgreSQL's wal sender during logical replication
  In-Reply-To: <20191127175935.GA20945@alvherre.pgsql>
  References: <20191119232849.qhtuhq4udrqrz4he@alap3.anarazel.de> <20191127175935.GA20945@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