Hi, I noticed that the pg_resetwal documentation for the --commit-timestamp-ids (-c) option was missing a multiplier explanation, unlike similar options such as --oldest-transaction-id (-u). There's even a TODO comment in the source asking about this.
This patch adds: - Multiplier value (21824 / 0x5540) for calculating transaction IDs from pg_commit_ts file names - Concrete example showing file 0007 → 0x25480 - Comment documenting the multiplier formula The multiplier is calculated as: SLRU_PAGES_PER_SEGMENT * BLCKSZ / SizeOfCommitTimestampEntry = 32 * 8192 / 12 = 21824 This follows the same documentation pattern used for the -u option. Patch attached. Thanks, Aviral Asthana
From 2e16abf8c0669f7f14d2976eded0fa8e849b5992 Mon Sep 17 00:00:00 2001 From: Aviral Asthana <[email protected]> Date: Sun, 30 Aug 2026 14:43:31 +0530 Subject: [PATCH v1] doc: Add multiplier explanation for pg_resetwal -c option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The documentation for the --commit-timestamp-ids (-c) option in pg_resetwal lacked a multiplier explanation, unlike similar options such as --oldest-transaction-id (-u). This made it difficult for users to correctly calculate transaction IDs from pg_commit_ts file names. This patch adds: - Multiplier value (21824 / 0x5540) derived from SLRU_PAGES_PER_SEGMENT, BLCKSZ, and SizeOfCommitTimestampEntry - Concrete example showing file 0007 → 0x25480 - Comment documenting the multiplier formula This resolves the TODO comment asking whether a multiplier should be documented similar to other options. Co-Authored-By: Claude Sonnet 4.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01LHazXMxCf8CU4EfiHF91je --- doc/src/sgml/ref/pg_resetwal.sgml | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/doc/src/sgml/ref/pg_resetwal.sgml b/doc/src/sgml/ref/pg_resetwal.sgml index 664c525f481..1273e7704c7 100644 --- a/doc/src/sgml/ref/pg_resetwal.sgml +++ b/doc/src/sgml/ref/pg_resetwal.sgml @@ -188,13 +188,18 @@ PostgreSQL documentation A safe value for the oldest transaction ID for which the commit time can be retrieved (first part) can be determined by looking for the numerically smallest file name in the directory - <filename>pg_commit_ts</filename> under the data directory. Conversely, a safe + <filename>pg_commit_ts</filename> under the data directory, and then + multiplying by 21824 (0x5540). Conversely, a safe value for the newest transaction ID for which the commit time can be retrieved (second part) can be determined by looking for the numerically - greatest file name in the same directory. The file names are in - hexadecimal. + greatest file name in the same directory, and then multiplying by 21824 (0x5540). + Note that the file names are in hexadecimal. It is usually easiest to specify + the option values in hexadecimal too. For example, if <filename>0007</filename> + is the smallest entry in <filename>pg_commit_ts</filename>, + <literal>-c 0x25480,...</literal> will work (the multiplier is represented + by 0x5540 following the 0x7). </para> - <!-- XXX: Should there be a multiplier, similar to the other options? --> + <!-- 21824 = SLRU_PAGES_PER_SEGMENT * BLCKSZ / SizeOfCommitTimestampEntry --> </listitem> </varlistentry> -- 2.34.1
