PostgreSQL Source Code  git master
relmapper.h
Go to the documentation of this file.
1 /*-------------------------------------------------------------------------
2  *
3  * relmapper.h
4  * Catalog-to-filenumber mapping
5  *
6  *
7  * Portions Copyright (c) 1996-2024, PostgreSQL Global Development Group
8  * Portions Copyright (c) 1994, Regents of the University of California
9  *
10  * src/include/utils/relmapper.h
11  *
12  *-------------------------------------------------------------------------
13  */
14 #ifndef RELMAPPER_H
15 #define RELMAPPER_H
16 
17 #include "access/xlogreader.h"
18 #include "lib/stringinfo.h"
19 
20 /* ----------------
21  * relmap-related XLOG entries
22  * ----------------
23  */
24 
25 #define XLOG_RELMAP_UPDATE 0x00
26 
27 typedef struct xl_relmap_update
28 {
29  Oid dbid; /* database ID, or 0 for shared map */
30  Oid tsid; /* database's tablespace, or pg_global */
31  int32 nbytes; /* size of relmap data */
34 
35 #define MinSizeOfRelmapUpdate offsetof(xl_relmap_update, data)
36 
37 
38 extern RelFileNumber RelationMapOidToFilenumber(Oid relationId, bool shared);
39 
40 extern Oid RelationMapFilenumberToOid(RelFileNumber filenumber, bool shared);
42  Oid relationId);
43 extern void RelationMapCopy(Oid dbid, Oid tsid, char *srcdbpath,
44  char *dstdbpath);
45 extern void RelationMapUpdateMap(Oid relationId, RelFileNumber fileNumber,
46  bool shared, bool immediate);
47 
48 extern void RelationMapRemoveMapping(Oid relationId);
49 
50 extern void RelationMapInvalidate(bool shared);
51 extern void RelationMapInvalidateAll(void);
52 
53 extern void AtCCI_RelationMap(void);
54 extern void AtEOXact_RelationMap(bool isCommit, bool isParallelWorker);
55 extern void AtPrepare_RelationMap(void);
56 
57 extern void CheckPointRelationMap(void);
58 
59 extern void RelationMapFinishBootstrap(void);
60 
61 extern void RelationMapInitialize(void);
62 extern void RelationMapInitializePhase2(void);
63 extern void RelationMapInitializePhase3(void);
64 
65 extern Size EstimateRelationMapSpace(void);
66 extern void SerializeRelationMap(Size maxSize, char *startAddress);
67 extern void RestoreRelationMap(char *startAddress);
68 
69 extern void relmap_redo(XLogReaderState *record);
70 extern void relmap_desc(StringInfo buf, XLogReaderState *record);
71 extern const char *relmap_identify(uint8 info);
72 
73 #endif /* RELMAPPER_H */
signed int int32
Definition: c.h:483
#define FLEXIBLE_ARRAY_MEMBER
Definition: c.h:387
unsigned char uint8
Definition: c.h:493
size_t Size
Definition: c.h:594
static char * buf
Definition: pg_test_fsync.c:73
unsigned int Oid
Definition: postgres_ext.h:31
RelFileNumber RelationMapOidToFilenumberForDatabase(char *dbpath, Oid relationId)
Definition: relmapper.c:266
Size EstimateRelationMapSpace(void)
Definition: relmapper.c:714
void RelationMapRemoveMapping(Oid relationId)
Definition: relmapper.c:439
void SerializeRelationMap(Size maxSize, char *startAddress)
Definition: relmapper.c:725
void relmap_desc(StringInfo buf, XLogReaderState *record)
Definition: relmapdesc.c:20
void RelationMapCopy(Oid dbid, Oid tsid, char *srcdbpath, char *dstdbpath)
Definition: relmapper.c:293
Oid RelationMapFilenumberToOid(RelFileNumber filenumber, bool shared)
Definition: relmapper.c:219
const char * relmap_identify(uint8 info)
Definition: relmapdesc.c:35
void RelationMapInvalidateAll(void)
Definition: relmapper.c:491
void RestoreRelationMap(char *startAddress)
Definition: relmapper.c:742
struct xl_relmap_update xl_relmap_update
void RelationMapInitialize(void)
Definition: relmapper.c:652
void AtPrepare_RelationMap(void)
Definition: relmapper.c:589
void relmap_redo(XLogReaderState *record)
Definition: relmapper.c:1097
void AtEOXact_RelationMap(bool isCommit, bool isParallelWorker)
Definition: relmapper.c:542
void RelationMapInvalidate(bool shared)
Definition: relmapper.c:469
void RelationMapInitializePhase2(void)
Definition: relmapper.c:672
void RelationMapFinishBootstrap(void)
Definition: relmapper.c:626
RelFileNumber RelationMapOidToFilenumber(Oid relationId, bool shared)
Definition: relmapper.c:166
void RelationMapUpdateMap(Oid relationId, RelFileNumber fileNumber, bool shared, bool immediate)
Definition: relmapper.c:326
void RelationMapInitializePhase3(void)
Definition: relmapper.c:693
void AtCCI_RelationMap(void)
Definition: relmapper.c:505
void CheckPointRelationMap(void)
Definition: relmapper.c:612
Oid RelFileNumber
Definition: relpath.h:25
char data[FLEXIBLE_ARRAY_MEMBER]
Definition: relmapper.h:32