Re: hot_standby_feedback vs excludeVacuum and snapshots

From: Noah Misch <noah(at)leadboat(dot)com>
To: Simon Riggs <simon(at)2ndquadrant(dot)com>
Cc: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Greg Stark <stark(at)mit(dot)edu>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: hot_standby_feedback vs excludeVacuum and snapshots
Date: 2018-07-08 18:51:38
Message-ID: 20180708185138.GA643430@rfd.leadboat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jul 06, 2018 at 04:32:56PM +0100, Simon Riggs wrote:
> On 6 July 2018 at 03:30, Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com> wrote:
> > On Thu, Jul 5, 2018 at 8:27 AM, Noah Misch <noah(at)leadboat(dot)com> wrote:
> >>> However, 49bff5300d527 also introduced a similar bug where subtransaction
> >>> commit would fail to release an AccessExclusiveLock, leaving the lock to
> >>> be removed sometimes early and sometimes late. This commit fixes
> >>> that bug also. Backpatch to PG10 needed.
> >>
> >> Subtransaction commit is too early to release an arbitrary
> >> AccessExclusiveLock. The primary releases every AccessExclusiveLock at
> >> top-level transaction commit, top-level transaction abort, or subtransaction
> >> abort. CommitSubTransaction() doesn't do that; it transfers locks to the
> >> parent sub(xact). Standby nodes can't safely remove an arbitrary lock earlier
> >> than the primary would.
> >
> > But we don't release locks acquired by committing subxacts until the
> > top level xact commits. Perhaps that's what the git commit message
> > meant by "early", as opposed to "late" meaning when
> > StandbyReleaseOldLocks() next runs because an XLOG_RUNNING_XACTS
> > record is replayed?
>
> Locks held by subtransactions were not released at the correct timing
> of top-level commit; they are now.

I read the above-quoted commit message as saying that the commit expands the
set of locks released when replaying subtransaction commit. The only lock
that should ever be released at subxact commit is the subxact XID lock. If
that continues to be the only lock released at subxact commit, good.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Markus Winand 2018-07-08 19:15:42 Re: XML/XPath issues: text/CDATA in XMLTABLE, XPath evaluated with wrong context
Previous Message Andres Freund 2018-07-08 18:27:49 Re: XLogSegNoOffsetToRecPtr fixup