PostgreSQL Source Code  git master
syncrep.h File Reference
#include "access/xlogdefs.h"
Include dependency graph for syncrep.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  SyncRepStandbyData
 
struct  SyncRepConfigData
 

Macros

#define SyncRepRequested()    (max_wal_senders > 0 && synchronous_commit > SYNCHRONOUS_COMMIT_LOCAL_FLUSH)
 
#define SYNC_REP_NO_WAIT   (-1)
 
#define SYNC_REP_WAIT_WRITE   0
 
#define SYNC_REP_WAIT_FLUSH   1
 
#define SYNC_REP_WAIT_APPLY   2
 
#define NUM_SYNC_REP_WAIT_MODE   3
 
#define SYNC_REP_NOT_WAITING   0
 
#define SYNC_REP_WAITING   1
 
#define SYNC_REP_WAIT_COMPLETE   2
 
#define SYNC_REP_PRIORITY   0
 
#define SYNC_REP_QUORUM   1
 

Typedefs

typedef struct SyncRepStandbyData SyncRepStandbyData
 
typedef struct SyncRepConfigData SyncRepConfigData
 

Functions

void SyncRepWaitForLSN (XLogRecPtr lsn, bool commit)
 
void SyncRepCleanupAtProcExit (void)
 
void SyncRepInitConfig (void)
 
void SyncRepReleaseWaiters (void)
 
int SyncRepGetCandidateStandbys (SyncRepStandbyData **standbys)
 
void SyncRepUpdateSyncStandbysDefined (void)
 
int syncrep_yyparse (void)
 
int syncrep_yylex (void)
 
void syncrep_yyerror (const char *str)
 
void syncrep_scanner_init (const char *str)
 
void syncrep_scanner_finish (void)
 

Variables

PGDLLIMPORT SyncRepConfigDataSyncRepConfig
 
PGDLLIMPORT SyncRepConfigDatasyncrep_parse_result
 
PGDLLIMPORT char * syncrep_parse_error_msg
 
PGDLLIMPORT char * SyncRepStandbyNames
 

Macro Definition Documentation

◆ NUM_SYNC_REP_WAIT_MODE

#define NUM_SYNC_REP_WAIT_MODE   3

Definition at line 27 of file syncrep.h.

◆ SYNC_REP_NO_WAIT

#define SYNC_REP_NO_WAIT   (-1)

Definition at line 22 of file syncrep.h.

◆ SYNC_REP_NOT_WAITING

#define SYNC_REP_NOT_WAITING   0

Definition at line 30 of file syncrep.h.

◆ SYNC_REP_PRIORITY

#define SYNC_REP_PRIORITY   0

Definition at line 35 of file syncrep.h.

◆ SYNC_REP_QUORUM

#define SYNC_REP_QUORUM   1

Definition at line 36 of file syncrep.h.

◆ SYNC_REP_WAIT_APPLY

#define SYNC_REP_WAIT_APPLY   2

Definition at line 25 of file syncrep.h.

◆ SYNC_REP_WAIT_COMPLETE

#define SYNC_REP_WAIT_COMPLETE   2

Definition at line 32 of file syncrep.h.

◆ SYNC_REP_WAIT_FLUSH

#define SYNC_REP_WAIT_FLUSH   1

Definition at line 24 of file syncrep.h.

◆ SYNC_REP_WAIT_WRITE

#define SYNC_REP_WAIT_WRITE   0

Definition at line 23 of file syncrep.h.

◆ SYNC_REP_WAITING

#define SYNC_REP_WAITING   1

Definition at line 31 of file syncrep.h.

◆ SyncRepRequested

#define SyncRepRequested ( )     (max_wal_senders > 0 && synchronous_commit > SYNCHRONOUS_COMMIT_LOCAL_FLUSH)

Definition at line 18 of file syncrep.h.

Typedef Documentation

◆ SyncRepConfigData

◆ SyncRepStandbyData

Function Documentation

◆ syncrep_scanner_finish()

void syncrep_scanner_finish ( void  )

◆ syncrep_scanner_init()

void syncrep_scanner_init ( const char *  str)

◆ syncrep_yyerror()

void syncrep_yyerror ( const char *  str)

◆ syncrep_yylex()

int syncrep_yylex ( void  )

◆ syncrep_yyparse()

int syncrep_yyparse ( void  )

◆ SyncRepCleanupAtProcExit()

void SyncRepCleanupAtProcExit ( void  )

Definition at line 373 of file syncrep.c.

374 {
375  /*
376  * First check if we are removed from the queue without the lock to not
377  * slow down backend exit.
378  */
380  {
381  LWLockAcquire(SyncRepLock, LW_EXCLUSIVE);
382 
383  /* maybe we have just been removed, so recheck */
386 
387  LWLockRelease(SyncRepLock);
388  }
389 }
static void dlist_delete_thoroughly(dlist_node *node)
Definition: ilist.h:416
static bool dlist_node_is_detached(const dlist_node *node)
Definition: ilist.h:525
bool LWLockAcquire(LWLock *lock, LWLockMode mode)
Definition: lwlock.c:1168
void LWLockRelease(LWLock *lock)
Definition: lwlock.c:1781
@ LW_EXCLUSIVE
Definition: lwlock.h:114
PGPROC * MyProc
Definition: proc.c:66
dlist_node syncRepLinks
Definition: proc.h:254

References dlist_delete_thoroughly(), dlist_node_is_detached(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyProc, and PGPROC::syncRepLinks.

Referenced by ProcKill().

◆ SyncRepGetCandidateStandbys()

int SyncRepGetCandidateStandbys ( SyncRepStandbyData **  standbys)

Definition at line 711 of file syncrep.c.

712 {
713  int i;
714  int n;
715 
716  /* Create result array */
717  *standbys = (SyncRepStandbyData *)
719 
720  /* Quick exit if sync replication is not requested */
721  if (SyncRepConfig == NULL)
722  return 0;
723 
724  /* Collect raw data from shared memory */
725  n = 0;
726  for (i = 0; i < max_wal_senders; i++)
727  {
728  volatile WalSnd *walsnd; /* Use volatile pointer to prevent code
729  * rearrangement */
730  SyncRepStandbyData *stby;
731  WalSndState state; /* not included in SyncRepStandbyData */
732 
733  walsnd = &WalSndCtl->walsnds[i];
734  stby = *standbys + n;
735 
736  SpinLockAcquire(&walsnd->mutex);
737  stby->pid = walsnd->pid;
738  state = walsnd->state;
739  stby->write = walsnd->write;
740  stby->flush = walsnd->flush;
741  stby->apply = walsnd->apply;
743  SpinLockRelease(&walsnd->mutex);
744 
745  /* Must be active */
746  if (stby->pid == 0)
747  continue;
748 
749  /* Must be streaming or stopping */
750  if (state != WALSNDSTATE_STREAMING &&
752  continue;
753 
754  /* Must be synchronous */
755  if (stby->sync_standby_priority == 0)
756  continue;
757 
758  /* Must have a valid flush position */
759  if (XLogRecPtrIsInvalid(stby->flush))
760  continue;
761 
762  /* OK, it's a candidate */
763  stby->walsnd_index = i;
764  stby->is_me = (walsnd == MyWalSnd);
765  n++;
766  }
767 
768  /*
769  * In quorum mode, we return all the candidates. In priority mode, if we
770  * have too many candidates then return only the num_sync ones of highest
771  * priority.
772  */
774  n > SyncRepConfig->num_sync)
775  {
776  /* Sort by priority ... */
777  qsort(*standbys, n, sizeof(SyncRepStandbyData),
779  /* ... then report just the first num_sync ones */
780  n = SyncRepConfig->num_sync;
781  }
782 
783  return n;
784 }
int i
Definition: isn.c:72
void * palloc(Size size)
Definition: mcxt.c:1317
#define qsort(a, b, c, d)
Definition: port.h:447
#define SpinLockRelease(lock)
Definition: spin.h:61
#define SpinLockAcquire(lock)
Definition: spin.h:59
uint8 syncrep_method
Definition: syncrep.h:68
int sync_standby_priority
Definition: syncrep.h:49
XLogRecPtr apply
Definition: syncrep.h:48
XLogRecPtr write
Definition: syncrep.h:46
XLogRecPtr flush
Definition: syncrep.h:47
WalSnd walsnds[FLEXIBLE_ARRAY_MEMBER]
slock_t mutex
XLogRecPtr flush
WalSndState state
XLogRecPtr write
int sync_standby_priority
XLogRecPtr apply
Definition: regguts.h:323
static int standby_priority_comparator(const void *a, const void *b)
Definition: syncrep.c:790
SyncRepConfigData * SyncRepConfig
Definition: syncrep.c:97
#define SYNC_REP_PRIORITY
Definition: syncrep.h:35
WalSnd * MyWalSnd
Definition: walsender.c:112
int max_wal_senders
Definition: walsender.c:121
WalSndCtlData * WalSndCtl
Definition: walsender.c:109
WalSndState
@ WALSNDSTATE_STREAMING
@ WALSNDSTATE_STOPPING
#define XLogRecPtrIsInvalid(r)
Definition: xlogdefs.h:29

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().

◆ SyncRepInitConfig()

void SyncRepInitConfig ( void  )

Definition at line 402 of file syncrep.c.

403 {
404  int priority;
405 
406  /*
407  * Determine if we are a potential sync standby and remember the result
408  * for handling replies from standby.
409  */
410  priority = SyncRepGetStandbyPriority();
411  if (MyWalSnd->sync_standby_priority != priority)
412  {
414  MyWalSnd->sync_standby_priority = priority;
416 
417  ereport(DEBUG1,
418  (errmsg_internal("standby \"%s\" now has synchronous standby priority %d",
419  application_name, priority)));
420  }
421 }
int errmsg_internal(const char *fmt,...)
Definition: elog.c:1157
#define DEBUG1
Definition: elog.h:30
#define ereport(elevel,...)
Definition: elog.h:149
char * application_name
Definition: guc_tables.c:543
static int SyncRepGetStandbyPriority(void)
Definition: syncrep.c:817

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().

◆ SyncRepReleaseWaiters()

void SyncRepReleaseWaiters ( void  )

Definition at line 431 of file syncrep.c.

432 {
433  volatile WalSndCtlData *walsndctl = WalSndCtl;
434  XLogRecPtr writePtr;
435  XLogRecPtr flushPtr;
436  XLogRecPtr applyPtr;
437  bool got_recptr;
438  bool am_sync;
439  int numwrite = 0;
440  int numflush = 0;
441  int numapply = 0;
442 
443  /*
444  * If this WALSender is serving a standby that is not on the list of
445  * potential sync standbys then we have nothing to do. If we are still
446  * starting up, still running base backup or the current flush position is
447  * still invalid, then leave quickly also. Streaming or stopping WAL
448  * senders are allowed to release waiters.
449  */
450  if (MyWalSnd->sync_standby_priority == 0 ||
454  {
455  announce_next_takeover = true;
456  return;
457  }
458 
459  /*
460  * We're a potential sync standby. Release waiters if there are enough
461  * sync standbys and we are considered as sync.
462  */
463  LWLockAcquire(SyncRepLock, LW_EXCLUSIVE);
464 
465  /*
466  * Check whether we are a sync standby or not, and calculate the synced
467  * positions among all sync standbys. (Note: although this step does not
468  * of itself require holding SyncRepLock, it seems like a good idea to do
469  * it after acquiring the lock. This ensures that the WAL pointers we use
470  * to release waiters are newer than any previous execution of this
471  * routine used.)
472  */
473  got_recptr = SyncRepGetSyncRecPtr(&writePtr, &flushPtr, &applyPtr, &am_sync);
474 
475  /*
476  * If we are managing a sync standby, though we weren't prior to this,
477  * then announce we are now a sync standby.
478  */
479  if (announce_next_takeover && am_sync)
480  {
481  announce_next_takeover = false;
482 
484  ereport(LOG,
485  (errmsg("standby \"%s\" is now a synchronous standby with priority %d",
487  else
488  ereport(LOG,
489  (errmsg("standby \"%s\" is now a candidate for quorum synchronous standby",
490  application_name)));
491  }
492 
493  /*
494  * If the number of sync standbys is less than requested or we aren't
495  * managing a sync standby then just leave.
496  */
497  if (!got_recptr || !am_sync)
498  {
499  LWLockRelease(SyncRepLock);
500  announce_next_takeover = !am_sync;
501  return;
502  }
503 
504  /*
505  * Set the lsn first so that when we wake backends they will release up to
506  * this location.
507  */
508  if (walsndctl->lsn[SYNC_REP_WAIT_WRITE] < writePtr)
509  {
510  walsndctl->lsn[SYNC_REP_WAIT_WRITE] = writePtr;
511  numwrite = SyncRepWakeQueue(false, SYNC_REP_WAIT_WRITE);
512  }
513  if (walsndctl->lsn[SYNC_REP_WAIT_FLUSH] < flushPtr)
514  {
515  walsndctl->lsn[SYNC_REP_WAIT_FLUSH] = flushPtr;
516  numflush = SyncRepWakeQueue(false, SYNC_REP_WAIT_FLUSH);
517  }
518  if (walsndctl->lsn[SYNC_REP_WAIT_APPLY] < applyPtr)
519  {
520  walsndctl->lsn[SYNC_REP_WAIT_APPLY] = applyPtr;
521  numapply = SyncRepWakeQueue(false, SYNC_REP_WAIT_APPLY);
522  }
523 
524  LWLockRelease(SyncRepLock);
525 
526  elog(DEBUG3, "released %d procs up to write %X/%X, %d procs up to flush %X/%X, %d procs up to apply %X/%X",
527  numwrite, LSN_FORMAT_ARGS(writePtr),
528  numflush, LSN_FORMAT_ARGS(flushPtr),
529  numapply, LSN_FORMAT_ARGS(applyPtr));
530 }
int errmsg(const char *fmt,...)
Definition: elog.c:1070
#define LOG
Definition: elog.h:31
#define DEBUG3
Definition: elog.h:28
#define elog(elevel,...)
Definition: elog.h:225
XLogRecPtr lsn[NUM_SYNC_REP_WAIT_MODE]
static bool SyncRepGetSyncRecPtr(XLogRecPtr *writePtr, XLogRecPtr *flushPtr, XLogRecPtr *applyPtr, bool *am_sync)
Definition: syncrep.c:543
static int SyncRepWakeQueue(bool all, int mode)
Definition: syncrep.c:864
static bool announce_next_takeover
Definition: syncrep.c:95
#define SYNC_REP_WAIT_WRITE
Definition: syncrep.h:23
#define SYNC_REP_WAIT_FLUSH
Definition: syncrep.h:24
#define SYNC_REP_WAIT_APPLY
Definition: syncrep.h:25
#define LSN_FORMAT_ARGS(lsn)
Definition: xlogdefs.h:43
uint64 XLogRecPtr
Definition: xlogdefs.h:21

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().

◆ SyncRepUpdateSyncStandbysDefined()

void SyncRepUpdateSyncStandbysDefined ( void  )

Definition at line 921 of file syncrep.c.

922 {
923  bool sync_standbys_defined = SyncStandbysDefined();
924 
925  if (sync_standbys_defined != WalSndCtl->sync_standbys_defined)
926  {
927  LWLockAcquire(SyncRepLock, LW_EXCLUSIVE);
928 
929  /*
930  * If synchronous_standby_names has been reset to empty, it's futile
931  * for backends to continue waiting. Since the user no longer wants
932  * synchronous replication, we'd better wake them up.
933  */
934  if (!sync_standbys_defined)
935  {
936  int i;
937 
938  for (i = 0; i < NUM_SYNC_REP_WAIT_MODE; i++)
939  SyncRepWakeQueue(true, i);
940  }
941 
942  /*
943  * Only allow people to join the queue when there are synchronous
944  * standbys defined. Without this interlock, there's a race
945  * condition: we might wake up all the current waiters; then, some
946  * backend that hasn't yet reloaded its config might go to sleep on
947  * the queue (and never wake up). This prevents that.
948  */
949  WalSndCtl->sync_standbys_defined = sync_standbys_defined;
950 
951  LWLockRelease(SyncRepLock);
952  }
953 }
#define SyncStandbysDefined()
Definition: syncrep.c:92
#define NUM_SYNC_REP_WAIT_MODE
Definition: syncrep.h:27

References i, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), NUM_SYNC_REP_WAIT_MODE, WalSndCtlData::sync_standbys_defined, SyncRepWakeQueue(), SyncStandbysDefined, and WalSndCtl.

Referenced by UpdateSharedMemoryConfig().

◆ SyncRepWaitForLSN()

void SyncRepWaitForLSN ( XLogRecPtr  lsn,
bool  commit 
)

Definition at line 148 of file syncrep.c.

149 {
150  int mode;
151 
152  /*
153  * This should be called while holding interrupts during a transaction
154  * commit to prevent the follow-up shared memory queue cleanups to be
155  * influenced by external interruptions.
156  */
158 
159  /*
160  * Fast exit if user has not requested sync replication, or there are no
161  * sync replication standby names defined.
162  *
163  * Since this routine gets called every commit time, it's important to
164  * exit quickly if sync replication is not requested. So we check
165  * WalSndCtl->sync_standbys_defined flag without the lock and exit
166  * immediately if it's false. If it's true, we need to check it again
167  * later while holding the lock, to check the flag and operate the sync
168  * rep queue atomically. This is necessary to avoid the race condition
169  * described in SyncRepUpdateSyncStandbysDefined(). On the other hand, if
170  * it's false, the lock is not necessary because we don't touch the queue.
171  */
172  if (!SyncRepRequested() ||
173  !((volatile WalSndCtlData *) WalSndCtl)->sync_standbys_defined)
174  return;
175 
176  /* Cap the level for anything other than commit to remote flush only. */
177  if (commit)
179  else
181 
183  Assert(WalSndCtl != NULL);
184 
185  LWLockAcquire(SyncRepLock, LW_EXCLUSIVE);
187 
188  /*
189  * We don't wait for sync rep if WalSndCtl->sync_standbys_defined is not
190  * set. See SyncRepUpdateSyncStandbysDefined.
191  *
192  * Also check that the standby hasn't already replied. Unlikely race
193  * condition but we'll be fetching that cache line anyway so it's likely
194  * to be a low cost check.
195  */
197  lsn <= WalSndCtl->lsn[mode])
198  {
199  LWLockRelease(SyncRepLock);
200  return;
201  }
202 
203  /*
204  * Set our waitLSN so WALSender will know when to wake us, and add
205  * ourselves to the queue.
206  */
207  MyProc->waitLSN = lsn;
210  Assert(SyncRepQueueIsOrderedByLSN(mode));
211  LWLockRelease(SyncRepLock);
212 
213  /* Alter ps display to show waiting for sync rep. */
215  {
216  char buffer[32];
217 
218  sprintf(buffer, "waiting for %X/%X", LSN_FORMAT_ARGS(lsn));
219  set_ps_display_suffix(buffer);
220  }
221 
222  /*
223  * Wait for specified LSN to be confirmed.
224  *
225  * Each proc has its own wait latch, so we perform a normal latch
226  * check/wait loop here.
227  */
228  for (;;)
229  {
230  int rc;
231 
232  /* Must reset the latch before testing state. */
234 
235  /*
236  * Acquiring the lock is not needed, the latch ensures proper
237  * barriers. If it looks like we're done, we must really be done,
238  * because once walsender changes the state to SYNC_REP_WAIT_COMPLETE,
239  * it will never update it again, so we can't be seeing a stale value
240  * in that case.
241  */
243  break;
244 
245  /*
246  * If a wait for synchronous replication is pending, we can neither
247  * acknowledge the commit nor raise ERROR or FATAL. The latter would
248  * lead the client to believe that the transaction aborted, which is
249  * not true: it's already committed locally. The former is no good
250  * either: the client has requested synchronous replication, and is
251  * entitled to assume that an acknowledged commit is also replicated,
252  * which might not be true. So in this case we issue a WARNING (which
253  * some clients may be able to interpret) and shut off further output.
254  * We do NOT reset ProcDiePending, so that the process will die after
255  * the commit is cleaned up.
256  */
257  if (ProcDiePending)
258  {
260  (errcode(ERRCODE_ADMIN_SHUTDOWN),
261  errmsg("canceling the wait for synchronous replication and terminating connection due to administrator command"),
262  errdetail("The transaction has already committed locally, but might not have been replicated to the standby.")));
265  break;
266  }
267 
268  /*
269  * It's unclear what to do if a query cancel interrupt arrives. We
270  * can't actually abort at this point, but ignoring the interrupt
271  * altogether is not helpful, so we just terminate the wait with a
272  * suitable warning.
273  */
274  if (QueryCancelPending)
275  {
276  QueryCancelPending = false;
278  (errmsg("canceling wait for synchronous replication due to user request"),
279  errdetail("The transaction has already committed locally, but might not have been replicated to the standby.")));
281  break;
282  }
283 
284  /*
285  * Wait on latch. Any condition that should wake us up will set the
286  * latch, so no need for timeout.
287  */
289  WAIT_EVENT_SYNC_REP);
290 
291  /*
292  * If the postmaster dies, we'll probably never get an acknowledgment,
293  * because all the wal sender processes will exit. So just bail out.
294  */
295  if (rc & WL_POSTMASTER_DEATH)
296  {
297  ProcDiePending = true;
300  break;
301  }
302  }
303 
304  /*
305  * WalSender has checked our LSN and has removed us from queue. Clean up
306  * state and leave. It's OK to reset these shared memory fields without
307  * holding SyncRepLock, because any walsenders will ignore us anyway when
308  * we're not on the queue. We need a read barrier to make sure we see the
309  * changes to the queue link (this might be unnecessary without
310  * assertions, but better safe than sorry).
311  */
312  pg_read_barrier();
315  MyProc->waitLSN = 0;
316 
317  /* reset ps display to remove the suffix */
320 }
#define pg_read_barrier()
Definition: atomics.h:156
#define Min(x, y)
Definition: c.h:958
#define Assert(condition)
Definition: c.h:812
@ DestNone
Definition: dest.h:87
int errdetail(const char *fmt,...)
Definition: elog.c:1203
int errcode(int sqlerrcode)
Definition: elog.c:853
#define WARNING
Definition: elog.h:36
volatile uint32 InterruptHoldoffCount
Definition: globals.c:42
volatile sig_atomic_t QueryCancelPending
Definition: globals.c:32
struct Latch * MyLatch
Definition: globals.c:62
volatile sig_atomic_t ProcDiePending
Definition: globals.c:33
void ResetLatch(Latch *latch)
Definition: latch.c:724
int WaitLatch(Latch *latch, int wakeEvents, long timeout, uint32 wait_event_info)
Definition: latch.c:517
#define WL_LATCH_SET
Definition: latch.h:127
#define WL_POSTMASTER_DEATH
Definition: latch.h:131
static PgChecksumMode mode
Definition: pg_checksums.c:55
#define sprintf
Definition: port.h:240
CommandDest whereToSendOutput
Definition: postgres.c:90
void set_ps_display_remove_suffix(void)
Definition: ps_status.c:421
void set_ps_display_suffix(const char *suffix)
Definition: ps_status.c:369
bool update_process_title
Definition: ps_status.c:29
XLogRecPtr waitLSN
Definition: proc.h:252
int syncRepState
Definition: proc.h:253
static int SyncRepWaitMode
Definition: syncrep.c:98
static void SyncRepQueueInsert(int mode)
Definition: syncrep.c:329
static void SyncRepCancelWait(void)
Definition: syncrep.c:363
#define SyncRepRequested()
Definition: syncrep.h:18
#define SYNC_REP_WAITING
Definition: syncrep.h:31
#define SYNC_REP_WAIT_COMPLETE
Definition: syncrep.h:32
#define SYNC_REP_NOT_WAITING
Definition: syncrep.h:30

References Assert, DestNone, dlist_node_is_detached(), ereport, errcode(), errdetail(), errmsg(), InterruptHoldoffCount, 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, WalSndCtlData::sync_standbys_defined, SyncRepCancelWait(), PGPROC::syncRepLinks, SyncRepQueueInsert(), SyncRepRequested, PGPROC::syncRepState, SyncRepWaitMode, update_process_title, WaitLatch(), PGPROC::waitLSN, WalSndCtl, WARNING, whereToSendOutput, WL_LATCH_SET, and WL_POSTMASTER_DEATH.

Referenced by EndPrepare(), RecordTransactionAbortPrepared(), RecordTransactionCommit(), and RecordTransactionCommitPrepared().

Variable Documentation

◆ syncrep_parse_error_msg

PGDLLIMPORT char* syncrep_parse_error_msg
extern

◆ syncrep_parse_result

PGDLLIMPORT SyncRepConfigData* syncrep_parse_result
extern

◆ SyncRepConfig

◆ SyncRepStandbyNames

PGDLLIMPORT char* SyncRepStandbyNames
extern

Definition at line 90 of file syncrep.c.