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 "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 bool | 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 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 31 of file pg_recvlogical.c.
enum StreamStopReason |
Enumerator | |
---|---|
STREAM_STOP_NONE | |
STREAM_STOP_END_OF_WAL | |
STREAM_STOP_KEEPALIVE | |
STREAM_STOP_SIGNAL |
Definition at line 33 of file pg_recvlogical.c.
|
static |
Definition at line 176 of file pg_recvlogical.c.
References conn, and PQfinish().
Referenced by main().
|
static |
Definition at line 1023 of file pg_recvlogical.c.
References conn, feGetCurrentTimestamp(), now(), OutputFsync(), and sendFeedback().
Referenced by StreamLogicalLog().
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 690 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, exit(), fsync_interval, get_progname(), GetConnection(), getopt_long(), InvalidXLogRecPtr, no_argument, noloop, noptions, optarg, optind, option_parse_int(), outfile, 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, and verbose.
|
static |
Definition at line 183 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, and pg_fatal.
Referenced by flushAndSendFeedback(), and StreamLogicalLog().
|
static |
Definition at line 1040 of file pg_recvlogical.c.
References Assert, conn, endpos, LSN_FORMAT_ARGS, pg_log_info, PQflush(), PQputCopyEnd(), STREAM_STOP_END_OF_WAL, STREAM_STOP_KEEPALIVE, STREAM_STOP_NONE, STREAM_STOP_SIGNAL, verbose, and XLogRecPtrIsInvalid.
Referenced by StreamLogicalLog().
|
static |
Definition at line 124 of file pg_recvlogical.c.
References conn, fe_sendint64(), InvalidXLogRecPtr, len, LSN_FORMAT_ARGS, now(), output_fsync_lsn, output_written_lsn, pg_log_error, pg_log_info, PQerrorMessage(), PQflush(), PQputCopyData(), replication_slot, startpos, and verbose.
Referenced by flushAndSendFeedback(), and StreamLogicalLog().
|
static |
Definition at line 672 of file pg_recvlogical.c.
References stop_reason, STREAM_STOP_SIGNAL, and time_to_abort.
Referenced by main().
|
static |
Definition at line 682 of file pg_recvlogical.c.
References output_reopen.
Referenced by main().
|
static |
Definition at line 211 of file pg_recvlogical.c.
References appendPQExpBuffer(), appendPQExpBufferChar(), appendPQExpBufferStr(), close, conn, copybuf, createPQExpBuffer(), PQExpBufferData::data, destroyPQExpBuffer(), EINTR, endpos, error(), fe_recvint64(), feGetCurrentTimestamp(), feTimestampDifference(), feTimestampDifferenceExceeds(), flushAndSendFeedback(), fstat, fsync_interval, GetConnection(), i, InvalidXLogRecPtr, LSN_FORMAT_ARGS, Max, noptions, now(), outfd, outfile, output_fsync_lsn, 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(), PQresultErrorMessage(), PQresultStatus(), PQsocket(), prepareToTerminate(), replication_slot, res, resetPQExpBuffer(), S_IRUSR, S_ISREG, S_IWUSR, select, sendFeedback(), stat::st_mode, standby_message_timeout, startpos, generate_unaccent_rules::stdout, stop_reason, STREAM_STOP_END_OF_WAL, STREAM_STOP_KEEPALIVE, time_to_abort, verbose, and write.
Referenced by main().
|
static |
Definition at line 80 of file pg_recvlogical.c.
References _, fsync_interval, plugin, printf, progname, and standby_message_timeout.
Referenced by main().
|
static |
Definition at line 50 of file pg_recvlogical.c.
Referenced by main().
|
static |
Definition at line 53 of file pg_recvlogical.c.
Referenced by main().
|
static |
Definition at line 52 of file pg_recvlogical.c.
Referenced by main().
|
static |
Definition at line 49 of file pg_recvlogical.c.
Referenced by main(), prepareToTerminate(), and StreamLogicalLog().
|
static |
Definition at line 47 of file pg_recvlogical.c.
Referenced by main(), OutputFsync(), StreamLogicalLog(), and usage().
|
static |
Definition at line 45 of file pg_recvlogical.c.
Referenced by main().
|
static |
Definition at line 58 of file pg_recvlogical.c.
Referenced by appendReloptionsArray(), build_local_reloptions(), get_hba_options(), get_reloptions(), main(), parseRelOptionsInternal(), StreamLogicalLog(), and untransformRelOptions().
|
static |
Definition at line 57 of file pg_recvlogical.c.
Referenced by appendReloptionsArray(), build_reloptions(), check_createrole_self_grant(), conninfo_array_parse(), conninfo_init(), conninfo_parse(), conninfo_uri_parse(), dblink_connstr_has_pw(), DefineCustomEnumVariable(), DefineVirtualRelation(), deparseAnalyzeSql(), deparseColumnRef(), do_copy(), exec_dynquery_with_params(), exec_prepare_plan(), exec_stmt_call(), exec_stmt_dynexecute(), exec_stmt_return_query(), execute(), extractRelOptions(), file_acquire_sample_rows(), fileAnalyzeForeignTable(), fileBeginForeignScan(), fileExplainForeignScan(), fileGetOptions(), fill_hba_line(), get_batch_size_option(), get_file_fdw_attribute_options(), get_json_agg_constructor(), get_reloptions(), GetForeignColumnOptions(), llvm_optimize_module(), pg_options_to_table(), RelationParseRelOptions(), run_apply_worker(), run_tablesync_worker(), sequence_options(), SPI_execute(), SPI_execute_plan(), SPI_execute_plan_with_paramlist(), SPI_execute_snapshot(), SPI_execute_with_args(), and WalReceiverMain().
|
static |
Definition at line 62 of file pg_recvlogical.c.
Referenced by OutputFsync(), and StreamLogicalLog().
|
static |
Definition at line 42 of file pg_recvlogical.c.
Referenced by ecpg_filter_source(), isolation_start_test(), main(), OutputFsync(), psql_start_test(), and StreamLogicalLog().
|
static |
Definition at line 70 of file pg_recvlogical.c.
Referenced by OutputFsync(), sendFeedback(), and StreamLogicalLog().
|
static |
Definition at line 66 of file pg_recvlogical.c.
Referenced by OutputFsync(), and StreamLogicalLog().
|
static |
Definition at line 67 of file pg_recvlogical.c.
Referenced by OutputFsync(), and StreamLogicalLog().
|
static |
Definition at line 68 of file pg_recvlogical.c.
Referenced by OutputFsync(), and StreamLogicalLog().
|
static |
Definition at line 65 of file pg_recvlogical.c.
Referenced by sighup_handler(), and StreamLogicalLog().
|
static |
Definition at line 69 of file pg_recvlogical.c.
Referenced by OutputFsync(), sendFeedback(), and StreamLogicalLog().
|
static |
Definition at line 59 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().
|
static |
Definition at line 54 of file pg_recvlogical.c.
Referenced by main(), sendFeedback(), and StreamLogicalLog().
|
static |
Definition at line 51 of file pg_recvlogical.c.
Referenced by main().
|
static |
Definition at line 46 of file pg_recvlogical.c.
Referenced by main(), StreamLogicalLog(), and usage().
|
static |
Definition at line 48 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(), ReadEndOfStreamingResult(), RunIdentifySystem(), sendFeedback(), SplitToVariants(), StartLogStreamer(), StreamLogicalLog(), and testprs_getlexeme().
|
static |
Definition at line 64 of file pg_recvlogical.c.
Referenced by sigexit_handler(), and StreamLogicalLog().
|
static |
Definition at line 63 of file pg_recvlogical.c.
Referenced by main(), sigexit_handler(), and StreamLogicalLog().
|
static |
Definition at line 44 of file pg_recvlogical.c.
Referenced by AlterReplicationSlot(), create_logical_replication_slot(), 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 43 of file pg_recvlogical.c.
Referenced by main(), prepareToTerminate(), sendFeedback(), and StreamLogicalLog().