73 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
74 errmsg(
"a backup is already in progress in this session")));
107 #define PG_STOP_BACKUP_V2_COLS 3
118 elog(
ERROR,
"return type must be a row type");
121 MemSet(nulls, 0,
sizeof(nulls));
125 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
126 errmsg(
"backup is not in progress"),
127 errhint(
"Did you call pg_backup_start()?")));
164 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
165 errmsg(
"recovery is in progress"),
166 errhint(
"WAL control functions cannot be executed during recovery.")));
186 char *restore_name_str;
191 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
192 errmsg(
"recovery is in progress"),
193 errhint(
"WAL control functions cannot be executed during recovery.")));
197 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
198 errmsg(
"WAL level not sufficient for creating a restore point"),
199 errhint(
"wal_level must be set to \"replica\" or \"logical\" at server start.")));
205 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
206 errmsg(
"value too long for restore point (maximum %d characters)",
MAXFNAMELEN - 1)));
230 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
231 errmsg(
"recovery is in progress"),
232 errhint(
"WAL control functions cannot be executed during recovery.")));
251 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
252 errmsg(
"recovery is in progress"),
253 errhint(
"WAL control functions cannot be executed during recovery.")));
272 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
273 errmsg(
"recovery is in progress"),
274 errhint(
"WAL control functions cannot be executed during recovery.")));
342 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
343 errmsg(
"recovery is in progress"),
344 errhint(
"%s cannot be executed during recovery.",
345 "pg_walfile_name_offset()")));
400 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
401 errmsg(
"recovery is in progress"),
402 errhint(
"%s cannot be executed during recovery.",
403 "pg_walfile_name()")));
423 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
424 errmsg(
"recovery is not in progress"),
425 errhint(
"Recovery control functions can only be executed during recovery.")));
429 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
430 errmsg(
"standby promotion is ongoing"),
431 errhint(
"%s cannot be executed after promotion is triggered.",
432 "pg_wal_replay_pause()")));
453 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
454 errmsg(
"recovery is not in progress"),
455 errhint(
"Recovery control functions can only be executed during recovery.")));
459 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
460 errmsg(
"standby promotion is ongoing"),
461 errhint(
"%s cannot be executed after promotion is triggered.",
462 "pg_wal_replay_resume()")));
477 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
478 errmsg(
"recovery is not in progress"),
479 errhint(
"Recovery control functions can only be executed during recovery.")));
496 char *statestr = NULL;
500 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
501 errmsg(
"recovery is not in progress"),
502 errhint(
"Recovery control functions can only be executed during recovery.")));
508 statestr =
"not paused";
511 statestr =
"pause requested";
580 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
581 errmsg(
"recovery is not in progress"),
582 errhint(
"Recovery control functions can only be executed during recovery.")));
586 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
587 errmsg(
"\"wait_seconds\" must not be negative or zero")));
594 errmsg(
"could not create file \"%s\": %m",
600 errmsg(
"could not write file \"%s\": %m",
607 (
errmsg(
"failed to send signal to postmaster: %m")));
617 #define WAITS_PER_SECOND 10
644 "server did not promote within %d seconds",
static Datum values[MAXATTR]
#define CStringGetTextDatum(s)
#define MemSet(start, val, len)
int errmsg_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...)
int errcode_for_file_access(void)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
TupleDesc BlessTupleDesc(TupleDesc tupdesc)
FILE * AllocateFile(const char *name, const char *mode)
#define PG_GETARG_TEXT_PP(n)
#define DirectFunctionCall2(func, arg1, arg2)
#define PG_GETARG_DATUM(n)
#define PG_RETURN_TEXT_P(x)
#define PG_GETARG_INT32(n)
#define PG_GETARG_BOOL(n)
#define PG_RETURN_DATUM(x)
#define PG_RETURN_BOOL(x)
TypeFuncClass get_call_result_type(FunctionCallInfo fcinfo, Oid *resultTypeId, TupleDesc *resultTupleDesc)
#define HeapTupleGetDatum(tuple)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, Datum *values, bool *isnull)
void ResetLatch(Latch *latch)
int WaitLatch(Latch *latch, int wakeEvents, long timeout, uint32 wait_event_info)
#define WL_POSTMASTER_DEATH
Assert(fmt[strlen(fmt) - 1] !='\n')
void pfree(void *pointer)
MemoryContext TopMemoryContext
#define CHECK_FOR_INTERRUPTS()
#define PG_RETURN_NUMERIC(x)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
static char promote_file[MAXPGPATH]
Datum pg_lsn_mi(PG_FUNCTION_ARGS)
static void static void status(const char *fmt,...) pg_attribute_printf(1
#define UInt32GetDatum(X)
StringInfo makeStringInfo(void)
TupleDesc CreateTemplateTupleDesc(int natts)
void TupleDescInitEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim)
#define PG_RETURN_TIMESTAMPTZ(x)
char * text_to_cstring(const text *t)
text * cstring_to_text(const char *s)
XLogRecPtr GetWalRcvFlushRecPtr(XLogRecPtr *latestChunkStart, TimeLineID *receiveTLI)
XLogRecPtr do_pg_backup_start(const char *backupidstr, bool fast, TimeLineID *starttli_p, StringInfo labelfile, List **tablespaces, StringInfo tblspcmapfile)
bool RecoveryInProgress(void)
TimeLineID GetWALInsertionTimeLine(void)
XLogRecPtr RequestXLogSwitch(bool mark_unimportant)
SessionBackupState get_backup_status(void)
XLogRecPtr GetXLogInsertRecPtr(void)
XLogRecPtr GetFlushRecPtr(TimeLineID *insertTLI)
void register_persistent_abort_backup_handler(void)
XLogRecPtr GetXLogWriteRecPtr(void)
XLogRecPtr XLogRestorePoint(const char *rpName)
XLogRecPtr do_pg_backup_stop(char *labelfile, bool waitforarchive, TimeLineID *stoptli_p)
#define PROMOTE_SIGNAL_FILE
#define XLogSegmentOffset(xlogptr, wal_segsz_bytes)
#define XLogFileName(fname, tli, logSegNo, wal_segsz_bytes)
#define XLByteToPrevSeg(xlrp, logSegNo, wal_segsz_bytes)
Datum pg_is_wal_replay_paused(PG_FUNCTION_ARGS)
Datum pg_wal_lsn_diff(PG_FUNCTION_ARGS)
Datum pg_backup_start(PG_FUNCTION_ARGS)
Datum pg_create_restore_point(PG_FUNCTION_ARGS)
Datum pg_current_wal_insert_lsn(PG_FUNCTION_ARGS)
Datum pg_switch_wal(PG_FUNCTION_ARGS)
Datum pg_is_in_recovery(PG_FUNCTION_ARGS)
Datum pg_backup_stop(PG_FUNCTION_ARGS)
Datum pg_last_xact_replay_timestamp(PG_FUNCTION_ARGS)
static StringInfo label_file
Datum pg_current_wal_lsn(PG_FUNCTION_ARGS)
Datum pg_last_wal_receive_lsn(PG_FUNCTION_ARGS)
Datum pg_walfile_name(PG_FUNCTION_ARGS)
Datum pg_current_wal_flush_lsn(PG_FUNCTION_ARGS)
Datum pg_walfile_name_offset(PG_FUNCTION_ARGS)
Datum pg_promote(PG_FUNCTION_ARGS)
Datum pg_get_wal_replay_pause_state(PG_FUNCTION_ARGS)
static StringInfo tblspc_map_file
Datum pg_last_wal_replay_lsn(PG_FUNCTION_ARGS)
Datum pg_wal_replay_pause(PG_FUNCTION_ARGS)
Datum pg_wal_replay_resume(PG_FUNCTION_ARGS)
#define PG_STOP_BACKUP_V2_COLS
void SetRecoveryPause(bool recoveryPause)
void WakeupRecovery(void)
bool PromoteIsTriggered(void)
XLogRecPtr GetXLogReplayRecPtr(TimeLineID *replayTLI)
RecoveryPauseState GetRecoveryPauseState(void)
TimestampTz GetLatestXTime(void)
@ RECOVERY_PAUSE_REQUESTED