Skip to content

Commit cd8324c

Browse files
Rename CHECKPOINT_FLUSH_ALL to CHECKPOINT_FLUSH_UNLOGGED.
The new name more accurately relects 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 "flush-unlogged" instead of "flush-all", too. This is preparatory work for a follow-up commit that will add a FLUSH_UNLOGGED option to the CHECKPOINT command. Author: Christoph Berg <myon@debian.org> Discussion: https://postgr.es/m/aDnaKTEf-0dLiEfz%40msg.df7cb.de
1 parent f25792c commit cd8324c

File tree

4 files changed

+9
-10
lines changed

4 files changed

+9
-10
lines changed

src/backend/access/transam/xlog.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6828,7 +6828,7 @@ LogCheckpointStart(int flags, bool restartpoint)
68286828
(flags & CHECKPOINT_WAIT) ? " wait" : "",
68296829
(flags & CHECKPOINT_CAUSE_XLOG) ? " wal" : "",
68306830
(flags & CHECKPOINT_CAUSE_TIME) ? " time" : "",
6831-
(flags & CHECKPOINT_FLUSH_ALL) ? " flush-all" : "")));
6831+
(flags & CHECKPOINT_FLUSH_UNLOGGED) ? " flush-unlogged" : "")));
68326832
else
68336833
ereport(LOG,
68346834
/* translator: the placeholders show checkpoint options */
@@ -6840,7 +6840,7 @@ LogCheckpointStart(int flags, bool restartpoint)
68406840
(flags & CHECKPOINT_WAIT) ? " wait" : "",
68416841
(flags & CHECKPOINT_CAUSE_XLOG) ? " wal" : "",
68426842
(flags & CHECKPOINT_CAUSE_TIME) ? " time" : "",
6843-
(flags & CHECKPOINT_FLUSH_ALL) ? " flush-all" : "")));
6843+
(flags & CHECKPOINT_FLUSH_UNLOGGED) ? " flush-unlogged" : "")));
68446844
}
68456845

68466846
/*
@@ -7028,7 +7028,7 @@ update_checkpoint_display(int flags, bool restartpoint, bool reset)
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).
7031-
* CHECKPOINT_FLUSH_ALL: also flush buffers of unlogged tables.
7031+
* CHECKPOINT_FLUSH_UNLOGGED: also flush buffers of unlogged tables.
70327032
*
70337033
* Note: flags contains other bits, of interest here only for logging purposes.
70347034
* In particular note that this routine is synchronous and does not pay

src/backend/commands/dbcommands.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -571,7 +571,7 @@ CreateDatabaseUsingFileCopy(Oid src_dboid, Oid dst_dboid, Oid src_tsid,
571571
*/
572572
if (!IsBinaryUpgrade)
573573
RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE |
574-
CHECKPOINT_WAIT | CHECKPOINT_FLUSH_ALL);
574+
CHECKPOINT_WAIT | CHECKPOINT_FLUSH_UNLOGGED);
575575

576576
/*
577577
* Iterate through all tablespaces of the template database, and copy each
@@ -2121,7 +2121,7 @@ movedb(const char *dbname, const char *tblspcname)
21212121
* files, which would cause rmdir() to fail.
21222122
*/
21232123
RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT
2124-
| CHECKPOINT_FLUSH_ALL);
2124+
| CHECKPOINT_FLUSH_UNLOGGED);
21252125

21262126
/* Close all smgr fds in all backends. */
21272127
WaitForProcSignalBarrier(EmitProcSignalBarrier(PROCSIGNAL_BARRIER_SMGRRELEASE));

src/backend/storage/buffer/bufmgr.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3341,8 +3341,8 @@ UnpinBufferNoOwner(BufferDesc *buf)
33413341
* This is called at checkpoint time to write out all dirty shared buffers.
33423342
* The checkpoint request flags should be passed in. If CHECKPOINT_IMMEDIATE
33433343
* is set, we disable delays between writes; if CHECKPOINT_IS_SHUTDOWN,
3344-
* CHECKPOINT_END_OF_RECOVERY or CHECKPOINT_FLUSH_ALL is set, we write even
3345-
* unlogged buffers, which are otherwise skipped. The remaining flags
3344+
* CHECKPOINT_END_OF_RECOVERY or CHECKPOINT_FLUSH_UNLOGGED is set, we write
3345+
* even unlogged buffers, which are otherwise skipped. The remaining flags
33463346
* currently have no effect here.
33473347
*/
33483348
static void
@@ -3367,7 +3367,7 @@ BufferSync(int flags)
33673367
* recovery, we write all dirty buffers.
33683368
*/
33693369
if (!((flags & (CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_END_OF_RECOVERY |
3370-
CHECKPOINT_FLUSH_ALL))))
3370+
CHECKPOINT_FLUSH_UNLOGGED))))
33713371
mask |= BM_PERMANENT;
33723372

33733373
/*

src/include/access/xlog.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ extern PGDLLIMPORT bool XLOG_DEBUG;
141141
* issued at end of WAL recovery */
142142
#define CHECKPOINT_IMMEDIATE 0x0004 /* Do it without delays */
143143
#define CHECKPOINT_FORCE 0x0008 /* Force even if no activity */
144-
#define CHECKPOINT_FLUSH_ALL 0x0010 /* Flush all pages, including those
145-
* belonging to unlogged tables */
144+
#define CHECKPOINT_FLUSH_UNLOGGED 0x0010 /* Flush unlogged tables */
146145
/* These are important to RequestCheckpoint */
147146
#define CHECKPOINT_WAIT 0x0020 /* Wait for completion */
148147
#define CHECKPOINT_REQUESTED 0x0040 /* Checkpoint request has been made */

0 commit comments

Comments
 (0)