Re: heap vacuum & cleanup locks

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: heap vacuum & cleanup locks
Дата
Msg-id CA+TgmobSPh-uKJ7n5j64H56KwpCqMioU_HF6OZ975OYfn8nC4w@mail.gmail.com
обсуждение исходный текст
Ответ на Re: heap vacuum & cleanup locks  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
On Wed, Nov 9, 2011 at 5:18 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Robert Haas <robertmhaas@gmail.com> writes:
>> As for what to do about all this, I think Tom's idea would work for
>> good tuples, but the current freezing code can't handle dead tuples;
>> it counts on those having been already removed.
>
> I have not gone back to look at the code, but are you worried about the
> fact that it doesn't consider replacing xmax with FrozenTransactionId?
> Surely we could do that if we wanted.  It just never seemed necessary
> before --- but if vacuum is to be allowed to punt repeatedly on the same
> page, maybe we do need to cover the case.

No, I'm worried about the fact that that it does this:
       xid = HeapTupleHeaderGetXmin(tuple);       if (TransactionIdIsNormal(xid) &&
TransactionIdPrecedes(xid,cutoff_xid))       {               if (buf != InvalidBuffer)               {
    /* trade in share lock for exclusive lock */                       LockBuffer(buf, BUFFER_LOCK_UNLOCK);
         LockBuffer(buf, BUFFER_LOCK_EXCLUSIVE);                       buf = InvalidBuffer;               }
 HeapTupleHeaderSetXmin(tuple, FrozenTransactionId); 

Note that the ONLY thing we're checking with respect to the tuple xmin
is that it's a normal XID that precedes the cutoff.  We are not
checking whether it's committed.  So there had better not be any
tuples left on the page that are from inserting transactions that
aborted, or this is going to go boom.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Cost estimates for parameterized paths
Следующее
От: Robert Haas
Дата:
Сообщение: Re: heap vacuum & cleanup locks