Completed all of the agreed changes for TG:
- WAL writer now runs always, wal_writer_delay = 50ms (default)
- when transaction_guarantee = off we record the latest LSN
- when we set xact hint bits we look at the latest LSN
- added database-level stats to show guaranteed commits
- fsync parameter still present
- removed logic in XLogInsert to test half-full wal buffers
- no DFC cache anymore
- retained LSN pass-down to mark clog to allow WAL-flush-before-write
Passed all of an afternoons testing with pgbench and make check.
make check passes with both settings of transaction_guarantee
Re-eyeballed every line of the patch to catch errors
Operating parameters are:
- transaction_guarantee = on | (off) [USERSET]
Normal transactions are guaranteed to have been written to disk before
we report COMMIT success back to the user. When the transaction
guarantee is relaxed we respond to the user that the transaction has
succeeded and defer the write to disk. The walwriter process will ensure
that any unguaranteed transactions are written to disk after at most two
cycles of the wal_writer_delay. This leaves a short window of data loss
that can occur should the database server crash.
- wal_writer_delay = 50ms (10-1000)
For debug, we have
- trace_commit = off | (on)
- trace_bg_flush = off | (on) - in this patch, defaults to **on**, but
this would be set back to off following review
More extensive docs required. Planning a whole new section to explain
why its OK and what it means etc., plus additional section in Perf Tips.
Code has good comments to explain things.
Logic to signal walwriter exists but is not now ever called. Seemed
worth keeping until review, at least.
--
Simon Riggs
EnterpriseDB http://www.enterprisedb.com