-
Notifications
You must be signed in to change notification settings - Fork 14
/
gpdb.h
100 lines (84 loc) · 3.03 KB
/
gpdb.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
89
90
91
92
93
94
95
96
97
98
99
100
/*-------------------------------------------------------------------------
*
* gpdb.h
* Dump append only table
*
*
* Copyright (c) 2021 VMware, Inc. or its affiliates
* SPDX-License-Identifier: GPL-2.0-or-later
*
*
*-------------------------------------------------------------------------
*/
#ifndef GPDB_H
#define GPDB_H
#include "cdb/cdbappendonlyam.h"
typedef enum gpdbSwitches
{
GPDB_APPEND_ONLY = 0x00000001, /* -z: AppendOnly files */
GPDB_HAS_CHECKSUM = 0x00000002, /* -M: Checksum is present */
#if 0
/* FIXME: GPDB: retire -p */
GPDB_DEPARSE_HEAP = 0x00000004, /* -p: Deparse heap data */
#endif
#if 0
/* FIXME: GPDB: how to use -D and -B? */
GPDB_DISABLE_DEAD_TUPLE = 0x00000008, /* -D: Disable dead tuple info */
GPDB_BLOCK_DIRECTORY_FILE = 0x00000010, /* -B: Deparse the input block
* directory file */
#endif
GPDB_COMPRESS_TYPE_MASK = 0x000f0000, /* -T: Compress type */
GPDB_COMPRESS_TYPE_NONE = 0x00000000, /* Default compress type */
GPDB_COMPRESS_TYPE_ZLIB = 0x00010000,
GPDB_COMPRESS_TYPE_QUICKLZ = 0x00020000,
GPDB_COMPRESS_TYPE_ZSTD = 0x00030000,
GPDB_COMPRESS_LEVEL_MASK = 0x00f00000, /* -L: Compress level */
GPDB_COMPRESS_LEVEL_SHIFT = 20,
GPDB_COMPRESS_LEVEL_MAX = (GPDB_COMPRESS_LEVEL_MASK >>
GPDB_COMPRESS_LEVEL_SHIFT),
GPDB_COMPRESS_LEVEL_DEFAULT= 1 << GPDB_COMPRESS_LEVEL_SHIFT,
GPDB_ORIENTATION_MASK = 0x01000000, /* -O: Orientation of AO */
GPDB_ORIENTATION_ROW = 0x00000000, /* Default orientation */
GPDB_ORIENTATION_COLUMN = 0x01000000,
} gpdbSwitches;
extern unsigned int gpdbOptions;
#define GPDB_SET_OPTION(_x,_y,_z,_m) \
if (_x & _m) \
{ \
rc = OPT_RC_DUPLICATE; \
duplicateSwitch = _z; \
} \
else \
_x |= _y;
#define GPDB_GET_COMPRESS_TYPE(_x) \
(_x & GPDB_COMPRESS_TYPE_MASK)
#define GPDB_SET_COMPRESS_TYPE(_x,_y) \
GPDB_SET_OPTION(_x,_y,'T',GPDB_COMPRESS_TYPE_MASK)
#define GPDB_GET_COMPRESS_LEVEL(_x) \
((_x & GPDB_COMPRESS_LEVEL_MASK) >> GPDB_COMPRESS_LEVEL_SHIFT)
#define GPDB_SET_COMPRESS_LEVEL(_x,_y) \
GPDB_SET_OPTION(_x, \
_y << GPDB_COMPRESS_LEVEL_SHIFT, \
'L', \
GPDB_COMPRESS_LEVEL_MASK)
#define GPDB_GET_ORIENTATION(_x) \
(_x & GPDB_ORIENTATION_MASK)
#define GPDB_SET_ORIENTATION(_x,_y) \
GPDB_SET_OPTION(_x, _y, 'O', GPDB_ORIENTATION_MASK)
#if GP_VERSION_NUM < 60000
#define HeapTupleHeaderGetRawXmax(tup) HeapTupleHeaderGetXmax(tup)
static inline uint64
PageGetLSN_(Page page)
{
XLogRecPtr pageLSN = PageGetLSN(page);
return (((uint64) pageLSN.xlogid) << 32) | pageLSN.xrecoff;
}
#endif /* GP_VERSION_NUM */
#if 0
extern void file_set_dirs(char *file);
extern void build_tupdesc(void);
extern void fixupItemBlock(Page page, unsigned int blockSize, unsigned int bytesToFormat);
extern void DeparseMiniPage(struct Minipage *minipage, uint32 numEntries, char *deparsed);
#endif
extern int DumpAppendOnlyFileContents(FILE *fp, unsigned int blockSize);
#endif /* GPDB_H */