-
Notifications
You must be signed in to change notification settings - Fork 16
/
ptrack.h
88 lines (79 loc) · 2.02 KB
/
ptrack.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*-------------------------------------------------------------------------
*
* ptrack.h
* header for ptrack map for tracking updates of relation's pages
*
*
* Copyright (c) 2019-2022, Postgres Professional
* Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* src/include/storage/ptrack.h
*
*-------------------------------------------------------------------------
*/
#ifndef PTRACK_H
#define PTRACK_H
#include "access/xlogdefs.h"
#include "storage/block.h"
#include "storage/buf.h"
#if PG_VERSION_NUM >= 160000
#include "storage/relfilelocator.h"
#else
#include "storage/relfilenode.h"
#endif
#include "storage/smgr.h"
#include "utils/relcache.h"
/* Ptrack version as a string */
#define PTRACK_VERSION "2.4"
/* Ptrack version as a number */
#define PTRACK_VERSION_NUM 240
/* Last ptrack version that changed map file format */
#define PTRACK_MAP_FILE_VERSION_NUM 220
#if PG_VERSION_NUM >= 160000
#define RelFileNode RelFileLocator
#define RelFileNodeBackend RelFileLocatorBackend
#define nodeDb(node) (node).dbOid
#define nodeSpc(node) (node).spcOid
#define nodeRel(node) (node).relNumber
#define nodeOf(ndbck) (ndbck).locator
#else
#define nodeDb(node) (node).dbNode
#define nodeSpc(node) (node).spcNode
#define nodeRel(node) (node).relNode
#define nodeOf(ndbck) (ndbck).node
#endif
#if PG_VERSION_NUM >= 170000
#define InvalidBackendId INVALID_PROC_NUMBER
#endif
/*
* Structure identifying block on the disk.
*/
typedef struct PtBlockId
{
RelFileNode relnode;
ForkNumber forknum;
BlockNumber blocknum;
} PtBlockId;
/*
* Context for ptrack_get_pagemapset set returning function.
*/
typedef struct PtScanCtx
{
XLogRecPtr lsn;
PtBlockId bid;
uint32 relsize;
char *relpath;
List *filelist;
} PtScanCtx;
/*
* List item type for ptrack data files list.
*/
typedef struct PtrackFileList_i
{
RelFileNode relnode;
ForkNumber forknum;
int segno;
char *path;
} PtrackFileList_i;
#endif /* PTRACK_H */