PostgreSQL Source Code
git master
|
#include "postgres.h"
#include <unistd.h>
#include "access/xact.h"
#include "miscadmin.h"
#include "pgstat.h"
#include "replication/syncrep.h"
#include "replication/walsender.h"
#include "replication/walsender_private.h"
#include "storage/pmsignal.h"
#include "storage/proc.h"
#include "tcop/tcopprot.h"
#include "utils/builtins.h"
#include "utils/ps_status.h"
Go to the source code of this file.
Macros | |
#define | SyncStandbysDefined() (SyncRepStandbyNames != NULL && SyncRepStandbyNames[0] != '\0') |
Variables | |
char * | SyncRepStandbyNames |
static bool | announce_next_takeover = true |
SyncRepConfigData * | SyncRepConfig = NULL |
static int | SyncRepWaitMode = SYNC_REP_NO_WAIT |
#define SyncStandbysDefined | ( | ) | (SyncRepStandbyNames != NULL && SyncRepStandbyNames[0] != '\0') |
void assign_synchronous_commit | ( | int | newval, |
void * | extra | ||
) |
Definition at line 1086 of file syncrep.c.
References newval, SYNC_REP_NO_WAIT, SYNC_REP_WAIT_APPLY, SYNC_REP_WAIT_FLUSH, SYNC_REP_WAIT_WRITE, SYNCHRONOUS_COMMIT_REMOTE_APPLY, SYNCHRONOUS_COMMIT_REMOTE_FLUSH, SYNCHRONOUS_COMMIT_REMOTE_WRITE, and SyncRepWaitMode.
void assign_synchronous_standby_names | ( | const char * | newval, |
void * | extra | ||
) |
Definition at line 1023 of file syncrep.c.
References SyncRepConfigData::config_size, GUC_check_errcode(), GUC_check_errdetail, GUC_check_errmsg, malloc, newval, SyncRepConfigData::num_sync, syncrep_parse_error_msg, syncrep_parse_result, syncrep_scanner_finish(), syncrep_scanner_init(), and syncrep_yyparse().
|
static |
|
static |
Definition at line 804 of file syncrep.c.
References a, b, SyncRepStandbyData::sync_standby_priority, and SyncRepStandbyData::walsnd_index.
Referenced by SyncRepGetCandidateStandbys().
|
static |
Definition at line 372 of file syncrep.c.
References LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyProc, SHMQueueDelete(), SHMQueueIsDetached(), SYNC_REP_NOT_WAITING, PGPROC::syncRepLinks, and PGPROC::syncRepState.
Referenced by SyncRepWaitForLSN().
void SyncRepCleanupAtProcExit | ( | void | ) |
Definition at line 382 of file syncrep.c.
References LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyProc, SHMQueueDelete(), SHMQueueIsDetached(), and PGPROC::syncRepLinks.
Referenced by ProcKill().
int SyncRepGetCandidateStandbys | ( | SyncRepStandbyData ** | standbys | ) |
Definition at line 725 of file syncrep.c.
References SyncRepStandbyData::apply, WalSnd::apply, SyncRepStandbyData::flush, WalSnd::flush, i, SyncRepStandbyData::is_me, max_wal_senders, WalSnd::mutex, MyWalSnd, SyncRepConfigData::num_sync, palloc(), SyncRepStandbyData::pid, WalSnd::pid, qsort, SpinLockAcquire, SpinLockRelease, standby_priority_comparator(), WalSnd::state, SYNC_REP_PRIORITY, SyncRepStandbyData::sync_standby_priority, WalSnd::sync_standby_priority, SyncRepConfigData::syncrep_method, SyncRepConfig, SyncRepStandbyData::walsnd_index, WalSndCtl, WalSndCtlData::walsnds, WALSNDSTATE_STOPPING, WALSNDSTATE_STREAMING, SyncRepStandbyData::write, WalSnd::write, and XLogRecPtrIsInvalid.
Referenced by pg_stat_get_wal_senders(), and SyncRepGetSyncRecPtr().
|
static |
Definition at line 659 of file syncrep.c.
References SyncRepStandbyData::apply, Assert(), cmp_lsn(), SyncRepStandbyData::flush, i, palloc(), pfree(), qsort, and SyncRepStandbyData::write.
Referenced by SyncRepGetSyncRecPtr().
|
static |
Definition at line 626 of file syncrep.c.
References SyncRepStandbyData::apply, SyncRepStandbyData::flush, i, SyncRepStandbyData::write, write, and XLogRecPtrIsInvalid.
Referenced by SyncRepGetSyncRecPtr().
|
static |
Definition at line 831 of file syncrep.c.
References am_cascading_walsender, application_name, SyncRepConfigData::member_names, SyncRepConfigData::nmembers, pg_strcasecmp(), SYNC_REP_PRIORITY, SyncRepConfigData::syncrep_method, SyncRepConfig, and SyncStandbysDefined.
Referenced by SyncRepInitConfig().
|
static |
Definition at line 552 of file syncrep.c.
References i, InvalidXLogRecPtr, SyncRepConfigData::num_sync, pfree(), SYNC_REP_PRIORITY, SyncRepConfigData::syncrep_method, SyncRepConfig, SyncRepGetCandidateStandbys(), SyncRepGetNthLatestSyncRecPtr(), and SyncRepGetOldestSyncRecPtr().
Referenced by SyncRepReleaseWaiters().
void SyncRepInitConfig | ( | void | ) |
Definition at line 411 of file syncrep.c.
References application_name, DEBUG1, ereport, errmsg_internal(), WalSnd::mutex, MyWalSnd, SpinLockAcquire, SpinLockRelease, WalSnd::sync_standby_priority, and SyncRepGetStandbyPriority().
Referenced by ProcessPendingWrites(), StartLogicalReplication(), StartReplication(), WalSndLoop(), and WalSndWaitForWal().
|
static |
Definition at line 339 of file syncrep.c.
References Assert(), mode, MyProc, NUM_SYNC_REP_WAIT_MODE, offsetof, SHMQueueInsertAfter(), SHMQueuePrev(), PGPROC::syncRepLinks, WalSndCtlData::SyncRepQueue, PGPROC::waitLSN, and WalSndCtl.
Referenced by SyncRepWaitForLSN().
void SyncRepReleaseWaiters | ( | void | ) |
Definition at line 440 of file syncrep.c.
References announce_next_takeover, application_name, DEBUG3, elog, ereport, errmsg(), WalSnd::flush, LOG, WalSndCtlData::lsn, LSN_FORMAT_ARGS, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyWalSnd, WalSnd::state, SYNC_REP_PRIORITY, SYNC_REP_WAIT_APPLY, SYNC_REP_WAIT_FLUSH, SYNC_REP_WAIT_WRITE, WalSnd::sync_standby_priority, SyncRepConfigData::syncrep_method, SyncRepConfig, SyncRepGetSyncRecPtr(), SyncRepWakeQueue(), WalSndCtl, WALSNDSTATE_STOPPING, WALSNDSTATE_STREAMING, and XLogRecPtrIsInvalid.
Referenced by ProcessStandbyReplyMessage().
void SyncRepUpdateSyncStandbysDefined | ( | void | ) |
Definition at line 947 of file syncrep.c.
References i, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), NUM_SYNC_REP_WAIT_MODE, WalSndCtlData::sync_standbys_defined, SyncRepWakeQueue(), SyncStandbysDefined, and WalSndCtl.
Referenced by UpdateSharedMemoryConfig().
void SyncRepWaitForLSN | ( | XLogRecPtr | lsn, |
bool | commit | ||
) |
Definition at line 148 of file syncrep.c.
References Assert(), DestNone, ereport, errcode(), errdetail(), errmsg(), get_ps_display(), InterruptHoldoffCount, len, LSN_FORMAT_ARGS, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), Min, mode, MyLatch, MyProc, palloc(), pfree(), pg_read_barrier, ProcDiePending, QueryCancelPending, ResetLatch(), set_ps_display(), SHMQueueIsDetached(), sprintf, SYNC_REP_NOT_WAITING, SYNC_REP_WAIT_COMPLETE, SYNC_REP_WAIT_FLUSH, SYNC_REP_WAITING, WalSndCtlData::sync_standbys_defined, SyncRepCancelWait(), PGPROC::syncRepLinks, SyncRepQueueInsert(), SyncRepRequested, PGPROC::syncRepState, SyncRepWaitMode, update_process_title, WAIT_EVENT_SYNC_REP, WaitLatch(), PGPROC::waitLSN, WalSndCtl, WARNING, whereToSendOutput, WL_LATCH_SET, and WL_POSTMASTER_DEATH.
Referenced by EndPrepare(), RecordTransactionAbortPrepared(), RecordTransactionCommit(), and RecordTransactionCommitPrepared().
|
static |
Definition at line 878 of file syncrep.c.
References Assert(), WalSndCtlData::lsn, LW_EXCLUSIVE, LWLockHeldByMeInMode(), mode, NUM_SYNC_REP_WAIT_MODE, offsetof, pg_write_barrier, PGPROC::procLatch, SetLatch(), SHMQueueDelete(), SHMQueueNext(), SYNC_REP_WAIT_COMPLETE, PGPROC::syncRepLinks, WalSndCtlData::SyncRepQueue, PGPROC::syncRepState, PGPROC::waitLSN, and WalSndCtl.
Referenced by SyncRepReleaseWaiters(), and SyncRepUpdateSyncStandbysDefined().
Definition at line 95 of file syncrep.c.
Referenced by SyncRepReleaseWaiters().
SyncRepConfigData* SyncRepConfig = NULL |
Definition at line 97 of file syncrep.c.
Referenced by assign_synchronous_standby_names(), pg_stat_get_wal_senders(), SyncRepGetCandidateStandbys(), SyncRepGetStandbyPriority(), SyncRepGetSyncRecPtr(), and SyncRepReleaseWaiters().
|
static |
Definition at line 98 of file syncrep.c.
Referenced by assign_synchronous_commit(), and SyncRepWaitForLSN().