Prepared Xacts and Vacuum question

From: "Satoshi Nagayasu" <snaga(at)snaga(dot)org>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Prepared Xacts and Vacuum question
Date: 2006-02-19 09:59:14
Message-ID: fa3bffeb0602190159m3722e249qf219d21bf55285a7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

When I was playing with VACUUM, I found that if I have prepared xacts
on the database A, I can't vacuum full on the database B.

Scenario:
1.) Prepare some transaction on "testdb" database.
2.) Create database "pgbench".
3.) Run "pgbench -i" to load pgbench data on "pgbench" database
4.) Delete all records from "accounts" table.
5.) Do VACUUM FULL on "pgbench" database.
6.) "accounts" table will not be shrinked.
7.) Rollback the prepared xacts on "testdb" database.
8.) Do VACUUM FULL on "pgbench" database.
9.) "accounts" table is shrinked.

For more details, please see the attached file.

According to my investigation, when the transaction is prepared,
PROC->xmin always set from the prepared transaction id,
even if it is another database.

So vacuum can't collect the deleted row between current xid and
prepared transaction's xid, and detect them as "nonremovable rows".

I found this on 8.1.0 and current cvs.

I think the prepared xacts on any database mustn't affect to another database.
Is this bug or spec?

Any comments?

Thanks.
--
NAGAYASU Satoshi <snaga(at)snaga(dot)org>

Attachment Content-Type Size
vacuum81.txt text/plain 5.4 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dave Page 2006-02-19 10:02:53 Re: Pgfoundry and gborg: shut one down
Previous Message Marc G. Fournier 2006-02-19 07:54:20 Re: Pgfoundry and gborg: shut one down