Fix slot's xmin advancement and subxact's lost snapshots in decoding.

From: Arseny Sher <a(dot)sher(at)postgrespro(dot)ru>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Fix slot's xmin advancement and subxact's lost snapshots in decoding.
Date: 2018-04-08 05:46:04
Message-ID: 87lgdyz1wj.fsf@ars-thinkpad
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

I've discovered a couple of bugs in logical decoding code, both leading
to incorrect decoding results in somewhat rare cases. First, xmin of
slots is advanced too early. This affects the results only when
interlocking allows to perform DDL concurrently with looking at the
schema. In fact, I was not aware about such DDL until at
https://www.postgresql.org/message-id/flat/87tvu0p0jm(dot)fsf%40ars-thinkpad#87tvu0p0jm(dot)fsf(at)ars-thinkpad
I raised this question and Andres pointed out ALTER of composite
types. Probably there are others, I am not sure; it would be interesting
to know them.

Another problem is that new snapshots are never queued to known
subxacts. It means decoding results can be wrong if toplevel doesn't
write anything while subxact does.

Please see detailed description of the issues, tests which reproduce
them and fixes in the attached patch.

--
Arseny Sher
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachment Content-Type Size
0001-Fix-slot-s-xmin-advancement-and-subxact-s-lost-snaps.patch text/x-diff 25.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabien COELHO 2018-04-08 05:58:31 Re: [HACKERS] pgbench - allow to store select results into variables
Previous Message Amit Kapila 2018-04-08 05:36:00 Re: Checkpoint not retrying failed fsync?