]> granicus.if.org Git - postgresql/commit
Fix some serious bugs in archive recovery, now that bgwriter is active
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 25 Jun 2009 21:36:00 +0000 (21:36 +0000)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Thu, 25 Jun 2009 21:36:00 +0000 (21:36 +0000)
commit7e48b77b1cebb9a43f9fdd6b17128a0ba36132f9
tree2b8e61b091da3e25653610bf892b7f5c19499d27
parente6b8f47047784b1d3053f1c7de2eb90cfa127f20
Fix some serious bugs in archive recovery, now that bgwriter is active
during it:

When bgwriter is active, the startup process can't perform mdsync() correctly
because it won't see the fsync requests accumulated in bgwriter's private
pendingOpsTable. Therefore make bgwriter responsible for the end-of-recovery
checkpoint as well, when it's active.

When bgwriter is active (= archive recovery), the startup process must not
accumulate fsync requests to its own pendingOpsTable, since bgwriter won't
see them there when it performs restartpoints. Make startup process drop its
pendingOpsTable when bgwriter is launched to avoid that.

Update minimum recovery point one last time when leaving archive recovery.
It won't be updated by the end-of-recovery checkpoint because XLogFlush()
sees us as out of recovery already.

This fixes bug #4879 reported by Fujii Masao.
src/backend/access/transam/xlog.c
src/backend/postmaster/bgwriter.c
src/backend/storage/smgr/md.c
src/include/access/xlog.h
src/include/storage/smgr.h