1/*-------------------------------------------------------------------------
2 *
3 * relmapper.h
4 * Catalog-to-filenode mapping
5 *
6 *
7 * Portions Copyright (c) 1996-2019, 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
27typedef 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 */
32 char data[FLEXIBLE_ARRAY_MEMBER];
33} xl_relmap_update;
34
35#define MinSizeOfRelmapUpdate offsetof(xl_relmap_update, data)
36
37
38extern Oid RelationMapOidToFilenode(Oid relationId, bool shared);
39
40extern Oid RelationMapFilenodeToOid(Oid relationId, bool shared);
41
42extern void RelationMapUpdateMap(Oid relationId, Oid fileNode, bool shared,
43 bool immediate);
44
45extern void RelationMapRemoveMapping(Oid relationId);
46
47extern void RelationMapInvalidate(bool shared);
48extern void RelationMapInvalidateAll(void);
49
50extern void AtCCI_RelationMap(void);
51extern void AtEOXact_RelationMap(bool isCommit, bool isParallelWorker);
52extern void AtPrepare_RelationMap(void);
53
54extern void CheckPointRelationMap(void);
55
56extern void RelationMapFinishBootstrap(void);
57
58extern void RelationMapInitialize(void);
59extern void RelationMapInitializePhase2(void);
60extern void RelationMapInitializePhase3(void);
61
62extern Size EstimateRelationMapSpace(void);
63extern void SerializeRelationMap(Size maxSize, char *startAddress);
64extern void RestoreRelationMap(char *startAddress);
65
66extern void relmap_redo(XLogReaderState *record);
67extern void relmap_desc(StringInfo buf, XLogReaderState *record);
68extern const char *relmap_identify(uint8 info);
69
70#endif /* RELMAPPER_H */
71