aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2007-09-20 21:43:27 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2007-09-20 21:43:27 +0000
commiteb5f4d6c5cece3e3fa80a506153e5202b093b7ca (patch)
treed560fbbce2a591f6613f3c8d40371b74c2cb464c /src
parent754838caa3524121bc12f86fd16b53a3a0e8d472 (diff)
downloadpostgresql-eb5f4d6c5cece3e3fa80a506153e5202b093b7ca.tar.gz
postgresql-eb5f4d6c5cece3e3fa80a506153e5202b093b7ca.zip
Revert ill-fated patch to release exclusive lock early after vacuum
truncates a table. Introduces race condition, as shown by buildfarm failures.
Diffstat (limited to 'src')
-rw-r--r--src/backend/commands/vacuumlazy.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/backend/commands/vacuumlazy.c b/src/backend/commands/vacuumlazy.c
index b9050719cb4..564ab8d9fdd 100644
--- a/src/backend/commands/vacuumlazy.c
+++ b/src/backend/commands/vacuumlazy.c
@@ -36,7 +36,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.97 2007/09/20 17:56:31 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/commands/vacuumlazy.c,v 1.98 2007/09/20 21:43:27 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -855,8 +855,13 @@ lazy_truncate_heap(Relation onerel, LVRelStats *vacrelstats)
*/
RelationTruncate(onerel, new_rel_pages);
- /* Now we're OK to release the lock. */
- UnlockRelation(onerel, AccessExclusiveLock);
+ /*
+ * Note: once we have truncated, we *must* keep the exclusive lock
+ * until commit. The sinval message that will be sent at commit
+ * (as a result of vac_update_relstats()) must be received by other
+ * backends, to cause them to reset their rd_targblock values, before
+ * they can safely access the table again.
+ */
/*
* Drop free-space info for removed blocks; these must not get entered