Skip to content

Commit d27d5e1

Browse files
nathan-bossartCommitfest Bot
authored andcommitted
Rename CHECKPOINT_IMMEDIATE to CHECKPOINT_FAST.
The new name more accurately indicates 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. And references to "immediate" checkpoints in the documentation have been updated to say "fast" instead. This is preparatory work for a follow-up commit that will add a MODE option to the CHECKPOINT command. Author: Christoph Berg <[email protected]> Discussion: https://postgr.es/m/aDnaKTEf-0dLiEfz%40msg.df7cb.de
1 parent 55999bc commit d27d5e1

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
@@ -6505,7 +6505,7 @@ PerformRecoveryXLogAction(void)
65056505
else
65066506
{
65076507
RequestCheckpoint(CHECKPOINT_END_OF_RECOVERY |
6508-
CHECKPOINT_IMMEDIATE |
6508+
CHECKPOINT_FAST |
65096509
CHECKPOINT_WAIT);
65106510
}
65116511

@@ -6814,7 +6814,7 @@ ShutdownXLOG(int code, Datum arg)
68146814
WalSndWaitStopping();
68156815

68166816
if (RecoveryInProgress())
6817-
CreateRestartPoint(CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_IMMEDIATE);
6817+
CreateRestartPoint(CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_FAST);
68186818
else
68196819
{
68206820
/*
@@ -6826,7 +6826,7 @@ ShutdownXLOG(int code, Datum arg)
68266826
if (XLogArchivingActive())
68276827
RequestXLogSwitch(false);
68286828

6829-
CreateCheckPoint(CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_IMMEDIATE);
6829+
CreateCheckPoint(CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_FAST);
68306830
}
68316831
}
68326832

@@ -6842,7 +6842,7 @@ LogCheckpointStart(int flags, bool restartpoint)
68426842
(errmsg("restartpoint starting:%s%s%s%s%s%s%s%s",
68436843
(flags & CHECKPOINT_IS_SHUTDOWN) ? " shutdown" : "",
68446844
(flags & CHECKPOINT_END_OF_RECOVERY) ? " end-of-recovery" : "",
6845-
(flags & CHECKPOINT_IMMEDIATE) ? " immediate" : "",
6845+
(flags & CHECKPOINT_FAST) ? " fast" : "",
68466846
(flags & CHECKPOINT_FORCE) ? " force" : "",
68476847
(flags & CHECKPOINT_WAIT) ? " wait" : "",
68486848
(flags & CHECKPOINT_CAUSE_XLOG) ? " wal" : "",
@@ -6854,7 +6854,7 @@ LogCheckpointStart(int flags, bool restartpoint)
68546854
(errmsg("checkpoint starting:%s%s%s%s%s%s%s%s",
68556855
(flags & CHECKPOINT_IS_SHUTDOWN) ? " shutdown" : "",
68566856
(flags & CHECKPOINT_END_OF_RECOVERY) ? " end-of-recovery" : "",
6857-
(flags & CHECKPOINT_IMMEDIATE) ? " immediate" : "",
6857+
(flags & CHECKPOINT_FAST) ? " fast" : "",
68586858
(flags & CHECKPOINT_FORCE) ? " force" : "",
68596859
(flags & CHECKPOINT_WAIT) ? " wait" : "",
68606860
(flags & CHECKPOINT_CAUSE_XLOG) ? " wal" : "",
@@ -7042,8 +7042,8 @@ update_checkpoint_display(int flags, bool restartpoint, bool reset)
70427042
* flags is a bitwise OR of the following:
70437043
* CHECKPOINT_IS_SHUTDOWN: checkpoint is for database shutdown.
70447044
* CHECKPOINT_END_OF_RECOVERY: checkpoint is for end of WAL recovery.
7045-
* CHECKPOINT_IMMEDIATE: finish the checkpoint ASAP,
7046-
* ignoring checkpoint_completion_target parameter.
7045+
* CHECKPOINT_FAST: finish the checkpoint ASAP, ignoring
7046+
* checkpoint_completion_target parameter.
70477047
* CHECKPOINT_FORCE: force a checkpoint even if no XLOG activity has occurred
70487048
* since the last one (implied by CHECKPOINT_IS_SHUTDOWN or
70497049
* CHECKPOINT_END_OF_RECOVERY).
@@ -8946,9 +8946,8 @@ issue_xlog_fsync(int fd, XLogSegNo segno, TimeLineID tli)
89468946
* backup state and tablespace map.
89478947
*
89488948
* Input parameters are "state" (the backup state), "fast" (if true, we do
8949-
* the checkpoint in immediate mode to make it faster), and "tablespaces"
8950-
* (if non-NULL, indicates a list of tablespaceinfo structs describing the
8951-
* cluster's tablespaces.).
8949+
* the checkpoint in fast mode), and "tablespaces" (if non-NULL, indicates a
8950+
* list of tablespaceinfo structs describing the cluster's tablespaces.).
89528951
*
89538952
* The tablespace map contents are appended to passed-in parameter
89548953
* tablespace_map and the caller is responsible for including it in the backup
@@ -9076,11 +9075,11 @@ do_pg_backup_start(const char *backupidstr, bool fast, List **tablespaces,
90769075
* during recovery means that checkpointer is running, we can use
90779076
* RequestCheckpoint() to establish a restartpoint.
90789077
*
9079-
* We use CHECKPOINT_IMMEDIATE only if requested by user (via
9080-
* passing fast = true). Otherwise this can take awhile.
9078+
* We use CHECKPOINT_FAST only if requested by user (via passing
9079+
* fast = true). Otherwise this can take awhile.
90819080
*/
90829081
RequestCheckpoint(CHECKPOINT_FORCE | CHECKPOINT_WAIT |
9083-
(fast ? CHECKPOINT_IMMEDIATE : 0));
9082+
(fast ? CHECKPOINT_FAST : 0));
90849083

90859084
/*
90869085
* 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)