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

Commit6a10f0f

Browse files
committed
Release the exclusive lock on the table early after truncating it in lazy
vacuum, instead of waiting till commit.
1 parentf7379f5 commit6a10f0f

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

‎src/backend/commands/vacuumlazy.c

Lines changed: 4 additions & 5 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.92 2007/09/1017:58:45 alvherre Exp $
39+
* $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.93 2007/09/1021:40:03 alvherre Exp $
4040
*
4141
*-------------------------------------------------------------------------
4242
*/
@@ -802,6 +802,9 @@ lazy_truncate_heap(Relation onerel, LVRelStats *vacrelstats)
802802
*/
803803
RelationTruncate(onerel,new_rel_pages);
804804

805+
/* Now we're OK to release the lock. */
806+
UnlockRelation(onerel,AccessExclusiveLock);
807+
805808
/*
806809
* Drop free-space info for removed blocks; these must not get entered
807810
* into the FSM!
@@ -834,10 +837,6 @@ lazy_truncate_heap(Relation onerel, LVRelStats *vacrelstats)
834837
vacrelstats->rel_pages=new_rel_pages;
835838
vacrelstats->pages_removed=old_rel_pages-new_rel_pages;
836839

837-
/*
838-
* We keep the exclusive lock until commit (perhaps not necessary)?
839-
*/
840-
841840
ereport(elevel,
842841
(errmsg("\"%s\": truncated %u to %u pages",
843842
RelationGetRelationName(onerel),

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp