advancing snapshot's xmin

Поиск
Список
Период
Сортировка
От Alvaro Herrera
Тема advancing snapshot's xmin
Дата
Msg-id 20080325202645.GA15520@alvh.no-ip.org
обсуждение исходный текст
Ответы Re: advancing snapshot's xmin  (Simon Riggs <simon@2ndquadrant.com>)
Re: advancing snapshot's xmin  (Neil Conway <neilc@samurai.com>)
Список pgsql-hackers
Hi,

I've finished (hopefully) the code to handle a current list of open
snapshots in a transaction.  I'm now wondering how to put it to good use
;-)  I'm not posting it yet -- first I want to get some feedback on the
previous patch I posted,
http://archives.postgresql.org/pgsql-patches/2008-03/msg00245.php


I think the important change here is switching the semantics of
MyProc->xmin.  Currently, it is "the minimum of Xmin and Xid, across all
backends, at the moment the current transaction fetches its serializable
snapshot".  The first important bit is that it is computed only once:
when the serializable snapshot is taken.

So ISTM the important change is that we will have to update MyProc->xmin
more frequently than that.  I'm thinking in keeping enough local state
so that we can detect at what time the earliest open snapshot is
unregistered; when that happens, we can recalculate MyProc->xmin based
on the snapshots we have and the Xid/Xmin of remote backends (which
could have also been updating their own xmins).

There is one hole here: contention on ProcArrayLock.  Basically, for
simple transactions we will need to update MyProc after every command.
It has been reported that ProcArrayLock is the most contended lock for
some loads; this would only add to that, and heavily I think.  Perhaps
we could restructure the locking here somehow to avoid this problem, but
it is complex enough already that it may not even be possible.

Another idea is to throttle the updating of Xmin so it only happens once
in a while, but it's difficult to find a useful criterion and avoid
falling into the trap that we just neglected to update it before a large
command.


Thoughts?

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support


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

Предыдущее
От: Dimitri Fontaine
Дата:
Сообщение: Re: GiST opclass and varlena
Следующее
От: "Gokulakannan Somasundaram"
Дата:
Сообщение: Hash Join Optimization