Help needed debugging a storage issue

From: Tudor Zaharia <tudor(at)zaharia(dot)ch>
To: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Help needed debugging a storage issue
Date: 2025-12-08 21:44:07
Message-ID: DU2PR09MB54089FABC3436B094AE69B94CFA2A@DU2PR09MB5408.eurprd09.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi, my name is Tudor and I am one of the maintainers of PGlite - PostgreSQL in WASM. I am doing a major refactoring of our codebase and I am a bit stuck in the last step of initdb.

IIUC, my problem is related to the storage layer. I see this in the logs:

2025-12-08 21:38:42.741 +01 [42] WARNING: invalid page in block 0 of relation base/1/1259_fsm; zeroing out page
2025-12-08 21:38:42.882 +01 [42] WARNING: invalid page in block 2 of relation base/1/1259_fsm; zeroing out page
2025-12-08 21:38:42.903 +01 [42] FATAL: invalid page in block 1 of relation base/1/2600
2025-12-08 21:38:42.903 +01 [42] STATEMENT: CREATE VIEW pg_stats_ext WITH (security_barrier) AS <ommited>

base/1/1259_fsm is 1MB
base/1/2600 is 16KB

Looking through the logs ("boot" stage):

DEBUG: building index "pg_toast_2600_index" on table "pg_toast_2600" serially
DEBUG: index "pg_toast_2600_index" can safely use deduplication
...
LOG: checkpoint complete: wrote 227 buffers (1.4%); 0 WAL file(s) added, 0 removed, 0 recycled; write=0.003 s, sync=0.000 s, total=0.004 s; sync files=0, longest=0.000 s, average=0.000 s; distance=711 kB, estimate=711 kB; lsn=0/1B1D38, redo lsn=0/1B1D38

I am using PostgreSQL v17.5 (also did some test on v17.7).

I would appreciate some pointers in debugging this further.

PS: I have been trying various "-c" flags, which got the initialization process further, but invariably fails with 'FATAL: invalid page in block ...' error. These are the flags I am using right now in "boot" stage: '--boot', '-F', '-c', 'log_checkpoints=true', '-X', '1048576', '-d', '4', '-D', '/pglite/data', '-c', 'checkpoint_flush_after=1', '-c', 'fsync=on', '-c', 'synchronous_commit=on', '-c', 'effective_io_concurrency=1', '-c', 'maintenance_io_concurrency=1', '-c','backend_flush_after=1', '-c', 'io_combine_limit=1', '-c', 'ignore_invalid_pages=on', '-c', 'ignore_system_indexes=on', '-c', 'ignore_checksum_failure=on', '-c', 'backend_flush_after=1' that got me to the "VACUUM FREEZE" step of the "single" stage.

Browse pgsql-general by date

  From Date Subject
Next Message Igor Korot 2025-12-09 02:39:46 How do I check for NULL
Previous Message Bernice Southey 2025-12-08 15:35:38 Advent of Code Day 8