PostgreSQL Source Code
git master
|
#include "postgres_fe.h"
#include <dirent.h>
#include <limits.h>
#include <signal.h>
#include <sys/stat.h>
#include <unistd.h>
#include "access/xlog_internal.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 "receivelog.h"
#include "streamutil.h"
Go to the source code of this file.
Macros | |
#define | RECONNECT_SLEEP_TIME 5 |
Functions | |
static void | usage (void) |
static DIR * | get_destination_dir (char *dest_folder) |
static void | close_destination_dir (DIR *dest_dir, char *dest_folder) |
static XLogRecPtr | FindStreamingStart (uint32 *tli) |
static void | StreamLog (void) |
static bool | stop_streaming (XLogRecPtr xlogpos, uint32 timeline, bool segment_finished) |
static void | disconnect_atexit (void) |
static bool | is_xlogfilename (const char *filename, bool *ispartial, pg_compress_algorithm *wal_compression_algorithm) |
static void | sigexit_handler (SIGNAL_ARGS) |
int | main (int argc, char **argv) |
Variables | |
static char * | basedir = NULL |
static int | verbose = 0 |
static int | compresslevel = 0 |
static bool | noloop = false |
static int | standby_message_timeout = 10 * 1000 |
static volatile sig_atomic_t | time_to_stop = false |
static bool | do_create_slot = false |
static bool | slot_exists_ok = false |
static bool | do_drop_slot = false |
static bool | do_sync = true |
static bool | synchronous = false |
static char * | replication_slot = NULL |
static pg_compress_algorithm | compression_algorithm = PG_COMPRESSION_NONE |
static XLogRecPtr | endpos = InvalidXLogRecPtr |
#define RECONNECT_SLEEP_TIME 5 |
Definition at line 40 of file pg_receivewal.c.
|
static |
Definition at line 252 of file pg_receivewal.c.
References Assert, closedir(), and pg_fatal.
Referenced by FindStreamingStart(), and main().
|
static |
Definition at line 68 of file pg_receivewal.c.
References conn, and PQfinish().
Referenced by main().
|
static |
Definition at line 268 of file pg_receivewal.c.
References basedir, buf, close, close_destination_dir(), dirent::d_name, exit(), fd(), get_destination_dir(), InvalidXLogRecPtr, is_xlogfilename(), MAXPGPATH, PG_BINARY, PG_COMPRESSION_GZIP, PG_COMPRESSION_LZ4, PG_COMPRESSION_NONE, pg_fatal, pg_free(), pg_log_error, pg_log_warning, pg_malloc0(), read, readdir(), snprintf, stat::st_size, stat, WalSegSz, XLogFromFileName(), and XLogSegNoOffsetToRecPtr.
Referenced by StreamLog().
|
static |
Definition at line 235 of file pg_receivewal.c.
References Assert, opendir(), and pg_fatal.
Referenced by FindStreamingStart(), and main().
|
static |
Definition at line 116 of file pg_receivewal.c.
References filename, PG_COMPRESSION_GZIP, PG_COMPRESSION_LZ4, PG_COMPRESSION_NONE, and XLOG_FNAME_LEN.
Referenced by FindStreamingStart().
int main | ( | int | argc, |
char ** | argv | ||
) |
Definition at line 624 of file pg_receivewal.c.
References basedir, close_destination_dir(), compression_algorithm, compresslevel, conn, connection_string, CreateReplicationSlot(), dbgetpassword, dbhost, dbport, dbuser, disconnect_atexit(), do_create_slot, do_drop_slot, do_sync, DropReplicationSlot(), endpos, exit(), get_destination_dir(), get_progname(), GetConnection(), getopt_long(), pg_compress_specification::level, no_argument, noloop, optarg, optind, option_parse_int(), parse_compress_algorithm(), parse_compress_options(), parse_compress_specification(), PG_COMPRESSION_ZSTD, pg_fatal, pg_log_error, pg_log_error_hint, pg_log_info, pg_logging_init(), pg_mode_mask, pg_strdup(), PG_TEXTDOMAIN, pg_usleep(), pqsignal(), progname, RECONNECT_SLEEP_TIME, replication_slot, required_argument, RetrieveWalSegSize(), RunIdentifySystem(), set_pglocale_pgservice(), sigexit_handler(), slot_exists_ok, standby_message_timeout, StreamLog(), synchronous, time_to_stop, usage(), validate_compress_specification(), and verbose.
|
static |
|
static |
Definition at line 184 of file pg_receivewal.c.
References endpos, InvalidXLogRecPtr, LSN_FORMAT_ARGS, pg_log_info, time_to_stop, verbose, and XLogRecPtrIsInvalid.
Referenced by StreamLog().
|
static |
Definition at line 500 of file pg_receivewal.c.
References Assert, basedir, CheckServerVersionForStreaming(), compression_algorithm, compresslevel, conn, CreateWalDirectoryMethod(), do_sync, StreamCtl::do_sync, exit(), FindStreamingStart(), WalWriteMethodOps::finish, WalWriteMethodOps::free, GetConnection(), GetSlotInformation(), InvalidXLogRecPtr, LSN_FORMAT_ARGS, StreamCtl::mark_done, WalWriteMethod::ops, StreamCtl::partial_suffix, pg_log_info, PGINVALID_SOCKET, PQfinish(), PQserverVersion(), ReceiveXlogStream(), replication_slot, StreamCtl::replication_slot, RunIdentifySystem(), standby_message_timeout, StreamCtl::standby_message_timeout, StreamCtl::startpos, StreamCtl::stop_socket, stop_streaming(), StreamCtl::stream_stop, synchronous, StreamCtl::synchronous, StreamCtl::sysidentifier, StreamCtl::timeline, verbose, StreamCtl::walmethod, WalSegSz, and XLogSegmentOffset.
Referenced by main().
|
static |
Definition at line 75 of file pg_receivewal.c.
References _, printf, progname, and standby_message_timeout.
Referenced by main().
|
static |
Definition at line 43 of file pg_receivewal.c.
Referenced by FindStreamingStart(), main(), and StreamLog().
|
static |
Definition at line 55 of file pg_receivewal.c.
Referenced by BaseBackup(), CreateWalDirectoryMethod(), CreateWalTarMethod(), main(), and StreamLog().
|
static |
Definition at line 45 of file pg_receivewal.c.
Referenced by bbsink_gzip_new(), bbsink_lz4_new(), main(), and StreamLog().
Definition at line 49 of file pg_receivewal.c.
Referenced by main().
Definition at line 51 of file pg_receivewal.c.
Referenced by main().
Definition at line 52 of file pg_receivewal.c.
Referenced by main(), and StreamLog().
|
static |
Definition at line 56 of file pg_receivewal.c.
Referenced by _PrepParallelRestore(), build_regexp_split_result(), get_next_fragment(), GetCopyDataString(), inner_subltree(), main(), mark_fragment(), mark_hl_fragments(), SimpleLruDoesPhysicalPageExist(), and stop_streaming().
Definition at line 46 of file pg_receivewal.c.
Referenced by main().
|
static |
Definition at line 54 of file pg_receivewal.c.
Referenced by main(), and StreamLog().
Definition at line 50 of file pg_receivewal.c.
Referenced by CreateReplicationSlot(), and main().
|
static |
Definition at line 47 of file pg_receivewal.c.
Referenced by main(), StreamLog(), and usage().
Definition at line 53 of file pg_receivewal.c.
Referenced by main(), and StreamLog().
|
static |
Definition at line 48 of file pg_receivewal.c.
Referenced by main(), pgarch_MainLoop(), sigexit_handler(), and stop_streaming().
|
static |
Definition at line 44 of file pg_receivewal.c.
Referenced by main(), stop_streaming(), and StreamLog().