pgsql: Fix some serious bugs in archive recovery, now that bgwriter is - Mailing list pgsql-committers

From heikki@postgresql.org (Heikki Linnakangas)
Subject pgsql: Fix some serious bugs in archive recovery, now that bgwriter is
Date
Msg-id 20090625213601.0ABF6753336@cvs.postgresql.org
Whole thread Raw
List pgsql-committers
Log Message:
-----------
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.

Modified Files:
--------------
    pgsql/src/backend/access/transam:
        xlog.c (r1.343 -> r1.344)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/transam/xlog.c?r1=1.343&r2=1.344)
    pgsql/src/backend/postmaster:
        bgwriter.c (r1.60 -> r1.61)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/postmaster/bgwriter.c?r1=1.60&r2=1.61)
    pgsql/src/backend/storage/smgr:
        md.c (r1.146 -> r1.147)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/storage/smgr/md.c?r1=1.146&r2=1.147)
    pgsql/src/include/access:
        xlog.h (r1.91 -> r1.92)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/access/xlog.h?r1=1.91&r2=1.92)
    pgsql/src/include/storage:
        smgr.h (r1.67 -> r1.68)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/include/storage/smgr.h?r1=1.67&r2=1.68)

pgsql-committers by date:

Previous
From: petere@postgresql.org (Peter Eisentraut)
Date:
Subject: pgsql: Man pages back to lowercase names, with additional fixup to make
Next
From: tgl@postgresql.org (Tom Lane)
Date:
Subject: pgsql: Add __attribute__((format_arg(1))) to the declaration of