pg_resetwal tests, logging, and docs update

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2023-08-30T12:45:30Z
Lists: pgsql-hackers

Attachments

I noticed that pg_resetwal has poor test coverage.  There are some TAP 
tests, but they all run with -n, so they don't actually test the full 
functionality.  (There is a non-dry-run call of pg_resetwal in the 
recovery test suite, but that is incidental.)

So I added a bunch of more tests to test all the different options and 
scenarios.  That also led to adding more documentation about more 
details how some of the options behave, and some tweaks in the program 
output.

It's attached as one big patch, but it could be split into smaller 
pieces, depending what gets agreement.

Commits

  1. doc: pg_resetwal: Add comments how the multipliers are derived

  2. pg_resetwal: Add more tests and test coverage

  3. More consistent behavior of GetDataDirectoryCreatePerm on Windows

  4. doc: Improve documentation about pg_resetwal -f option

  5. pg_resetwal: Use frontend logging API

  6. pg_resetwal: Regroup --help output

  7. pg_resetwal: Improve error with wrong/missing data directory

  8. pg_resetwal: Update an obsolete comment