This commit introduced a problem with wal_keep_segments:
commit dfda6ebaec6763090fb78b458a979b558c50b39b
Date: Sun Jun 24 18:06:38 2012 +0300
Don't waste the last segment of each 4GB logical log file.
in a side window do: watch "ls -lrt /tmp/data/pg_xlog"
dfda6ebaec/bin/initdb -D /tmp/data
dfda6ebaec/bin/pg_ctl -D /tmp/data -l logfile restart -o "--fsync=off --wal_keep_segments=20"
createdb
pgbench -i -s10
pgbench -T3600
xlogs accumulate until there are about 26 of them. Then all of a sudden they drop down to 11 of them. Then it builds back up to around 26, and seems to stay there permanently.
At some point when it is over-pruning and recycling, it recyles the log files that are still needed for recovery, and if the database crashes at that point it will not recover because it can't find either the primary secondary checkpoint records.
Cheers,
Jeff