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

Commit17eaae9

Browse files
committed
Fix logging of pages skipped due to pins during vacuum.
The new logging introduced in35192f0 made the incorrect assumptionthat scan_all vacuums would always wait for buffer pins; but they onlydo so if the page actually needs to be frozen.Fix that inaccuracy by removing the difference in log output based onscan_all and just always remove the same message. I chose to keep thesplit log message from the original commit for now, it seems likelythat it'll be of use in the future.Also merge the line about buffer pins in autovacuum's log output intothe existing "pages: ..." line. It seems odd to have a separate lineabout pins, without the "topic: " prefix others have.Also rename the new 'pinned_pages' variable to 'pinskipped_pages'because it actually tracks the number of pages that could *not* bepinned.Discussion: 20150104005324.GC9626@awork2.anarazel.de
1 parent2048e5b commit17eaae9

File tree

1 file changed

+8
-24
lines changed

1 file changed

+8
-24
lines changed

‎src/backend/commands/vacuumlazy.c

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ typedef struct LVRelStats
105105
BlockNumberold_rel_pages;/* previous value of pg_class.relpages */
106106
BlockNumberrel_pages;/* total number of pages */
107107
BlockNumberscanned_pages;/* number of pages we examined */
108-
BlockNumberpinned_pages;/* # of pages wecould not initially lock */
108+
BlockNumberpinskipped_pages;/* # of pages weskipped due to a pin */
109109
doublescanned_tuples;/* counts only tuples on scanned pages */
110110
doubleold_rel_tuples;/* previous value of pg_class.reltuples */
111111
doublenew_rel_tuples;/* new estimated total # of tuples */
@@ -356,19 +356,10 @@ lazy_vacuum_rel(Relation onerel, VacuumStmt *vacstmt,
356356
get_namespace_name(RelationGetNamespace(onerel)),
357357
RelationGetRelationName(onerel),
358358
vacrelstats->num_index_scans);
359-
appendStringInfo(&buf,_("pages: %u removed, %u remain\n"),
359+
appendStringInfo(&buf,_("pages: %u removed, %u remain, %u skipped due to pins\n"),
360360
vacrelstats->pages_removed,
361-
vacrelstats->rel_pages);
362-
if (vacrelstats->pinned_pages>0)
363-
{
364-
if (scan_all)
365-
appendStringInfo(&buf,_("waited for %u buffer pins\n"),
366-
vacrelstats->pinned_pages);
367-
else
368-
appendStringInfo(&buf,
369-
_("skipped %u pages due to buffer pins\n"),
370-
vacrelstats->pinned_pages);
371-
}
361+
vacrelstats->rel_pages,
362+
vacrelstats->pinskipped_pages);
372363
appendStringInfo(&buf,
373364
_("tuples: %.0f removed, %.0f remain, %.0f are dead but not yet removable\n"),
374365
vacrelstats->tuples_deleted,
@@ -634,8 +625,6 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
634625
/* We need buffer cleanup lock so that we can prune HOT chains. */
635626
if (!ConditionalLockBufferForCleanup(buf))
636627
{
637-
vacrelstats->pinned_pages++;
638-
639628
/*
640629
* If we're not scanning the whole relation to guard against XID
641630
* wraparound, it's OK to skip vacuuming a page. The next vacuum
@@ -644,6 +633,7 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
644633
if (!scan_all)
645634
{
646635
ReleaseBuffer(buf);
636+
vacrelstats->pinskipped_pages++;
647637
continue;
648638
}
649639

@@ -663,6 +653,7 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
663653
{
664654
UnlockReleaseBuffer(buf);
665655
vacrelstats->scanned_pages++;
656+
vacrelstats->pinskipped_pages++;
666657
continue;
667658
}
668659
LockBuffer(buf,BUFFER_LOCK_UNLOCK);
@@ -1129,15 +1120,8 @@ lazy_scan_heap(Relation onerel, LVRelStats *vacrelstats,
11291120
nkeep);
11301121
appendStringInfo(&buf,_("There were %.0f unused item pointers.\n"),
11311122
nunused);
1132-
if (vacrelstats->pinned_pages>0)
1133-
{
1134-
if (scan_all)
1135-
appendStringInfo(&buf,_("Waited for %u buffer pins.\n"),
1136-
vacrelstats->pinned_pages);
1137-
else
1138-
appendStringInfo(&buf,_("Skipped %u pages due to buffer pins.\n"),
1139-
vacrelstats->pinned_pages);
1140-
}
1123+
appendStringInfo(&buf,_("Skipped %u pages due to buffer pins.\n"),
1124+
vacrelstats->pinskipped_pages);
11411125
appendStringInfo(&buf,_("%u pages are entirely empty.\n"),
11421126
empty_pages);
11431127
appendStringInfo(&buf,_("%s."),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp