mirror of
https://github.com/postgres/postgres.git
synced 2025-09-02 04:21:28 +03:00
Post-PG 10 beta1 pgindent run
perltidy run not included.
This commit is contained in:
@@ -28,7 +28,7 @@ typedef LogicalOutputPluginWriterWrite LogicalOutputPluginWriterPrepareWrite;
|
||||
|
||||
typedef void (*LogicalOutputPluginWriterUpdateProgress) (
|
||||
struct LogicalDecodingContext *lr,
|
||||
XLogRecPtr Ptr,
|
||||
XLogRecPtr Ptr,
|
||||
TransactionId xid
|
||||
);
|
||||
|
||||
@@ -93,14 +93,14 @@ extern LogicalDecodingContext *CreateInitDecodingContext(char *plugin,
|
||||
XLogPageReadCB read_page,
|
||||
LogicalOutputPluginWriterPrepareWrite prepare_write,
|
||||
LogicalOutputPluginWriterWrite do_write,
|
||||
LogicalOutputPluginWriterUpdateProgress update_progress);
|
||||
LogicalOutputPluginWriterUpdateProgress update_progress);
|
||||
extern LogicalDecodingContext *CreateDecodingContext(
|
||||
XLogRecPtr start_lsn,
|
||||
List *output_plugin_options,
|
||||
XLogPageReadCB read_page,
|
||||
LogicalOutputPluginWriterPrepareWrite prepare_write,
|
||||
LogicalOutputPluginWriterWrite do_write,
|
||||
LogicalOutputPluginWriterUpdateProgress update_progress);
|
||||
LogicalOutputPluginWriterUpdateProgress update_progress);
|
||||
extern void DecodingContextFindStartpoint(LogicalDecodingContext *ctx);
|
||||
extern bool DecodingContextReady(LogicalDecodingContext *ctx);
|
||||
extern void FreeDecodingContext(LogicalDecodingContext *ctx);
|
||||
|
@@ -12,8 +12,8 @@
|
||||
#ifndef LOGICALLAUNCHER_H
|
||||
#define LOGICALLAUNCHER_H
|
||||
|
||||
extern int max_logical_replication_workers;
|
||||
extern int max_sync_workers_per_subscription;
|
||||
extern int max_logical_replication_workers;
|
||||
extern int max_sync_workers_per_subscription;
|
||||
|
||||
extern void ApplyLauncherRegister(void);
|
||||
extern void ApplyLauncherMain(Datum main_arg);
|
||||
|
@@ -31,52 +31,52 @@
|
||||
typedef struct LogicalRepTupleData
|
||||
{
|
||||
/* column values in text format, or NULL for a null value: */
|
||||
char *values[MaxTupleAttributeNumber];
|
||||
char *values[MaxTupleAttributeNumber];
|
||||
/* markers for changed/unchanged column values: */
|
||||
bool changed[MaxTupleAttributeNumber];
|
||||
bool changed[MaxTupleAttributeNumber];
|
||||
} LogicalRepTupleData;
|
||||
|
||||
typedef uint32 LogicalRepRelId;
|
||||
typedef uint32 LogicalRepRelId;
|
||||
|
||||
/* Relation information */
|
||||
typedef struct LogicalRepRelation
|
||||
{
|
||||
/* Info coming from the remote side. */
|
||||
LogicalRepRelId remoteid; /* unique id of the relation */
|
||||
char *nspname; /* schema name */
|
||||
char *relname; /* relation name */
|
||||
int natts; /* number of columns */
|
||||
char **attnames; /* column names */
|
||||
Oid *atttyps; /* column types */
|
||||
char replident; /* replica identity */
|
||||
Bitmapset *attkeys; /* Bitmap of key columns */
|
||||
LogicalRepRelId remoteid; /* unique id of the relation */
|
||||
char *nspname; /* schema name */
|
||||
char *relname; /* relation name */
|
||||
int natts; /* number of columns */
|
||||
char **attnames; /* column names */
|
||||
Oid *atttyps; /* column types */
|
||||
char replident; /* replica identity */
|
||||
Bitmapset *attkeys; /* Bitmap of key columns */
|
||||
} LogicalRepRelation;
|
||||
|
||||
/* Type mapping info */
|
||||
typedef struct LogicalRepTyp
|
||||
{
|
||||
Oid remoteid; /* unique id of the type */
|
||||
char *nspname; /* schema name */
|
||||
char *typname; /* name of the type */
|
||||
Oid typoid; /* local type Oid */
|
||||
Oid remoteid; /* unique id of the type */
|
||||
char *nspname; /* schema name */
|
||||
char *typname; /* name of the type */
|
||||
Oid typoid; /* local type Oid */
|
||||
} LogicalRepTyp;
|
||||
|
||||
/* Transaction info */
|
||||
typedef struct LogicalRepBeginData
|
||||
{
|
||||
XLogRecPtr final_lsn;
|
||||
TimestampTz committime;
|
||||
TransactionId xid;
|
||||
XLogRecPtr final_lsn;
|
||||
TimestampTz committime;
|
||||
TransactionId xid;
|
||||
} LogicalRepBeginData;
|
||||
|
||||
typedef struct LogicalRepCommitData
|
||||
{
|
||||
XLogRecPtr commit_lsn;
|
||||
XLogRecPtr end_lsn;
|
||||
TimestampTz committime;
|
||||
XLogRecPtr commit_lsn;
|
||||
XLogRecPtr end_lsn;
|
||||
TimestampTz committime;
|
||||
} LogicalRepCommitData;
|
||||
|
||||
extern void logicalrep_write_begin(StringInfo out, ReorderBufferTXN *txn);
|
||||
extern void logicalrep_write_begin(StringInfo out, ReorderBufferTXN *txn);
|
||||
extern void logicalrep_read_begin(StringInfo in,
|
||||
LogicalRepBeginData *begin_data);
|
||||
extern void logicalrep_write_commit(StringInfo out, ReorderBufferTXN *txn,
|
||||
@@ -87,20 +87,20 @@ extern void logicalrep_write_origin(StringInfo out, const char *origin,
|
||||
XLogRecPtr origin_lsn);
|
||||
extern char *logicalrep_read_origin(StringInfo in, XLogRecPtr *origin_lsn);
|
||||
extern void logicalrep_write_insert(StringInfo out, Relation rel,
|
||||
HeapTuple newtuple);
|
||||
HeapTuple newtuple);
|
||||
extern LogicalRepRelId logicalrep_read_insert(StringInfo in, LogicalRepTupleData *newtup);
|
||||
extern void logicalrep_write_update(StringInfo out, Relation rel, HeapTuple oldtuple,
|
||||
HeapTuple newtuple);
|
||||
HeapTuple newtuple);
|
||||
extern LogicalRepRelId logicalrep_read_update(StringInfo in,
|
||||
bool *has_oldtuple, LogicalRepTupleData *oldtup,
|
||||
LogicalRepTupleData *newtup);
|
||||
extern void logicalrep_write_delete(StringInfo out, Relation rel,
|
||||
HeapTuple oldtuple);
|
||||
HeapTuple oldtuple);
|
||||
extern LogicalRepRelId logicalrep_read_delete(StringInfo in,
|
||||
LogicalRepTupleData *oldtup);
|
||||
LogicalRepTupleData *oldtup);
|
||||
extern void logicalrep_write_rel(StringInfo out, Relation rel);
|
||||
extern LogicalRepRelation *logicalrep_read_rel(StringInfo in);
|
||||
extern void logicalrep_write_typ(StringInfo out, Oid typoid);
|
||||
extern void logicalrep_read_typ(StringInfo out, LogicalRepTyp *ltyp);
|
||||
|
||||
#endif /* LOGICALREP_PROTO_H */
|
||||
#endif /* LOGICALREP_PROTO_H */
|
||||
|
@@ -16,28 +16,27 @@
|
||||
|
||||
typedef struct LogicalRepRelMapEntry
|
||||
{
|
||||
LogicalRepRelation remoterel; /* key is remoterel.remoteid */
|
||||
LogicalRepRelation remoterel; /* key is remoterel.remoteid */
|
||||
|
||||
/* Mapping to local relation, filled as needed. */
|
||||
Oid localreloid; /* local relation id */
|
||||
Relation localrel; /* relcache entry */
|
||||
AttrNumber *attrmap; /* map of local attributes to
|
||||
* remote ones */
|
||||
bool updatable; /* Can apply updates/deletes? */
|
||||
Oid localreloid; /* local relation id */
|
||||
Relation localrel; /* relcache entry */
|
||||
AttrNumber *attrmap; /* map of local attributes to remote ones */
|
||||
bool updatable; /* Can apply updates/deletes? */
|
||||
|
||||
/* Sync state. */
|
||||
char state;
|
||||
XLogRecPtr statelsn;
|
||||
char state;
|
||||
XLogRecPtr statelsn;
|
||||
} LogicalRepRelMapEntry;
|
||||
|
||||
extern void logicalrep_relmap_update(LogicalRepRelation *remoterel);
|
||||
|
||||
extern LogicalRepRelMapEntry *logicalrep_rel_open(LogicalRepRelId remoteid,
|
||||
LOCKMODE lockmode);
|
||||
LOCKMODE lockmode);
|
||||
extern void logicalrep_rel_close(LogicalRepRelMapEntry *rel,
|
||||
LOCKMODE lockmode);
|
||||
LOCKMODE lockmode);
|
||||
|
||||
extern void logicalrep_typmap_update(LogicalRepTyp *remotetyp);
|
||||
extern Oid logicalrep_typmap_getid(Oid remoteid);
|
||||
extern Oid logicalrep_typmap_getid(Oid remoteid);
|
||||
|
||||
#endif /* LOGICALRELATION_H */
|
||||
|
@@ -17,14 +17,14 @@
|
||||
|
||||
typedef struct PGOutputData
|
||||
{
|
||||
MemoryContext context; /* private memory context for transient
|
||||
* allocations */
|
||||
MemoryContext context; /* private memory context for transient
|
||||
* allocations */
|
||||
|
||||
/* client info */
|
||||
uint32 protocol_version;
|
||||
uint32 protocol_version;
|
||||
|
||||
List *publication_names;
|
||||
List *publications;
|
||||
List *publication_names;
|
||||
List *publications;
|
||||
} PGOutputData;
|
||||
|
||||
#endif /* PGOUTPUT_H */
|
||||
#endif /* PGOUTPUT_H */
|
||||
|
@@ -33,8 +33,8 @@ typedef enum
|
||||
* that started after this.
|
||||
*
|
||||
* Once we reached this we start to collect changes. We cannot apply them
|
||||
* yet, because they might be based on transactions that were still running
|
||||
* when FULL_SNAPSHOT was reached.
|
||||
* yet, because they might be based on transactions that were still
|
||||
* running when FULL_SNAPSHOT was reached.
|
||||
*/
|
||||
SNAPBUILD_FULL_SNAPSHOT = 1,
|
||||
|
||||
|
@@ -48,7 +48,7 @@ typedef struct SyncRepConfigData
|
||||
int config_size; /* total size of this struct, in bytes */
|
||||
int num_sync; /* number of sync standbys that we need to
|
||||
* wait for */
|
||||
uint8 syncrep_method; /* method to choose sync standbys */
|
||||
uint8 syncrep_method; /* method to choose sync standbys */
|
||||
int nmembers; /* number of members in the following list */
|
||||
/* member_names contains nmembers consecutive nul-terminated C strings */
|
||||
char member_names[FLEXIBLE_ARRAY_MEMBER];
|
||||
|
@@ -129,8 +129,8 @@ typedef struct
|
||||
* Latch used by startup process to wake up walreceiver after telling it
|
||||
* where to start streaming (after setting receiveStart and
|
||||
* receiveStartTLI), and also to tell it to send apply feedback to the
|
||||
* primary whenever specially marked commit records are applied.
|
||||
* This is normally mapped to procLatch when walreceiver is running.
|
||||
* primary whenever specially marked commit records are applied. This is
|
||||
* normally mapped to procLatch when walreceiver is running.
|
||||
*/
|
||||
Latch *latch;
|
||||
} WalRcvData;
|
||||
@@ -139,25 +139,23 @@ extern WalRcvData *WalRcv;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
bool logical; /* True if this is logical
|
||||
replication stream, false if
|
||||
physical stream. */
|
||||
char *slotname; /* Name of the replication slot
|
||||
or NULL. */
|
||||
XLogRecPtr startpoint; /* LSN of starting point. */
|
||||
bool logical; /* True if this is logical replication stream,
|
||||
* false if physical stream. */
|
||||
char *slotname; /* Name of the replication slot or NULL. */
|
||||
XLogRecPtr startpoint; /* LSN of starting point. */
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
TimeLineID startpointTLI; /* Starting timeline */
|
||||
} physical;
|
||||
TimeLineID startpointTLI; /* Starting timeline */
|
||||
} physical;
|
||||
struct
|
||||
{
|
||||
uint32 proto_version; /* Logical protocol version */
|
||||
List *publication_names; /* String list of publications */
|
||||
} logical;
|
||||
} proto;
|
||||
uint32 proto_version; /* Logical protocol version */
|
||||
List *publication_names; /* String list of publications */
|
||||
} logical;
|
||||
} proto;
|
||||
} WalRcvStreamOptions;
|
||||
|
||||
struct WalReceiverConn;
|
||||
@@ -171,11 +169,13 @@ typedef struct WalReceiverConn WalReceiverConn;
|
||||
typedef enum
|
||||
{
|
||||
WALRCV_ERROR, /* There was error when executing the query. */
|
||||
WALRCV_OK_COMMAND, /* Query executed utility or replication command. */
|
||||
WALRCV_OK_COMMAND, /* Query executed utility or replication
|
||||
* command. */
|
||||
WALRCV_OK_TUPLES, /* Query returned tuples. */
|
||||
WALRCV_OK_COPY_IN, /* Query started COPY FROM. */
|
||||
WALRCV_OK_COPY_OUT, /* Query started COPY TO. */
|
||||
WALRCV_OK_COPY_BOTH /* Query started COPY BOTH replication protocol. */
|
||||
WALRCV_OK_COPY_BOTH /* Query started COPY BOTH replication
|
||||
* protocol. */
|
||||
} WalRcvExecStatus;
|
||||
|
||||
/*
|
||||
@@ -184,57 +184,57 @@ typedef enum
|
||||
*/
|
||||
typedef struct WalRcvExecResult
|
||||
{
|
||||
WalRcvExecStatus status;
|
||||
char *err;
|
||||
Tuplestorestate *tuplestore;
|
||||
TupleDesc tupledesc;
|
||||
WalRcvExecStatus status;
|
||||
char *err;
|
||||
Tuplestorestate *tuplestore;
|
||||
TupleDesc tupledesc;
|
||||
} WalRcvExecResult;
|
||||
|
||||
/* libpqwalreceiver hooks */
|
||||
typedef WalReceiverConn *(*walrcv_connect_fn) (const char *conninfo, bool logical,
|
||||
const char *appname,
|
||||
char **err);
|
||||
const char *appname,
|
||||
char **err);
|
||||
typedef void (*walrcv_check_conninfo_fn) (const char *conninfo);
|
||||
typedef char *(*walrcv_get_conninfo_fn) (WalReceiverConn *conn);
|
||||
typedef char *(*walrcv_identify_system_fn) (WalReceiverConn *conn,
|
||||
TimeLineID *primary_tli,
|
||||
int *server_version);
|
||||
TimeLineID *primary_tli,
|
||||
int *server_version);
|
||||
typedef void (*walrcv_readtimelinehistoryfile_fn) (WalReceiverConn *conn,
|
||||
TimeLineID tli,
|
||||
char **filename,
|
||||
char **content, int *size);
|
||||
TimeLineID tli,
|
||||
char **filename,
|
||||
char **content, int *size);
|
||||
typedef bool (*walrcv_startstreaming_fn) (WalReceiverConn *conn,
|
||||
const WalRcvStreamOptions *options);
|
||||
const WalRcvStreamOptions *options);
|
||||
typedef void (*walrcv_endstreaming_fn) (WalReceiverConn *conn,
|
||||
TimeLineID *next_tli);
|
||||
TimeLineID *next_tli);
|
||||
typedef int (*walrcv_receive_fn) (WalReceiverConn *conn, char **buffer,
|
||||
pgsocket *wait_fd);
|
||||
pgsocket *wait_fd);
|
||||
typedef void (*walrcv_send_fn) (WalReceiverConn *conn, const char *buffer,
|
||||
int nbytes);
|
||||
int nbytes);
|
||||
typedef char *(*walrcv_create_slot_fn) (WalReceiverConn *conn,
|
||||
const char *slotname, bool temporary,
|
||||
CRSSnapshotAction snapshot_action,
|
||||
XLogRecPtr *lsn);
|
||||
CRSSnapshotAction snapshot_action,
|
||||
XLogRecPtr *lsn);
|
||||
typedef WalRcvExecResult *(*walrcv_exec_fn) (WalReceiverConn *conn,
|
||||
const char *query,
|
||||
const int nRetTypes,
|
||||
const Oid *retTypes);
|
||||
const char *query,
|
||||
const int nRetTypes,
|
||||
const Oid *retTypes);
|
||||
typedef void (*walrcv_disconnect_fn) (WalReceiverConn *conn);
|
||||
|
||||
typedef struct WalReceiverFunctionsType
|
||||
{
|
||||
walrcv_connect_fn walrcv_connect;
|
||||
walrcv_check_conninfo_fn walrcv_check_conninfo;
|
||||
walrcv_get_conninfo_fn walrcv_get_conninfo;
|
||||
walrcv_identify_system_fn walrcv_identify_system;
|
||||
walrcv_readtimelinehistoryfile_fn walrcv_readtimelinehistoryfile;
|
||||
walrcv_startstreaming_fn walrcv_startstreaming;
|
||||
walrcv_endstreaming_fn walrcv_endstreaming;
|
||||
walrcv_receive_fn walrcv_receive;
|
||||
walrcv_send_fn walrcv_send;
|
||||
walrcv_create_slot_fn walrcv_create_slot;
|
||||
walrcv_exec_fn walrcv_exec;
|
||||
walrcv_disconnect_fn walrcv_disconnect;
|
||||
walrcv_connect_fn walrcv_connect;
|
||||
walrcv_check_conninfo_fn walrcv_check_conninfo;
|
||||
walrcv_get_conninfo_fn walrcv_get_conninfo;
|
||||
walrcv_identify_system_fn walrcv_identify_system;
|
||||
walrcv_readtimelinehistoryfile_fn walrcv_readtimelinehistoryfile;
|
||||
walrcv_startstreaming_fn walrcv_startstreaming;
|
||||
walrcv_endstreaming_fn walrcv_endstreaming;
|
||||
walrcv_receive_fn walrcv_receive;
|
||||
walrcv_send_fn walrcv_send;
|
||||
walrcv_create_slot_fn walrcv_create_slot;
|
||||
walrcv_exec_fn walrcv_exec;
|
||||
walrcv_disconnect_fn walrcv_disconnect;
|
||||
} WalReceiverFunctionsType;
|
||||
|
||||
extern PGDLLIMPORT WalReceiverFunctionsType *WalReceiverFunctions;
|
||||
|
@@ -22,71 +22,71 @@
|
||||
typedef struct LogicalRepWorker
|
||||
{
|
||||
/* Time at which this worker was launched. */
|
||||
TimestampTz launch_time;
|
||||
TimestampTz launch_time;
|
||||
|
||||
/* Indicates if this slot is used or free. */
|
||||
bool in_use;
|
||||
bool in_use;
|
||||
|
||||
/* Increased everytime the slot is taken by new worker. */
|
||||
uint16 generation;
|
||||
uint16 generation;
|
||||
|
||||
/* Pointer to proc array. NULL if not running. */
|
||||
PGPROC *proc;
|
||||
PGPROC *proc;
|
||||
|
||||
/* Database id to connect to. */
|
||||
Oid dbid;
|
||||
Oid dbid;
|
||||
|
||||
/* User to use for connection (will be same as owner of subscription). */
|
||||
Oid userid;
|
||||
Oid userid;
|
||||
|
||||
/* Subscription id for the worker. */
|
||||
Oid subid;
|
||||
Oid subid;
|
||||
|
||||
/* Used for initial table synchronization. */
|
||||
Oid relid;
|
||||
char relstate;
|
||||
Oid relid;
|
||||
char relstate;
|
||||
XLogRecPtr relstate_lsn;
|
||||
slock_t relmutex;
|
||||
|
||||
/* Stats. */
|
||||
XLogRecPtr last_lsn;
|
||||
TimestampTz last_send_time;
|
||||
TimestampTz last_recv_time;
|
||||
TimestampTz last_send_time;
|
||||
TimestampTz last_recv_time;
|
||||
XLogRecPtr reply_lsn;
|
||||
TimestampTz reply_time;
|
||||
TimestampTz reply_time;
|
||||
} LogicalRepWorker;
|
||||
|
||||
/* Main memory context for apply worker. Permanent during worker lifetime. */
|
||||
extern MemoryContext ApplyContext;
|
||||
extern MemoryContext ApplyContext;
|
||||
|
||||
/* libpqreceiver connection */
|
||||
extern struct WalReceiverConn *wrconn;
|
||||
extern struct WalReceiverConn *wrconn;
|
||||
|
||||
/* Worker and subscription objects. */
|
||||
extern Subscription *MySubscription;
|
||||
extern LogicalRepWorker *MyLogicalRepWorker;
|
||||
extern Subscription *MySubscription;
|
||||
extern LogicalRepWorker *MyLogicalRepWorker;
|
||||
|
||||
extern bool in_remote_transaction;
|
||||
extern bool in_remote_transaction;
|
||||
extern volatile sig_atomic_t got_SIGHUP;
|
||||
extern volatile sig_atomic_t got_SIGTERM;
|
||||
|
||||
extern void logicalrep_worker_attach(int slot);
|
||||
extern LogicalRepWorker *logicalrep_worker_find(Oid subid, Oid relid,
|
||||
bool only_running);
|
||||
bool only_running);
|
||||
extern void logicalrep_worker_launch(Oid dbid, Oid subid, const char *subname,
|
||||
Oid userid, Oid relid);
|
||||
Oid userid, Oid relid);
|
||||
extern void logicalrep_worker_stop(Oid subid, Oid relid);
|
||||
extern void logicalrep_worker_wakeup(Oid subid, Oid relid);
|
||||
extern void logicalrep_worker_wakeup_ptr(LogicalRepWorker *worker);
|
||||
|
||||
extern int logicalrep_sync_worker_count(Oid subid);
|
||||
extern int logicalrep_sync_worker_count(Oid subid);
|
||||
|
||||
extern void logicalrep_worker_sighup(SIGNAL_ARGS);
|
||||
extern void logicalrep_worker_sigterm(SIGNAL_ARGS);
|
||||
extern char *LogicalRepSyncTableStart(XLogRecPtr *origin_startpos);
|
||||
void process_syncing_tables(XLogRecPtr current_lsn);
|
||||
void process_syncing_tables(XLogRecPtr current_lsn);
|
||||
void invalidate_syncing_table_states(Datum arg, int cacheid,
|
||||
uint32 hashvalue);
|
||||
uint32 hashvalue);
|
||||
|
||||
static inline bool
|
||||
am_tablesync_worker(void)
|
||||
|
Reference in New Issue
Block a user