-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbdr_seq.h
79 lines (57 loc) · 2.43 KB
/
bdr_seq.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
#ifndef BDR_SEQ_H
#define BDR_SEQ_H
struct CreateSeqStmt;
struct AlterSeqStmt;
#ifdef HAVE_SEQAM
extern Oid BdrVotesRelid;
extern Oid BdrSeqamOid;
extern Oid BdrSequenceValuesRelid;
extern Oid BdrSequenceElectionsRelid;
static inline bool
isBdrGlobalSeqRelId(Oid relid)
{
return relid == BdrSequenceValuesRelid ||
relid == BdrSequenceElectionsRelid ||
relid == BdrVotesRelid;
}
extern void bdr_sequencer_set_nnodes(int nnodes);
extern void bdr_sequencer_shmem_init(int sequencers);
extern void bdr_sequencer_init(int seq_slot, int nnodes);
extern void bdr_sequencer_lock(void);
extern bool bdr_sequencer_vote(void);
extern void bdr_sequencer_tally(void);
extern bool bdr_sequencer_start_elections(void);
extern void bdr_sequencer_fill_sequences(void);
extern void bdr_sequencer_wakeup(void);
extern void bdr_schedule_eoxact_sequencer_wakeup(void);
extern int bdr_sequencer_get_next_free_slot(void);
extern void filter_CreateBdrSeqStmt(struct CreateSeqStmt *stmt);
extern void filter_AlterBdrSeqStmt(struct AlterSeqStmt *stmt, Oid seqoid);
extern void bdr_maintain_seq_schema(Oid schema_oid);
#else
#define GLOBAL_SEQ_ERROR() global_seq_error(__func__, __LINE__)
inline static void global_seq_error(const char *func, int line)
{
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("BDR global sequences not supported on this install (in %s:%d)",
func, line)));
};
/* Do-nothing stubs for when global sequences disabled */
static inline bool isBdrGlobalSeqRelId(Oid relid) { return false; }
inline static void bdr_sequencer_set_nnodes(Size nnodes) { };
inline static void bdr_sequencer_shmem_init(int sequencers) { };
inline static void bdr_sequencer_init(int seq_slot, Size nnodes) { };
inline static void bdr_sequencer_lock(void) { };
inline static bool bdr_sequencer_vote(void) { return false; };
inline static void bdr_sequencer_tally(void) { };
inline static bool bdr_sequencer_start_elections(void) { return false; };
inline static void bdr_sequencer_fill_sequences(void) { };
inline static void bdr_sequencer_wakeup(void) { };
inline static void bdr_schedule_eoxact_sequencer_wakeup(void) { };
inline static int bdr_sequencer_get_next_free_slot(void) { return -1; };
inline static void filter_CreateBdrSeqStmt(struct CreateSeqStmt *stmt) { };
inline static void filter_AlterBdrSeqStmt(struct AlterSeqStmt *stmt, Oid seqoid) { };
inline static void bdr_maintain_seq_schema(Oid schema_oid) { };
#endif /* HAVE_SEQAM */
#endif