146#define WRITES_PER_ABSORB 1000
149#define CKPT_REQ_BATCH_SIZE 10000
152#define MAX_CHECKPOINT_REQUESTS 10000000
471 (
errmsg_plural(
"checkpoints are occurring too frequently (%d second apart)",
472 "checkpoints are occurring too frequently (%d seconds apart)",
475 errhint(
"Consider increasing the configuration parameter \"%s\".",
"max_wal_size")));
746 elog(
DEBUG1,
"write-ahead log switch forced (\"archive_timeout\"=%d)",
1019 if (
strcmp(opt->defname,
"mode") == 0)
1028 errmsg(
"unrecognized value for %s option \"%s\": \"%s\"",
1029 "CHECKPOINT",
"mode",
mode),
1032 else if (
strcmp(opt->defname,
"flush_unlogged") == 0)
1037 errmsg(
"unrecognized %s option \"%s\"",
1038 "CHECKPOINT", opt->defname),
1046 errmsg(
"permission denied to execute %s command",
1048 errdetail(
"Only roles with privileges of the \"%s\" role may execute this command.",
1125#define MAX_SIGNAL_TRIES 600
1136 "could not notify checkpoint: checkpointer is not running");
1199 (
errmsg(
"checkpoint request failed"),
1200 errhint(
"Consult recent messages in the server log for details.")));
1235 elog(
ERROR,
"ForwardSyncRequest must not be called in checkpointer");
1354 for (n = 0; n < num_requests; n++)
1394 for (n = 0; n < num_requests; n++)
1419 (
errmsg_internal(
"compacted fsync request queue from %d entries to %d entries",
1477 for (
i = 0;
i < n;
i++)
1519 elog(
DEBUG2,
"checkpointer updated shared memory configuration values");
1529 static int ckpt_done = 0;
bool has_privs_of_role(Oid member, Oid role)
void pgaio_error_cleanup(void)
void AuxiliaryProcessMainCommon(void)
Datum now(PG_FUNCTION_ARGS)
void AtEOXact_Buffers(bool isCommit)
#define Assert(condition)
#define FLEXIBLE_ARRAY_MEMBER
#define MemSet(start, val, len)
static void UpdateSharedMemoryConfig(void)
static bool FastCheckpointRequested(void)
static XLogRecPtr ckpt_start_recptr
static bool IsCheckpointOnSchedule(double progress)
bool ForwardSyncRequest(const FileTag *ftag, SyncRequestType type)
static void ReqShutdownXLOG(SIGNAL_ARGS)
static void CheckArchiveTimeout(void)
static double ckpt_cached_elapsed
void CheckpointerMain(const void *startup_data, size_t startup_data_len)
static bool CompactCheckpointerRequestQueue(void)
static void ProcessCheckpointerInterrupts(void)
static volatile sig_atomic_t ShutdownXLOGPending
#define CKPT_REQ_BATCH_SIZE
void WakeupCheckpointer(void)
void AbsorbSyncRequests(void)
#define WRITES_PER_ABSORB
double CheckPointCompletionTarget
static pg_time_t last_xlog_switch_time
#define MAX_CHECKPOINT_REQUESTS
void CheckpointerShmemInit(void)
bool FirstCallSinceLastCheckpoint(void)
static CheckpointerShmemStruct * CheckpointerShmem
void RequestCheckpoint(int flags)
static pg_time_t last_checkpoint_time
void ExecCheckpoint(ParseState *pstate, CheckPointStmt *stmt)
void CheckpointWriteDelay(int flags, double progress)
static pg_time_t ckpt_start_time
Size CheckpointerShmemSize(void)
bool ConditionVariableCancelSleep(void)
void ConditionVariableBroadcast(ConditionVariable *cv)
void ConditionVariablePrepareToSleep(ConditionVariable *cv)
void ConditionVariableInit(ConditionVariable *cv)
void ConditionVariableSleep(ConditionVariable *cv, uint32 wait_event_info)
char * defGetString(DefElem *def)
bool defGetBoolean(DefElem *def)
void * hash_search(HTAB *hashp, const void *keyPtr, HASHACTION action, bool *foundPtr)
void AtEOXact_HashTables(bool isCommit)
HTAB * hash_create(const char *tabname, int64 nelem, const HASHCTL *info, int flags)
void hash_destroy(HTAB *hashp)
int errmsg_plural(const char *fmt_singular, const char *fmt_plural, unsigned long n,...)
int errmsg_internal(const char *fmt,...)
void EmitErrorReport(void)
int errdetail(const char *fmt,...)
ErrorContextCallback * error_context_stack
void FlushErrorState(void)
int errhint(const char *fmt,...)
int errcode(int sqlerrcode)
int errmsg(const char *fmt,...)
sigjmp_buf * PG_exception_stack
#define ereport(elevel,...)
static double elapsed_time(instr_time *starttime)
void AtEOXact_Files(bool isCommit)
#define palloc0_array(type, count)
volatile sig_atomic_t LogMemoryContextPending
volatile sig_atomic_t ProcSignalBarrierPending
volatile uint32 CritSectionCount
bool IsPostmasterEnvironment
void ProcessConfigFile(GucContext context)
void SignalHandlerForShutdownRequest(SIGNAL_ARGS)
volatile sig_atomic_t ShutdownRequestPending
volatile sig_atomic_t ConfigReloadPending
void SignalHandlerForConfigReload(SIGNAL_ARGS)
void before_shmem_exit(pg_on_exit_callback function, Datum arg)
void SetLatch(Latch *latch)
void ResetLatch(Latch *latch)
int WaitLatch(Latch *latch, int wakeEvents, long timeout, uint32 wait_event_info)
void DisableLogicalDecodingIfNecessary(void)
bool LWLockHeldByMe(LWLock *lock)
bool LWLockAcquire(LWLock *lock, LWLockMode mode)
void LWLockRelease(LWLock *lock)
void LWLockReleaseAll(void)
void MemoryContextReset(MemoryContext context)
void pfree(void *pointer)
MemoryContext TopMemoryContext
MemoryContext CurrentMemoryContext
void ProcessLogMemoryContextInterrupt(void)
#define AllocSetContextCreate
#define ALLOCSET_DEFAULT_SIZES
#define AmCheckpointerProcess()
#define RESUME_INTERRUPTS()
#define START_CRIT_SECTION()
#define CHECK_FOR_INTERRUPTS()
#define HOLD_INTERRUPTS()
#define END_CRIT_SECTION()
BackendType MyBackendType
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
int parser_errposition(ParseState *pstate, int location)
static PgChecksumMode mode
#define foreach_ptr(type, var, lst)
void pgstat_before_server_shutdown(int code, Datum arg)
void pgstat_report_checkpointer(void)
PgStat_CheckpointerStats PendingCheckpointerStats
void pgstat_report_wal(bool force)
void SendPostmasterSignal(PMSignalReason reason)
@ PMSIGNAL_XLOG_IS_SHUTDOWN
#define GetPGProcByNumber(n)
#define INVALID_PROC_NUMBER
void ProcessProcSignalBarrier(void)
void procsignal_sigusr1_handler(SIGNAL_ARGS)
void ReleaseAuxProcessResources(bool isCommit)
Size add_size(Size s1, Size s2)
Size mul_size(Size s1, Size s2)
void * ShmemInitStruct(const char *name, Size size, bool *foundPtr)
void pg_usleep(long microsec)
void smgrdestroyall(void)
#define SpinLockInit(lock)
#define SpinLockRelease(lock)
#define SpinLockAcquire(lock)
ConditionVariable done_cv
ConditionVariable start_cv
CheckpointerRequest requests[FLEXIBLE_ARRAY_MEMBER]
ProcNumber checkpointerProc
PgStat_Counter restartpoints_requested
PgStat_Counter num_requested
PgStat_Counter num_performed
PgStat_Counter restartpoints_timed
PgStat_Counter restartpoints_performed
void RememberSyncRequest(const FileTag *ftag, SyncRequestType type)
void SyncRepUpdateSyncStandbysDefined(void)
static void pgstat_report_wait_end(void)
#define WL_EXIT_ON_PM_DEATH
int gettimeofday(struct timeval *tp, void *tzp)
void UpdateFullPageWrites(void)
bool RecoveryInProgress(void)
XLogRecPtr RequestXLogSwitch(bool mark_unimportant)
bool CreateRestartPoint(int flags)
XLogRecPtr GetInsertRecPtr(void)
void ShutdownXLOG(int code, Datum arg)
pg_time_t GetLastSegSwitchData(XLogRecPtr *lastSwitchLSN)
XLogRecPtr GetLastImportantRecPtr(void)
bool CreateCheckPoint(int flags)
#define CHECKPOINT_FLUSH_UNLOGGED
#define CHECKPOINT_CAUSE_XLOG
#define CHECKPOINT_END_OF_RECOVERY
#define CHECKPOINT_CAUSE_TIME
#define CHECKPOINT_REQUESTED
#define XLogSegmentOffset(xlogptr, wal_segsz_bytes)
XLogRecPtr GetXLogReplayRecPtr(TimeLineID *replayTLI)