Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit18724af

Browse files
committed
Remove unnecessary smgrimmedsync() when creating unlogged table.
This became safe after commit4b4798e. The smgrcreate() call willnow register the segment for syncing at the next checkpoint, so wedon't need to sync it here. If a checkpoint happens before thecreation is WAL-logged, the records will be replayed when startingrecovery from the checkpoint. If a checkpoint happens after the WALlogging, the checkpoint will fsync() it.In the passing, clarify a comment in smgrDoPendingSyncs().Discussion:https://www.postgresql.org/message-id/6e5bbc08-cdfc-b2b3-9e23-1a914b9850a9%40iki.fiReviewed-by: Robert Haas
1 parentb0ec61c commit18724af

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

‎src/backend/access/heap/heapam_handler.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -606,12 +606,9 @@ heapam_relation_set_new_filelocator(Relation rel,
606606

607607
/*
608608
* If required, set up an init fork for an unlogged table so that it can
609-
* be correctly reinitialized on restart. An immediate sync is required
610-
* even if the page has been logged, because the write did not go through
611-
* shared_buffers and therefore a concurrent checkpoint may have moved the
612-
* redo pointer past our xlog record. Recovery may as well remove it
613-
* while replaying, for example, XLOG_DBASE_CREATE* or XLOG_TBLSPC_CREATE
614-
* record. Therefore, logging is necessary even if wal_level=minimal.
609+
* be correctly reinitialized on restart. Recovery may remove it while
610+
* replaying, for example, an XLOG_DBASE_CREATE* or XLOG_TBLSPC_CREATE
611+
* record. Therefore, logging is necessary even if wal_level=minimal.
615612
*/
616613
if (persistence==RELPERSISTENCE_UNLOGGED)
617614
{
@@ -620,7 +617,6 @@ heapam_relation_set_new_filelocator(Relation rel,
620617
rel->rd_rel->relkind==RELKIND_TOASTVALUE);
621618
smgrcreate(srel,INIT_FORKNUM, false);
622619
log_smgrcreate(newrlocator,INIT_FORKNUM);
623-
smgrimmedsync(srel,INIT_FORKNUM);
624620
}
625621

626622
smgrclose(srel);

‎src/backend/catalog/storage.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -764,7 +764,7 @@ smgrDoPendingSyncs(bool isCommit, bool isParallelWorker)
764764
/*
765765
* We emit newpage WAL records for smaller relations.
766766
*
767-
* Small WAL records have a chance to beemitted along with other
767+
* Small WAL records have a chance to beflushed along with other
768768
* backends' WAL records. We emit WAL records instead of syncing for
769769
* files that are smaller than a certain threshold, expecting faster
770770
* commit. The threshold is defined by the GUC wal_skip_threshold.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp