Skip to content

Commit bb938e2

Browse files
Rename CHECKPOINT_IMMEDIATE to CHECKPOINT_FAST.
The new name more accurately reflects the effects of this flag on a requested checkpoint. Checkpoint-related log messages (i.e., those controlled by the log_checkpoints configuration parameter) will now say "fast" instead of "immediate", too. Likewise, references to "immediate" checkpoints in the documentation have been updated to say "fast". This is preparatory work for a follow-up commit that will add a MODE option to the CHECKPOINT command. Author: Christoph Berg <myon@debian.org> Discussion: https://postgr.es/m/aDnaKTEf-0dLiEfz%40msg.df7cb.de
1 parent cd8324c commit bb938e2

File tree

12 files changed

+40
-40
lines changed

12 files changed

+40
-40
lines changed

doc/src/sgml/backup.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -991,7 +991,7 @@ SELECT pg_backup_start(label => 'label', fast => false);
991991
usually preferable as it minimizes the impact on the running system. If you
992992
want to start the backup as soon as possible, pass <literal>true</literal> as
993993
the second parameter to <function>pg_backup_start</function> and it will
994-
request an immediate checkpoint, which will finish as fast as possible using
994+
request a fast checkpoint, which will finish as fast as possible using
995995
as much I/O as possible.
996996
</para>
997997

doc/src/sgml/func.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28973,7 +28973,7 @@ LOG: Grand total: 1651920 bytes in 201 blocks; 622360 free (88 chunks); 1029560
2897328973
will be stored.)
2897428974
If the optional second parameter is given as <literal>true</literal>,
2897528975
it specifies executing <function>pg_backup_start</function> as quickly
28976-
as possible. This forces an immediate checkpoint which will cause a
28976+
as possible. This forces a fast checkpoint which will cause a
2897728977
spike in I/O operations, slowing any concurrently executing queries.
2897828978
</para>
2897928979
<para>

doc/src/sgml/ref/checkpoint.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ CHECKPOINT
3737
</para>
3838

3939
<para>
40-
The <command>CHECKPOINT</command> command forces an immediate
40+
The <command>CHECKPOINT</command> command forces a fast
4141
checkpoint when the command is issued, without waiting for a
4242
regular checkpoint scheduled by the system (controlled by the settings in
4343
<xref linkend="runtime-config-wal-checkpoints"/>).

doc/src/sgml/ref/pg_basebackup.sgml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,8 +500,9 @@ PostgreSQL documentation
500500
<term><option>--checkpoint={fast|spread}</option></term>
501501
<listitem>
502502
<para>
503-
Sets checkpoint mode to fast (immediate) or spread (the default)
503+
Sets checkpoint mode to fast or spread
504504
(see <xref linkend="backup-lowlevel-base-backup"/>).
505+
The default is spread.
505506
</para>
506507
</listitem>
507508
</varlistentry>

src/backend/access/transam/xlog.c

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6486,7 +6486,7 @@ PerformRecoveryXLogAction(void)
64866486
else
64876487
{
64886488
RequestCheckpoint(CHECKPOINT_END_OF_RECOVERY |
6489-
CHECKPOINT_IMMEDIATE |
6489+
CHECKPOINT_FAST |
64906490
CHECKPOINT_WAIT);
64916491
}
64926492

@@ -6795,7 +6795,7 @@ ShutdownXLOG(int code, Datum arg)
67956795
WalSndWaitStopping();
67966796

67976797
if (RecoveryInProgress())
6798-
CreateRestartPoint(CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_IMMEDIATE);
6798+
CreateRestartPoint(CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_FAST);
67996799
else
68006800
{
68016801
/*
@@ -6807,7 +6807,7 @@ ShutdownXLOG(int code, Datum arg)
68076807
if (XLogArchivingActive())
68086808
RequestXLogSwitch(false);
68096809

6810-
CreateCheckPoint(CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_IMMEDIATE);
6810+
CreateCheckPoint(CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_FAST);
68116811
}
68126812
}
68136813

@@ -6823,7 +6823,7 @@ LogCheckpointStart(int flags, bool restartpoint)
68236823
(errmsg("restartpoint starting:%s%s%s%s%s%s%s%s",
68246824
(flags & CHECKPOINT_IS_SHUTDOWN) ? " shutdown" : "",
68256825
(flags & CHECKPOINT_END_OF_RECOVERY) ? " end-of-recovery" : "",
6826-
(flags & CHECKPOINT_IMMEDIATE) ? " immediate" : "",
6826+
(flags & CHECKPOINT_FAST) ? " fast" : "",
68276827
(flags & CHECKPOINT_FORCE) ? " force" : "",
68286828
(flags & CHECKPOINT_WAIT) ? " wait" : "",
68296829
(flags & CHECKPOINT_CAUSE_XLOG) ? " wal" : "",
@@ -6835,7 +6835,7 @@ LogCheckpointStart(int flags, bool restartpoint)
68356835
(errmsg("checkpoint starting:%s%s%s%s%s%s%s%s",
68366836
(flags & CHECKPOINT_IS_SHUTDOWN) ? " shutdown" : "",
68376837
(flags & CHECKPOINT_END_OF_RECOVERY) ? " end-of-recovery" : "",
6838-
(flags & CHECKPOINT_IMMEDIATE) ? " immediate" : "",
6838+
(flags & CHECKPOINT_FAST) ? " fast" : "",
68396839
(flags & CHECKPOINT_FORCE) ? " force" : "",
68406840
(flags & CHECKPOINT_WAIT) ? " wait" : "",
68416841
(flags & CHECKPOINT_CAUSE_XLOG) ? " wal" : "",
@@ -7023,8 +7023,8 @@ update_checkpoint_display(int flags, bool restartpoint, bool reset)
70237023
* flags is a bitwise OR of the following:
70247024
* CHECKPOINT_IS_SHUTDOWN: checkpoint is for database shutdown.
70257025
* CHECKPOINT_END_OF_RECOVERY: checkpoint is for end of WAL recovery.
7026-
* CHECKPOINT_IMMEDIATE: finish the checkpoint ASAP,
7027-
* ignoring checkpoint_completion_target parameter.
7026+
* CHECKPOINT_FAST: finish the checkpoint ASAP, ignoring
7027+
* checkpoint_completion_target parameter.
70287028
* CHECKPOINT_FORCE: force a checkpoint even if no XLOG activity has occurred
70297029
* since the last one (implied by CHECKPOINT_IS_SHUTDOWN or
70307030
* CHECKPOINT_END_OF_RECOVERY).
@@ -8929,9 +8929,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli)
89298929
* backup state and tablespace map.
89308930
*
89318931
* Input parameters are "state" (the backup state), "fast" (if true, we do
8932-
* the checkpoint in immediate mode to make it faster), and "tablespaces"
8933-
* (if non-NULL, indicates a list of tablespaceinfo structs describing the
8934-
* cluster's tablespaces.).
8932+
* the checkpoint in fast mode), and "tablespaces" (if non-NULL, indicates a
8933+
* list of tablespaceinfo structs describing the cluster's tablespaces.).
89358934
*
89368935
* The tablespace map contents are appended to passed-in parameter
89378936
* tablespace_map and the caller is responsible for including it in the backup
@@ -9059,11 +9058,11 @@ do_pg_backup_start(const char *backupidstr, bool fast, List **tablespaces,
90599058
* during recovery means that checkpointer is running, we can use
90609059
* RequestCheckpoint() to establish a restartpoint.
90619060
*
9062-
* We use CHECKPOINT_IMMEDIATE only if requested by user (via
9063-
* passing fast = true). Otherwise this can take awhile.
9061+
* We use CHECKPOINT_FAST only if requested by user (via passing
9062+
* fast = true). Otherwise this can take awhile.
90649063
*/
90659064
RequestCheckpoint(CHECKPOINT_FORCE | CHECKPOINT_WAIT |
9066-
(fast ? CHECKPOINT_IMMEDIATE : 0));
9065+
(fast ? CHECKPOINT_FAST : 0));
90679066

90689067
/*
90699068
* Now we need to fetch the checkpoint record location, and also

src/backend/commands/dbcommands.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ CreateDatabaseUsingFileCopy(Oid src_dboid, Oid dst_dboid, Oid src_tsid,
570570
* any CREATE DATABASE commands.
571571
*/
572572
if (!IsBinaryUpgrade)
573-
RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE |
573+
RequestCheckpoint(CHECKPOINT_FAST | CHECKPOINT_FORCE |
574574
CHECKPOINT_WAIT | CHECKPOINT_FLUSH_UNLOGGED);
575575

576576
/*
@@ -673,7 +673,7 @@ CreateDatabaseUsingFileCopy(Oid src_dboid, Oid dst_dboid, Oid src_tsid,
673673
* strategy that avoids these problems.
674674
*/
675675
if (!IsBinaryUpgrade)
676-
RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE |
676+
RequestCheckpoint(CHECKPOINT_FAST | CHECKPOINT_FORCE |
677677
CHECKPOINT_WAIT);
678678
}
679679

@@ -1870,7 +1870,7 @@ dropdb(const char *dbname, bool missing_ok, bool force)
18701870
* Force a checkpoint to make sure the checkpointer has received the
18711871
* message sent by ForgetDatabaseSyncRequests.
18721872
*/
1873-
RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT);
1873+
RequestCheckpoint(CHECKPOINT_FAST | CHECKPOINT_FORCE | CHECKPOINT_WAIT);
18741874

18751875
/* Close all smgr fds in all backends. */
18761876
WaitForProcSignalBarrier(EmitProcSignalBarrier(PROCSIGNAL_BARRIER_SMGRRELEASE));
@@ -2120,7 +2120,7 @@ movedb(const char *dbname, const char *tblspcname)
21202120
* On Windows, this also ensures that background procs don't hold any open
21212121
* files, which would cause rmdir() to fail.
21222122
*/
2123-
RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT
2123+
RequestCheckpoint(CHECKPOINT_FAST | CHECKPOINT_FORCE | CHECKPOINT_WAIT
21242124
| CHECKPOINT_FLUSH_UNLOGGED);
21252125

21262126
/* Close all smgr fds in all backends. */
@@ -2252,7 +2252,7 @@ movedb(const char *dbname, const char *tblspcname)
22522252
* any unlogged operations done in the new DB tablespace before the
22532253
* next checkpoint.
22542254
*/
2255-
RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT);
2255+
RequestCheckpoint(CHECKPOINT_FAST | CHECKPOINT_FORCE | CHECKPOINT_WAIT);
22562256

22572257
/*
22582258
* Force synchronous commit, thus minimizing the window between

src/backend/commands/tablespace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ DropTableSpace(DropTableSpaceStmt *stmt)
500500
* mustn't delete. So instead, we force a checkpoint which will clean
501501
* out any lingering files, and try again.
502502
*/
503-
RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT);
503+
RequestCheckpoint(CHECKPOINT_FAST | CHECKPOINT_FORCE | CHECKPOINT_WAIT);
504504

505505
/*
506506
* On Windows, an unlinked file persists in the directory listing

src/backend/postmaster/checkpointer.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ static pg_time_t last_xlog_switch_time;
161161
static void ProcessCheckpointerInterrupts(void);
162162
static void CheckArchiveTimeout(void);
163163
static bool IsCheckpointOnSchedule(double progress);
164-
static bool ImmediateCheckpointRequested(void);
164+
static bool FastCheckpointRequested(void);
165165
static bool CompactCheckpointerRequestQueue(void);
166166
static void UpdateSharedMemoryConfig(void);
167167

@@ -734,20 +734,20 @@ CheckArchiveTimeout(void)
734734
}
735735

736736
/*
737-
* Returns true if an immediate checkpoint request is pending. (Note that
738-
* this does not check the *current* checkpoint's IMMEDIATE flag, but whether
739-
* there is one pending behind it.)
737+
* Returns true if a fast checkpoint request is pending. (Note that this does
738+
* not check the *current* checkpoint's FAST flag, but whether there is one
739+
* pending behind it.)
740740
*/
741741
static bool
742-
ImmediateCheckpointRequested(void)
742+
FastCheckpointRequested(void)
743743
{
744744
volatile CheckpointerShmemStruct *cps = CheckpointerShmem;
745745

746746
/*
747747
* We don't need to acquire the ckpt_lck in this case because we're only
748748
* looking at a single flag bit.
749749
*/
750-
if (cps->ckpt_flags & CHECKPOINT_IMMEDIATE)
750+
if (cps->ckpt_flags & CHECKPOINT_FAST)
751751
return true;
752752
return false;
753753
}
@@ -760,7 +760,7 @@ ImmediateCheckpointRequested(void)
760760
* checkpoint_completion_target.
761761
*
762762
* The checkpoint request flags should be passed in; currently the only one
763-
* examined is CHECKPOINT_IMMEDIATE, which disables delays between writes.
763+
* examined is CHECKPOINT_FAST, which disables delays between writes.
764764
*
765765
* 'progress' is an estimate of how much of the work has been done, as a
766766
* fraction between 0.0 meaning none, and 1.0 meaning all done.
@@ -778,10 +778,10 @@ CheckpointWriteDelay(int flags, double progress)
778778
* Perform the usual duties and take a nap, unless we're behind schedule,
779779
* in which case we just try to catch up as quickly as possible.
780780
*/
781-
if (!(flags & CHECKPOINT_IMMEDIATE) &&
781+
if (!(flags & CHECKPOINT_FAST) &&
782782
!ShutdownXLOGPending &&
783783
!ShutdownRequestPending &&
784-
!ImmediateCheckpointRequested() &&
784+
!FastCheckpointRequested() &&
785785
IsCheckpointOnSchedule(progress))
786786
{
787787
if (ConfigReloadPending)
@@ -983,11 +983,11 @@ CheckpointerShmemInit(void)
983983
* flags is a bitwise OR of the following:
984984
* CHECKPOINT_IS_SHUTDOWN: checkpoint is for database shutdown.
985985
* CHECKPOINT_END_OF_RECOVERY: checkpoint is for end of WAL recovery.
986-
* CHECKPOINT_IMMEDIATE: finish the checkpoint ASAP,
986+
* CHECKPOINT_FAST: finish the checkpoint ASAP,
987987
* ignoring checkpoint_completion_target parameter.
988988
* CHECKPOINT_FORCE: force a checkpoint even if no XLOG activity has occurred
989989
* since the last one (implied by CHECKPOINT_IS_SHUTDOWN or
990-
* CHECKPOINT_END_OF_RECOVERY).
990+
* CHECKPOINT_END_OF_RECOVERY, and the CHECKPOINT command).
991991
* CHECKPOINT_WAIT: wait for completion before returning (otherwise,
992992
* just signal checkpointer to do it, and return).
993993
* CHECKPOINT_CAUSE_XLOG: checkpoint is requested due to xlog filling.
@@ -1009,7 +1009,7 @@ RequestCheckpoint(int flags)
10091009
* There's no point in doing slow checkpoints in a standalone backend,
10101010
* because there's no other backends the checkpoint could disrupt.
10111011
*/
1012-
CreateCheckPoint(flags | CHECKPOINT_IMMEDIATE);
1012+
CreateCheckPoint(flags | CHECKPOINT_FAST);
10131013

10141014
/* Free all smgr objects, as CheckpointerMain() normally would. */
10151015
smgrdestroyall();

src/backend/storage/buffer/bufmgr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3339,8 +3339,8 @@ UnpinBufferNoOwner(BufferDesc *buf)
33393339
* BufferSync -- Write out all dirty buffers in the pool.
33403340
*
33413341
* This is called at checkpoint time to write out all dirty shared buffers.
3342-
* The checkpoint request flags should be passed in. If CHECKPOINT_IMMEDIATE
3343-
* is set, we disable delays between writes; if CHECKPOINT_IS_SHUTDOWN,
3342+
* The checkpoint request flags should be passed in. If CHECKPOINT_FAST is
3343+
* set, we disable delays between writes; if CHECKPOINT_IS_SHUTDOWN,
33443344
* CHECKPOINT_END_OF_RECOVERY or CHECKPOINT_FLUSH_UNLOGGED is set, we write
33453345
* even unlogged buffers, which are otherwise skipped. The remaining flags
33463346
* currently have no effect here.

src/backend/tcop/utility.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -952,7 +952,7 @@ standard_ProcessUtility(PlannedStmt *pstmt,
952952
errdetail("Only roles with privileges of the \"%s\" role may execute this command.",
953953
"pg_checkpoint")));
954954

955-
RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_WAIT |
955+
RequestCheckpoint(CHECKPOINT_FAST | CHECKPOINT_WAIT |
956956
(RecoveryInProgress() ? 0 : CHECKPOINT_FORCE));
957957
break;
958958

0 commit comments

Comments
 (0)