73 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
74 errmsg(
"a backup is already in progress in this session")));
97 NULL, tblspc_map_file,
true);
131 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
132 errmsg(
"non-exclusive backup in progress"),
133 errhint(
"Did you mean to use pg_stop_backup('f')?")));
184 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
185 errmsg(
"set-valued function called in context that cannot accept a set")));
188 (
errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
189 errmsg(
"materialize mode required, but it is not allowed in this context")));
193 elog(
ERROR,
"return type must be a row type");
206 MemSet(nulls, 0,
sizeof(nulls));
212 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
213 errmsg(
"non-exclusive backup in progress"),
214 errhint(
"Did you mean to use pg_stop_backup('f')?")));
229 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
230 errmsg(
"non-exclusive backup is not in progress"),
231 errhint(
"Did you mean to use pg_stop_backup('t')?")));
247 pfree(tblspc_map_file);
248 tblspc_map_file = NULL;
273 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
274 errmsg(
"recovery is in progress"),
275 errhint(
"WAL control functions cannot be executed during recovery.")));
295 char *restore_name_str;
300 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
301 errmsg(
"recovery is in progress"),
302 errhint(
"WAL control functions cannot be executed during recovery.")));
306 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
307 errmsg(
"WAL level not sufficient for creating a restore point"),
308 errhint(
"wal_level must be set to \"replica\" or \"logical\" at server start.")));
314 (
errcode(ERRCODE_INVALID_PARAMETER_VALUE),
315 errmsg(
"value too long for restore point (maximum %d characters)",
MAXFNAMELEN - 1)));
339 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
340 errmsg(
"recovery is in progress"),
341 errhint(
"WAL control functions cannot be executed during recovery.")));
360 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
361 errmsg(
"recovery is in progress"),
362 errhint(
"WAL control functions cannot be executed during recovery.")));
381 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
382 errmsg(
"recovery is in progress"),
383 errhint(
"WAL control functions cannot be executed during recovery.")));
451 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
452 errmsg(
"recovery is in progress"),
453 errhint(
"%s cannot be executed during recovery.",
454 "pg_walfile_name_offset()")));
508 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
509 errmsg(
"recovery is in progress"),
510 errhint(
"%s cannot be executed during recovery.",
511 "pg_walfile_name()")));
530 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
531 errmsg(
"recovery is not in progress"),
532 errhint(
"Recovery control functions can only be executed during recovery.")));
536 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
537 errmsg(
"standby promotion is ongoing"),
538 errhint(
"%s cannot be executed after promotion is triggered.",
539 "pg_wal_replay_pause()")));
557 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
558 errmsg(
"recovery is not in progress"),
559 errhint(
"Recovery control functions can only be executed during recovery.")));
563 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
564 errmsg(
"standby promotion is ongoing"),
565 errhint(
"%s cannot be executed after promotion is triggered.",
566 "pg_wal_replay_resume()")));
581 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
582 errmsg(
"recovery is not in progress"),
583 errhint(
"Recovery control functions can only be executed during recovery.")));
651 char backup_start_time[30];
662 errmsg(
"could not read file \"%s\": %m",
670 backup_start_time[0] =
'\0';
671 while (fgets(fline,
sizeof(fline), lfp) != NULL)
673 if (sscanf(fline,
"START TIME: %25[^\n]\n", backup_start_time) == 1)
689 if (strlen(backup_start_time) == 0)
691 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
721 (
errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
722 errmsg(
"recovery is not in progress"),
723 errhint(
"Recovery control functions can only be executed during recovery.")));
725 if (wait_seconds <= 0)
727 (
errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE),
728 errmsg(
"\"wait_seconds\" must not be negative or zero")));
735 errmsg(
"could not create file \"%s\": %m",
741 errmsg(
"could not write file \"%s\": %m",
748 (
errmsg(
"failed to send signal to postmaster: %m")));
758 #define WAITS_PER_SECOND 10 785 "server did not promote within %d seconds",
#define PG_RETURN_NUMERIC(x)
void tuplestore_putvalues(Tuplestorestate *state, TupleDesc tdesc, Datum *values, bool *isnull)
Datum pg_last_wal_receive_lsn(PG_FUNCTION_ARGS)
#define PG_GETARG_INT32(n)
Datum pg_promote(PG_FUNCTION_ARGS)
Datum pg_switch_wal(PG_FUNCTION_ARGS)
#define IsA(nodeptr, _type_)
XLogRecPtr RequestXLogSwitch(bool mark_unimportant)
TypeFuncClass get_call_result_type(FunctionCallInfo fcinfo, Oid *resultTypeId, TupleDesc *resultTupleDesc)
static StringInfo label_file
int errhint(const char *fmt,...)
void register_persistent_abort_backup_handler(void)
Datum pg_start_backup(PG_FUNCTION_ARGS)
TupleDesc CreateTemplateTupleDesc(int natts)
Datum pg_is_in_backup(PG_FUNCTION_ARGS)
int errmsg_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...)
#define XLByteToPrevSeg(xlrp, logSegNo, wal_segsz_bytes)
#define PG_GETARG_DATUM(n)
SessionBackupState get_backup_status(void)
#define PROMOTE_SIGNAL_FILE
Datum pg_lsn_mi(PG_FUNCTION_ARGS)
StringInfo makeStringInfo(void)
#define tuplestore_donestoring(state)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
Datum pg_last_wal_replay_lsn(PG_FUNCTION_ARGS)
int errcode(int sqlerrcode)
#define MemSet(start, val, len)
XLogRecPtr GetFlushRecPtr(void)
HeapTuple heap_form_tuple(TupleDesc tupleDescriptor, Datum *values, bool *isnull)
TimestampTz GetLatestXTime(void)
#define PG_GETARG_BOOL(n)
bool BackupInProgress(void)
bool RecoveryInProgress(void)
bool PromoteIsTriggered(void)
Datum pg_wal_lsn_diff(PG_FUNCTION_ARGS)
#define PG_RETURN_TIMESTAMPTZ(x)
void ResetLatch(Latch *latch)
XLogRecPtr do_pg_start_backup(const char *backupidstr, bool fast, TimeLineID *starttli_p, StringInfo labelfile, List **tablespaces, StringInfo tblspcmapfile, bool needtblspcmapfile)
int WaitLatch(Latch *latch, int wakeEvents, long timeout, uint32 wait_event_info)
#define PG_GETARG_TEXT_PP(n)
bool RecoveryIsPaused(void)
void pfree(void *pointer)
#define ObjectIdGetDatum(X)
XLogRecPtr do_pg_stop_backup(char *labelfile, bool waitforarchive, TimeLineID *stoptli_p)
XLogRecPtr GetXLogInsertRecPtr(void)
XLogRecPtr GetXLogReplayRecPtr(TimeLineID *replayTLI)
TupleDesc BlessTupleDesc(TupleDesc tupdesc)
Datum pg_wal_replay_resume(PG_FUNCTION_ARGS)
Datum pg_stop_backup(PG_FUNCTION_ARGS)
int errcode_for_file_access(void)
#define CStringGetDatum(X)
FILE * AllocateFile(const char *name, const char *mode)
#define UInt32GetDatum(X)
Datum pg_create_restore_point(PG_FUNCTION_ARGS)
void TupleDescInitEntry(TupleDesc desc, AttrNumber attributeNumber, const char *attributeName, Oid oidtypeid, int32 typmod, int attdim)
MemoryContext TopMemoryContext
#define DirectFunctionCall3(func, arg1, arg2, arg3)
Datum pg_is_wal_replay_paused(PG_FUNCTION_ARGS)
Tuplestorestate * tuplestore_begin_heap(bool randomAccess, bool interXact, int maxKBytes)
#define WL_POSTMASTER_DEATH
#define PG_RETURN_BOOL(x)
Datum pg_wal_replay_pause(PG_FUNCTION_ARGS)
#define PG_RETURN_DATUM(x)
#define XLogSegmentOffset(xlogptr, wal_segsz_bytes)
TimeLineID ThisTimeLineID
Datum pg_walfile_name_offset(PG_FUNCTION_ARGS)
#define ereport(elevel,...)
static StringInfo tblspc_map_file
#define PG_RETURN_TEXT_P(x)
XLogRecPtr GetXLogWriteRecPtr(void)
SetFunctionReturnMode returnMode
text * cstring_to_text(const char *s)
Datum pg_current_wal_flush_lsn(PG_FUNCTION_ARGS)
XLogRecPtr XLogRestorePoint(const char *rpName)
Datum pg_current_wal_lsn(PG_FUNCTION_ARGS)
#define XLogFileName(fname, tli, logSegNo, wal_segsz_bytes)
Datum pg_walfile_name(PG_FUNCTION_ARGS)
void SetRecoveryPause(bool recoveryPause)
#define HeapTupleGetDatum(tuple)
XLogRecPtr GetWalRcvFlushRecPtr(XLogRecPtr *latestChunkStart, TimeLineID *receiveTLI)
MemoryContext ecxt_per_query_memory
Tuplestorestate * setResult
static char promote_file[MAXPGPATH]
static Datum values[MAXATTR]
char * text_to_cstring(const text *t)
Datum timestamptz_in(PG_FUNCTION_ARGS)
int errmsg(const char *fmt,...)
Datum pg_stop_backup_v2(PG_FUNCTION_ARGS)
Datum pg_current_wal_insert_lsn(PG_FUNCTION_ARGS)
#define CStringGetTextDatum(s)
#define BACKUP_LABEL_FILE
#define CHECK_FOR_INTERRUPTS()
static void static void status(const char *fmt,...) pg_attribute_printf(1
Datum pg_is_in_recovery(PG_FUNCTION_ARGS)
Datum pg_last_xact_replay_timestamp(PG_FUNCTION_ARGS)
#define DirectFunctionCall2(func, arg1, arg2)
Datum pg_backup_start_time(PG_FUNCTION_ARGS)