Rename CHECKPOINT_FLUSH_ALL to CHECKPOINT_FLUSH_UNLOGGED.
authorNathan Bossart <nathan@postgresql.org>
Fri, 11 Jul 2025 16:51:25 +0000 (11:51 -0500)
committerNathan Bossart <nathan@postgresql.org>
Fri, 11 Jul 2025 16:51:25 +0000 (11:51 -0500)
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

src/backend/access/transam/xlog.c
src/backend/commands/dbcommands.c
src/backend/storage/buffer/bufmgr.c
src/include/access/xlog.h

index 304b60933c9c71ee95d884d1bd8c8be66a987f2d..d5a731dbe63432d295a939ab87dc8133a88cdeb8 100644 (file)
@@ -6828,7 +6828,7 @@ LogCheckpointStart(int flags, bool restartpoint)
                        (flags & CHECKPOINT_WAIT) ? " wait" : "",
                        (flags & CHECKPOINT_CAUSE_XLOG) ? " wal" : "",
                        (flags & CHECKPOINT_CAUSE_TIME) ? " time" : "",
-                       (flags & CHECKPOINT_FLUSH_ALL) ? " flush-all" : "")));
+                       (flags & CHECKPOINT_FLUSH_UNLOGGED) ? " flush-unlogged" : "")));
    else
        ereport(LOG,
        /* translator: the placeholders show checkpoint options */
@@ -6840,7 +6840,7 @@ LogCheckpointStart(int flags, bool restartpoint)
                        (flags & CHECKPOINT_WAIT) ? " wait" : "",
                        (flags & CHECKPOINT_CAUSE_XLOG) ? " wal" : "",
                        (flags & CHECKPOINT_CAUSE_TIME) ? " time" : "",
-                       (flags & CHECKPOINT_FLUSH_ALL) ? " flush-all" : "")));
+                       (flags & CHECKPOINT_FLUSH_UNLOGGED) ? " flush-unlogged" : "")));
 }
 
 /*
@@ -7028,7 +7028,7 @@ update_checkpoint_display(int flags, bool restartpoint, bool reset)
  * CHECKPOINT_FORCE: force a checkpoint even if no XLOG activity has occurred
  *     since the last one (implied by CHECKPOINT_IS_SHUTDOWN or
  *     CHECKPOINT_END_OF_RECOVERY).
- * CHECKPOINT_FLUSH_ALL: also flush buffers of unlogged tables.
+ * CHECKPOINT_FLUSH_UNLOGGED: also flush buffers of unlogged tables.
  *
  * Note: flags contains other bits, of interest here only for logging purposes.
  * In particular note that this routine is synchronous and does not pay
index c95eb94501671dc42176c0347417cec8db095a55..2d32ffd02c73d327bc84521b59d36c26ba045400 100644 (file)
@@ -571,7 +571,7 @@ CreateDatabaseUsingFileCopy(Oid src_dboid, Oid dst_dboid, Oid src_tsid,
     */
    if (!IsBinaryUpgrade)
        RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE |
-                         CHECKPOINT_WAIT | CHECKPOINT_FLUSH_ALL);
+                         CHECKPOINT_WAIT | CHECKPOINT_FLUSH_UNLOGGED);
 
    /*
     * Iterate through all tablespaces of the template database, and copy each
@@ -2121,7 +2121,7 @@ movedb(const char *dbname, const char *tblspcname)
     * files, which would cause rmdir() to fail.
     */
    RequestCheckpoint(CHECKPOINT_IMMEDIATE | CHECKPOINT_FORCE | CHECKPOINT_WAIT
-                     | CHECKPOINT_FLUSH_ALL);
+                     | CHECKPOINT_FLUSH_UNLOGGED);
 
    /* Close all smgr fds in all backends. */
    WaitForProcSignalBarrier(EmitProcSignalBarrier(PROCSIGNAL_BARRIER_SMGRRELEASE));
index bd68d7e0ca9ee2d01aa8209c58c6e3a517bcab66..0b4b23e02a25f34cbb45ceb1c1275685b107709e 100644 (file)
@@ -3341,8 +3341,8 @@ UnpinBufferNoOwner(BufferDesc *buf)
  * This is called at checkpoint time to write out all dirty shared buffers.
  * The checkpoint request flags should be passed in.  If CHECKPOINT_IMMEDIATE
  * is set, we disable delays between writes; if CHECKPOINT_IS_SHUTDOWN,
- * CHECKPOINT_END_OF_RECOVERY or CHECKPOINT_FLUSH_ALL is set, we write even
- * unlogged buffers, which are otherwise skipped.  The remaining flags
+ * CHECKPOINT_END_OF_RECOVERY or CHECKPOINT_FLUSH_UNLOGGED is set, we write
+ * even unlogged buffers, which are otherwise skipped.  The remaining flags
  * currently have no effect here.
  */
 static void
@@ -3367,7 +3367,7 @@ BufferSync(int flags)
     * recovery, we write all dirty buffers.
     */
    if (!((flags & (CHECKPOINT_IS_SHUTDOWN | CHECKPOINT_END_OF_RECOVERY |
-                   CHECKPOINT_FLUSH_ALL))))
+                   CHECKPOINT_FLUSH_UNLOGGED))))
        mask |= BM_PERMANENT;
 
    /*
index d313099c027f0af3e76e2a4eb97b706e80702700..80c42b5f80f023b73f8c28f4e57d4e111c172697 100644 (file)
@@ -141,8 +141,7 @@ extern PGDLLIMPORT bool XLOG_DEBUG;
                                             * issued at end of WAL recovery */
 #define CHECKPOINT_IMMEDIATE   0x0004  /* Do it without delays */
 #define CHECKPOINT_FORCE       0x0008  /* Force even if no activity */
-#define CHECKPOINT_FLUSH_ALL   0x0010  /* Flush all pages, including those
-                                        * belonging to unlogged tables */
+#define CHECKPOINT_FLUSH_UNLOGGED  0x0010  /* Flush unlogged tables */
 /* These are important to RequestCheckpoint */
 #define CHECKPOINT_WAIT            0x0020  /* Wait for completion */
 #define CHECKPOINT_REQUESTED   0x0040  /* Checkpoint request has been made */