PostgreSQL Source Code  git master
walsender.h File Reference
#include <signal.h>
#include "fmgr.h"
Include dependency graph for walsender.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define WalSndWakeupRequest()   do { wake_wal_senders = true; } while (0)
 
#define WalSndWakeupProcessRequests()
 

Enumerations

enum  CRSSnapshotAction { CRS_EXPORT_SNAPSHOT, CRS_NOEXPORT_SNAPSHOT, CRS_USE_SNAPSHOT }
 

Functions

void InitWalSender (void)
 
bool exec_replication_command (const char *query_string)
 
void WalSndErrorCleanup (void)
 
void WalSndSignals (void)
 
Size WalSndShmemSize (void)
 
void WalSndShmemInit (void)
 
void WalSndWakeup (void)
 
void WalSndInitStopping (void)
 
void WalSndWaitStopping (void)
 
void HandleWalSndInitStopping (void)
 
void WalSndRqstFileReload (void)
 

Variables

bool am_walsender
 
bool am_cascading_walsender
 
bool am_db_walsender
 
bool wake_wal_senders
 
int max_wal_senders
 
int wal_sender_timeout
 
bool log_replication_commands
 

Macro Definition Documentation

◆ WalSndWakeupProcessRequests

#define WalSndWakeupProcessRequests ( )
Value:
do \
{ \
{ \
wake_wal_senders = false; \
if (max_wal_senders > 0) \
WalSndWakeup(); \
} \
} while (0)
int max_wal_senders
Definition: walsender.c:120
bool wake_wal_senders
Definition: walsender.c:129

Definition at line 64 of file walsender.h.

Referenced by XLogBackgroundFlush(), and XLogFlush().

◆ WalSndWakeupRequest

#define WalSndWakeupRequest ( )    do { wake_wal_senders = true; } while (0)

Definition at line 58 of file walsender.h.

Referenced by XLogWrite().

Enumeration Type Documentation

◆ CRSSnapshotAction

Enumerator
CRS_EXPORT_SNAPSHOT 
CRS_NOEXPORT_SNAPSHOT 
CRS_USE_SNAPSHOT 

Definition at line 22 of file walsender.h.

Function Documentation

◆ exec_replication_command()

bool exec_replication_command ( const char *  query_string)

Definition at line 1416 of file walsender.c.

References ALLOCSET_DEFAULT_SIZES, AllocSetContextCreate(), CHECK_FOR_INTERRUPTS, CreateDestReceiver(), CreateReplicationSlot(), CurrentMemoryContext, DEBUG1, generate_unaccent_rules::dest, DestRemote, DestRemoteSimple, DropReplicationSlot(), elog, EndCommand(), ereport, errcode(), errmsg(), errmsg_internal(), ERROR, GetPGVariable(), got_STOPPING, IdentifySystem(), initStringInfo(), InvalidOid, IsA, IsAbortedTransactionBlockState(), IsTransactionBlock(), StartReplicationCmd::kind, LOG, log_replication_commands, MemoryContextDelete(), MemoryContextSwitchTo(), MyDatabaseId, VariableShowStmt::name, PreventTransactionChain(), REPLICATION_KIND_PHYSICAL, replication_parse_result, replication_scanner_init(), replication_yyparse(), SendBaseBackup(), SendTimeLineHistory(), SnapBuildClearExportedSnapshot(), StartLogicalReplication(), StartReplication(), WalSnd::state, T_BaseBackupCmd, T_CreateReplicationSlotCmd, T_DropReplicationSlotCmd, T_IdentifySystemCmd, T_SQLCmd, T_StartReplicationCmd, T_TimeLineHistoryCmd, T_VariableShowStmt, TimeLineHistoryCmd::type, Node::type, WalSndSetState(), and WALSNDSTATE_STOPPING.

Referenced by PostgresMain().

1417 {
1418  int parse_rc;
1419  Node *cmd_node;
1420  MemoryContext cmd_context;
1421  MemoryContext old_context;
1422 
1423  /*
1424  * If WAL sender has been told that shutdown is getting close, switch its
1425  * status accordingly to handle the next replication commands correctly.
1426  */
1427  if (got_STOPPING)
1429 
1430  /*
1431  * Throw error if in stopping mode. We need prevent commands that could
1432  * generate WAL while the shutdown checkpoint is being written. To be
1433  * safe, we just prohibit all new commands.
1434  */
1436  ereport(ERROR,
1437  (errmsg("cannot execute new commands while WAL sender is in stopping mode")));
1438 
1439  /*
1440  * CREATE_REPLICATION_SLOT ... LOGICAL exports a snapshot until the next
1441  * command arrives. Clean up the old stuff if there's anything.
1442  */
1444 
1446 
1448  "Replication command context",
1450  old_context = MemoryContextSwitchTo(cmd_context);
1451 
1452  replication_scanner_init(cmd_string);
1453  parse_rc = replication_yyparse();
1454  if (parse_rc != 0)
1455  ereport(ERROR,
1456  (errcode(ERRCODE_SYNTAX_ERROR),
1457  (errmsg_internal("replication command parser returned %d",
1458  parse_rc))));
1459 
1460  cmd_node = replication_parse_result;
1461 
1462  /*
1463  * Log replication command if log_replication_commands is enabled. Even
1464  * when it's disabled, log the command with DEBUG1 level for backward
1465  * compatibility. Note that SQL commands are not logged here, and will be
1466  * logged later if log_statement is enabled.
1467  */
1468  if (cmd_node->type != T_SQLCmd)
1470  (errmsg("received replication command: %s", cmd_string)));
1471 
1472  /*
1473  * CREATE_REPLICATION_SLOT ... LOGICAL exports a snapshot. If it was
1474  * called outside of transaction the snapshot should be cleared here.
1475  */
1476  if (!IsTransactionBlock())
1478 
1479  /*
1480  * For aborted transactions, don't allow anything except pure SQL, the
1481  * exec_simple_query() will handle it correctly.
1482  */
1483  if (IsAbortedTransactionBlockState() && !IsA(cmd_node, SQLCmd))
1484  ereport(ERROR,
1485  (errcode(ERRCODE_IN_FAILED_SQL_TRANSACTION),
1486  errmsg("current transaction is aborted, "
1487  "commands ignored until end of transaction block")));
1488 
1490 
1491  /*
1492  * Allocate buffers that will be used for each outgoing and incoming
1493  * message. We do this just once per command to reduce palloc overhead.
1494  */
1498 
1499  switch (cmd_node->type)
1500  {
1501  case T_IdentifySystemCmd:
1502  IdentifySystem();
1503  break;
1504 
1505  case T_BaseBackupCmd:
1506  PreventTransactionChain(true, "BASE_BACKUP");
1507  SendBaseBackup((BaseBackupCmd *) cmd_node);
1508  break;
1509 
1512  break;
1513 
1516  break;
1517 
1518  case T_StartReplicationCmd:
1519  {
1520  StartReplicationCmd *cmd = (StartReplicationCmd *) cmd_node;
1521 
1522  PreventTransactionChain(true, "START_REPLICATION");
1523 
1524  if (cmd->kind == REPLICATION_KIND_PHYSICAL)
1525  StartReplication(cmd);
1526  else
1528  break;
1529  }
1530 
1531  case T_TimeLineHistoryCmd:
1532  PreventTransactionChain(true, "TIMELINE_HISTORY");
1534  break;
1535 
1536  case T_VariableShowStmt:
1537  {
1539  VariableShowStmt *n = (VariableShowStmt *) cmd_node;
1540 
1541  GetPGVariable(n->name, dest);
1542  }
1543  break;
1544 
1545  case T_SQLCmd:
1546  if (MyDatabaseId == InvalidOid)
1547  ereport(ERROR,
1548  (errmsg("cannot execute SQL commands in WAL sender for physical replication")));
1549 
1550  /* Tell the caller that this wasn't a WalSender command. */
1551  return false;
1552 
1553  default:
1554  elog(ERROR, "unrecognized replication command node tag: %u",
1555  cmd_node->type);
1556  }
1557 
1558  /* done */
1559  MemoryContextSwitchTo(old_context);
1560  MemoryContextDelete(cmd_context);
1561 
1562  /* Send CommandComplete message */
1563  EndCommand("SELECT", DestRemote);
1564 
1565  return true;
1566 }
#define IsA(nodeptr, _type_)
Definition: nodes.h:561
void MemoryContextDelete(MemoryContext context)
Definition: mcxt.c:200
#define DEBUG1
Definition: elog.h:25
static void SendTimeLineHistory(TimeLineHistoryCmd *cmd)
Definition: walsender.c:427
static void DropReplicationSlot(DropReplicationSlotCmd *cmd)
Definition: walsender.c:1029
bool IsAbortedTransactionBlockState(void)
Definition: xact.c:371
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Definition: palloc.h:109
Definition: nodes.h:510
static StringInfoData output_message
Definition: walsender.c:160
static volatile sig_atomic_t got_STOPPING
Definition: walsender.c:187
int errcode(int sqlerrcode)
Definition: elog.c:575
#define LOG
Definition: elog.h:26
void GetPGVariable(const char *name, DestReceiver *dest)
Definition: guc.c:7912
Node * replication_parse_result
bool IsTransactionBlock(void)
Definition: xact.c:4447
ReplicationKind kind
Definition: replnodes.h:82
void EndCommand(const char *commandTag, CommandDest dest)
Definition: dest.c:157
#define ERROR
Definition: elog.h:43
void SendBaseBackup(BaseBackupCmd *cmd)
Definition: basebackup.c:694
#define ALLOCSET_DEFAULT_SIZES
Definition: memutils.h:165
WalSndState state
NodeTag type
Definition: nodes.h:512
DestReceiver * CreateDestReceiver(CommandDest dest)
Definition: dest.c:109
static void StartReplication(StartReplicationCmd *cmd)
Definition: walsender.c:523
MemoryContext CurrentMemoryContext
Definition: mcxt.c:37
#define ereport(elevel, rest)
Definition: elog.h:122
int replication_yyparse(void)
void initStringInfo(StringInfo str)
Definition: stringinfo.c:46
static StringInfoData reply_message
Definition: walsender.c:161
MemoryContext AllocSetContextCreate(MemoryContext parent, const char *name, Size minContextSize, Size initBlockSize, Size maxBlockSize)
Definition: aset.c:322
static void StartLogicalReplication(StartReplicationCmd *cmd)
Definition: walsender.c:1040
Oid MyDatabaseId
Definition: globals.c:77
WalSnd * MyWalSnd
Definition: walsender.c:111
#define InvalidOid
Definition: postgres_ext.h:36
int errmsg_internal(const char *fmt,...)
Definition: elog.c:827
void WalSndSetState(WalSndState state)
Definition: walsender.c:3097
static void CreateReplicationSlot(CreateReplicationSlotCmd *cmd)
Definition: walsender.c:835
static StringInfoData tmpbuf
Definition: walsender.c:162
bool log_replication_commands
Definition: walsender.c:124
int errmsg(const char *fmt,...)
Definition: elog.c:797
#define CHECK_FOR_INTERRUPTS()
Definition: miscadmin.h:98
#define elog
Definition: elog.h:219
static void IdentifySystem(void)
Definition: walsender.c:338
void SnapBuildClearExportedSnapshot(void)
Definition: snapbuild.c:696
void PreventTransactionChain(bool isTopLevel, const char *stmtType)
Definition: xact.c:3153
void replication_scanner_init(const char *query_string)

◆ HandleWalSndInitStopping()

void HandleWalSndInitStopping ( void  )

Definition at line 2902 of file walsender.c.

References am_walsender, Assert, got_STOPPING, kill, MyProcPid, and replication_active.

Referenced by procsignal_sigusr1_handler().

2903 {
2905 
2906  /*
2907  * If replication has not yet started, die like with SIGTERM. If
2908  * replication is active, only set a flag and wake up the main loop. It
2909  * will send any outstanding WAL, wait for it to be replicated to the
2910  * standby, and then exit gracefully.
2911  */
2912  if (!replication_active)
2913  kill(MyProcPid, SIGTERM);
2914  else
2915  got_STOPPING = true;
2916 }
int MyProcPid
Definition: globals.c:39
static volatile sig_atomic_t got_STOPPING
Definition: walsender.c:187
#define kill(pid, sig)
Definition: win32_port.h:437
bool am_walsender
Definition: walsender.c:114
static volatile sig_atomic_t replication_active
Definition: walsender.c:195
#define Assert(condition)
Definition: c.h:670

◆ InitWalSender()

void InitWalSender ( void  )

Referenced by PostgresMain().

◆ WalSndErrorCleanup()

void WalSndErrorCleanup ( void  )

Definition at line 291 of file walsender.c.

References close, ConditionVariableCancelSleep(), DestNone, DestRemote, got_SIGUSR2, got_STOPPING, LWLockReleaseAll(), MyReplicationSlot, pgstat_report_wait_end(), proc_exit(), replication_active, ReplicationSlotCleanup(), ReplicationSlotRelease(), sendFile, WalSndSetState(), WalSndShutdown(), WALSNDSTATE_STARTUP, and whereToSendOutput.

Referenced by PostgresMain().

292 {
296 
297  if (sendFile >= 0)
298  {
299  close(sendFile);
300  sendFile = -1;
301  }
302 
303  if (MyReplicationSlot != NULL)
305 
307 
308  replication_active = false;
309 
310  if (got_STOPPING || got_SIGUSR2)
311  proc_exit(0);
312 
313  /* Revert back to startup state */
315 }
static int sendFile
Definition: walsender.c:135
static volatile sig_atomic_t got_STOPPING
Definition: walsender.c:187
void proc_exit(int code)
Definition: ipc.c:99
void ConditionVariableCancelSleep(void)
void ReplicationSlotRelease(void)
Definition: slot.c:416
static void pgstat_report_wait_end(void)
Definition: pgstat.h:1244
static volatile sig_atomic_t got_SIGUSR2
Definition: walsender.c:186
static volatile sig_atomic_t replication_active
Definition: walsender.c:195
ReplicationSlot * MyReplicationSlot
Definition: slot.c:96
void WalSndSetState(WalSndState state)
Definition: walsender.c:3097
void ReplicationSlotCleanup(void)
Definition: slot.c:471
void LWLockReleaseAll(void)
Definition: lwlock.c:1820
#define close(a)
Definition: win32.h:12

◆ WalSndInitStopping()

void WalSndInitStopping ( void  )

Definition at line 3033 of file walsender.c.

References i, InvalidBackendId, max_wal_senders, WalSnd::mutex, WalSnd::pid, PROCSIG_WALSND_INIT_STOPPING, SendProcSignal(), SpinLockAcquire, SpinLockRelease, and WalSndCtlData::walsnds.

Referenced by ShutdownXLOG().

3034 {
3035  int i;
3036 
3037  for (i = 0; i < max_wal_senders; i++)
3038  {
3039  WalSnd *walsnd = &WalSndCtl->walsnds[i];
3040  pid_t pid;
3041 
3042  SpinLockAcquire(&walsnd->mutex);
3043  pid = walsnd->pid;
3044  SpinLockRelease(&walsnd->mutex);
3045 
3046  if (pid == 0)
3047  continue;
3048 
3050  }
3051 }
WalSndCtlData * WalSndCtl
Definition: walsender.c:108
WalSnd walsnds[FLEXIBLE_ARRAY_MEMBER]
slock_t mutex
#define SpinLockAcquire(lock)
Definition: spin.h:62
int SendProcSignal(pid_t pid, ProcSignalReason reason, BackendId backendId)
Definition: procsignal.c:180
int max_wal_senders
Definition: walsender.c:120
#define SpinLockRelease(lock)
Definition: spin.h:64
#define InvalidBackendId
Definition: backendid.h:23
int i

◆ WalSndRqstFileReload()

void WalSndRqstFileReload ( void  )

Definition at line 2879 of file walsender.c.

References i, max_wal_senders, WalSnd::mutex, WalSnd::needreload, WalSnd::pid, SpinLockAcquire, SpinLockRelease, and WalSndCtlData::walsnds.

Referenced by KeepFileRestoredFromArchive().

2880 {
2881  int i;
2882 
2883  for (i = 0; i < max_wal_senders; i++)
2884  {
2885  WalSnd *walsnd = &WalSndCtl->walsnds[i];
2886 
2887  SpinLockAcquire(&walsnd->mutex);
2888  if (walsnd->pid == 0)
2889  {
2890  SpinLockRelease(&walsnd->mutex);
2891  continue;
2892  }
2893  walsnd->needreload = true;
2894  SpinLockRelease(&walsnd->mutex);
2895  }
2896 }
WalSndCtlData * WalSndCtl
Definition: walsender.c:108
WalSnd walsnds[FLEXIBLE_ARRAY_MEMBER]
slock_t mutex
#define SpinLockAcquire(lock)
Definition: spin.h:62
int max_wal_senders
Definition: walsender.c:120
#define SpinLockRelease(lock)
Definition: spin.h:64
bool needreload
int i

◆ WalSndShmemInit()

void WalSndShmemInit ( void  )

Definition at line 2972 of file walsender.c.

References i, max_wal_senders, MemSet, WalSnd::mutex, NUM_SYNC_REP_WAIT_MODE, ShmemInitStruct(), SHMQueueInit(), SpinLockInit, WalSndCtlData::SyncRepQueue, WalSndCtlData::walsnds, and WalSndShmemSize().

Referenced by CreateSharedMemoryAndSemaphores().

2973 {
2974  bool found;
2975  int i;
2976 
2977  WalSndCtl = (WalSndCtlData *)
2978  ShmemInitStruct("Wal Sender Ctl", WalSndShmemSize(), &found);
2979 
2980  if (!found)
2981  {
2982  /* First time through, so initialize */
2984 
2985  for (i = 0; i < NUM_SYNC_REP_WAIT_MODE; i++)
2987 
2988  for (i = 0; i < max_wal_senders; i++)
2989  {
2990  WalSnd *walsnd = &WalSndCtl->walsnds[i];
2991 
2992  SpinLockInit(&walsnd->mutex);
2993  }
2994  }
2995 }
Size WalSndShmemSize(void)
Definition: walsender.c:2960
#define SpinLockInit(lock)
Definition: spin.h:60
WalSndCtlData * WalSndCtl
Definition: walsender.c:108
#define MemSet(start, val, len)
Definition: c.h:853
WalSnd walsnds[FLEXIBLE_ARRAY_MEMBER]
slock_t mutex
void * ShmemInitStruct(const char *name, Size size, bool *foundPtr)
Definition: shmem.c:372
SHM_QUEUE SyncRepQueue[NUM_SYNC_REP_WAIT_MODE]
int max_wal_senders
Definition: walsender.c:120
void SHMQueueInit(SHM_QUEUE *queue)
Definition: shmqueue.c:36
int i
#define NUM_SYNC_REP_WAIT_MODE
Definition: syncrep.h:28

◆ WalSndShmemSize()

Size WalSndShmemSize ( void  )

Definition at line 2960 of file walsender.c.

References add_size(), max_wal_senders, mul_size(), and offsetof.

Referenced by CreateSharedMemoryAndSemaphores(), and WalSndShmemInit().

2961 {
2962  Size size = 0;
2963 
2964  size = offsetof(WalSndCtlData, walsnds);
2965  size = add_size(size, mul_size(max_wal_senders, sizeof(WalSnd)));
2966 
2967  return size;
2968 }
int max_wal_senders
Definition: walsender.c:120
Size mul_size(Size s1, Size s2)
Definition: shmem.c:492
Size add_size(Size s1, Size s2)
Definition: shmem.c:475
size_t Size
Definition: c.h:404
#define offsetof(type, field)
Definition: c.h:593

◆ WalSndSignals()

void WalSndSignals ( void  )

Definition at line 2936 of file walsender.c.

References die(), InitializeTimeouts(), PostgresSigHupHandler(), pqsignal(), procsignal_sigusr1_handler(), quickdie(), SIG_DFL, SIG_IGN, SIGCHLD, SIGCONT, SIGHUP, SIGPIPE, SIGQUIT, SIGTTIN, SIGTTOU, SIGUSR1, SIGUSR2, SIGWINCH, StatementCancelHandler(), and WalSndLastCycleHandler().

Referenced by PostgresMain().

2937 {
2938  /* Set up signal handlers */
2939  pqsignal(SIGHUP, PostgresSigHupHandler); /* set flag to read config
2940  * file */
2941  pqsignal(SIGINT, StatementCancelHandler); /* query cancel */
2942  pqsignal(SIGTERM, die); /* request shutdown */
2943  pqsignal(SIGQUIT, quickdie); /* hard crash time */
2944  InitializeTimeouts(); /* establishes SIGALRM handler */
2947  pqsignal(SIGUSR2, WalSndLastCycleHandler); /* request a last cycle and
2948  * shutdown */
2949 
2950  /* Reset some signals that are accepted by postmaster but not here */
2956 }
void InitializeTimeouts(void)
Definition: timeout.c:340
#define SIGQUIT
Definition: win32_port.h:164
#define SIGTTOU
Definition: win32_port.h:175
#define SIGTTIN
Definition: win32_port.h:174
#define SIGUSR1
Definition: win32_port.h:177
static void WalSndLastCycleHandler(SIGNAL_ARGS)
Definition: walsender.c:2924
#define SIGCHLD
Definition: win32_port.h:173
#define SIGWINCH
Definition: win32_port.h:176
#define SIGCONT
Definition: win32_port.h:172
#define SIGPIPE
Definition: win32_port.h:168
#define SIGUSR2
Definition: win32_port.h:178
void StatementCancelHandler(SIGNAL_ARGS)
Definition: postgres.c:2683
#define SIGHUP
Definition: win32_port.h:163
void PostgresSigHupHandler(SIGNAL_ARGS)
Definition: postgres.c:2723
#define SIG_IGN
Definition: win32_port.h:160
pqsigfunc pqsignal(int signum, pqsigfunc handler)
Definition: signal.c:168
#define SIG_DFL
Definition: win32_port.h:158
void die(SIGNAL_ARGS)
Definition: postgres.c:2652
void procsignal_sigusr1_handler(SIGNAL_ARGS)
Definition: procsignal.c:261
void quickdie(SIGNAL_ARGS)
Definition: postgres.c:2591

