Re: [HACKERS] SERIALIZABLE on standby servers

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Kevin Grittner <kgrittn(at)gmail(dot)com>
Cc: Simon Riggs <simon(at)2ndquadrant(dot)com>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>
Subject: Re: [HACKERS] SERIALIZABLE on standby servers
Date: 2018-09-21 13:55:01
Message-ID: CAEepm=1+oBXAUckBG_KgXxbhj1pcj_rqwZBKfvfi3azvr2bwGQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Sep 22, 2018 at 12:28 AM Thomas Munro
<thomas(dot)munro(at)enterprisedb(dot)com> wrote:
> I'll add it to the next
> Commitfest so I know when to rebase it.

And cfbot immediately showed that this assertion in
OldSerXidSetActiveSerXmin() could fail in the isolation tests:

Assert(!TransactionIdIsValid(oldSerXidControl->tailXid)
|| TransactionIdFollows(xid, oldSerXidControl->tailXid));

Not sure how that ever worked or if I screwed something up while
rebasing, but the quick (and possibly wrong?) solution I found was to
exclude hypothetical SERIALIABLEXACTs when scanning for the new oldest
xid:

@@ -3181,6 +3322,7 @@ SetNewSxactGlobalXmin(void)
for (sxact = FirstPredXact(); sxact != NULL; sxact =
NextPredXact(sxact))
{
if (!SxactIsRolledBack(sxact)
+ && !SxactIsHypothetical(sxact)
&& !SxactIsCommitted(sxact)
&& sxact != OldCommittedSxact)

Here's a version like that in the meantime so that the CI passes. The
real solution might be to give them their own xid (right now they
"borrow" one, see PreCommit_CheckForSerializationFailure()... now that
I think about it, that must be wrong), when I have more time for this
project.

--
Thomas Munro
http://www.enterprisedb.com

Attachment Content-Type Size
0001-SERIALIZABLE-READ-ONLY-DEFERRABLE-for-hot-standby-v4.patch application/octet-stream 39.0 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hubert Zhang 2018-09-21 14:21:16 Re: Proposal for disk quota feature
Previous Message Thomas Munro 2018-09-21 12:56:47 Re: Size and size_t in dsa API