Skip to content

Commit 59a5ab3

Browse files
committed
Remove rm_safe_restartpoint machinery.
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.
1 parent 1d3b258 commit 59a5ab3

File tree

5 files changed

+28
-65
lines changed

5 files changed

+28
-65
lines changed

src/backend/access/transam/rmgr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
#include "utils/relmapper.h"
2626

2727
/* must be kept in sync with RmgrData definition in xlog_internal.h */
28-
#define PG_RMGR(symname,name,redo,desc,startup,cleanup,restartpoint) \
29-
{ name, redo, desc, startup, cleanup, restartpoint },
28+
#define PG_RMGR(symname,name,redo,desc,startup,cleanup) \
29+
{ name, redo, desc, startup, cleanup },
3030

3131
const RmgrData RmgrTable[RM_MAX_ID + 1] = {
3232
#include "access/rmgrlist.h"

src/backend/access/transam/xlog.c

Lines changed: 7 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -7143,6 +7143,13 @@ StartupXLOG(void)
71437143
recoveryPausesHere();
71447144
}
71457145

7146+
/* Allow resource managers to do any required cleanup. */
7147+
for (rmid = 0; rmid <= RM_MAX_ID; rmid++)
7148+
{
7149+
if (RmgrTable[rmid].rm_cleanup != NULL)
7150+
RmgrTable[rmid].rm_cleanup();
7151+
}
7152+
71467153
ereport(LOG,
71477154
(errmsg("redo done at %X/%X",
71487155
(uint32) (ReadRecPtr >> 32), (uint32) ReadRecPtr)));
@@ -7368,27 +7375,6 @@ StartupXLOG(void)
73687375

73697376
if (InRecovery)
73707377
{
7371-
int rmid;
7372-
7373-
/*
7374-
* Resource managers might need to write WAL records, eg, to record
7375-
* index cleanup actions. So temporarily enable XLogInsertAllowed in
7376-
* this process only.
7377-
*/
7378-
LocalSetXLogInsertAllowed();
7379-
7380-
/*
7381-
* Allow resource managers to do any required cleanup.
7382-
*/
7383-
for (rmid = 0; rmid <= RM_MAX_ID; rmid++)
7384-
{
7385-
if (RmgrTable[rmid].rm_cleanup != NULL)
7386-
RmgrTable[rmid].rm_cleanup();
7387-
}
7388-
7389-
/* Disallow XLogInsert again */
7390-
LocalXLogInsertAllowed = -1;
7391-
73927378
/*
73937379
* Perform a checkpoint to update all our recovery activity to disk.
73947380
*
@@ -8750,31 +8736,9 @@ CheckPointGuts(XLogRecPtr checkPointRedo, int flags)
87508736
static void
87518737
RecoveryRestartPoint(const CheckPoint *checkPoint)
87528738
{
8753-
int rmid;
8754-
87558739
/* use volatile pointer to prevent code rearrangement */
87568740
volatile XLogCtlData *xlogctl = XLogCtl;
87578741

8758-
/*
8759-
* Is it safe to restartpoint? We must ask each of the resource managers
8760-
* whether they have any partial state information that might prevent a
8761-
* correct restart from this point. If so, we skip this opportunity, but
8762-
* return at the next checkpoint record for another try.
8763-
*/
8764-
for (rmid = 0; rmid <= RM_MAX_ID; rmid++)
8765-
{
8766-
if (RmgrTable[rmid].rm_safe_restartpoint != NULL)
8767-
if (!(RmgrTable[rmid].rm_safe_restartpoint()))
8768-
{
8769-
elog(trace_recovery(DEBUG2),
8770-
"RM %d not safe to record restart point at %X/%X",
8771-
rmid,
8772-
(uint32) (checkPoint->redo >> 32),
8773-
(uint32) checkPoint->redo);
8774-
return;
8775-
}
8776-
}
8777-
87788742
/*
87798743
* Also refrain from creating a restartpoint if we have seen any
87808744
* references to non-existent pages. Restarting recovery from the

src/include/access/rmgr.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ typedef uint8 RmgrId;
1919
* Note: RM_MAX_ID must fit in RmgrId; widening that type will affect the XLOG
2020
* file format.
2121
*/
22-
#define PG_RMGR(symname,name,redo,desc,startup,cleanup,restartpoint) \
22+
#define PG_RMGR(symname,name,redo,desc,startup,cleanup) \
2323
symname,
2424

2525
typedef enum RmgrIds

src/include/access/rmgrlist.h

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -24,21 +24,21 @@
2424
* Changes to this list possibly need a XLOG_PAGE_MAGIC bump.
2525
*/
2626

27-
/* symbol name, textual name, redo, desc, startup, cleanup, restartpoint */
28-
PG_RMGR(RM_XLOG_ID, "XLOG", xlog_redo, xlog_desc, NULL, NULL, NULL)
29-
PG_RMGR(RM_XACT_ID, "Transaction", xact_redo, xact_desc, NULL, NULL, NULL)
30-
PG_RMGR(RM_SMGR_ID, "Storage", smgr_redo, smgr_desc, NULL, NULL, NULL)
31-
PG_RMGR(RM_CLOG_ID, "CLOG", clog_redo, clog_desc, NULL, NULL, NULL)
32-
PG_RMGR(RM_DBASE_ID, "Database", dbase_redo, dbase_desc, NULL, NULL, NULL)
33-
PG_RMGR(RM_TBLSPC_ID, "Tablespace", tblspc_redo, tblspc_desc, NULL, NULL, NULL)
34-
PG_RMGR(RM_MULTIXACT_ID, "MultiXact", multixact_redo, multixact_desc, NULL, NULL, NULL)
35-
PG_RMGR(RM_RELMAP_ID, "RelMap", relmap_redo, relmap_desc, NULL, NULL, NULL)
36-
PG_RMGR(RM_STANDBY_ID, "Standby", standby_redo, standby_desc, NULL, NULL, NULL)
37-
PG_RMGR(RM_HEAP2_ID, "Heap2", heap2_redo, heap2_desc, NULL, NULL, NULL)
38-
PG_RMGR(RM_HEAP_ID, "Heap", heap_redo, heap_desc, NULL, NULL, NULL)
39-
PG_RMGR(RM_BTREE_ID, "Btree", btree_redo, btree_desc, NULL, NULL, NULL)
40-
PG_RMGR(RM_HASH_ID, "Hash", hash_redo, hash_desc, NULL, NULL, NULL)
41-
PG_RMGR(RM_GIN_ID, "Gin", gin_redo, gin_desc, gin_xlog_startup, gin_xlog_cleanup, NULL)
42-
PG_RMGR(RM_GIST_ID, "Gist", gist_redo, gist_desc, gist_xlog_startup, gist_xlog_cleanup, NULL)
43-
PG_RMGR(RM_SEQ_ID, "Sequence", seq_redo, seq_desc, NULL, NULL, NULL)
44-
PG_RMGR(RM_SPGIST_ID, "SPGist", spg_redo, spg_desc, spg_xlog_startup, spg_xlog_cleanup, NULL)
27+
/* symbol name, textual name, redo, desc, startup, cleanup */
28+
PG_RMGR(RM_XLOG_ID, "XLOG", xlog_redo, xlog_desc, NULL, NULL)
29+
PG_RMGR(RM_XACT_ID, "Transaction", xact_redo, xact_desc, NULL, NULL)
30+
PG_RMGR(RM_SMGR_ID, "Storage", smgr_redo, smgr_desc, NULL, NULL)
31+
PG_RMGR(RM_CLOG_ID, "CLOG", clog_redo, clog_desc, NULL, NULL)
32+
PG_RMGR(RM_DBASE_ID, "Database", dbase_redo, dbase_desc, NULL, NULL)
33+
PG_RMGR(RM_TBLSPC_ID, "Tablespace", tblspc_redo, tblspc_desc, NULL, NULL)
34+
PG_RMGR(RM_MULTIXACT_ID, "MultiXact", multixact_redo, multixact_desc, NULL, NULL)
35+
PG_RMGR(RM_RELMAP_ID, "RelMap", relmap_redo, relmap_desc, NULL, NULL)
36+
PG_RMGR(RM_STANDBY_ID, "Standby", standby_redo, standby_desc, NULL, NULL)
37+
PG_RMGR(RM_HEAP2_ID, "Heap2", heap2_redo, heap2_desc, NULL, NULL)
38+
PG_RMGR(RM_HEAP_ID, "Heap", heap_redo, heap_desc, NULL, NULL)
39+
PG_RMGR(RM_BTREE_ID, "Btree", btree_redo, btree_desc, NULL, NULL)
40+
PG_RMGR(RM_HASH_ID, "Hash", hash_redo, hash_desc, NULL, NULL)
41+
PG_RMGR(RM_GIN_ID, "Gin", gin_redo, gin_desc, gin_xlog_startup, gin_xlog_cleanup)
42+
PG_RMGR(RM_GIST_ID, "Gist", gist_redo, gist_desc, gist_xlog_startup, gist_xlog_cleanup)
43+
PG_RMGR(RM_SEQ_ID, "Sequence", seq_redo, seq_desc, NULL, NULL)
44+
PG_RMGR(RM_SPGIST_ID, "SPGist", spg_redo, spg_desc, spg_xlog_startup, spg_xlog_cleanup)

src/include/access/xlog_internal.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,6 @@ typedef struct RmgrData
248248
void (*rm_desc) (StringInfo buf, uint8 xl_info, char *rec);
249249
void (*rm_startup) (void);
250250
void (*rm_cleanup) (void);
251-
bool (*rm_safe_restartpoint) (void);
252251
} RmgrData;
253252

254253
extern const RmgrData RmgrTable[];

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy