Hello
0002 misses an old summary that ends exactly at the switch point
The 0003 commit message says that a summary written before a minor
update "can still be on disk ... and the check added by the previous
commit still refuses it". That holds for a summary that crosses the
switch point, but not when the old summarizer was in the middle of a
summary at promotion time:
* It has already added the records past the target to its block reference table
* then summarizer_read_local_xlog_page() moves read_upto back to the
switch point
* SummarizeWAL() hits end of WAL and writes the file as [start, switch
point], with the truncation from past the target inside it
* ws->end_lsn == tli_end_lsn, so 0002 doesn't flag it
Reproduction steps:
primary: summarize_wal = on, autovacuum = off
CREATE TABLE t (id int, v int, pad text STORAGE PLAIN);
INSERT INTO t SELECT g, 0, repeat('x', 4096) FROM generate_series(1,4) g;
VACUUM t;
pg_basebackup -D full -c fast -R
UPDATE t SET v = 1 WHERE id = 4;
SELECT pg_current_wal_insert_lsn(); -- recovery_target_lsn for the standby
standby from the same backup: summarize_wal = on,
recovery_target_action = 'pause', running the old summarizer
primary: DELETE FROM t WHERE id > 1; VACUUM t;
wait for the standby to pause and its summarizer to catch up with the
received WAL
pg_ctl -m immediate stop the primary, promote the standby
restart the standby on 18 + v5, pg_basebackup
--incremental=full/backup_manifest, pg_combinebackup
Result:
00000002.history: 1 0/030051F0 after LSN 0/03004168
timeline 1 summary: 0/02000028 - 0/030051F0, limit block 1 for t
restored rows: 1|0 2|0 3|0 4|0
promoted server rows: 1|0 2|0 3|0 4|1