|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <unistd.h>#include "access/xact.h"#include "common/int.h"#include "miscadmin.h"#include "pgstat.h"#include "replication/syncrep.h"#include "replication/walsender.h"#include "replication/walsender_private.h"#include "storage/proc.h"#include "tcop/tcopprot.h"#include "utils/guc_hooks.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') |
Definition at line 92 of file syncrep.c.
Definition at line 1122 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.
Definition at line 1116 of file syncrep.c.
References SyncRepConfig.
Definition at line 1057 of file syncrep.c.
References fb(), GUC_check_errcode(), GUC_check_errdetail, GUC_check_errmsg, guc_malloc(), LOG, newval, syncrep_scanner_finish(), syncrep_scanner_init(), and syncrep_yyparse().
Definition at line 738 of file syncrep.c.
References a, b, fb(), and pg_cmp_u64().
Referenced by SyncRepGetNthLatestSyncRecPtr().
Definition at line 832 of file syncrep.c.
Referenced by SyncRepGetCandidateStandbys().
Definition at line 406 of file syncrep.c.
References dlist_delete_thoroughly(), dlist_node_is_detached(), fb(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyProc, SYNC_REP_NOT_WAITING, PGPROC::syncRepLinks, and PGPROC::syncRepState.
Referenced by SyncRepWaitForLSN().
Definition at line 416 of file syncrep.c.
References dlist_delete_thoroughly(), dlist_node_is_detached(), fb(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyProc, and PGPROC::syncRepLinks.
Referenced by ProcKill().
| int SyncRepGetCandidateStandbys | ( | SyncRepStandbyData ** | standbys | ) |
Definition at line 754 of file syncrep.c.
References fb(), i, max_wal_senders, MyWalSnd, SyncRepConfigData::num_sync, palloc_array, qsort, SpinLockAcquire, SpinLockRelease, standby_priority_comparator(), SYNC_REP_PRIORITY, SyncRepConfigData::syncrep_method, SyncRepConfig, WalSndCtl, WalSndCtlData::walsnds, WALSNDSTATE_STOPPING, WALSNDSTATE_STREAMING, and XLogRecPtrIsValid.
Referenced by pg_stat_get_wal_senders(), and SyncRepGetSyncRecPtr().
|
static |
Definition at line 693 of file syncrep.c.
References Assert, cmp_lsn(), fb(), i, palloc_array, pfree(), and qsort.
Referenced by SyncRepGetSyncRecPtr().
|
static |
Definition at line 660 of file syncrep.c.
References fb(), i, write, and XLogRecPtrIsValid.
Referenced by SyncRepGetSyncRecPtr().
Definition at line 859 of file syncrep.c.
References am_cascading_walsender, application_name, fb(), SyncRepConfigData::member_names, SyncRepConfigData::nmembers, pg_strcasecmp(), SYNC_REP_PRIORITY, SyncRepConfigData::syncrep_method, SyncRepConfig, and SyncStandbysDefined.
Referenced by SyncRepInitConfig().
|
static |
Definition at line 586 of file syncrep.c.
References fb(), i, InvalidXLogRecPtr, SyncRepConfigData::num_sync, pfree(), SYNC_REP_PRIORITY, SyncRepConfigData::syncrep_method, SyncRepConfig, SyncRepGetCandidateStandbys(), SyncRepGetNthLatestSyncRecPtr(), and SyncRepGetOldestSyncRecPtr().
Referenced by SyncRepReleaseWaiters().
Definition at line 445 of file syncrep.c.
References application_name, DEBUG1, ereport, errmsg_internal(), fb(), WalSnd::mutex, MyWalSnd, SpinLockAcquire, SpinLockRelease, WalSnd::sync_standby_priority, and SyncRepGetStandbyPriority().
Referenced by ProcessPendingWrites(), StartLogicalReplication(), StartReplication(), WalSndLoop(), and WalSndWaitForWal().
Definition at line 372 of file syncrep.c.
References Assert, dlist_iter::cur, dlist_container, dlist_insert_after(), dlist_push_head(), dlist_reverse_foreach, mode, MyProc, NUM_SYNC_REP_WAIT_MODE, PGPROC::syncRepLinks, WalSndCtlData::SyncRepQueue, PGPROC::waitLSN, and WalSndCtl.
Referenced by SyncRepWaitForLSN().
Definition at line 474 of file syncrep.c.
References announce_next_takeover, application_name, DEBUG3, elog, ereport, errmsg(), fb(), WalSnd::flush, LOG, 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 XLogRecPtrIsValid.
Referenced by ProcessStandbyReplyMessage().
Definition at line 963 of file syncrep.c.
References Assert, fb(), i, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), NUM_SYNC_REP_WAIT_MODE, SYNC_STANDBY_DEFINED, SYNC_STANDBY_INIT, WalSndCtlData::sync_standbys_status, SyncRepWakeQueue(), SyncStandbysDefined, and WalSndCtl.
Referenced by UpdateSharedMemoryConfig().
| void SyncRepWaitForLSN | ( | XLogRecPtr | lsn, |
| bool | commit | ||
| ) |
Definition at line 148 of file syncrep.c.
References Assert, DestNone, dlist_node_is_detached(), ereport, errcode(), errdetail(), errmsg(), fb(), InterruptHoldoffCount, InvalidXLogRecPtr, LSN_FORMAT_ARGS, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), Min, mode, MyLatch, MyProc, pg_read_barrier, ProcDiePending, QueryCancelPending, ResetLatch(), set_ps_display_remove_suffix(), set_ps_display_suffix(), sprintf, SYNC_REP_NOT_WAITING, SYNC_REP_WAIT_COMPLETE, SYNC_REP_WAIT_FLUSH, SYNC_REP_WAITING, SYNC_STANDBY_DEFINED, SYNC_STANDBY_INIT, WalSndCtlData::sync_standbys_status, SyncRepCancelWait(), PGPROC::syncRepLinks, SyncRepQueueInsert(), SyncRepRequested, PGPROC::syncRepState, SyncRepWaitMode, SyncStandbysDefined, update_process_title, WaitLatch(), PGPROC::waitLSN, WalSndCtl, WARNING, whereToSendOutput, WL_LATCH_SET, and WL_POSTMASTER_DEATH.
Referenced by EndPrepare(), RecordTransactionAbortPrepared(), RecordTransactionCommit(), and RecordTransactionCommitPrepared().
Definition at line 906 of file syncrep.c.
References Assert, dlist_mutable_iter::cur, dlist_container, dlist_delete_thoroughly(), dlist_foreach_modify, fb(), LW_EXCLUSIVE, LWLockHeldByMeInMode(), mode, NUM_SYNC_REP_WAIT_MODE, pg_write_barrier, PGPROC::procLatch, SetLatch(), 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().