PostgreSQL Source Code git master
slotsync.h File Reference
Include dependency graph for slotsync.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

char * CheckAndGetDbnameFromConninfo (void)
 
bool ValidateSlotSyncParams (int elevel)
 
pg_noreturn void ReplSlotSyncWorkerMain (const void *startup_data, size_t startup_data_len)
 
void ShutDownSlotSync (void)
 
bool SlotSyncWorkerCanRestart (void)
 
bool IsSyncingReplicationSlots (void)
 
Size SlotSyncShmemSize (void)
 
void SlotSyncShmemInit (void)
 
void SyncReplicationSlots (WalReceiverConn *wrconn)
 

Variables

PGDLLIMPORT bool sync_replication_slots
 
PGDLLIMPORT char * PrimaryConnInfo
 
PGDLLIMPORT char * PrimarySlotName
 

Function Documentation

◆ CheckAndGetDbnameFromConninfo()

char * CheckAndGetDbnameFromConninfo ( void  )

Definition at line 1176 of file slotsync.c.

1177{
1178 char *dbname;
1179
1180 /*
1181 * The slot synchronization needs a database connection for walrcv_exec to
1182 * work.
1183 */
1185 if (dbname == NULL)
1186 ereport(ERROR,
1187 errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1188
1189 /*
1190 * translator: first %s is a connection option; second %s is a GUC
1191 * variable name
1192 */
1193 errmsg("replication slot synchronization requires \"%s\" to be specified in \"%s\"",
1194 "dbname", "primary_conninfo"));
1195 return dbname;
1196}
int errcode(int sqlerrcode)
Definition: elog.c:863
int errmsg(const char *fmt,...)
Definition: elog.c:1080
#define ERROR
Definition: elog.h:39
#define ereport(elevel,...)
Definition: elog.h:150
char * dbname
Definition: streamutil.c:49
#define walrcv_get_dbname_from_conninfo(conninfo)
Definition: walreceiver.h:445
char * PrimaryConnInfo
Definition: xlogrecovery.c:99

References dbname, ereport, errcode(), errmsg(), ERROR, PrimaryConnInfo, and walrcv_get_dbname_from_conninfo.

Referenced by pg_sync_replication_slots(), and ReplSlotSyncWorkerMain().

◆ IsSyncingReplicationSlots()

bool IsSyncingReplicationSlots ( void  )

Definition at line 1882 of file slotsync.c.

1883{
1884 return syncing_slots;
1885}
static bool syncing_slots
Definition: slotsync.c:137

References syncing_slots.

Referenced by CreateDecodingContext(), GetStandbyFlushRecPtr(), and ReplicationSlotCreate().

◆ ReplSlotSyncWorkerMain()

pg_noreturn void ReplSlotSyncWorkerMain ( const void *  startup_data,
size_t  startup_data_len 
)

Definition at line 1533 of file slotsync.c.

1534{
1535 WalReceiverConn *wrconn = NULL;
1536 char *dbname;
1537 char *err;
1538 sigjmp_buf local_sigjmp_buf;
1539 StringInfoData app_name;
1540
1541 Assert(startup_data_len == 0);
1542
1544
1545 init_ps_display(NULL);
1546
1548
1549 /*
1550 * Create a per-backend PGPROC struct in shared memory. We must do this
1551 * before we access any shared memory.
1552 */
1553 InitProcess();
1554
1555 /*
1556 * Early initialization.
1557 */
1558 BaseInit();
1559
1560 Assert(SlotSyncCtx != NULL);
1561
1562 /*
1563 * If an exception is encountered, processing resumes here.
1564 *
1565 * We just need to clean up, report the error, and go away.
1566 *
1567 * If we do not have this handling here, then since this worker process
1568 * operates at the bottom of the exception stack, ERRORs turn into FATALs.
1569 * Therefore, we create our own exception handler to catch ERRORs.
1570 */
1571 if (sigsetjmp(local_sigjmp_buf, 1) != 0)
1572 {
1573 /* since not using PG_TRY, must reset error stack by hand */
1574 error_context_stack = NULL;
1575
1576 /* Prevents interrupts while cleaning up */
1578
1579 /* Report the error to the server log */
1581
1582 /*
1583 * We can now go away. Note that because we called InitProcess, a
1584 * callback was registered to do ProcKill, which will clean up
1585 * necessary state.
1586 */
1587 proc_exit(0);
1588 }
1589
1590 /* We can now handle ereport(ERROR) */
1591 PG_exception_stack = &local_sigjmp_buf;
1592
1593 /* Setup signal handling */
1596 pqsignal(SIGTERM, die);
1599 pqsignal(SIGUSR2, SIG_IGN);
1600 pqsignal(SIGPIPE, SIG_IGN);
1601 pqsignal(SIGCHLD, SIG_DFL);
1602
1604
1605 ereport(LOG, errmsg("slot sync worker started"));
1606
1607 /* Register it as soon as SlotSyncCtx->pid is initialized. */
1609
1610 /*
1611 * Establishes SIGALRM handler and initialize timeout module. It is needed
1612 * by InitPostgres to register different timeouts.
1613 */
1615
1616 /* Load the libpq-specific functions */
1617 load_file("libpqwalreceiver", false);
1618
1619 /*
1620 * Unblock signals (they were blocked when the postmaster forked us)
1621 */
1622 sigprocmask(SIG_SETMASK, &UnBlockSig, NULL);
1623
1624 /*
1625 * Set always-secure search path, so malicious users can't redirect user
1626 * code (e.g. operators).
1627 *
1628 * It's not strictly necessary since we won't be scanning or writing to
1629 * any user table locally, but it's good to retain it here for added
1630 * precaution.
1631 */
1632 SetConfigOption("search_path", "", PGC_SUSET, PGC_S_OVERRIDE);
1633
1635
1636 /*
1637 * Connect to the database specified by the user in primary_conninfo. We
1638 * need a database connection for walrcv_exec to work which we use to
1639 * fetch slot information from the remote node. See comments atop
1640 * libpqrcv_exec.
1641 *
1642 * We do not specify a specific user here since the slot sync worker will
1643 * operate as a superuser. This is safe because the slot sync worker does
1644 * not interact with user tables, eliminating the risk of executing
1645 * arbitrary code within triggers.
1646 */
1647 InitPostgres(dbname, InvalidOid, NULL, InvalidOid, 0, NULL);
1648
1650
1651 initStringInfo(&app_name);
1652 if (cluster_name[0])
1653 appendStringInfo(&app_name, "%s_%s", cluster_name, "slotsync worker");
1654 else
1655 appendStringInfoString(&app_name, "slotsync worker");
1656
1657 /*
1658 * Establish the connection to the primary server for slot
1659 * synchronization.
1660 */
1661 wrconn = walrcv_connect(PrimaryConnInfo, false, false, false,
1662 app_name.data, &err);
1663
1664 if (!wrconn)
1665 ereport(ERROR,
1666 errcode(ERRCODE_CONNECTION_FAILURE),
1667 errmsg("synchronization worker \"%s\" could not connect to the primary server: %s",
1668 app_name.data, err));
1669
1670 pfree(app_name.data);
1671
1672 /*
1673 * Register the disconnection callback.
1674 *
1675 * XXX: This can be combined with previous cleanup registration of
1676 * slotsync_worker_onexit() but that will need the connection to be made
1677 * global and we want to avoid introducing global for this purpose.
1678 */
1680
1681 /*
1682 * Using the specified primary server connection, check that we are not a
1683 * cascading standby and slot configured in 'primary_slot_name' exists on
1684 * the primary server.
1685 */
1687
1688 /* Main loop to synchronize slots */
1689 for (;;)
1690 {
1691 bool some_slot_updated = false;
1692 bool started_tx = false;
1693 List *remote_slots;
1694
1696
1697 /*
1698 * The syscache access in fetch_remote_slots() needs a transaction
1699 * env.
1700 */
1701 if (!IsTransactionState())
1702 {
1704 started_tx = true;
1705 }
1706
1707 remote_slots = fetch_remote_slots(wrconn, NIL);
1708 some_slot_updated = synchronize_slots(wrconn, remote_slots, NULL);
1709 list_free_deep(remote_slots);
1710
1711 if (started_tx)
1713
1714 wait_for_slot_activity(some_slot_updated);
1715 }
1716
1717 /*
1718 * The slot sync worker can't get here because it will only stop when it
1719 * receives a stop request from the startup process, or when there is an
1720 * error.
1721 */
1722 Assert(false);
1723}
sigset_t UnBlockSig
Definition: pqsignal.c:22
void load_file(const char *filename, bool restricted)
Definition: dfmgr.c:149
void EmitErrorReport(void)
Definition: elog.c:1704
ErrorContextCallback * error_context_stack
Definition: elog.c:95
sigjmp_buf * PG_exception_stack
Definition: elog.c:97
#define LOG
Definition: elog.h:31
void err(int eval, const char *fmt,...)
Definition: err.c:43
int MyProcPid
Definition: globals.c:47
void SetConfigOption(const char *name, const char *value, GucContext context, GucSource source)
Definition: guc.c:4196
@ PGC_S_OVERRIDE
Definition: guc.h:123
@ PGC_SUSET
Definition: guc.h:78
char * cluster_name
Definition: guc_tables.c:555
Assert(PointerIsAligned(start, uint64))
void SignalHandlerForConfigReload(SIGNAL_ARGS)
Definition: interrupt.c:61
void before_shmem_exit(pg_on_exit_callback function, Datum arg)
Definition: ipc.c:337
void proc_exit(int code)
Definition: ipc.c:104
void list_free_deep(List *list)
Definition: list.c:1560
void pfree(void *pointer)
Definition: mcxt.c:1616
@ NormalProcessing
Definition: miscadmin.h:472
@ InitProcessing
Definition: miscadmin.h:471
#define GetProcessingMode()
Definition: miscadmin.h:481
#define HOLD_INTERRUPTS()
Definition: miscadmin.h:134
#define SetProcessingMode(mode)
Definition: miscadmin.h:483
@ B_SLOTSYNC_WORKER
Definition: miscadmin.h:348
BackendType MyBackendType
Definition: miscinit.c:64
#define NIL
Definition: pg_list.h:68
#define die(msg)
Definition: pg_test_fsync.c:99
#define pqsignal
Definition: port.h:551
void FloatExceptionHandler(SIGNAL_ARGS)
Definition: postgres.c:3079
void StatementCancelHandler(SIGNAL_ARGS)
Definition: postgres.c:3062
static Datum PointerGetDatum(const void *X)
Definition: postgres.h:352
uint64_t Datum
Definition: postgres.h:70
#define InvalidOid
Definition: postgres_ext.h:37
void BaseInit(void)
Definition: postinit.c:607
void InitPostgres(const char *in_dbname, Oid dboid, const char *username, Oid useroid, bits32 flags, char *out_dbname)
Definition: postinit.c:710
void procsignal_sigusr1_handler(SIGNAL_ARGS)
Definition: procsignal.c:677
void init_ps_display(const char *fixed_part)
Definition: ps_status.c:285
static void slotsync_worker_disconnect(int code, Datum arg)
Definition: slotsync.c:1387
static SlotSyncCtxStruct * SlotSyncCtx
Definition: slotsync.c:114
char * CheckAndGetDbnameFromConninfo(void)
Definition: slotsync.c:1176
static void ProcessSlotSyncInterrupts(void)
Definition: slotsync.c:1352
static void wait_for_slot_activity(bool some_slot_updated)
Definition: slotsync.c:1446
static void slotsync_worker_onexit(int code, Datum arg)
Definition: slotsync.c:1400
static void validate_remote_info(WalReceiverConn *wrconn)
Definition: slotsync.c:1098
static void check_and_set_sync_info(pid_t sync_process_pid)
Definition: slotsync.c:1481
static List * fetch_remote_slots(WalReceiverConn *wrconn, List *slot_names)
Definition: slotsync.c:920
static bool synchronize_slots(WalReceiverConn *wrconn, List *remote_slot_list, bool *slot_persistence_pending)
Definition: slotsync.c:1062
void InitProcess(void)
Definition: proc.c:395
void appendStringInfo(StringInfo str, const char *fmt,...)
Definition: stringinfo.c:145
void appendStringInfoString(StringInfo str, const char *s)
Definition: stringinfo.c:230
void initStringInfo(StringInfo str)
Definition: stringinfo.c:97
Definition: pg_list.h:54
void InitializeTimeouts(void)
Definition: timeout.c:470
static WalReceiverConn * wrconn
Definition: walreceiver.c:94
#define walrcv_connect(conninfo, replication, logical, must_use_password, appname, err)
Definition: walreceiver.h:435
#define SIGCHLD
Definition: win32_port.h:168
#define SIGHUP
Definition: win32_port.h:158
#define SIGPIPE
Definition: win32_port.h:163
#define SIGUSR1
Definition: win32_port.h:170
#define SIGUSR2
Definition: win32_port.h:171
bool IsTransactionState(void)
Definition: xact.c:388
void StartTransactionCommand(void)
Definition: xact.c:3080
void CommitTransactionCommand(void)
Definition: xact.c:3178

References appendStringInfo(), appendStringInfoString(), Assert(), B_SLOTSYNC_WORKER, BaseInit(), before_shmem_exit(), check_and_set_sync_info(), CheckAndGetDbnameFromConninfo(), cluster_name, CommitTransactionCommand(), StringInfoData::data, dbname, die, EmitErrorReport(), ereport, err(), errcode(), errmsg(), ERROR, error_context_stack, fetch_remote_slots(), FloatExceptionHandler(), GetProcessingMode, HOLD_INTERRUPTS, init_ps_display(), InitializeTimeouts(), InitPostgres(), InitProcess(), InitProcessing, initStringInfo(), InvalidOid, IsTransactionState(), list_free_deep(), load_file(), LOG, MyBackendType, MyProcPid, NIL, NormalProcessing, pfree(), PG_exception_stack, PGC_S_OVERRIDE, PGC_SUSET, PointerGetDatum(), pqsignal, PrimaryConnInfo, proc_exit(), ProcessSlotSyncInterrupts(), procsignal_sigusr1_handler(), SetConfigOption(), SetProcessingMode, SIGCHLD, SIGHUP, SignalHandlerForConfigReload(), SIGPIPE, SIGUSR1, SIGUSR2, slotsync_worker_disconnect(), slotsync_worker_onexit(), SlotSyncCtx, StartTransactionCommand(), StatementCancelHandler(), synchronize_slots(), UnBlockSig, validate_remote_info(), wait_for_slot_activity(), walrcv_connect, and wrconn.

