Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 6474085

Browse files
committed
Fix comments on wal_level=minimal, CREATE TABLESPACE and CREATE DATABASE.
Commit 97ddda8 removed the rmtree() behavior from XLOG_TBLSPC_CREATE, obsoleting that part of the comment. The comment's point about XLOG_DBASE_CREATE was wrong when commit fa0f466 introduced the point. (It would have been accurate if that commit had predated commit fbcbc5d introducing the second checkpoint of CREATE DATABASE.) Nothing can skip log_smgrcreate() on the basis of wal_level=minimal, so don't comment on that. Commit c6b9204 expanded WAL skipping from five specific operations to relfilenodes generally, hence the CreateDatabaseUsingFileCopy() comment change. Discussion: https://postgr.es/m/20231008022204.cc@rfd.leadboat.com
1 parent 03e9b95 commit 6474085

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/backend/access/heap/heapam_handler.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,9 +605,7 @@ heapam_relation_set_new_filelocator(Relation rel,
605605

606606
/*
607607
* If required, set up an init fork for an unlogged table so that it can
608-
* be correctly reinitialized on restart. Recovery may remove it while
609-
* replaying, for example, an XLOG_DBASE_CREATE* or XLOG_TBLSPC_CREATE
610-
* record. Therefore, logging is necessary even if wal_level=minimal.
608+
* be correctly reinitialized on restart.
611609
*/
612610
if (persistence == RELPERSISTENCE_UNLOGGED)
613611
{

src/backend/commands/dbcommands.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -644,9 +644,10 @@ CreateDatabaseUsingFileCopy(Oid src_dboid, Oid dst_dboid, Oid src_tsid,
644644
* make the XLOG entry for the benefit of PITR operations). This avoids
645645
* two nasty scenarios:
646646
*
647-
* #1: When PITR is off, we don't XLOG the contents of newly created
648-
* indexes; therefore the drop-and-recreate-whole-directory behavior of
649-
* DBASE_CREATE replay would lose such indexes.
647+
* #1: At wal_level=minimal, we don't XLOG the contents of newly created
648+
* relfilenodes; therefore the drop-and-recreate-whole-directory behavior
649+
* of DBASE_CREATE replay would lose such files created in the new
650+
* database between our commit and the next checkpoint.
650651
*
651652
* #2: Since we have to recopy the source database during DBASE_CREATE
652653
* replay, we run the risk of copying changes in it that were committed

0 commit comments

Comments
 (0)