Never store 0 as the nextMXact

Before this commit, when multixid wraparound happens,
MultiXactState->nextMXact goes to 0, which is invalid. All the readers
need to deal with that possibility and skip over the 0. That's
error-prone and we've missed it a few times in the past. This commit
changes the responsibility so that all the writers of
MultiXactState->nextMXact skip over the zero already, and readers can
trust that it's never 0.

We were already doing that for MultiXactState->oldestMultiXactId; none
of its writers would set it to 0. ReadMultiXactIdRange() was
nevertheless checking for that possibility. For clarity, remove that
check.

Reviewed-by: Ashutosh Bapat <[email protected]>
Reviewed-by: Maxim Orlov <[email protected]>
Discussion: 
https://www.postgresql.org/message-id/[email protected]

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/87a350e1f284bb99591f9185c0be0ae28899f38a

Modified Files
--------------
src/backend/access/transam/multixact.c | 79 ++++++++--------------------------
src/bin/pg_resetwal/pg_resetwal.c      |  2 +
src/bin/pg_resetwal/t/001_basic.pl     | 15 ++-----
3 files changed, 24 insertions(+), 72 deletions(-)

Reply via email to