◆ WalSndWaitStopping()

void WalSndWaitStopping ( void  )

Definition at line 3059 of file walsender.c.

References i, max_wal_senders, WalSnd::mutex, pg_usleep(), WalSnd::pid, SpinLockAcquire, SpinLockRelease, WalSnd::state, WalSndCtlData::walsnds, and WALSNDSTATE_STOPPING.

Referenced by ShutdownXLOG().

3060 {
3061  for (;;)
3062  {
3063  int i;
3064  bool all_stopped = true;
3065 
3066  for (i = 0; i < max_wal_senders; i++)
3067  {
3068  WalSnd *walsnd = &WalSndCtl->walsnds[i];
3069 
3070  SpinLockAcquire(&walsnd->mutex);
3071 
3072  if (walsnd->pid == 0)
3073  {
3074  SpinLockRelease(&walsnd->mutex);
3075  continue;
3076  }
3077 
3078  if (walsnd->state != WALSNDSTATE_STOPPING)
3079  {
3080  all_stopped = false;
3081  SpinLockRelease(&walsnd->mutex);
3082  break;
3083  }
3084  SpinLockRelease(&walsnd->mutex);
3085  }
3086 
3087  /* safe to leave if confirmation is done for all WAL senders */
3088  if (all_stopped)
3089  return;
3090 
3091  pg_usleep(10000L); /* wait for 10 msec */
3092  }
3093 }
WalSndCtlData * WalSndCtl
Definition: walsender.c:108
WalSnd walsnds[FLEXIBLE_ARRAY_MEMBER]
slock_t mutex
#define SpinLockAcquire(lock)
Definition: spin.h:62
void pg_usleep(long microsec)
Definition: signal.c:53
WalSndState state
int max_wal_senders
Definition: walsender.c:120
#define SpinLockRelease(lock)
Definition: spin.h:64
int i

◆ WalSndWakeup()

void WalSndWakeup ( void  )

Definition at line 3004 of file walsender.c.

References i, WalSnd::latch, max_wal_senders, WalSnd::mutex, SetLatch(), SpinLockAcquire, SpinLockRelease, and WalSndCtlData::walsnds.

Referenced by KeepFileRestoredFromArchive(), StartupXLOG(), and XLogWalRcvFlush().

3005 {
3006  int i;
3007 
3008  for (i = 0; i < max_wal_senders; i++)
3009  {
3010  Latch *latch;
3011  WalSnd *walsnd = &WalSndCtl->walsnds[i];
3012 
3013  /*
3014  * Get latch pointer with spinlock held, for the unlikely case that
3015  * pointer reads aren't atomic (as they're 8 bytes).
3016  */
3017  SpinLockAcquire(&walsnd->mutex);
3018  latch = walsnd->latch;
3019  SpinLockRelease(&walsnd->mutex);
3020 
3021  if (latch != NULL)
3022  SetLatch(latch);
3023  }
3024 }
WalSndCtlData * WalSndCtl
Definition: walsender.c:108
WalSnd walsnds[FLEXIBLE_ARRAY_MEMBER]
slock_t mutex
#define SpinLockAcquire(lock)
Definition: spin.h:62
Latch * latch
Definition: latch.h:110
int max_wal_senders
Definition: walsender.c:120
#define SpinLockRelease(lock)
Definition: spin.h:64
void SetLatch(volatile Latch *latch)
Definition: latch.c:414
int i

Variable Documentation

◆ am_cascading_walsender

◆ am_db_walsender

bool am_db_walsender

Definition at line 117 of file walsender.c.

Referenced by check_db(), InitPostgres(), and ProcessStartupPacket().

◆ am_walsender

◆ log_replication_commands

bool log_replication_commands

Definition at line 124 of file walsender.c.

Referenced by exec_replication_command().

◆ max_wal_senders

◆ wake_wal_senders

bool wake_wal_senders

Definition at line 129 of file walsender.c.

◆ wal_sender_timeout

int wal_sender_timeout