Re: pg_resetwal tests, logging, and docs update
Aleksander Alekseev <aleksander@timescale.com>
From: Aleksander Alekseev <aleksander@timescale.com>
To: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: Peter Eisentraut <peter@eisentraut.org>
Date: 2023-09-13T14:36:21Z
Lists: pgsql-hackers
Hi,
> 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.
All in all the patch looks OK but I have a couple of nitpicks.
```
+ working on a data directory in an unclean shutdown state or with a corrupt
+ control file.
```
```
+ After running this command on a data directory with corrupted WAL or a
+ corrupt control file,
```
I'm not a native English speaker but shouldn't it be "corruptED control file"?
```
+ Force <command>pg_resetwal</command> to proceed even in situations where
+ it could be dangerous,
```
"where" is probably fine but wouldn't "WHEN it could be dangerous" be better?
```
+ // FIXME: why 2?
if (set_oldest_commit_ts_xid < 2 &&
```
Should we rewrite this to < FrozenTransactionId ?
```
+$mult = 32 * $blcksz * 4; # FIXME
```
Unless I'm missing something this $mult value is not used. Is it
really needed here?
--
Best regards,
Aleksander Alekseev
Commits
-
doc: pg_resetwal: Add comments how the multipliers are derived
- 6ceec8a1fe7a 17.0 landed
-
pg_resetwal: Add more tests and test coverage
- 7b5275eec3a5 17.0 landed
-
More consistent behavior of GetDataDirectoryCreatePerm on Windows
- 2c7c6c417fe6 17.0 landed
-
doc: Improve documentation about pg_resetwal -f option
- 5f1b00e64aee 17.0 landed
-
pg_resetwal: Use frontend logging API
- a11d8e10f226 17.0 landed
-
pg_resetwal: Regroup --help output
- b5da1b3a939a 17.0 landed
-
pg_resetwal: Improve error with wrong/missing data directory
- 1d863c250461 17.0 landed
-
pg_resetwal: Update an obsolete comment
- 7273945cafa7 17.0 landed