Lazy xid assignment V4

Поиск
Список
Период
Сортировка
От Florian G. Pflug
Тема Lazy xid assignment V4
Дата
Msg-id 46DD9464.2010906@phlo.org
обсуждение исходный текст
Ответы Re: Lazy xid assignment V4  ("Pavan Deolasee" <pavan.deolasee@gmail.com>)
Re: Lazy xid assignment V4  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: Lazy xid assignment V4  ("Heikki Linnakangas" <heikki@enterprisedb.com>)
Re: Lazy xid assignment V4  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-patches
Hi

Here is an updated patch, following the discussion.
The patch can be found at: http://soc.phlo.org/lazyxidassign.v4.patch
(I seems I still can't get attachments through to this list)

Most changes are just small fixes and tweaks. Those are
.) Introduced %v for log_line_prefix
.) I missed a few places when I renamed ResourceOwnerId to
    VirtualTransactionId. (In lock.c/.h and lmgr.c/.h +
    a few comments). Should be fixed now.
.) Fixed some typos and outdated-ness in comments.

Two changes are a bit larger

1) 2PC was broken in V3. I added code that skips LOCKTYPE_VIRTUALTRANSACTION
locks when writing the locks to the 2PC state file, but I didn't
add the same exception to the code that reassigns the locks to
a dummy PGROC afterwards. So the locks weren't released at PREPARE
time. Fixed now.

2) The more I thought about the sessionId, the less I liked it.
It adds a new per-backend identifier, beside pid and BackendId,
only to than *still* have wraparound issues. That seems a bit
stupid.

I therefore got rid of the sessionId completely, and replaced it
with MyBackendId. To guarantee that VirtualTransactionIds are
not reused too quickly, I added an array nextLocalTransactionIds
to shared memory, with one entry per backendId. That seems much cleaner -
it doesn't add yet another per-backend identifier, doesn't need
yet another variable initialized at backend start, and solved the
wraparound problem too.

It *does* cost a bit of shared memory, but not much. For
max_backends=2048 the array is as large as *one* shared buffer.

It doesn't need any locking, either, because each backend
only ever touches it's own entry in the array.

Because the backendId part of VirtualTransactionIds is now
always a rather small number (<= MaxBackends), and might
be interesting to know, I changed the string representation to
show the backendId in decimal notation.

greetings, Florian Pflug


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

Предыдущее
От: Andrew Dunstan
Дата:
Сообщение: Re: [HACKERS] enum types and binary queries
Следующее
От: "Pavan Deolasee"
Дата:
Сообщение: Re: Lazy xid assignment V4