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

Commit2825337

Browse files
committed
Fix vac_update_relstats to ensure it always sends a relcache inval message,
even if none of the fields in the pg_class row change. This behavior isnecessary to ensure other backends flush rd_targblock values that mightpoint to truncated-away pages. We got this right pre-8.2 but it was brokenby overoptimistic change to not write out the pg_class row if unchanged.Per report from Pavan Deolasee.
1 parent2afb01d commit2825337

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

‎src/backend/commands/vacuum.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
*
1414
*
1515
* IDENTIFICATION
16-
* $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.346 2007/02/15 23:23:22 alvherre Exp $
16+
* $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.347 2007/03/08 17:03:31 tgl Exp $
1717
*
1818
*-------------------------------------------------------------------------
1919
*/
@@ -715,10 +715,20 @@ vac_update_relstats(Oid relid, BlockNumber num_pages, double num_tuples,
715715
}
716716

717717
/*
718-
* If anything changed, write out the tuple
718+
* If anything changed, write out the tuple. Even if nothing changed,
719+
* force relcache invalidation so all backends reset their rd_targblock
720+
* --- otherwise it might point to a page we truncated away.
719721
*/
720722
if (dirty)
723+
{
721724
heap_inplace_update(rd,ctup);
725+
/* the above sends a cache inval message */
726+
}
727+
else
728+
{
729+
/* no need to change tuple, but force relcache inval anyway */
730+
CacheInvalidateRelcacheByTuple(ctup);
731+
}
722732

723733
heap_close(rd,RowExclusiveLock);
724734
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp