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

Commiteb5f4d6

Browse files
committed
Revert ill-fated patch to release exclusive lock early after vacuum
truncates a table. Introduces race condition, as shown by buildfarmfailures.
1 parent754838c commiteb5f4d6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

‎src/backend/commands/vacuumlazy.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
*
3737
*
3838
* IDENTIFICATION
39-
* $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.97 2007/09/2017:56:31 tgl Exp $
39+
* $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.98 2007/09/2021:43:27 tgl Exp $
4040
*
4141
*-------------------------------------------------------------------------
4242
*/
@@ -855,8 +855,13 @@ lazy_truncate_heap(Relation onerel, LVRelStats *vacrelstats)
855855
*/
856856
RelationTruncate(onerel,new_rel_pages);
857857

858-
/* Now we're OK to release the lock. */
859-
UnlockRelation(onerel,AccessExclusiveLock);
858+
/*
859+
* Note: once we have truncated, we *must* keep the exclusive lock
860+
* until commit. The sinval message that will be sent at commit
861+
* (as a result of vac_update_relstats()) must be received by other
862+
* backends, to cause them to reset their rd_targblock values, before
863+
* they can safely access the table again.
864+
*/
860865

861866
/*
862867
* Drop free-space info for removed blocks; these must not get entered

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp