pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bossart, Nathan <bossartn@amazon.com>
To: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Cc: Schneider, Jeremy <schnjere@amazon.com>
Subject: ERROR:  multixact X from before cutoff Y found to be still running
Date: Thu, 5 Sep 2019 00:37:40 +0000
Message-ID: <DAFB8AFF-2F05-4E33-AD7F-FF8B0F760C17@amazon.com> (raw)

Hi,

Currently, if you hold a multixact open long enough to generate an
"oldest multixact is far in the past" message during VACUUM, you may
see the following ERROR:

        WARNING:  oldest multixact is far in the past
        HINT:  Close open transactions with multixacts soon to avoid wraparound problems.
        ERROR:  multixact X from before cutoff Y found to be still running

Upon further inspection, I found that this is because the multixact
limit used in this case is the threshold for which we emit the "oldest
multixact" message.  Instead, I think the multixact limit should be
set to the result of GetOldestMultiXactId(), effectively forcing a
minimum freeze age of zero.  The ERROR itself is emitted by
FreezeMultiXactId() and appears to be a safeguard against problems
like this.

I've attached a patch to set the limit to the oldest multixact instead
of the "safeMxactLimit" in this case.  I'd like to credit Jeremy
Schneider as the original reporter.

Nathan



Attachments:

fix_multixact_limit.patch (application/octet-stream, 1.1K) download diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index e154507ecd..8ba42d79fa 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -893,6 +893,7 @@ vacuum_set_xid_limits(Relation rel, int effective_multixact_freeze_max_age; TransactionId limit; TransactionId safeLimit; + MultiXactId oldestMxact; MultiXactId mxactLimit; MultiXactId safeMxactLimit; @@ -970,7 +971,8 @@ vacuum_set_xid_limits(Relation rel, Assert(mxid_freezemin >= 0); /* compute the cutoff multi, being careful to generate a valid value */ - mxactLimit = GetOldestMultiXactId() - mxid_freezemin; + oldestMxact = GetOldestMultiXactId(); + mxactLimit = oldestMxact - mxid_freezemin; if (mxactLimit < FirstMultiXactId) mxactLimit = FirstMultiXactId; @@ -984,7 +986,7 @@ vacuum_set_xid_limits(Relation rel, ereport(WARNING, (errmsg("oldest multixact is far in the past"), errhint("Close open transactions with multixacts soon to avoid wraparound problems."))); - mxactLimit = safeMxactLimit; + mxactLimit = oldestMxact; } *multiXactCutoff = mxactLimit;

view thread (13+ messages)  latest in thread

Message-ID: <DAFB8AFF-2F05-4E33-AD7F-FF8B0F760C17@amazon.com>
Permalink:  ../DAFB8AFF-2F05-4E33-AD7F-FF8B0F760C17@amazon.com/
Also on:    postgresql.org/message-id/DAFB8AFF-2F05-4E33-AD7F-FF8B0F760C17@amazon.com

 ·  · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: bossartn@amazon.com, schnjere@amazon.com
  Subject: Re: ERROR:  multixact X from before cutoff Y found to be still running
  In-Reply-To: <DAFB8AFF-2F05-4E33-AD7F-FF8B0F760C17@amazon.com>

* 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