Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5a1cd89

Browse files
committed
Split out list of XLog resource managers
The new rmgrlist.h header, containing all necessary dataabout built-in resource managers, allows other pieces of code toaccess them.In particular, this allows a future pg_xlogdump program to extractrm_desc function pointers, without having to keep a duplicate list ofthem.
1 parentcb9b66d commit5a1cd89

File tree

4 files changed

+68
-38
lines changed

4 files changed

+68
-38
lines changed

‎src/backend/access/transam/rmgr.c

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,10 @@
2424
#include"storage/standby.h"
2525
#include"utils/relmapper.h"
2626

27+
/* must be kept in sync with RmgrData definition in xlog_internal.h */
28+
#definePG_RMGR(symname,name,redo,desc,startup,cleanup,restartpoint) \
29+
{ name, redo, desc, startup, cleanup, restartpoint },
2730

2831
constRmgrDataRmgrTable[RM_MAX_ID+1]= {
29-
{"XLOG",xlog_redo,xlog_desc,NULL,NULL,NULL},
30-
{"Transaction",xact_redo,xact_desc,NULL,NULL,NULL},
31-
{"Storage",smgr_redo,smgr_desc,NULL,NULL,NULL},
32-
{"CLOG",clog_redo,clog_desc,NULL,NULL,NULL},
33-
{"Database",dbase_redo,dbase_desc,NULL,NULL,NULL},
34-
{"Tablespace",tblspc_redo,tblspc_desc,NULL,NULL,NULL},
35-
{"MultiXact",multixact_redo,multixact_desc,NULL,NULL,NULL},
36-
{"RelMap",relmap_redo,relmap_desc,NULL,NULL,NULL},
37-
{"Standby",standby_redo,standby_desc,NULL,NULL,NULL},
38-
{"Heap2",heap2_redo,heap2_desc,NULL,NULL,NULL},
39-
{"Heap",heap_redo,heap_desc,NULL,NULL,NULL},
40-
{"Btree",btree_redo,btree_desc,btree_xlog_startup,btree_xlog_cleanup,btree_safe_restartpoint},
41-
{"Hash",hash_redo,hash_desc,NULL,NULL,NULL},
42-
{"Gin",gin_redo,gin_desc,gin_xlog_startup,gin_xlog_cleanup,gin_safe_restartpoint},
43-
{"Gist",gist_redo,gist_desc,gist_xlog_startup,gist_xlog_cleanup,NULL},
44-
{"Sequence",seq_redo,seq_desc,NULL,NULL,NULL},
45-
{"SPGist",spg_redo,spg_desc,spg_xlog_startup,spg_xlog_cleanup,NULL}
32+
#include"access/rmgrlist.h"
4633
};

‎src/include/access/rmgr.h

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,23 @@ typedef uint8 RmgrId;
1313
/*
1414
* Built-in resource managers
1515
*
16-
* Note: RM_MAX_ID could be as much as 255 without breaking the XLOG file
17-
* format, but we keep it small to minimize the size of RmgrTable[].
16+
* The actual numerical values for each rmgr ID are defined by the order
17+
* of entries in rmgrlist.h.
18+
*
19+
* Note: RM_MAX_ID must fit in RmgrId; widening that type will affect the XLOG
20+
* file format.
1821
*/
19-
#defineRM_XLOG_ID0
20-
#defineRM_XACT_ID1
21-
#defineRM_SMGR_ID2
22-
#defineRM_CLOG_ID3
23-
#defineRM_DBASE_ID4
24-
#defineRM_TBLSPC_ID5
25-
#defineRM_MULTIXACT_ID6
26-
#defineRM_RELMAP_ID7
27-
#defineRM_STANDBY_ID8
28-
#defineRM_HEAP2_ID9
29-
#defineRM_HEAP_ID10
30-
#defineRM_BTREE_ID11
31-
#defineRM_HASH_ID12
32-
#defineRM_GIN_ID13
33-
#defineRM_GIST_ID14
34-
#defineRM_SEQ_ID15
35-
#defineRM_SPGIST_ID16
22+
#definePG_RMGR(symname,name,redo,desc,startup,cleanup,restartpoint) \
23+
symname,
24+
25+
typedefenumRmgrIds
26+
{
27+
#include "access/rmgrlist.h"
28+
RM_NEXT_ID
29+
}RmgrIds;
30+
31+
#undef PG_RMGR
3632

37-
#defineRM_MAX_IDRM_SPGIST_ID
33+
#defineRM_MAX_ID(RM_NEXT_ID - 1)
3834

3935
#endif/* RMGR_H */

‎src/include/access/rmgrlist.h

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*---------------------------------------------------------------------------
2+
* rmgrlist.h
3+
*
4+
* The resource manager list is kept in its own source file for possible
5+
* use by automatic tools.The exact representation of a rmgr is determined
6+
* by the PG_RMGR macro, which is not defined in this file; it can be
7+
* defined by the caller for special purposes.
8+
*
9+
* Portions Copyright (c) 1996-2013, PostgreSQL Global Development Group
10+
* Portions Copyright (c) 1994, Regents of the University of California
11+
*
12+
* src/include/access/rmgrlist.h
13+
*---------------------------------------------------------------------------
14+
*/
15+
16+
/* there is deliberately not an #ifndef RMGRLIST_H here */
17+
18+
/*
19+
* List of resource manager entries. Note that order of entries defines the
20+
* numerical values of each rmgr's ID, which is stored in WAL records. New
21+
* entries should be added at the end, to avoid changing IDs of existing
22+
* entries.
23+
*
24+
* Changes to this list possibly need a XLOG_PAGE_MAGIC bump.
25+
*/
26+
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,btree_xlog_startup,btree_xlog_cleanup,btree_safe_restartpoint)
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,gin_safe_restartpoint)
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)

‎src/include/access/xlog_internal.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,10 @@ struct XLogRecord;
233233
/*
234234
* Method table for resource managers.
235235
*
236-
* RmgrTable[] is indexed by RmgrId values (see rmgr.h).
236+
* This struct must be kept in sync with the PG_RMGR definition in
237+
* rmgr.c.
238+
*
239+
* RmgrTable[] is indexed by RmgrId values (see rmgrlist.h).
237240
*/
238241
typedefstructRmgrData
239242
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp