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 374 of file syncrep.c.

375 {
376  /*
377  * First check if we are removed from the queue without the lock to not
378  * slow down backend exit.
379  */
381  {
382  LWLockAcquire(SyncRepLock, LW_EXCLUSIVE);
383 
384  /* maybe we have just been removed, so recheck */
387 
388  LWLockRelease(SyncRepLock);
389  }
390 }
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:1195
void LWLockRelease(LWLock *lock)
Definition: lwlock.c:1803
@ LW_EXCLUSIVE
Definition: lwlock.h:116
PGPROC * MyProc
Definition: proc.c:66
dlist_node syncRepLinks
Definition: proc.h:245

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 717 of file syncrep.c.

718 {
719  int i;
720  int n;
721 
722  /* Create result array */
723  *standbys = (SyncRepStandbyData *)
725 
726  /* Quick exit if sync replication is not requested */
727  if (SyncRepConfig == NULL)
728  return 0;
729 
730  /* Collect raw data from shared memory */
731  n = 0;
732  for (i = 0; i < max_wal_senders; i++)
733  {
734  volatile WalSnd *walsnd; /* Use volatile pointer to prevent code
735  * rearrangement */
736  SyncRepStandbyData *stby;
737  WalSndState state; /* not included in SyncRepStandbyData */
738 
739  walsnd = &WalSndCtl->walsnds[i];
740  stby = *standbys + n;
741 
742  SpinLockAcquire(&walsnd->mutex);
743  stby->pid = walsnd->pid;
744  state = walsnd->state;
745  stby->write = walsnd->write;
746  stby->flush = walsnd->flush;
747  stby->apply = walsnd->apply;
749  SpinLockRelease(&walsnd->mutex);
750 
751  /* Must be active */
752  if (stby->pid == 0)
753  continue;
754 
755  /* Must be streaming or stopping */
756  if (state != WALSNDSTATE_STREAMING &&
758  continue;
759 
760  /* Must be synchronous */
761  if (stby->sync_standby_priority == 0)
762  continue;
763 
764  /* Must have a valid flush position */
765  if (XLogRecPtrIsInvalid(stby->flush))
766  continue;
767 
768  /* OK, it's a candidate */
769  stby->walsnd_index = i;
770  stby->is_me = (walsnd == MyWalSnd);
771  n++;
772  }
773 
774  /*
775  * In quorum mode, we return all the candidates. In priority mode, if we
776  * have too many candidates then return only the num_sync ones of highest
777  * priority.
778  */
780  n > SyncRepConfig->num_sync)
781  {
782  /* Sort by priority ... */
783  qsort(*standbys, n, sizeof(SyncRepStandbyData),
785  /* ... then report just the first num_sync ones */
786  n = SyncRepConfig->num_sync;
787  }
788 
789  return n;
790 }
int i
Definition: isn.c:73
void * palloc(Size size)
Definition: mcxt.c:1226
#define qsort(a, b, c, d)
Definition: port.h:445
#define SpinLockRelease(lock)
Definition: spin.h:64
#define SpinLockAcquire(lock)
Definition: spin.h:62
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:796
SyncRepConfigData * SyncRepConfig
Definition: syncrep.c:98
#define SYNC_REP_PRIORITY
Definition: syncrep.h:35
WalSnd * MyWalSnd
Definition: walsender.c:113
int max_wal_senders
Definition: walsender.c:122
WalSndCtlData * WalSndCtl
Definition: walsender.c:110
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 403 of file syncrep.c.

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

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 432 of file syncrep.c.

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

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

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

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, WAIT_EVENT_SYNC_REP, 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 91 of file syncrep.c.