comparison-results.txt.txt
text/plain
Filename: comparison-results.txt.txt
Type: text/plain
Part: 0
PostgreSQL patch #6680 — pg_switch_wal() return value comparison
================================================================
Date: 2026-06-11T06:18:07Z
Host: Microsoft Windows 11 Pro 10.0.26200 (native, MSYS2/UCRT64 toolchain)
Compiler: gcc.exe (Rev5, Built by MSYS2 project) 16.1.0
Source: github.com/postgres/postgres (master mirror)
Commit: 9d141466ff "Undo thinko in commit e78d1d6d4." (server version 19beta1)
Build: ./configure --enable-cassert --enable-debug --without-icu
--without-readline CFLAGS="-O0 -ggdb"
Patch-base suitability check:
The pre-patch code (`EndPos = StartPos + SizeOfXLogRecord;`) is present
verbatim in xlog.c on this commit, i.e. the v2 patch is NOT yet merged
into master, so this HEAD is a valid UNPATCHED baseline.
v2 patch applied with `git apply` (clean, --check passed):
1 file changed, 9 insertions(+), 2 deletions(-) [xlog.c only]
Both clusters were initialized identically:
initdb -U postgres -E UTF8 --no-locale ; pg_ctl -o "-p 55432" start
Identical SQL sequence was run against each build on a fresh cluster.
===== UNPATCHED MASTER =====
commit: 9d141466ff Undo thinko in commit e78d1d6d4.
branch: master
server version: 19beta1
CREATE TABLE
INSERT 0 1000
before_switch
---------------
0/017CF958
(1 row)
switch_1 | after_1
------------+------------
0/017CF970 | 0/02000000
(1 row)
switch_2 | after_2
------------+------------
0/02000000 | 0/02000000
(1 row)
switch_3 | after_3
------------+------------
0/02000000 | 0/02000000
(1 row)
server log scan: log clean (no FATAL/PANIC/assertion)
===== V2 PATCHED =====
commit: 9d141466ff Undo thinko in commit e78d1d6d4.
branch: review-6680-v2
server version: 19beta1
CREATE TABLE
INSERT 0 1000
before_switch
---------------
0/017CF958
(1 row)
switch_1 | after_1
------------+------------
0/017CF970 | 0/02000000
(1 row)
switch_2 | after_2
------------+------------
0/02000000 | 0/02000000
(1 row)
switch_3 | after_3
------------+------------
0/02000000 | 0/02000000
(1 row)
server log scan: log clean (no FATAL/PANIC/assertion)
===== REGRESSION TESTS (v2 patched build) =====
make check NO_LOCALE=1 → "All 245 tests passed." (exit 0)
===== CONCLUSION =====
Both builds show the same externally observable pattern:
- mid-segment switch returns the logical end of the XLOG_SWITCH record
(before_switch 0/017CF958 + SizeOfXLogRecord(24) = 0/017CF970; identical
in both builds, since MAXALIGN(SizeOfXLogRecord) == SizeOfXLogRecord here)
- pg_current_wal_lsn() then reports the next segment boundary (0/02000000)
- repeated switches at an exact segment boundary are idempotent no-ops
(both return value and pg_current_wal_lsn() stay pinned at 0/02000000)
In this run the two builds returned byte-for-byte identical LSNs at every
step (deterministic because the clusters were initialized with identical
options on the same commit).
=> v2 does not change the SQL-visible semantics of pg_switch_wal().
The compatibility concern about external tools depending on the
returned LSN is not triggered by this patch in the common
(non-page-boundary) case exercised here.