Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit a095c69

Browse files
knizhnikkelvich
authored andcommitted
Partly merge with new version of pglogical_output plugin
1 parent fb58fcd commit a095c69

File tree

5 files changed

+46
-12
lines changed

5 files changed

+46
-12
lines changed

pglogical_config.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
#error <postgres.h> must be included first
66
#endif
77

8+
#include "nodes/pg_list.h"
9+
#include "pglogical_output.h"
10+
811
inline static bool
912
server_float4_byval(void)
1013
{
@@ -45,9 +48,6 @@ server_bigendian(void)
4548
#endif
4649
}
4750

48-
typedef struct List List;
49-
typedef struct PGLogicalOutputData PGLogicalOutputData;
50-
5151
extern int process_parameters(List *options, PGLogicalOutputData *data);
5252

5353
extern List * prepare_startup_message(PGLogicalOutputData *data);

pglogical_hooks.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
/* public interface for hooks */
77
#include "pglogical_output/hooks.h"
8+
#include "pglogical_output.h"
89

910
extern void load_hooks(PGLogicalOutputData *data);
1011

pglogical_output/compat.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#ifndef PG_LOGICAL_COMPAT_H
2+
#define PG_LOGICAL_COMPAT_H
3+
4+
#include "pg_config.h"
5+
6+
/* 9.4 lacks replication origins */
7+
#if PG_VERSION_NUM >= 90500
8+
#define HAVE_REPLICATION_ORIGINS
9+
#else
10+
/* To allow the same signature on hooks in 9.4 */
11+
typedef uint16 RepOriginId;
12+
#define InvalidRepOriginId 0
13+
#endif
14+
15+
/* 9.4 lacks PG_UINT32_MAX */
16+
#ifndef PG_UINT32_MAX
17+
#define PG_UINT32_MAX UINT32_MAX
18+
#endif
19+
20+
#ifndef PG_INT32_MAX
21+
#define PG_INT32_MAX INT32_MAX
22+
#endif
23+
24+
#ifndef PG_INT32_MIN
25+
#define PG_INT32_MIN INT32_MIN
26+
#endif
27+
28+
#endif

pglogical_output/hooks.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
#include "utils/palloc.h"
88
#include "replication/reorderbuffer.h"
99

10-
struct PGLogicalOutputData;
11-
typedef struct PGLogicalOutputData PGLogicalOutputData;
10+
#include "pglogical_output/compat.h"
1211

1312
/*
1413
* This header is to be included by extensions that implement pglogical output
@@ -43,6 +42,8 @@ struct PGLogicalRowFilterArgs
4342
void *private_data;
4443
Relation changed_rel;
4544
enum ReorderBufferChangeType change_type;
45+
/* detailed row change event from logical decoding */
46+
ReorderBufferChange* change;
4647
};
4748

4849
typedef bool (*pglogical_row_filter_hook_fn)(struct PGLogicalRowFilterArgs *args);

pglogical_proto.h

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,26 @@
1313
#ifndef PG_LOGICAL_PROTO_H
1414
#define PG_LOGICAL_PROTO_H
1515

16-
typedef void (*pglogical_write_rel_fn)(StringInfo out, PGLogicalOutputData *data, Relation rel);
16+
struct PGLogicalOutputData;
17+
struct PGLRelMetaCacheEntry;
1718

18-
typedef void (*pglogical_write_begin_fn)(StringInfo out, PGLogicalOutputData *data,
19+
typedef void (*pglogical_write_rel_fn)(StringInfo out, struct PGLogicalOutputData *data,
20+
Relation rel/*, struct PGLRelMetaCacheEntry *cache_entry*/);
21+
22+
typedef void (*pglogical_write_begin_fn)(StringInfo out, struct PGLogicalOutputData *data,
1923
ReorderBufferTXN *txn);
20-
typedef void (*pglogical_write_commit_fn)(StringInfo out, PGLogicalOutputData *data,
24+
typedef void (*pglogical_write_commit_fn)(StringInfo out, struct PGLogicalOutputData *data,
2125
ReorderBufferTXN *txn, XLogRecPtr commit_lsn);
2226

2327
typedef void (*pglogical_write_origin_fn)(StringInfo out, const char *origin,
2428
XLogRecPtr origin_lsn);
2529

26-
typedef void (*pglogical_write_insert_fn)(StringInfo out, PGLogicalOutputData *data,
30+
typedef void (*pglogical_write_insert_fn)(StringInfo out, struct PGLogicalOutputData *data,
2731
Relation rel, HeapTuple newtuple);
28-
typedef void (*pglogical_write_update_fn)(StringInfo out, PGLogicalOutputData *data,
32+
typedef void (*pglogical_write_update_fn)(StringInfo out, struct PGLogicalOutputData *data,
2933
Relation rel, HeapTuple oldtuple,
3034
HeapTuple newtuple);
31-
typedef void (*pglogical_write_delete_fn)(StringInfo out, PGLogicalOutputData *data,
35+
typedef void (*pglogical_write_delete_fn)(StringInfo out, struct PGLogicalOutputData *data,
3236
Relation rel, HeapTuple oldtuple);
3337

3438
typedef void (*write_startup_message_fn)(StringInfo out, List *msg);
@@ -45,7 +49,7 @@ typedef struct PGLogicalProtoAPI
4549
pglogical_write_update_fn write_update;
4650
pglogical_write_delete_fn write_delete;
4751
pglogical_setup_hooks_fn setup_hooks;
48-
write_startup_message_fn write_startup_message;
52+
write_startup_message_fn write_startup_message;
4953
} PGLogicalProtoAPI;
5054

5155

0 commit comments

Comments
 (0)