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

Commitc1458cc

Browse files
Avoid marking buffer dirty when VACUUM has no work to do.
When wal_level = 'hot_standby' we touched the last page of therelation during a VACUUM, even if nothing else had happened.That would alter the LSN of the last block and set the mtimeof the relation file unnecessarily. Noted by Thom Brown.
1 parentf6438f6 commitc1458cc

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

‎src/backend/access/nbtree/nbtpage.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ _bt_page_recyclable(Page page)
732732
* and so must be scanned anyway during replay. We always write a WAL record
733733
* for the last block in the index, whether or not it contained any items
734734
* to be removed. This allows us to scan right up to end of index to
735-
* ensure correct locking.
735+
* ensure correct locking. That is the only time we are called with nitems==0.
736736
*/
737737
void
738738
_bt_delitems_vacuum(Relationrel,Bufferbuf,
@@ -764,7 +764,8 @@ _bt_delitems_vacuum(Relation rel, Buffer buf,
764764
*/
765765
opaque->btpo_flags &= ~BTP_HAS_GARBAGE;
766766

767-
MarkBufferDirty(buf);
767+
if (nitems>0)
768+
MarkBufferDirty(buf);
768769

769770
/* XLOG stuff */
770771
if (RelationNeedsWAL(rel))
@@ -804,8 +805,11 @@ _bt_delitems_vacuum(Relation rel, Buffer buf,
804805

805806
recptr=XLogInsert(RM_BTREE_ID,XLOG_BTREE_VACUUM,rdata);
806807

807-
PageSetLSN(page,recptr);
808-
PageSetTLI(page,ThisTimeLineID);
808+
if (nitems>0)
809+
{
810+
PageSetLSN(page,recptr);
811+
PageSetTLI(page,ThisTimeLineID);
812+
}
809813
}
810814

811815
END_CRIT_SECTION();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp