Remove rm_safe_restartpoint machinery.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 18 Mar 2014 20:06:59 +0000 (22:06 +0200)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 18 Mar 2014 20:10:35 +0000 (22:10 +0200)
It is no longer used, none of the resource managers have multi-record
actions that would make it unsafe to perform a restartpoint.

Also don't allow rm_cleanup to write WAL records, it's also no longer
required. Move the call to rm_cleanup routines to make it more symmetric
with rm_startup.

src/backend/access/transam/rmgr.c
src/backend/access/transam/xlog.c
src/include/access/rmgr.h
src/include/access/rmgrlist.h
src/include/access/xlog_internal.h

index 41d437932cdfd08a884da595876d0655b8adebf9..c0a7a6f1a57cde6988ce66690de1c300d5c4fcac 100644 (file)
@@ -25,8 +25,8 @@
 #include "utils/relmapper.h"
 
 /* must be kept in sync with RmgrData definition in xlog_internal.h */
-#define PG_RMGR(symname,name,redo,desc,startup,cleanup,restartpoint) \
-   { name, redo, desc, startup, cleanup, restartpoint },
+#define PG_RMGR(symname,name,redo,desc,startup,cleanup) \
+   { name, redo, desc, startup, cleanup },
 
 const RmgrData RmgrTable[RM_MAX_ID + 1] = {
 #include "access/rmgrlist.h"
index 5f3c3b9be1ecd493e4840dced87f9a056ee640a8..a2577314bcf7deecd9516161a5b80b408ed09a55 100644 (file)
@@ -7143,6 +7143,13 @@ StartupXLOG(void)
                recoveryPausesHere();
            }
 
+           /* Allow resource managers to do any required cleanup. */
+           for (rmid = 0; rmid <= RM_MAX_ID; rmid++)
+           {
+               if (RmgrTable[rmid].rm_cleanup != NULL)
+                   RmgrTable[rmid].rm_cleanup();
+           }
+
            ereport(LOG,
                    (errmsg("redo done at %X/%X",
                         (uint32) (ReadRecPtr >> 32), (uint32) ReadRecPtr)));
@@ -7368,27 +7375,6 @@ StartupXLOG(void)
 
    if (InRecovery)
    {
-       int         rmid;
-
-       /*
-        * Resource managers might need to write WAL records, eg, to record
-        * index cleanup actions.  So temporarily enable XLogInsertAllowed in
-        * this process only.
-        */
-       LocalSetXLogInsertAllowed();
-
-       /*
-        * Allow resource managers to do any required cleanup.
-        */
-       for (rmid = 0; rmid <= RM_MAX_ID; rmid++)
-       {
-           if (RmgrTable[rmid].rm_cleanup != NULL)
-               RmgrTable[rmid].rm_cleanup();
-       }
-
-       /* Disallow XLogInsert again */
-       LocalXLogInsertAllowed = -1;
-
        /*
         * Perform a checkpoint to update all our recovery activity to disk.
         *
@@ -8750,31 +8736,9 @@ CheckPointGuts(XLogRecPtr checkPointRedo, int flags)
 static void
 RecoveryRestartPoint(const CheckPoint *checkPoint)
 {
-   int         rmid;
-
    /* use volatile pointer to prevent code rearrangement */
    volatile XLogCtlData *xlogctl = XLogCtl;
 
-   /*
-    * Is it safe to restartpoint?  We must ask each of the resource managers
-    * whether they have any partial state information that might prevent a
-    * correct restart from this point.  If so, we skip this opportunity, but
-    * return at the next checkpoint record for another try.
-    */
-   for (rmid = 0; rmid <= RM_MAX_ID; rmid++)
-   {
-       if (RmgrTable[rmid].rm_safe_restartpoint != NULL)
-           if (!(RmgrTable[rmid].rm_safe_restartpoint()))
-           {
-               elog(trace_recovery(DEBUG2),
-                    "RM %d not safe to record restart point at %X/%X",
-                    rmid,
-                    (uint32) (checkPoint->redo >> 32),
-                    (uint32) checkPoint->redo);
-               return;
-           }
-   }
-
    /*
     * Also refrain from creating a restartpoint if we have seen any
     * references to non-existent pages. Restarting recovery from the
index 23650c3301eb867fdcf53eb39aa19a3ee538609a..51110b9cfc6ae7699d22e77e0b5c90728927af6f 100644 (file)
@@ -19,7 +19,7 @@ typedef uint8 RmgrId;
  * Note: RM_MAX_ID must fit in RmgrId; widening that type will affect the XLOG
  * file format.
  */
-#define PG_RMGR(symname,name,redo,desc,startup,cleanup,restartpoint) \
+#define PG_RMGR(symname,name,redo,desc,startup,cleanup) \
    symname,
 
 typedef enum RmgrIds
index d9ee57d6da26127a2f003a308850233331eb6d68..6449eeaf90ec92d2821c3f418670046c86d9f7cd 100644 (file)
  * Changes to this list possibly need a XLOG_PAGE_MAGIC bump.
  */
 
-/* symbol name, textual name, redo, desc, startup, cleanup, restartpoint */
-PG_RMGR(RM_XLOG_ID, "XLOG", xlog_redo, xlog_desc, NULL, NULL, NULL)
-PG_RMGR(RM_XACT_ID, "Transaction", xact_redo, xact_desc, NULL, NULL, NULL)
-PG_RMGR(RM_SMGR_ID, "Storage", smgr_redo, smgr_desc, NULL, NULL, NULL)
-PG_RMGR(RM_CLOG_ID, "CLOG", clog_redo, clog_desc, NULL, NULL, NULL)
-PG_RMGR(RM_DBASE_ID, "Database", dbase_redo, dbase_desc, NULL, NULL, NULL)
-PG_RMGR(RM_TBLSPC_ID, "Tablespace", tblspc_redo, tblspc_desc, NULL, NULL, NULL)
-PG_RMGR(RM_MULTIXACT_ID, "MultiXact", multixact_redo, multixact_desc, NULL, NULL, NULL)
-PG_RMGR(RM_RELMAP_ID, "RelMap", relmap_redo, relmap_desc, NULL, NULL, NULL)
-PG_RMGR(RM_STANDBY_ID, "Standby", standby_redo, standby_desc, NULL, NULL, NULL)
-PG_RMGR(RM_HEAP2_ID, "Heap2", heap2_redo, heap2_desc, NULL, NULL, NULL)
-PG_RMGR(RM_HEAP_ID, "Heap", heap_redo, heap_desc, NULL, NULL, NULL)
-PG_RMGR(RM_BTREE_ID, "Btree", btree_redo, btree_desc, NULL, NULL, NULL)
-PG_RMGR(RM_HASH_ID, "Hash", hash_redo, hash_desc, NULL, NULL, NULL)
-PG_RMGR(RM_GIN_ID, "Gin", gin_redo, gin_desc, gin_xlog_startup, gin_xlog_cleanup, NULL)
-PG_RMGR(RM_GIST_ID, "Gist", gist_redo, gist_desc, gist_xlog_startup, gist_xlog_cleanup, NULL)
-PG_RMGR(RM_SEQ_ID, "Sequence", seq_redo, seq_desc, NULL, NULL, NULL)
-PG_RMGR(RM_SPGIST_ID, "SPGist", spg_redo, spg_desc, spg_xlog_startup, spg_xlog_cleanup, NULL)
+/* symbol name, textual name, redo, desc, startup, cleanup */
+PG_RMGR(RM_XLOG_ID, "XLOG", xlog_redo, xlog_desc, NULL, NULL)
+PG_RMGR(RM_XACT_ID, "Transaction", xact_redo, xact_desc, NULL, NULL)
+PG_RMGR(RM_SMGR_ID, "Storage", smgr_redo, smgr_desc, NULL, NULL)
+PG_RMGR(RM_CLOG_ID, "CLOG", clog_redo, clog_desc, NULL, NULL)
+PG_RMGR(RM_DBASE_ID, "Database", dbase_redo, dbase_desc, NULL, NULL)
+PG_RMGR(RM_TBLSPC_ID, "Tablespace", tblspc_redo, tblspc_desc, NULL, NULL)
+PG_RMGR(RM_MULTIXACT_ID, "MultiXact", multixact_redo, multixact_desc, NULL, NULL)
+PG_RMGR(RM_RELMAP_ID, "RelMap", relmap_redo, relmap_desc, NULL, NULL)
+PG_RMGR(RM_STANDBY_ID, "Standby", standby_redo, standby_desc, NULL, NULL)
+PG_RMGR(RM_HEAP2_ID, "Heap2", heap2_redo, heap2_desc, NULL, NULL)
+PG_RMGR(RM_HEAP_ID, "Heap", heap_redo, heap_desc, NULL, NULL)
+PG_RMGR(RM_BTREE_ID, "Btree", btree_redo, btree_desc, NULL, NULL)
+PG_RMGR(RM_HASH_ID, "Hash", hash_redo, hash_desc, NULL, NULL)
+PG_RMGR(RM_GIN_ID, "Gin", gin_redo, gin_desc, gin_xlog_startup, gin_xlog_cleanup)
+PG_RMGR(RM_GIST_ID, "Gist", gist_redo, gist_desc, gist_xlog_startup, gist_xlog_cleanup)
+PG_RMGR(RM_SEQ_ID, "Sequence", seq_redo, seq_desc, NULL, NULL)
+PG_RMGR(RM_SPGIST_ID, "SPGist", spg_redo, spg_desc, spg_xlog_startup, spg_xlog_cleanup)
index ec021fe29aeac5d3b93148241cf21f55d46c5c7c..708ce22a5d9c3e775d0f325a0bc8f983285cb5d6 100644 (file)
@@ -248,7 +248,6 @@ typedef struct RmgrData
    void        (*rm_desc) (StringInfo buf, uint8 xl_info, char *rec);
    void        (*rm_startup) (void);
    void        (*rm_cleanup) (void);
-   bool        (*rm_safe_restartpoint) (void);
 } RmgrData;
 
 extern const RmgrData RmgrTable[];