Fix some serious bugs in archive recovery, now that bgwriter is active
commit4d5c56ea1807bf4d5c5c47fc52c09bcf51fafacb
authorheikki <heikki>
Thu, 25 Jun 2009 21:36:00 +0000 (25 21:36 +0000)
committerheikki <heikki>
Thu, 25 Jun 2009 21:36:00 +0000 (25 21:36 +0000)
tree1315d2364970f9a5aa792395950d93abb494c6da
parent78272c07328bfdabc7780d4374247563d21fe3a3
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