diff --git a/db/pglite/build/README.md b/db/pglite/build/README.md index 64333cbac..4f185daa7 100644 --- a/db/pglite/build/README.md +++ b/db/pglite/build/README.md @@ -11,6 +11,11 @@ electric-sql/postgres-pglite, branch REL_17_5_WASM-pglite). Clone it to /tmp/pgl - `wasi-c.diff` — makes the forced `-fPIC` in the compiler wrapper overridable (`PGLITE_PIC`). NOTE: the matching `-fpic` in `postgresql-src/wasm-build/build-pgcore.sh` (cloned at build time) is not covered by a diff here; the `-fno-pic` experiment did not take effect and is unmeasured. +- `max_wal_size.diff` — goes in `patches/postgresql-pglite/` as `src-include-port-wasm_common.h.zz-max-wal-size.diff` + (it must sort after pglite4j's own `wasm_common.h` patch). PGlite splices a fixed list of `-c` settings into + every start (`WASM_PGOPTS`), never reads `postgresql.conf`/`postgresql.auto.conf` on restart, and `pg_reload_conf()` + is a no-op without a postmaster, so `ALTER SYSTEM` cannot change anything. Adding `max_wal_size=128MB` to that + list caps `pg_wal` at ~130 MB instead of 1 GB once a `CHECKPOINT` runs. - `message_context_reset.diff` — goes in `patches/pglite-wasm/`. The fork stubs `MemoryContextResetAndDeleteChildren` (removed in PostgreSQL 17) as an empty macro, so `MessageContext` is never reset and every wire message leaks its parse/plan state (~10 KB per statement; a library scan reached 15 GB). The patch maps it to `MemoryContextReset`. diff --git a/db/pglite/build/max_wal_size.diff b/db/pglite/build/max_wal_size.diff new file mode 100644 index 000000000..7cad93a93 --- /dev/null +++ b/db/pglite/build/max_wal_size.diff @@ -0,0 +1,9 @@ +--- a/src/include/port/wasm_common.h ++++ b/src/include/port/wasm_common.h +@@ -63,5 +63,6 @@ + "-c", "synchronous_commit=on",\ + "-c", "wal_buffers=4MB",\ + "-c", "min_wal_size=80MB",\ ++ "-c", "max_wal_size=128MB",\ + "-c", "shared_buffers=128MB" + diff --git a/db/pglite/pglite.wasi.gz b/db/pglite/pglite.wasi.gz index ce1f6c6a8..9b959ed53 100644 Binary files a/db/pglite/pglite.wasi.gz and b/db/pglite/pglite.wasi.gz differ