|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <signal.h>#include <unistd.h>#include "access/timeline.h"#include "access/transam.h"#include "access/twophase.h"#include "access/xact.h"#include "access/xlog_internal.h"#include "access/xlogreader.h"#include "access/xlogrecovery.h"#include "access/xlogutils.h"#include "backup/basebackup.h"#include "backup/basebackup_incremental.h"#include "catalog/pg_authid.h"#include "catalog/pg_type.h"#include "commands/defrem.h"#include "funcapi.h"#include "libpq/libpq.h"#include "libpq/pqformat.h"#include "libpq/protocol.h"#include "miscadmin.h"#include "nodes/replnodes.h"#include "pgstat.h"#include "postmaster/interrupt.h"#include "replication/decode.h"#include "replication/logical.h"#include "replication/slotsync.h"#include "replication/slot.h"#include "replication/snapbuild.h"#include "replication/syncrep.h"#include "replication/walreceiver.h"#include "replication/walsender.h"#include "replication/walsender_private.h"#include "storage/condition_variable.h"#include "storage/aio_subsys.h"#include "storage/fd.h"#include "storage/ipc.h"#include "storage/pmsignal.h"#include "storage/proc.h"#include "storage/procarray.h"#include "tcop/dest.h"#include "tcop/tcopprot.h"#include "utils/acl.h"#include "utils/builtins.h"#include "utils/guc.h"#include "utils/lsyscache.h"#include "utils/memutils.h"#include "utils/pg_lsn.h"#include "utils/pgstat_internal.h"#include "utils/ps_status.h"#include "utils/timeout.h"#include "utils/timestamp.h"
Go to the source code of this file.
Data Structures | |
| struct | WalTimeSample |
| struct | LagTracker |
Macros | |
| #define | WALSENDER_STATS_FLUSH_INTERVAL 1000 |
| #define | MAX_SEND_SIZE (XLOG_BLCKSZ * 16) |
| #define | LAG_TRACKER_BUFFER_SIZE 8192 |
| #define | READ_REPLICATION_SLOT_COLS 3 |
| #define | WALSND_LOGICAL_LAG_TRACK_INTERVAL_MS 1000 |
| #define | PG_STAT_GET_WAL_SENDERS_COLS 12 |
Typedefs | |
| typedef void(* | WalSndSendDataCallback) (void) |
| #define LAG_TRACKER_BUFFER_SIZE 8192 |
Definition at line 226 of file walsender.c.
| #define MAX_SEND_SIZE (XLOG_BLCKSZ * 16) |
Definition at line 114 of file walsender.c.
| #define PG_STAT_GET_WAL_SENDERS_COLS 12 |
| #define READ_REPLICATION_SLOT_COLS 3 |
| #define WALSENDER_STATS_FLUSH_INTERVAL 1000 |
Definition at line 103 of file walsender.c.
| #define WALSND_LOGICAL_LAG_TRACK_INTERVAL_MS 1000 |
Definition at line 258 of file walsender.c.
|
static |
Definition at line 1415 of file walsender.c.
References defGetBoolean(), elog, ereport, errcode(), errmsg(), ERROR, failover, fb(), foreach_ptr, AlterReplicationSlotCmd::options, ReplicationSlotAlter(), AlterReplicationSlotCmd::slotname, and two_phase.
Referenced by exec_replication_command().
|
static |
Definition at line 1194 of file walsender.c.
References Assert, begin_tup_output_tupdesc(), CheckLogicalDecodingRequirements(), ReplicationSlotPersistentData::confirmed_flush, CreateDestReceiver(), CreateInitDecodingContext(), CreateTemplateTupleDesc(), CRS_EXPORT_SNAPSHOT, CRS_USE_SNAPSHOT, CStringGetTextDatum, ReplicationSlot::data, DecodingContextFindStartpoint(), DestRemoteSimple, do_tup_output(), end_tup_output(), EnsureLogicalDecodingEnabled(), ereport, errmsg(), ERROR, failover, fb(), FirstSnapshotSet, FreeDecodingContext(), InvalidXLogRecPtr, IsLogicalDecodingEnabled(), IsSubTransaction(), IsTransactionBlock(), CreateReplicationSlotCmd::kind, last_reply_timestamp, logical_read_xlog_page(), LSN_FORMAT_ARGS, MAXFNAMELEN, MyProc, MyReplicationSlot, ReplicationSlotPersistentData::name, NameStr, NIL, parseCreateReplSlotOptions(), CreateReplicationSlotCmd::plugin, REPLICATION_KIND_LOGICAL, REPLICATION_KIND_PHYSICAL, ReplicationSlotCreate(), ReplicationSlotMarkDirty(), ReplicationSlotPersist(), ReplicationSlotRelease(), ReplicationSlotReserveWal(), ReplicationSlotSave(), RestoreTransactionSnapshot(), RS_EPHEMERAL, RS_PERSISTENT, RS_TEMPORARY, CreateReplicationSlotCmd::slotname, SnapBuildExportSnapshot(), SnapBuildInitialSnapshot(), LogicalDecodingContext::snapshot_builder, snprintf, CreateReplicationSlotCmd::temporary, TTSOpsVirtual, TupleDescInitBuiltinEntry(), two_phase, values, wal_segment_close(), WalSndPrepareWrite(), WalSndSegmentOpen(), WalSndUpdateProgress(), WalSndWriteData(), XACT_REPEATABLE_READ, XactIsoLevel, XactReadOnly, and XL_ROUTINE.
Referenced by exec_replication_command(), main(), and StartLogStreamer().
|
static |
Definition at line 1406 of file walsender.c.
References ReplicationSlotDrop(), DropReplicationSlotCmd::slotname, and DropReplicationSlotCmd::wait.
Referenced by exec_replication_command(), and main().
Definition at line 1994 of file walsender.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, AlterReplicationSlot(), Assert, CHECK_FOR_INTERRUPTS, CommitTransactionCommand(), CreateDestReceiver(), CreateReplicationSlot(), CurrentMemoryContext, DEBUG1, debug_query_string, DestRemoteSimple, DropReplicationSlot(), elog, EndReplicationCommand(), ereport, errcode(), errmsg(), errmsg_internal(), ERROR, fb(), GetPGVariable(), got_STOPPING, IdentifySystem(), initStringInfo(), InvalidOid, IsAbortedTransactionBlockState(), StartReplicationCmd::kind, LOG, log_replication_commands, MemoryContextReset(), MemoryContextSwitchTo(), MyDatabaseId, MyWalSnd, VariableShowStmt::name, output_message, pgstat_report_activity(), PreventInTransactionBlock(), ReadReplicationSlot(), REPLICATION_KIND_PHYSICAL, replication_scanner_finish(), replication_scanner_init(), replication_scanner_is_replication_command(), replication_yyparse(), reply_message, SendBaseBackup(), SendTimeLineHistory(), set_ps_display(), SnapBuildClearExportedSnapshot(), StartLogicalReplication(), StartReplication(), StartTransactionCommand(), WalSnd::state, STATE_RUNNING, tmpbuf, TopMemoryContext, uploaded_manifest, UploadManifest(), WalSndSetState(), WALSNDSTATE_STOPPING, and xlogreader.
Referenced by PostgresMain().
| XLogRecPtr GetStandbyFlushRecPtr | ( | TimeLineID * | tli | ) |
Definition at line 3637 of file walsender.c.
References am_cascading_walsender, Assert, fb(), GetWalRcvFlushRecPtr(), GetXLogReplayRecPtr(), IsSyncingReplicationSlots(), and receiveTLI.
Referenced by IdentifySystem(), StartReplication(), synchronize_one_slot(), and XLogSendPhysical().
|
static |
Definition at line 736 of file walsender.c.
References AppendIncrementalManifestData(), Assert, buf, ereport, errcode(), errmsg(), ERROR, fb(), HOLD_CANCEL_INTERRUPTS, pq_getbyte(), pq_getmessage(), pq_getmsgstring(), PQ_LARGE_MESSAGE_LIMIT, PQ_SMALL_MESSAGE_LIMIT, pq_startmsgread(), PqMsg_CopyData, PqMsg_CopyDone, PqMsg_CopyFail, PqMsg_Flush, PqMsg_Sync, and RESUME_CANCEL_INTERRUPTS.
Referenced by UploadManifest().
Definition at line 3693 of file walsender.c.
References am_walsender, Assert, fb(), got_STOPPING, kill, MyProcPid, and replication_active.
Referenced by procsignal_sigusr1_handler().
Definition at line 400 of file walsender.c.
References am_cascading_walsender, begin_tup_output_tupdesc(), CommitTransactionCommand(), CreateDestReceiver(), CreateTemplateTupleDesc(), CStringGetTextDatum, cur, CurrentMemoryContext, dbname, DestRemoteSimple, do_tup_output(), end_tup_output(), fb(), get_database_name(), GetFlushRecPtr(), GetStandbyFlushRecPtr(), GetSystemIdentifier(), Int64GetDatum(), InvalidOid, LSN_FORMAT_ARGS, MAXFNAMELEN, MemoryContextStrdup(), MyDatabaseId, RecoveryInProgress(), snprintf, StartTransactionCommand(), TTSOpsVirtual, TupleDescInitBuiltinEntry(), UINT64_FORMAT, and values.
Referenced by exec_replication_command().
Definition at line 301 of file walsender.c.
References am_cascading_walsender, Assert, CreateAuxProcessResourceOwner(), fb(), InitWalSenderSlot(), InvalidOid, InvalidTransactionId, lag_tracker, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MarkPostmasterChildWalSender(), MemoryContextAllocZero(), MyDatabaseId, MyProc, PGPROC::pgxactoff, PMSIGNAL_ADVANCE_STATE_MACHINE, PROC_AFFECTS_ALL_HORIZONS, ProcGlobal, RecoveryInProgress(), SendPostmasterSignal(), PGPROC::statusFlags, PROC_HDR::statusFlags, TopMemoryContext, and PGPROC::xmin.
Referenced by PostgresMain().
Definition at line 3021 of file walsender.c.
References Assert, fb(), i, InvalidOid, InvalidXLogRecPtr, max_wal_senders, MyDatabaseId, MyProcPid, MyWalSnd, on_shmem_exit(), REPLICATION_KIND_LOGICAL, REPLICATION_KIND_PHYSICAL, SpinLockAcquire, SpinLockRelease, WalSndCtl, WalSndKill(), WalSndCtlData::walsnds, and WALSNDSTATE_STARTUP.
Referenced by InitWalSender().
|
static |
Definition at line 4286 of file walsender.c.
References Assert, LagTracker::buffer, fb(), lag_tracker, LAG_TRACKER_BUFFER_SIZE, LagTracker::last_read, WalTimeSample::lsn, next, now(), LagTracker::overflowed, LagTracker::read_heads, WalTimeSample::time, and LagTracker::write_head.
Referenced by ProcessStandbyReplyMessage().
|
static |
Definition at line 4228 of file walsender.c.
References am_walsender, LagTracker::buffer, fb(), i, lag_tracker, LAG_TRACKER_BUFFER_SIZE, LagTracker::last_lsn, WalTimeSample::lsn, NUM_SYNC_REP_WAIT_MODE, LagTracker::overflowed, LagTracker::read_heads, WalTimeSample::time, and LagTracker::write_head.
Referenced by WalSndUpdateProgress(), and XLogSendPhysical().
|
static |
Definition at line 1044 of file walsender.c.
References am_cascading_walsender, CheckXLogRemoved(), fb(), GetWALInsertionTimeLine(), GetXLogReplayRecPtr(), RecoveryInProgress(), sendTimeLine, sendTimeLineIsHistoric, sendTimeLineNextTLI, sendTimeLineValidUpto, WALRead(), WALReadRaiseError(), WalSndWaitForWal(), XLByteToSeg, and XLogReadDetermineTimeline().
Referenced by CreateReplicationSlot(), and StartLogicalReplication().
|
static |
Definition at line 1763 of file walsender.c.
References ReplicationSlot::data, ERROR, ReplicationSlotPersistentData::failover, fb(), got_STOPPING, MyReplicationSlot, replication_active, StandbySlotsHaveCaughtup(), and WARNING.
Referenced by NeedToWaitForWal(), and WalSndWaitForWal().
|
static |
Definition at line 1795 of file walsender.c.
References fb(), and NeedToWaitForStandbys().
Referenced by WalSndWaitForWal().
|
static |
Definition at line 3980 of file walsender.c.
References Interval::day, Interval::month, palloc_object, and Interval::time.
Referenced by pg_stat_get_wal_senders().
|
static |
Definition at line 1117 of file walsender.c.
References CRS_EXPORT_SNAPSHOT, CRS_NOEXPORT_SNAPSHOT, CRS_USE_SNAPSHOT, defGetBoolean(), defGetString(), elog, ereport, errcode(), errmsg(), ERROR, failover, fb(), CreateReplicationSlotCmd::kind, lfirst, CreateReplicationSlotCmd::options, REPLICATION_KIND_LOGICAL, REPLICATION_KIND_PHYSICAL, and two_phase.
Referenced by CreateReplicationSlot().
| Datum pg_stat_get_wal_senders | ( | PG_FUNCTION_ARGS | ) |
Definition at line 3996 of file walsender.c.
References CStringGetTextDatum, fb(), GetUserId(), has_privs_of_role(), i, InitMaterializedSRF(), Int32GetDatum(), IntervalPGetDatum(), j, LSNGetDatum(), max_wal_senders, MemSet, offset_to_interval(), PG_STAT_GET_WAL_SENDERS_COLS, SpinLockAcquire, SpinLockRelease, SYNC_REP_PRIORITY, SyncRepConfigData::syncrep_method, SyncRepConfig, SyncRepGetCandidateStandbys(), TimestampTzGetDatum(), tuplestore_putvalues(), values, WalSndCtl, WalSndGetStateString(), WalSndCtlData::walsnds, write, and XLogRecPtrIsValid.
|
static |
Definition at line 2401 of file walsender.c.
References Assert, ReplicationSlot::data, fb(), ReplicationSlot::mutex, MyReplicationSlot, PhysicalWakeupLogicalWalSnd(), ReplicationSlotMarkDirty(), ReplicationSlotsComputeRequiredLSN(), ReplicationSlotPersistentData::restart_lsn, SpinLockAcquire, SpinLockRelease, and XLogRecPtrIsValid.
Referenced by ProcessStandbyReplyMessage().
|
static |
Definition at line 2539 of file walsender.c.
References ReplicationSlotPersistentData::catalog_xmin, ReplicationSlot::data, ReplicationSlot::effective_catalog_xmin, ReplicationSlot::effective_xmin, fb(), InvalidTransactionId, ReplicationSlot::mutex, MyProc, MyReplicationSlot, ReplicationSlotMarkDirty(), ReplicationSlotsComputeRequiredXmin(), SpinLockAcquire, SpinLockRelease, TransactionIdIsNormal, TransactionIdPrecedes(), ReplicationSlotPersistentData::xmin, and PGPROC::xmin.
Referenced by ProcessStandbyHSFeedbackMessage().
Definition at line 1738 of file walsender.c.
References Assert, ConditionVariableBroadcast(), ReplicationSlot::data, MyReplicationSlot, ReplicationSlotPersistentData::name, NameStr, RecoveryInProgress(), SlotExistsInSyncStandbySlots(), SlotIsPhysical, WalSndCtlData::wal_confirm_rcv_cv, and WalSndCtl.
Referenced by pg_physical_replication_slot_advance(), and PhysicalConfirmReceivedLocation().
Definition at line 1619 of file walsender.c.
References CHECK_FOR_INTERRUPTS, ConfigReloadPending, fb(), GetCurrentTimestamp(), MyLatch, PGC_SIGHUP, pq_flush_if_writable, pq_is_send_pending, ProcessConfigFile(), ProcessRepliesIfAny(), ResetLatch(), SetLatch(), SyncRepInitConfig(), WalSndCheckTimeOut(), WalSndComputeSleeptime(), WalSndKeepaliveIfNecessary(), WalSndShutdown(), WalSndWait(), WL_SOCKET_READABLE, and WL_SOCKET_WRITEABLE.
Referenced by WalSndUpdateProgress(), and WalSndWriteData().
Definition at line 2250 of file walsender.c.
References Assert, COMMERROR, ereport, errcode(), errmsg(), FATAL, fb(), GetCurrentTimestamp(), last_processing, last_reply_timestamp, pq_endmsgread(), pq_getbyte_if_available(), pq_getmessage(), PQ_LARGE_MESSAGE_LIMIT, pq_putmessage_noblock, PQ_SMALL_MESSAGE_LIMIT, pq_startmsgread(), PqMsg_CopyData, PqMsg_CopyDone, PqMsg_Terminate, proc_exit(), ProcessStandbyMessage(), reply_message, resetStringInfo(), streamingDoneReceiving, streamingDoneSending, and waiting_for_ping_response.
Referenced by ProcessPendingWrites(), WalSndLoop(), and WalSndWaitForWal().
Definition at line 2619 of file walsender.c.
References DEBUG2, elog, fb(), InvalidTransactionId, message_level_is_interesting(), MyProc, MyReplicationSlot, MyWalSnd, pfree(), PhysicalReplicationSlotNewXmin(), pq_getmsgint(), pq_getmsgint64(), pstrdup(), reply_message, SpinLockAcquire, SpinLockRelease, timestamptz_to_str(), TransactionIdInRecentPast(), TransactionIdIsNormal, TransactionIdPrecedes(), and PGPROC::xmin.
Referenced by ProcessStandbyMessage().
Definition at line 2366 of file walsender.c.
References COMMERROR, ereport, errcode(), errmsg(), fb(), pq_getmsgbyte(), PqReplMsg_HotStandbyFeedback, PqReplMsg_PrimaryStatusRequest, PqReplMsg_StandbyStatusUpdate, proc_exit(), ProcessStandbyHSFeedbackMessage(), ProcessStandbyPSRequestMessage(), ProcessStandbyReplyMessage(), and reply_message.
Referenced by ProcessRepliesIfAny().
Definition at line 2739 of file walsender.c.
References StringInfoData::data, DEBUG2, elog, ERROR, fb(), FullTransactionIdFromAllowableAt(), GetCurrentTimestamp(), GetOldestActiveTransactionId(), GetXLogWriteRecPtr(), InvalidXLogRecPtr, StringInfoData::len, MyWalSnd, output_message, pq_getmsgint64(), pq_putmessage_noblock, pq_sendbyte(), pq_sendint64(), PqMsg_CopyData, PqReplMsg_PrimaryStatusUpdate, ReadNextFullTransactionId(), RecoveryInProgress(), reply_message, resetStringInfo(), SpinLockAcquire, SpinLockRelease, TransactionIdIsValid, TransactionIdPrecedes(), TwoPhaseGetOldestXidInCommit(), and U64FromFullTransactionId.
Referenced by ProcessStandbyMessage().
Definition at line 2434 of file walsender.c.
References am_cascading_walsender, DEBUG2, elog, fb(), GetCurrentTimestamp(), InvalidXLogRecPtr, LagTrackerRead(), LogicalConfirmReceivedLocation(), LSN_FORMAT_ARGS, message_level_is_interesting(), MyReplicationSlot, MyWalSnd, now(), pfree(), PhysicalConfirmReceivedLocation(), pq_getmsgbyte(), pq_getmsgint64(), pstrdup(), reply_message, sentPtr, SlotIsLogical, SpinLockAcquire, SpinLockRelease, SYNC_REP_WAIT_APPLY, SYNC_REP_WAIT_FLUSH, SYNC_REP_WAIT_WRITE, SyncRepReleaseWaiters(), timestamptz_to_str(), WalSndKeepalive(), and XLogRecPtrIsValid.
Referenced by ProcessStandbyMessage().
|
static |
Definition at line 481 of file walsender.c.
References Assert, begin_tup_output_tupdesc(), CreateDestReceiver(), CreateTemplateTupleDesc(), CStringGetTextDatum, DestRemoteSimple, do_tup_output(), end_tup_output(), ereport, errcode(), errmsg(), ERROR, fb(), GetWALInsertionTimeLine(), GetXLogReplayRecPtr(), i, ReplicationSlot::in_use, Int64GetDatum(), LSN_FORMAT_ARGS, LW_SHARED, LWLockAcquire(), LWLockRelease(), ReplicationSlot::mutex, NIL, OidIsValid, READ_REPLICATION_SLOT_COLS, readTimeLineHistory(), RecoveryInProgress(), SearchNamedReplicationSlot(), ReadReplicationSlotCmd::slotname, snprintf, SpinLockAcquire, SpinLockRelease, tliOfPointInHistory(), TTSOpsVirtual, TupleDescInitBuiltinEntry(), values, and XLogRecPtrIsValid.
Referenced by exec_replication_command().
|
static |
Definition at line 580 of file walsender.c.
References buf, CloseTransientFile(), CMD_SELECT, CreateDestReceiver(), CreateTemplateTupleDesc(), DestRemoteSimple, ereport, errcode(), ERRCODE_DATA_CORRUPTED, errcode_for_file_access(), errmsg(), ERROR, fb(), fd(), len, MAXFNAMELEN, MAXPGPATH, OpenTransientFile(), PG_BINARY, pgstat_report_wait_end(), pgstat_report_wait_start(), pq_beginmessage(), pq_endmessage(), pq_sendbytes(), pq_sendint16(), pq_sendint32(), PqMsg_DataRow, read, TimeLineHistoryCmd::timeline, TLHistoryFileName(), TLHistoryFilePath(), and TupleDescInitBuiltinEntry().
Referenced by exec_replication_command().
|
static |
Definition at line 1457 of file walsender.c.
References am_cascading_walsender, Assert, buf, CheckLogicalDecodingRequirements(), ReplicationSlotPersistentData::confirmed_flush, CreateDecodingContext(), ReplicationSlot::data, DestRemote, EndCommand(), ereport, errmsg(), fb(), FreeDecodingContext(), got_STOPPING, LOG, logical_decoding_ctx, logical_read_xlog_page(), WalSnd::mutex, MyReplicationSlot, MyWalSnd, StartReplicationCmd::options, pq_beginmessage(), pq_endmessage(), pq_flush, pq_sendbyte(), pq_sendint16(), PqMsg_CopyBothResponse, proc_exit(), LogicalDecodingContext::reader, RecoveryInProgress(), replication_active, ReplicationSlotAcquire(), ReplicationSlotRelease(), ReplicationSlotPersistentData::restart_lsn, sentPtr, WalSnd::sentPtr, SetQueryCompletion(), StartReplicationCmd::slotname, SpinLockAcquire, SpinLockRelease, StartReplicationCmd::startpoint, SyncRepInitConfig(), wal_segment_close(), WalSndLoop(), WalSndPrepareWrite(), WalSndSegmentOpen(), WalSndSetState(), WALSNDSTATE_CATCHUP, WALSNDSTATE_STARTUP, WalSndUpdateProgress(), WalSndWriteData(), XL_ROUTINE, XLogBeginRead(), xlogreader, and XLogSendLogical().
Referenced by exec_replication_command().
|
static |
Definition at line 812 of file walsender.c.
References am_cascading_walsender, Assert, begin_tup_output_tupdesc(), buf, CreateDestReceiver(), CreateTemplateTupleDesc(), CStringGetTextDatum, DestRemoteSimple, do_tup_output(), end_tup_output(), EndReplicationCommand(), ereport, errcode(), errdetail(), errmsg(), ERROR, fb(), GetFlushRecPtr(), GetStandbyFlushRecPtr(), got_STOPPING, Int64GetDatum(), InvalidXLogRecPtr, list_free_deep(), LSN_FORMAT_ARGS, WalSnd::mutex, MyReplicationSlot, MyWalSnd, pq_beginmessage(), pq_endmessage(), pq_flush, pq_sendbyte(), pq_sendint16(), PqMsg_CopyBothResponse, proc_exit(), readTimeLineHistory(), RecoveryInProgress(), replication_active, ReplicationSlotAcquire(), ReplicationSlotRelease(), sendTimeLine, sendTimeLineIsHistoric, sendTimeLineNextTLI, sendTimeLineValidUpto, sentPtr, WalSnd::sentPtr, SlotIsLogical, StartReplicationCmd::slotname, snprintf, SpinLockAcquire, SpinLockRelease, StartReplicationCmd::startpoint, streamingDoneReceiving, streamingDoneSending, SyncRepInitConfig(), StartReplicationCmd::timeline, tliSwitchPoint(), TTSOpsVirtual, TupleDescInitBuiltinEntry(), values, wal_segment_close(), wal_segment_size, WalSndLoop(), WalSndSegmentOpen(), WalSndSetState(), WALSNDSTATE_CATCHUP, WALSNDSTATE_STARTUP, XL_ROUTINE, xlogreader, XLogReaderAllocate(), XLogRecPtrIsValid, and XLogSendPhysical().
Referenced by exec_replication_command().
|
static |
Definition at line 2588 of file walsender.c.
References epoch, EpochFromFullTransactionId, fb(), ReadNextFullTransactionId(), TransactionIdPrecedesOrEquals(), and XidFromFullTransactionId.
Referenced by ProcessStandbyHSFeedbackMessage().
Definition at line 670 of file walsender.c.
References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate, Assert, AuxProcessResourceOwner, buf, CacheMemoryContext, CreateIncrementalBackupInfo(), CurrentMemoryContext, CurrentResourceOwner, fb(), FinalizeIncrementalManifest(), HandleUploadManifestPacket(), MemoryContextDelete(), MemoryContextSetParent(), pq_beginmessage(), pq_endmessage_reuse(), pq_flush, pq_sendbyte(), pq_sendint16(), PqMsg_CopyInResponse, ReleaseAuxProcessResources(), uploaded_manifest, and uploaded_manifest_mcxt.
Referenced by exec_replication_command().
Definition at line 2852 of file walsender.c.
References COMMERROR, ereport, errmsg(), fb(), last_processing, last_reply_timestamp, TimestampTzPlusMilliseconds, wal_sender_timeout, and WalSndShutdown().
Referenced by ProcessPendingWrites(), WalSndLoop(), and WalSndWaitForWal().
|
static |
Definition at line 2808 of file walsender.c.
References fb(), last_reply_timestamp, now(), TimestampDifferenceMilliseconds(), TimestampTzPlusMilliseconds, waiting_for_ping_response, and wal_sender_timeout.
Referenced by ProcessPendingWrites(), WalSndLoop(), and WalSndWaitForWal().
|
static |
Definition at line 3594 of file walsender.c.
References DestRemote, EndCommand(), fb(), WalSnd::flush, InvalidXLogRecPtr, MyWalSnd, pq_flush, pq_is_send_pending, proc_exit(), sentPtr, SetQueryCompletion(), waiting_for_ping_response, WalSndCaughtUp, WalSndKeepalive(), WalSnd::write, and XLogRecPtrIsValid.
Referenced by WalSndLoop().
Definition at line 348 of file walsender.c.
References ConditionVariableCancelSleep(), fb(), got_SIGUSR2, got_STOPPING, IsTransactionOrTransactionBlock(), LWLockReleaseAll(), MyReplicationSlot, pgaio_error_cleanup(), pgstat_report_wait_end(), proc_exit(), ReleaseAuxProcessResources(), replication_active, ReplicationSlotCleanup(), ReplicationSlotRelease(), XLogReaderState::seg, wal_segment_close(), WalSndSetState(), WALSNDSTATE_STARTUP, WALOpenSegment::ws_file, and xlogreader.
Referenced by PostgresMain().
|
static |
Definition at line 3961 of file walsender.c.
References WALSNDSTATE_BACKUP, WALSNDSTATE_CATCHUP, WALSNDSTATE_STARTUP, WALSNDSTATE_STOPPING, and WALSNDSTATE_STREAMING.
Referenced by pg_stat_get_wal_senders().
Definition at line 3878 of file walsender.c.
References fb(), i, INVALID_PROC_NUMBER, max_wal_senders, PROCSIG_WALSND_INIT_STOPPING, SendProcSignal(), SpinLockAcquire, SpinLockRelease, WalSndCtl, and WalSndCtlData::walsnds.
Referenced by ShutdownXLOG().
|
static |
Definition at line 4167 of file walsender.c.
References StringInfoData::data, DEBUG2, elog, fb(), GetCurrentTimestamp(), StringInfoData::len, output_message, pq_putmessage_noblock, pq_sendbyte(), pq_sendint64(), PqMsg_CopyData, PqReplMsg_Keepalive, resetStringInfo(), sentPtr, waiting_for_ping_response, and XLogRecPtrIsValid.
Referenced by ProcessStandbyReplyMessage(), WalSndDone(), WalSndKeepaliveIfNecessary(), WalSndUpdateProgress(), and WalSndWaitForWal().
Definition at line 4190 of file walsender.c.
References fb(), InvalidXLogRecPtr, last_processing, last_reply_timestamp, pq_flush_if_writable, TimestampTzPlusMilliseconds, waiting_for_ping_response, wal_sender_timeout, WalSndKeepalive(), and WalSndShutdown().
Referenced by ProcessPendingWrites(), WalSndLoop(), and WalSndWaitForWal().
Definition at line 3097 of file walsender.c.
References Assert, fb(), MyWalSnd, SpinLockAcquire, and SpinLockRelease.
Referenced by InitWalSenderSlot().
|
static |
Definition at line 3715 of file walsender.c.
References got_SIGUSR2, MyLatch, and SetLatch().
Referenced by WalSndSignals().
|
static |
Definition at line 2879 of file walsender.c.
References application_name, CHECK_FOR_INTERRUPTS, ConfigReloadPending, DEBUG1, ereport, errmsg_internal(), fb(), GetCurrentTimestamp(), got_SIGUSR2, last_reply_timestamp, MyLatch, MyWalSnd, now(), PGC_SIGHUP, PGSTAT_BACKEND_FLUSH_IO, pgstat_flush_backend(), pgstat_flush_io(), pq_flush_if_writable, pq_is_send_pending, ProcessConfigFile(), ProcessRepliesIfAny(), ResetLatch(), WalSnd::state, streamingDoneReceiving, streamingDoneSending, SyncRepInitConfig(), TimestampDifferenceExceeds(), waiting_for_ping_response, WALSENDER_STATS_FLUSH_INTERVAL, WalSndCaughtUp, WalSndCheckTimeOut(), WalSndComputeSleeptime(), WalSndDone(), WalSndKeepaliveIfNecessary(), WalSndSetState(), WalSndShutdown(), WALSNDSTATE_CATCHUP, WALSNDSTATE_STREAMING, WalSndWait(), WL_SOCKET_READABLE, WL_SOCKET_WRITEABLE, and XLogSendLogical().
Referenced by StartLogicalReplication(), and StartReplication().
|
static |
Definition at line 1550 of file walsender.c.
References fb(), InvalidXLogRecPtr, LogicalDecodingContext::out, pq_sendbyte(), pq_sendint64(), PqReplMsg_WALData, and resetStringInfo().
Referenced by CreateReplicationSlot(), and StartLogicalReplication().
Definition at line 3670 of file walsender.c.
References fb(), i, max_wal_senders, SpinLockAcquire, SpinLockRelease, WalSndCtl, and WalSndCtlData::walsnds.
Referenced by KeepFileRestoredFromArchive().
|
static |
Definition at line 3113 of file walsender.c.
References BasicOpenFile(), ereport, errcode_for_file_access(), errmsg(), ERROR, fb(), MAXFNAMELEN, MAXPGPATH, PG_BINARY, sendTimeLine, sendTimeLineIsHistoric, sendTimeLineNextTLI, sendTimeLineValidUpto, wal_segment_size, XLByteToSeg, XLogFileName(), and XLogFilePath().
Referenced by CreateReplicationSlot(), StartLogicalReplication(), and StartReplication().
| void WalSndSetState | ( | WalSndState | state | ) |
Definition at line 3942 of file walsender.c.
References am_walsender, Assert, fb(), MyWalSnd, SpinLockAcquire, and SpinLockRelease.
Referenced by exec_replication_command(), SendBaseBackup(), StartLogicalReplication(), StartReplication(), WalSndErrorCleanup(), WalSndLoop(), and XLogSendPhysical().
Definition at line 3754 of file walsender.c.
References ConditionVariableInit(), dlist_init(), fb(), i, max_wal_senders, MemSet, NUM_SYNC_REP_WAIT_MODE, ShmemInitStruct(), SpinLockInit, WalSndCtlData::SyncRepQueue, WalSndCtlData::wal_confirm_rcv_cv, WalSndCtlData::wal_flush_cv, WalSndCtlData::wal_replay_cv, WalSndCtl, WalSndCtlData::walsnds, and WalSndShmemSize().
Referenced by CreateOrAttachShmemStructs().
Definition at line 3742 of file walsender.c.
References add_size(), fb(), max_wal_senders, and mul_size().
Referenced by CalculateShmemSize(), and WalSndShmemInit().
Definition at line 384 of file walsender.c.
References DestNone, DestRemote, proc_exit(), and whereToSendOutput.
Referenced by ProcessPendingWrites(), WalSndCheckTimeOut(), WalSndKeepaliveIfNecessary(), WalSndLoop(), WalSndUpdateProgress(), WalSndWaitForWal(), and WalSndWriteData().
Definition at line 3723 of file walsender.c.
References die, fb(), InitializeTimeouts(), pqsignal, procsignal_sigusr1_handler(), SIGCHLD, SIGHUP, SignalHandlerForConfigReload(), SIGPIPE, SIGUSR1, SIGUSR2, StatementCancelHandler(), and WalSndLastCycleHandler().
Referenced by PostgresMain().
|
static |
Definition at line 1673 of file walsender.c.
References LogicalDecodingContext::end_xact, fb(), GetCurrentTimestamp(), LagTrackerWrite(), last_reply_timestamp, now(), pq_flush_if_writable, pq_is_send_pending, ProcessPendingWrites(), SYNC_STANDBY_DEFINED, SyncRepRequested, TimestampDifferenceExceeds(), TimestampTzPlusMilliseconds, wal_sender_timeout, WALSND_LOGICAL_LAG_TRACK_INTERVAL_MS, WalSndCtl, WalSndKeepalive(), and WalSndShutdown().
Referenced by CreateReplicationSlot(), and StartLogicalReplication().
Definition at line 3820 of file walsender.c.
References ConditionVariableCancelSleep(), ConditionVariablePrepareToSleep(), WaitEvent::events, fb(), FeBeWaitSet, FeBeWaitSetSocketPos, WalSnd::kind, ModifyWaitEvent(), MyWalSnd, proc_exit(), REPLICATION_KIND_LOGICAL, REPLICATION_KIND_PHYSICAL, WaitEventSetWait(), WalSndCtlData::wal_confirm_rcv_cv, WalSndCtlData::wal_flush_cv, WalSndCtlData::wal_replay_cv, WalSndCtl, and WL_POSTMASTER_DEATH.
Referenced by ProcessPendingWrites(), WalSndLoop(), and WalSndWaitForWal().
|
static |
Definition at line 1823 of file walsender.c.
References Assert, CHECK_FOR_INTERRUPTS, ConfigReloadPending, fb(), WalSnd::flush, GetCurrentTimestamp(), GetFlushRecPtr(), GetXLogReplayRecPtr(), got_STOPPING, InvalidXLogRecPtr, MyLatch, MyWalSnd, NeedToWaitForStandbys(), NeedToWaitForWal(), now(), PGC_SIGHUP, PGSTAT_BACKEND_FLUSH_IO, pgstat_flush_backend(), pgstat_flush_io(), pq_flush_if_writable, pq_is_send_pending, ProcessConfigFile(), ProcessRepliesIfAny(), RecoveryInProgress(), ResetLatch(), sentPtr, SetLatch(), streamingDoneReceiving, streamingDoneSending, SyncRepInitConfig(), TimestampDifferenceExceeds(), waiting_for_ping_response, WALSENDER_STATS_FLUSH_INTERVAL, WalSndCaughtUp, WalSndCheckTimeOut(), WalSndComputeSleeptime(), WalSndKeepalive(), WalSndKeepaliveIfNecessary(), WalSndShutdown(), WalSndWait(), WL_SOCKET_READABLE, WL_SOCKET_WRITEABLE, WalSnd::write, XLogBackgroundFlush(), and XLogRecPtrIsValid.
Referenced by logical_read_xlog_page().
Definition at line 3904 of file walsender.c.
References fb(), i, max_wal_senders, pg_usleep(), SpinLockAcquire, SpinLockRelease, WalSndCtl, WalSndCtlData::walsnds, and WALSNDSTATE_STOPPING.
Referenced by ShutdownXLOG().
Definition at line 3799 of file walsender.c.
References ConditionVariableBroadcast(), WalSndCtlData::wal_flush_cv, WalSndCtlData::wal_replay_cv, and WalSndCtl.
Referenced by ApplyWalRecord(), KeepFileRestoredFromArchive(), StartupXLOG(), WalSndWakeupProcessRequests(), and XLogWalRcvFlush().
|
static |
Definition at line 1577 of file walsender.c.
References CHECK_FOR_INTERRUPTS, StringInfoData::data, fb(), GetCurrentTimestamp(), last_reply_timestamp, StringInfoData::len, now(), LogicalDecodingContext::out, pq_flush_if_writable, pq_is_send_pending, pq_putmessage_noblock, pq_sendint64(), PqMsg_CopyData, ProcessPendingWrites(), resetStringInfo(), TimestampTzPlusMilliseconds, tmpbuf, wal_sender_timeout, and WalSndShutdown().
Referenced by CreateReplicationSlot(), and StartLogicalReplication().
Definition at line 3501 of file walsender.c.
References am_cascading_walsender, elog, XLogReaderState::EndRecPtr, ERROR, fb(), GetFlushRecPtr(), GetXLogReplayRecPtr(), got_SIGUSR2, got_STOPPING, InvalidXLogRecPtr, logical_decoding_ctx, LogicalDecodingProcessRecord(), MyWalSnd, LogicalDecodingContext::reader, sentPtr, SpinLockAcquire, SpinLockRelease, WalSndCaughtUp, XLogReadRecord(), and XLogRecPtrIsValid.
Referenced by StartLogicalReplication(), and WalSndLoop().
Definition at line 3191 of file walsender.c.
References am_cascading_walsender, Assert, CheckXLogRemoved(), StringInfoData::data, DEBUG1, elog, enlargeStringInfo(), fb(), GetCurrentTimestamp(), GetFlushRecPtr(), GetStandbyFlushRecPtr(), GetWALInsertionTimeLine(), got_STOPPING, LagTrackerWrite(), StringInfoData::len, list_free_deep(), LSN_FORMAT_ARGS, MAX_SEND_SIZE, MyWalSnd, output_message, pq_putmessage_noblock, pq_sendbyte(), pq_sendint64(), PqMsg_CopyData, PqMsg_CopyDone, PqReplMsg_WALData, readTimeLineHistory(), RecoveryInProgress(), resetStringInfo(), XLogReaderState::seg, XLogReaderState::segcxt, sendTimeLine, sendTimeLineIsHistoric, sendTimeLineNextTLI, sendTimeLineValidUpto, sentPtr, set_ps_display(), snprintf, SpinLockAcquire, SpinLockRelease, streamingDoneSending, tliSwitchPoint(), tmpbuf, update_process_title, wal_segment_close(), WALRead(), WALReadFromBuffers(), WALReadRaiseError(), WalSndCaughtUp, WalSndSetState(), WALSNDSTATE_STOPPING, WALOpenSegment::ws_file, WALSegmentContext::ws_segsize, WALOpenSegment::ws_tli, XLByteToSeg, and xlogreader.
Referenced by StartReplication().
Definition at line 124 of file walsender.c.
Referenced by GetStandbyFlushRecPtr(), IdentifySystem(), InitWalSender(), logical_read_xlog_page(), ProcessStandbyReplyMessage(), StartLogicalReplication(), StartReplication(), SyncRepGetStandbyPriority(), XLogSendLogical(), and XLogSendPhysical().
Definition at line 126 of file walsender.c.
Referenced by check_db(), ClientAuthentication(), InitPostgres(), and ProcessStartupPacket().
Definition at line 123 of file walsender.c.
Referenced by BackendInitialize(), check_db(), ClientAuthentication(), forbidden_in_wal_sender(), HandleWalSndInitStopping(), InitPostgres(), LagTrackerWrite(), MarkPostmasterChildWalSender(), PerformAuthentication(), PostgresMain(), ProcessStartupPacket(), ReplicationSlotAcquire(), ReplicationSlotRelease(), and WalSndSetState().
|
static |
Definition at line 205 of file walsender.c.
Referenced by WalSndErrorCleanup(), WalSndLastCycleHandler(), WalSndLoop(), and XLogSendLogical().
|
static |
Definition at line 206 of file walsender.c.
Referenced by exec_replication_command(), HandleWalSndInitStopping(), NeedToWaitForStandbys(), StartLogicalReplication(), StartReplication(), WalSndErrorCleanup(), WalSndWaitForWal(), XLogSendLogical(), and XLogSendPhysical().
|
static |
Definition at line 252 of file walsender.c.
Referenced by InitWalSender(), LagTrackerRead(), and LagTrackerWrite().
|
static |
Definition at line 181 of file walsender.c.
Referenced by ProcessRepliesIfAny(), WalSndCheckTimeOut(), and WalSndKeepaliveIfNecessary().
|
static |
Definition at line 187 of file walsender.c.
Referenced by CreateReplicationSlot(), ProcessRepliesIfAny(), WalSndCheckTimeOut(), WalSndComputeSleeptime(), WalSndKeepaliveIfNecessary(), WalSndLoop(), WalSndUpdateProgress(), and WalSndWriteData().
Definition at line 133 of file walsender.c.
Referenced by exec_replication_command(), ReplicationSlotAcquire(), and ReplicationSlotRelease().
|
static |
Definition at line 216 of file walsender.c.
Referenced by StartLogicalReplication(), and XLogSendLogical().
| int max_wal_senders = 10 |
Definition at line 129 of file walsender.c.
Referenced by CheckRequiredParameterValues(), InitControlFile(), InitializeMaxBackends(), InitPostmasterChildSlots(), InitProcess(), InitWalSenderSlot(), pg_stat_get_wal_senders(), PostmasterMain(), SyncRepGetCandidateStandbys(), WalSndInitStopping(), WalSndRqstFileReload(), WalSndShmemInit(), WalSndShmemSize(), WalSndWaitStopping(), WalSndWakeupProcessRequests(), and XLogReportParameters().
Definition at line 120 of file walsender.c.
Referenced by exec_replication_command(), InitWalSenderSlot(), ProcessStandbyHSFeedbackMessage(), ProcessStandbyPSRequestMessage(), ProcessStandbyReplyMessage(), StartLogicalReplication(), StartReplication(), SyncRepGetCandidateStandbys(), SyncRepInitConfig(), SyncRepReleaseWaiters(), WalSndDone(), WalSndKill(), WalSndLoop(), WalSndSetState(), WalSndWait(), WalSndWaitForWal(), XLogSendLogical(), and XLogSendPhysical().
|
static |
Definition at line 176 of file walsender.c.
Referenced by exec_replication_command(), ProcessStandbyPSRequestMessage(), WalSndKeepalive(), and XLogSendPhysical().
|
static |
Definition at line 214 of file walsender.c.
Referenced by HandleWalSndInitStopping(), NeedToWaitForStandbys(), StartLogicalReplication(), StartReplication(), and WalSndErrorCleanup().
|
static |
Definition at line 177 of file walsender.c.
Referenced by exec_replication_command(), ProcessRepliesIfAny(), ProcessStandbyHSFeedbackMessage(), ProcessStandbyMessage(), ProcessStandbyPSRequestMessage(), and ProcessStandbyReplyMessage().
|
static |
Definition at line 164 of file walsender.c.
Referenced by logical_read_xlog_page(), StartReplication(), WalSndSegmentOpen(), and XLogSendPhysical().
Definition at line 166 of file walsender.c.
Referenced by logical_read_xlog_page(), StartReplication(), WalSndSegmentOpen(), and XLogSendPhysical().
|
static |
Definition at line 165 of file walsender.c.
Referenced by logical_read_xlog_page(), StartReplication(), WalSndSegmentOpen(), and XLogSendPhysical().
|
static |
Definition at line 167 of file walsender.c.
Referenced by logical_read_xlog_page(), StartReplication(), WalSndSegmentOpen(), and XLogSendPhysical().
|
static |
Definition at line 173 of file walsender.c.
Referenced by ProcessStandbyReplyMessage(), StartLogicalReplication(), StartReplication(), WalSndDone(), WalSndKeepalive(), WalSndWaitForWal(), XLogSendLogical(), and XLogSendPhysical().
|
static |
Definition at line 199 of file walsender.c.
Referenced by ProcessRepliesIfAny(), StartReplication(), WalSndLoop(), and WalSndWaitForWal().
|
static |
Definition at line 198 of file walsender.c.
Referenced by ProcessRepliesIfAny(), StartReplication(), WalSndLoop(), WalSndWaitForWal(), and XLogSendPhysical().
|
static |
Definition at line 178 of file walsender.c.
Referenced by copy_crlf(), describeOneTableDetails(), exec_replication_command(), GetVisibilityMapPins(), mdc_finish(), multirange_recv(), parse_literal_data(), parse_symenc_sesskey(), pqGetHomeDirectory(), PQunescapeBytea(), prefix_init(), pullf_read_max(), scanGetCandidate(), shm_mq_sendv(), tsvectorin(), WalSndWriteData(), and XLogSendPhysical().
|
static |
Definition at line 155 of file walsender.c.
Referenced by exec_replication_command(), and UploadManifest().
|
static |
Definition at line 156 of file walsender.c.
Referenced by UploadManifest().
Definition at line 190 of file walsender.c.
Referenced by ProcessRepliesIfAny(), WalSndComputeSleeptime(), WalSndDone(), WalSndKeepalive(), WalSndKeepaliveIfNecessary(), WalSndLoop(), and WalSndWaitForWal().
Definition at line 138 of file walsender.c.
Referenced by WalSndWakeupProcessRequests().
| int wal_sender_timeout = 60 * 1000 |
Definition at line 131 of file walsender.c.
Referenced by WalSndCheckTimeOut(), WalSndComputeSleeptime(), WalSndKeepaliveIfNecessary(), WalSndUpdateProgress(), and WalSndWriteData().
Definition at line 202 of file walsender.c.
Referenced by WalSndDone(), WalSndLoop(), WalSndWaitForWal(), XLogSendLogical(), and XLogSendPhysical().
| WalSndCtlData* WalSndCtl = NULL |
Definition at line 117 of file walsender.c.
Referenced by InitWalSenderSlot(), pg_stat_get_wal_senders(), PhysicalWakeupLogicalWalSnd(), SyncRepGetCandidateStandbys(), SyncRepQueueInsert(), SyncRepReleaseWaiters(), SyncRepUpdateSyncStandbysDefined(), SyncRepWaitForLSN(), SyncRepWakeQueue(), WaitForStandbyConfirmation(), WalSndInitStopping(), WalSndRqstFileReload(), WalSndShmemInit(), WalSndUpdateProgress(), WalSndWait(), WalSndWaitStopping(), and WalSndWakeup().
|
static |
Definition at line 145 of file walsender.c.
Referenced by exec_replication_command(), StartLogicalReplication(), StartReplication(), WalSndErrorCleanup(), and XLogSendPhysical().