pg_resetwal --next-transaction-id may cause database failed to restart. - Mailing list pgsql-hackers

From movead.li@highgo.ca
Subject pg_resetwal --next-transaction-id may cause database failed to restart.
Date
Msg-id 20200622143134738140105@highgo.ca
Whole thread Raw
Responses Re: pg_resetwal --next-transaction-id may cause database failed torestart.
List pgsql-hackers
hello hackers,

When I try to use pg_resetwal tool to skip some transaction ID, I get a problem that is
the tool can accept all transaction id I offered with '-x' option, however, the database
may failed to restart because of can not read file under $PGDATA/pg_xact.  For
example, the 'NextXID' in a database is 1000, if you offer '-x 32769' then the database
failed to restart.

I read the document of pg_resetwal tool, it told me to write a 'safe value', but I think
pg_resetwal tool should report it and refuse to exec walreset work when using an unsafe
value, rather than remaining it until the user restarts the database.

I do a initial patch to limit the input, now it accepts transaction in two ways:
1. The transaction ID is on the same CLOG page with the 'NextXID' in pg_control.
2. The transaction ID is right at the end of a CLOG page.
The input limited above can ensure the database restart successfully.

The same situation with multixact and multixact-offset option and I make
the same change in the patch.

Do you think it is an issue?


Regards,
Highgo Software (Canada/China/Pakistan)
URL : www.highgo.ca
EMAIL: mailto:movead(dot)li(at)highgo(dot)ca
Attachment

pgsql-hackers by date:

Previous
From: Amul Sul
Date:
Subject: Re: [Patch] ALTER SYSTEM READ ONLY
Next
From: vignesh C
Date:
Subject: Re: [PATCH] Initial progress reporting for COPY command