ERROR: multixact X from before cutoff Y found to be still running

Nathan Bossart <bossartn@amazon.com>

From: "Bossart, Nathan" <bossartn@amazon.com>
To: "pgsql-bugs@postgresql.org" <pgsql-bugs@postgresql.org>
Cc: "Schneider, Jeremy" <schnjere@amazon.com>
Date: 2019-09-05T00:37:40Z
Lists: pgsql-bugs, pgsql-hackers

Attachments

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

Commits

  1. Fix bug that could try to freeze running multixacts.

  2. Teach autovacuum about multixact member wraparound.

  3. Separate multixact freezing parameters from xid's