Re: Proposal for CSN based snapshots

From: Alexander Kuzmenkov <a(dot)kuzmenkov(at)postgrespro(dot)ru>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Robert Haas <robertmhaas(at)gmail(dot)com>, Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Jeff Davis <pgsql(at)j-davis(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Greg Stark <stark(at)mit(dot)edu>, Andres Freund <andres(at)2ndquadrant(dot)com>, Rajeev rastogi <rajeev(dot)rastogi(at)huawei(dot)com>, Markus Wanner <markus(at)bluegap(dot)ch>, Ants Aasma <ants(at)cybertec(dot)at>, Bruce Momjian <bruce(at)momjian(dot)us>, obartunov <obartunov(at)postgrespro(dot)ru>, Teodor Sigaev <teodor(at)postgrespro(dot)ru>, Borodin Vladimir <root(at)simply(dot)name>
Subject: Re: Proposal for CSN based snapshots
Date: 2017-06-21 11:48:38
Message-ID: 725708e3-49f9-f26c-89bc-e8d410dcba09@postgrespro.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 21.06.2017 04:48, Michael Paquier wrote:
> There has not been much activity on this thread for some time, and I
> mentioned my intentions to some developers at the last PGCon. But I am
> planning to study more the work that has been done here, with as
> envisaged goal to present a patch for the first CF of PG11. Lots of
> fun ahead.

Hi Michael,

Glad to see you working on this! I've been studying this topic too.
Attached you can find a recently rebased version of Heikki's v4 patch.
I also fixed a bug that appeared on report-receipts isolation test:
XidIsConcurrent should report that a transaction is concurrent to ours
when its csn equals our snapshotcsn.

There is another bug where multiple tuples with the same primary key
appear after a pgbench read-write test. Querying pgbench_branches with
disabled index scans, I see several tuples with the same 'bid' value.
Usually they do not touch the index so there are no errors. But
sometimes HOT update is not possible and it errors out with violation of
unique constraint, which is how I noticed it. I can't reproduce it on my
machine and have to use a 72-core one.

For now I can conclude that the oldestActiveXid is not always updated
correctly. In TransactionIdAsyncCommitTree, just before the transaction
sets clog status, its xid can be less than oldestActiveXid. Other
transactions are seeing it as aborted for some time before it writes to
clog (see TransactionIdGetCommitSeqNo). They can update a tuple it
deleted, and that leads to duplication. Unfortunately, I didn't have
time yet to investigate this further.
--

Alexander Kuzmenkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

Attachment Content-Type Size
csn-5.patch.gz application/gzip 102.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Yugo Nagata 2017-06-21 11:56:57 pg_terminate_backend can terminate background workers and autovacuum launchers
Previous Message Dean Rasheed 2017-06-21 09:49:41 Re: Rules on table partitions