Simon Riggs wrote:
I'm undecided as to whether this is too much code or too little. I'm somewhat uncertain as to the locking requirements for the physical scan during a vacuum. I've worked out various options if we need to change this.
For the B-tree, an exclusive lock is enough to modify the contents of the page. A cleanup lock needs to be taken on every page to ensure that the vacuum doesn't finish and delete a heap tuple that's about to be accessed by an index scan. That could be handled in WAL replay by dropping the exclusive lock and re-acquiring the cleanup lock, but we can't do that for heap vacuums.
However, we require that in b-tree vacuum, you take a cleanup lock on *every* leaf page of the index, not only those that you modify. That's a problem, because there's no trace of such pages in the WAL.
PS. FSM doesn't need cleanup locks. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers