Hi Sho, Chao,
Thanks for looking. v2 is attached.
Sho Ito wrote:
> I noticed that an invalid value for `--cluster-state` directs the user
> to `--help`, but the help output doesn't list the accepted values.
Agreed, --help lists them now.
Chao Li wrote:
> * Print the previous recorded state alongside the new state before
> updating the control file.
pg_resetwal prints nothing on a real run, so I put this in --dry-run.
It now shows the stored state under "Current pg_control values", and
the new one under "Values to be changed". Both use the names the
option takes.
> * Provide an explicit mode to change only the cluster state, without
> doing other things.
I left this out. A wrong state can be fixed by running pg_resetwal -f
again with the right one. The WAL is already gone by then, so the
second reset loses nothing. I tried in-production, then -f with
shut-down, and the unlogged table kept its rows.
Without the reset it is a different tool, I think. For example,
setting shut-down on a crashed cluster would skip recovery while the
WAL is still there.
> With a non-default --cluster-state value, a cluster can enter
> recovery on its next startup and have its unlogged tables emptied.
> That affects the database contents, so this paragraph might need to
> be updated accordingly.
Right. That paragraph now says it does not hold when --cluster-state
sets a state other than shut-down.
Thanks,
Shihao