|
PostgreSQL Source Code git master
|
#include "postgres_fe.h"#include <dirent.h>#include <limits.h>#include <sys/select.h>#include <sys/stat.h>#include <unistd.h>#include "common/file_perm.h"#include "common/logging.h"#include "fe_utils/option_utils.h"#include "getopt_long.h"#include "libpq-fe.h"#include "libpq/pqsignal.h"#include "libpq/protocol.h"#include "pqexpbuffer.h"#include "streamutil.h"
Go to the source code of this file.
Macros | |
| #define | RECONNECT_SLEEP_TIME 5 |
Enumerations | |
| enum | StreamStopReason { STREAM_STOP_NONE , STREAM_STOP_END_OF_WAL , STREAM_STOP_KEEPALIVE , STREAM_STOP_SIGNAL } |
Functions | |
| static void | usage (void) |
| static void | StreamLogicalLog (void) |
| static bool | flushAndSendFeedback (PGconn *conn, TimestampTz *now) |
| static void | prepareToTerminate (PGconn *conn, XLogRecPtr endpos, StreamStopReason reason, XLogRecPtr lsn) |
| static bool | sendFeedback (PGconn *conn, TimestampTz now, bool force, bool replyRequested) |
| static void | disconnect_atexit (void) |
| static void | OutputFsync (TimestampTz now) |
| static void | sigexit_handler (SIGNAL_ARGS) |
| static void | sighup_handler (SIGNAL_ARGS) |
| int | main (int argc, char **argv) |
Variables | |
| static char * | outfile = NULL |
| static int | verbose = 0 |
| static bool | two_phase = false |
| static bool | failover = false |
| static int | noloop = 0 |
| static int | standby_message_timeout = 10 * 1000 |
| static int | fsync_interval = 10 * 1000 |
| static XLogRecPtr | startpos = InvalidXLogRecPtr |
| static XLogRecPtr | endpos = InvalidXLogRecPtr |
| static bool | do_create_slot = false |
| static bool | slot_exists_ok = false |
| static bool | do_start_slot = false |
| static bool | do_drop_slot = false |
| static char * | replication_slot = NULL |
| static char ** | options |
| static size_t | noptions = 0 |
| static const char * | plugin = "test_decoding" |
| static int | outfd = -1 |
| static volatile sig_atomic_t | time_to_abort = false |
| static volatile sig_atomic_t | stop_reason = STREAM_STOP_NONE |
| static volatile sig_atomic_t | output_reopen = false |
| static bool | output_isfile |
| static TimestampTz | output_last_fsync = -1 |
| static bool | output_needs_fsync = false |
| static XLogRecPtr | output_written_lsn = InvalidXLogRecPtr |
| static XLogRecPtr | output_fsync_lsn = InvalidXLogRecPtr |
| #define RECONNECT_SLEEP_TIME 5 |
Definition at line 32 of file pg_recvlogical.c.
| Enumerator | |
|---|---|
| STREAM_STOP_NONE | |
| STREAM_STOP_END_OF_WAL | |
| STREAM_STOP_KEEPALIVE | |
| STREAM_STOP_SIGNAL | |
Definition at line 34 of file pg_recvlogical.c.
Definition at line 181 of file pg_recvlogical.c.
References conn, fb(), and PQfinish().
Referenced by main().
|
static |
Definition at line 1055 of file pg_recvlogical.c.
References conn, feGetCurrentTimestamp(), now(), OutputFsync(), and sendFeedback().
Referenced by StreamLogicalLog().
Definition at line 693 of file pg_recvlogical.c.
References conn, CreateReplicationSlot(), data, dbgetpassword, dbhost, dbname, dbport, dbuser, disconnect_atexit(), do_create_slot, do_drop_slot, do_start_slot, DropReplicationSlot(), endpos, failover, fb(), feGetCurrentTimestamp(), fsync_interval, get_progname(), GetConnection(), getopt_long(), InvalidXLogRecPtr, no_argument, noloop, noptions, optarg, optind, option_parse_int(), outfd, outfile, OutputFsync(), pg_fatal, pg_log_error, pg_log_error_hint, pg_log_info, pg_logging_init(), pg_mode_mask, pg_realloc(), pg_strdup(), PG_TEXTDOMAIN, pg_usleep(), plugin, pqsignal, progname, RECONNECT_SLEEP_TIME, replication_slot, required_argument, RunIdentifySystem(), set_pglocale_pgservice(), sigexit_handler(), SIGHUP, sighup_handler(), slot_exists_ok, standby_message_timeout, startpos, StreamLogicalLog(), time_to_abort, two_phase, usage(), val, verbose, and XLogRecPtrIsValid.
|
static |
Definition at line 188 of file pg_recvlogical.c.
References fsync, fsync_interval, now(), outfd, outfile, output_fsync_lsn, output_isfile, output_last_fsync, output_needs_fsync, output_written_lsn, pg_fatal, and startpos.
Referenced by flushAndSendFeedback(), main(), and StreamLogicalLog().
|
static |
Definition at line 1071 of file pg_recvlogical.c.
References Assert, conn, endpos, fb(), LSN_FORMAT_ARGS, pg_log_info, PQflush(), PQputCopyEnd(), STREAM_STOP_END_OF_WAL, STREAM_STOP_KEEPALIVE, STREAM_STOP_NONE, STREAM_STOP_SIGNAL, verbose, and XLogRecPtrIsValid.
Referenced by StreamLogicalLog().
Definition at line 129 of file pg_recvlogical.c.
References conn, fb(), fe_sendint64(), InvalidXLogRecPtr, len, LSN_FORMAT_ARGS, now(), output_fsync_lsn, output_written_lsn, pg_log_error, pg_log_info, PQerrorMessage(), PQflush(), PQputCopyData(), PqReplMsg_StandbyStatusUpdate, replication_slot, startpos, and verbose.
Referenced by flushAndSendFeedback(), and StreamLogicalLog().
|
static |
Definition at line 675 of file pg_recvlogical.c.
References stop_reason, STREAM_STOP_SIGNAL, and time_to_abort.
Referenced by main().
|
static |
Definition at line 685 of file pg_recvlogical.c.
References output_reopen.
Referenced by main().
Definition at line 221 of file pg_recvlogical.c.
References appendPQExpBuffer(), appendPQExpBufferChar(), appendPQExpBufferStr(), close, conn, copybuf, createPQExpBuffer(), PQExpBufferData::data, destroyPQExpBuffer(), EINTR, endpos, error(), fb(), fe_recvint64(), feGetCurrentTimestamp(), feTimestampDifference(), feTimestampDifferenceExceeds(), flushAndSendFeedback(), fstat, fsync_interval, GetConnection(), i, InvalidXLogRecPtr, LSN_FORMAT_ARGS, Max, noptions, now(), outfd, outfile, output_isfile, output_last_fsync, output_needs_fsync, output_reopen, output_written_lsn, OutputFsync(), PG_BINARY, pg_log_error, pg_log_info, PGRES_COMMAND_OK, PGRES_COPY_BOTH, PGRES_COPY_OUT, PQclear, PQconsumeInput(), PQerrorMessage(), PQexec(), PQfinish(), PQfreemem(), PQgetCopyData(), PQgetResult, PqReplMsg_Keepalive, PqReplMsg_WALData, PQresultErrorMessage, PQresultStatus, PQsocket(), prepareToTerminate(), replication_slot, resetPQExpBuffer(), S_IRUSR, S_ISREG, S_IWUSR, select, sendFeedback(), standby_message_timeout, startpos, stop_reason, STREAM_STOP_END_OF_WAL, STREAM_STOP_KEEPALIVE, time_to_abort, verbose, write, and XLogRecPtrIsValid.
Referenced by main().
Definition at line 82 of file pg_recvlogical.c.
References _, fb(), fsync_interval, plugin, printf, progname, and standby_message_timeout.
Referenced by main().
Definition at line 52 of file pg_recvlogical.c.
Referenced by main().
Definition at line 55 of file pg_recvlogical.c.
Referenced by main().
Definition at line 54 of file pg_recvlogical.c.
Referenced by main().
|
static |
Definition at line 51 of file pg_recvlogical.c.
Referenced by main(), prepareToTerminate(), and StreamLogicalLog().
Definition at line 46 of file pg_recvlogical.c.
Referenced by AlterReplicationSlot(), create_logical_replication_slot(), CreateReplicationSlot(), CreateReplicationSlot(), libpqrcv_alter_slot(), libpqrcv_create_slot(), main(), parseCreateReplSlotOptions(), pg_create_logical_replication_slot(), ReplicationSlotAlter(), and ReplicationSlotCreate().
|
static |
Definition at line 49 of file pg_recvlogical.c.
Referenced by main(), OutputFsync(), StreamLogicalLog(), and usage().
|
static |
Definition at line 47 of file pg_recvlogical.c.
Referenced by main().
|
static |
Definition at line 60 of file pg_recvlogical.c.
Referenced by appendReloptionsArray(), build_local_reloptions(), get_hba_options(), get_reloptions(), main(), parseRelOptionsInternal(), StreamLogicalLog(), and untransformRelOptions().
Definition at line 59 of file pg_recvlogical.c.
|
static |
Definition at line 64 of file pg_recvlogical.c.
Referenced by main(), OutputFsync(), and StreamLogicalLog().
Definition at line 43 of file pg_recvlogical.c.
Referenced by ecpg_filter_source(), isolation_start_test(), main(), OutputFsync(), psql_start_test(), and StreamLogicalLog().
|
static |
Definition at line 72 of file pg_recvlogical.c.
Referenced by OutputFsync(), and sendFeedback().
|
static |
Definition at line 68 of file pg_recvlogical.c.
Referenced by OutputFsync(), and StreamLogicalLog().
|
static |
Definition at line 69 of file pg_recvlogical.c.
Referenced by OutputFsync(), and StreamLogicalLog().
Definition at line 70 of file pg_recvlogical.c.
Referenced by OutputFsync(), and StreamLogicalLog().
|
static |
Definition at line 67 of file pg_recvlogical.c.
Referenced by sighup_handler(), and StreamLogicalLog().
|
static |
Definition at line 71 of file pg_recvlogical.c.
Referenced by OutputFsync(), sendFeedback(), and StreamLogicalLog().
Definition at line 61 of file pg_recvlogical.c.
Referenced by copy_replication_slot(), create_logical_replication_slot(), CreateInitDecodingContext(), CreateReplicationSlot(), LoadOutputPlugin(), main(), pg_create_logical_replication_slot(), and usage().
Definition at line 56 of file pg_recvlogical.c.
Referenced by main(), sendFeedback(), and StreamLogicalLog().
Definition at line 53 of file pg_recvlogical.c.
Referenced by main().
|
static |
Definition at line 48 of file pg_recvlogical.c.
Referenced by main(), StreamLogicalLog(), and usage().
|
static |
Definition at line 50 of file pg_recvlogical.c.
Referenced by build_regexp_split_result(), get_next_fragment(), GetCopyDataString(), indent_declaration(), inner_subltree(), main(), mark_fragment(), mark_hl_fragments(), OutputFsync(), ReadEndOfStreamingResult(), RunIdentifySystem(), sendFeedback(), SplitToVariants(), StartLogStreamer(), StreamLogicalLog(), and testprs_getlexeme().
|
static |
Definition at line 66 of file pg_recvlogical.c.
Referenced by sigexit_handler(), and StreamLogicalLog().
|
static |
Definition at line 65 of file pg_recvlogical.c.
Referenced by main(), sigexit_handler(), and StreamLogicalLog().
Definition at line 45 of file pg_recvlogical.c.
Referenced by AlterReplicationSlot(), create_logical_replication_slot(), CreateReplicationSlot(), CreateReplicationSlot(), DecodeAbort(), DecodeCommit(), libpqrcv_alter_slot(), libpqrcv_create_slot(), main(), parseCreateReplSlotOptions(), pg_create_logical_replication_slot(), ReplicationSlotAlter(), ReplicationSlotCreate(), and xact_decode().
|
static |
Definition at line 44 of file pg_recvlogical.c.
Referenced by main(), prepareToTerminate(), sendFeedback(), and StreamLogicalLog().