Re: SSI SLRU low-level functions first cut

From: "Kevin Grittner" <Kevin(dot)Grittner(at)wicourts(dot)gov>
To: <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SSI SLRU low-level functions first cut
Date: 2011-01-02 13:47:01
Message-ID: 4D202D750200002500038EB9@gw.wicourts.gov
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Heikki Linnakangas wrote:

> Nothing checking for the hi-bit flag AFAICS. I guess the code that
> uses that would do check it.

Right. After getting this layer done, I went off to watch the
Badgers in the Rose Bowl, leaving that coding for today. ;-)

> But wouldn't it be simpler to mark the unused slots with zero
> commitseqno, instead of messing with the hi-bit in valid values?

This is the earliest commitSeqNo of rw-conflicts out which the
transaction we're looking up had. I'm using zero to mean that there
was no conflict. Perhaps instead of setting the high bit I could
just use a special value (like all bits set) instead of zero to mean
"no conflict". In any event, it's clear that all zero should mean
"not found" and I need some other way to indicate "no conflict".

> It's probably not necessary to explicitly truncate the slru at
> startup. We don't do that for pg_subtrans, which also doesn't
> survive restarts. The next checkpoint will truncate it.

Good point. That slims things down by 22 lines and eliminates a
distracting special case.

> It would possibly be simpler to not reset headXid and tailXid to
> InvalidTransactionId when the "window" is empty, but represent that
> as tailXid == headXid + 1.

I'll take a look. I went 'round a few time on how best to handle the
empty window, which was complicated a little bit by wanting to keep
track of the tail even when the window was currently empty. Because
xids won't be submitted in strictly sequential order, I might need
to go back a ways in the sequence to update something, so I need to
keep track of existing segment files even when there are currently no
xids to track; and I wanted the searches to have a fast path out for
such cases.

> OldSerXidGetMinConflictCommitSeqNo() calls LWLockRelease twice.

That's because the function calls SimpleLruReadPage_ReadOnly:

"Control lock must NOT be held at entry, but will be held at exit."

That strikes me as an odd API, but it is what it is.

-Kevin

Browse pgsql-hackers by date

  From Date Subject
Next Message Tatsuo Ishii 2011-01-02 13:56:28 Re: How to know killed by pg_terminate_backend
Previous Message Simon Riggs 2011-01-02 13:41:13 Re: Sync Rep Design