◆ ShutDownSlotSync()

void ShutDownSlotSync ( void  )

Definition at line 1784 of file slotsync.c.

1785{
1786 pid_t sync_process_pid;
1787
1789
1790 SlotSyncCtx->stopSignaled = true;
1791
1792 /*
1793 * Return if neither the slot sync worker is running nor the function
1794 * pg_sync_replication_slots() is executing.
1795 */
1796 if (!SlotSyncCtx->syncing)
1797 {
1800 return;
1801 }
1802
1803 sync_process_pid = SlotSyncCtx->pid;
1804
1806
1807 /*
1808 * Signal process doing slotsync, if any. The process will stop upon
1809 * detecting that the stopSignaled flag is set to true.
1810 */
1811 if (sync_process_pid != InvalidPid)
1812 kill(sync_process_pid, SIGUSR1);
1813
1814 /* Wait for slot sync to end */
1815 for (;;)
1816 {
1817 int rc;
1818
1819 /* Wait a bit, we don't expect to have to wait long */
1820 rc = WaitLatch(MyLatch,
1822 10L, WAIT_EVENT_REPLICATION_SLOTSYNC_SHUTDOWN);
1823
1824 if (rc & WL_LATCH_SET)
1825 {
1828 }
1829
1831
1832 /* Ensure that no process is syncing the slots. */
1833 if (!SlotSyncCtx->syncing)
1834 break;
1835
1837 }
1838
1840
1842}
struct Latch * MyLatch
Definition: globals.c:63
void ResetLatch(Latch *latch)
Definition: latch.c:374
int WaitLatch(Latch *latch, int wakeEvents, long timeout, uint32 wait_event_info)
Definition: latch.c:172
#define CHECK_FOR_INTERRUPTS()
Definition: miscadmin.h:123
#define InvalidPid
Definition: miscadmin.h:32
static void update_synced_slots_inactive_since(void)
Definition: slotsync.c:1732
#define SpinLockRelease(lock)
Definition: spin.h:61
#define SpinLockAcquire(lock)
Definition: spin.h:59
#define WL_TIMEOUT
Definition: waiteventset.h:37
#define WL_EXIT_ON_PM_DEATH
Definition: waiteventset.h:39
#define WL_LATCH_SET
Definition: waiteventset.h:34
#define kill(pid, sig)
Definition: win32_port.h:490

References CHECK_FOR_INTERRUPTS, InvalidPid, kill, SlotSyncCtxStruct::mutex, MyLatch, SlotSyncCtxStruct::pid, ResetLatch(), SIGUSR1, SlotSyncCtx, SpinLockAcquire, SpinLockRelease, SlotSyncCtxStruct::stopSignaled, SlotSyncCtxStruct::syncing, update_synced_slots_inactive_since(), WaitLatch(), WL_EXIT_ON_PM_DEATH, WL_LATCH_SET, and WL_TIMEOUT.

Referenced by FinishWalRecovery().

◆ SlotSyncShmemInit()

void SlotSyncShmemInit ( void  )

Definition at line 1900 of file slotsync.c.

1901{
1902 Size size = SlotSyncShmemSize();
1903 bool found;
1904
1906 ShmemInitStruct("Slot Sync Data", size, &found);
1907
1908 if (!found)
1909 {
1910 memset(SlotSyncCtx, 0, size);
1913 }
1914}
size_t Size
Definition: c.h:625
void * ShmemInitStruct(const char *name, Size size, bool *foundPtr)
Definition: shmem.c:389
Size SlotSyncShmemSize(void)
Definition: slotsync.c:1891
#define SpinLockInit(lock)
Definition: spin.h:57

References InvalidPid, SlotSyncCtxStruct::mutex, SlotSyncCtxStruct::pid, ShmemInitStruct(), SlotSyncCtx, SlotSyncShmemSize(), and SpinLockInit.

Referenced by CreateOrAttachShmemStructs().

◆ SlotSyncShmemSize()

Size SlotSyncShmemSize ( void  )

Definition at line 1891 of file slotsync.c.

1892{
1893 return sizeof(SlotSyncCtxStruct);
1894}
struct SlotSyncCtxStruct SlotSyncCtxStruct

Referenced by CalculateShmemSize(), and SlotSyncShmemInit().

◆ SlotSyncWorkerCanRestart()

bool SlotSyncWorkerCanRestart ( void  )

Definition at line 1857 of file slotsync.c.

1858{
1859 time_t curtime = time(NULL);
1860
1861 /*
1862 * If first time through, or time somehow went backwards, always update
1863 * last_start_time to match the current clock and allow worker start.
1864 * Otherwise allow it only once enough time has elapsed.
1865 */
1866 if (SlotSyncCtx->last_start_time == 0 ||
1867 curtime < SlotSyncCtx->last_start_time ||
1869 {
1870 SlotSyncCtx->last_start_time = curtime;
1871 return true;
1872 }
1873 return false;
1874}
#define SLOTSYNC_RESTART_INTERVAL_SEC
Definition: slotsync.c:130
time_t last_start_time
Definition: slotsync.c:110

References SlotSyncCtxStruct::last_start_time, SLOTSYNC_RESTART_INTERVAL_SEC, and SlotSyncCtx.

Referenced by LaunchMissingBackgroundProcesses().

◆ SyncReplicationSlots()

void SyncReplicationSlots ( WalReceiverConn wrconn)

Definition at line 1982 of file slotsync.c.

1983{
1985 {
1986 List *remote_slots = NIL;
1987 List *slot_names = NIL; /* List of slot names to track */
1988
1990
1991 /* Check for interrupts and config changes */
1993
1995
1996 /* Retry until all the slots are sync-ready */
1997 for (;;)
1998 {
1999 bool slot_persistence_pending = false;
2000 bool some_slot_updated = false;
2001
2002 /* Check for interrupts and config changes */
2004
2005 /* We must be in a valid transaction state */
2007
2008 /*
2009 * Fetch remote slot info for the given slot_names. If slot_names
2010 * is NIL, fetch all failover-enabled slots. Note that we reuse
2011 * slot_names from the first iteration; re-fetching all failover
2012 * slots each time could cause an endless loop. Instead of
2013 * reprocessing only the pending slots in each iteration, it's
2014 * better to process all the slots received in the first
2015 * iteration. This ensures that by the time we're done, all slots
2016 * reflect the latest values.
2017 */
2018 remote_slots = fetch_remote_slots(wrconn, slot_names);
2019
2020 /* Attempt to synchronize slots */
2021 some_slot_updated = synchronize_slots(wrconn, remote_slots,
2022 &slot_persistence_pending);
2023
2024 /*
2025 * If slot_persistence_pending is true, extract slot names for
2026 * future iterations (only needed if we haven't done it yet)
2027 */
2028 if (slot_names == NIL && slot_persistence_pending)
2029 slot_names = extract_slot_names(remote_slots);
2030
2031 /* Free the current remote_slots list */
2032 list_free_deep(remote_slots);
2033
2034 /* Done if all slots are persisted i.e are sync-ready */
2035 if (!slot_persistence_pending)
2036 break;
2037
2038 /* wait before retrying again */
2039 wait_for_slot_activity(some_slot_updated);
2040 }
2041
2042 if (slot_names)
2043 list_free_deep(slot_names);
2044
2045 /* Cleanup the synced temporary slots */
2047
2048 /* We are done with sync, so reset sync flag */
2050 }
2052}
#define PG_ENSURE_ERROR_CLEANUP(cleanup_function, arg)
Definition: ipc.h:47
#define PG_END_ENSURE_ERROR_CLEANUP(cleanup_function, arg)
Definition: ipc.h:52
void ReplicationSlotCleanup(bool synced_only)
Definition: slot.c:857
static void slotsync_failure_callback(int code, Datum arg)
Definition: slotsync.c:1920
static List * extract_slot_names(List *remote_slots)
Definition: slotsync.c:1956
static void reset_syncing_flag(void)
Definition: slotsync.c:1513

References Assert(), check_and_set_sync_info(), extract_slot_names(), fetch_remote_slots(), IsTransactionState(), list_free_deep(), MyProcPid, NIL, PG_END_ENSURE_ERROR_CLEANUP, PG_ENSURE_ERROR_CLEANUP, PointerGetDatum(), ProcessSlotSyncInterrupts(), ReplicationSlotCleanup(), reset_syncing_flag(), slotsync_failure_callback(), synchronize_slots(), validate_remote_info(), wait_for_slot_activity(), and wrconn.

Referenced by pg_sync_replication_slots().

◆ ValidateSlotSyncParams()

bool ValidateSlotSyncParams ( int  elevel)

Definition at line 1203 of file slotsync.c.

1204{
1205 /*
1206 * Logical slot sync/creation requires logical decoding to be enabled.
1207 */
1209 {
1210 ereport(elevel,
1211 errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1212 errmsg("replication slot synchronization requires \"effective_wal_level\" >= \"logical\" on the primary"),
1213 errhint("To enable logical decoding on primary, set \"wal_level\" >= \"logical\" or create at least one logical slot when \"wal_level\" = \"replica\"."));
1214
1215 return false;
1216 }
1217
1218 /*
1219 * A physical replication slot(primary_slot_name) is required on the
1220 * primary to ensure that the rows needed by the standby are not removed
1221 * after restarting, so that the synchronized slot on the standby will not
1222 * be invalidated.
1223 */
1224 if (PrimarySlotName == NULL || *PrimarySlotName == '\0')
1225 {
1226 ereport(elevel,
1227 errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1228 /* translator: %s is a GUC variable name */
1229 errmsg("replication slot synchronization requires \"%s\" to be set", "primary_slot_name"));
1230 return false;
1231 }
1232
1233 /*
1234 * hot_standby_feedback must be enabled to cooperate with the physical
1235 * replication slot, which allows informing the primary about the xmin and
1236 * catalog_xmin values on the standby.
1237 */
1239 {
1240 ereport(elevel,
1241 errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1242 /* translator: %s is a GUC variable name */
1243 errmsg("replication slot synchronization requires \"%s\" to be enabled",
1244 "hot_standby_feedback"));
1245 return false;
1246 }
1247
1248 /*
1249 * The primary_conninfo is required to make connection to primary for
1250 * getting slots information.
1251 */
1252 if (PrimaryConnInfo == NULL || *PrimaryConnInfo == '\0')
1253 {
1254 ereport(elevel,
1255 errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1256 /* translator: %s is a GUC variable name */
1257 errmsg("replication slot synchronization requires \"%s\" to be set",
1258 "primary_conninfo"));
1259 return false;
1260 }
1261
1262 return true;
1263}
int errhint(const char *fmt,...)
Definition: elog.c:1330
bool IsLogicalDecodingEnabled(void)
Definition: logicalctl.c:204
bool hot_standby_feedback
Definition: walreceiver.c:91
char * PrimarySlotName
Definition: xlogrecovery.c:100

References ereport, errcode(), errhint(), errmsg(), hot_standby_feedback, IsLogicalDecodingEnabled(), PrimaryConnInfo, and PrimarySlotName.

Referenced by LaunchMissingBackgroundProcesses(), and pg_sync_replication_slots().

Variable Documentation

◆ PrimaryConnInfo

◆ PrimarySlotName

◆ sync_replication_slots

PGDLLIMPORT bool sync_replication_slots
extern