Re: SSI patch version 14 - Mailing list pgsql-hackers

From Jeff Davis
Subject Re: SSI patch version 14
Date
Msg-id 1296499247.11513.777.camel@jdavis
Whole thread Raw
In response to Re: SSI patch version 14  ("Kevin Grittner" <Kevin.Grittner@wicourts.gov>)
Responses Re: SSI patch version 14
Re: SSI patch version 14
Re: SSI patch version 14
List pgsql-hackers
On Mon, 2011-01-31 at 07:26 -0600, Kevin Grittner wrote:
> > And why are you reading the infomask directly? Do the existing
> > visibility functions not suffice?
>  
> It's possible we re-invented some code somewhere, but I'm not clear
> on what code from this patch might use what existing function.  Could
> you provide specifics?

In CheckForSerializableConflictOut(), it takes a boolean "valid". Then
within the function, it tries to differentiate:
 1. Valid with no indication that it will be deleted. 2. Valid, but delete in progress 3. Invalid

For #1, you are using the hint bit (not the real transaction status),
and manually checking whether it's just a lock or a real delete. For #2
you are assuming any other xmax means that the transaction is in
progress (which it may not be, because the hint bit might not be set for
some time). I assume that will cause additional false positives.

If you used HeapTupleSatisfiesVacuum(), you could do something like:
 case HEAPTUPLE_LIVE:    return; case HEAPTUPLE_RECENTLY_DEAD: case HEAPTUPLE_DELETE_IN_PROGRESS:    xid =
HeapTupleHeaderGetXmax(tuple->t_data);   break; case HEAPTUPLE_INSERT_IN_PROGRESS:    xid =
HeapTupleHeaderGetXmin(tuple->t_data);   break; case HEAPTUPLE_DEAD:    return;
 

This is not identical to what's happening currently, and I haven't
thought this through thoroughly yet. For instance, "recently dead and
invalid" would be checking on the xmax instead of the xmin. Perhaps you
could exit early in that case (if you still keep the "valid" flag), but
that will happen soon enough anyway.

I don't think this function really cares about the visibility with
respect to the current snapshot, right? It really cares about what other
transactions are interacting with the tuple and how. And I think HTSV
meets that need a little better.

> > The biggest issue on my mind is what to do about Hot Standby. The
> > authors have a plan, but there is also some resistance to it:
> >
> >
> http://archives.postgresql.org/message-id/23698.1295566621@sss.pgh.pa.us
> >
> > We don't need a perfect solution for 9.1, but it would be nice if
> > we had a viable plan for 9.2.
>  
> I don't recall any real opposition to what I sketched out in this
> post, which came after the above-referenced one:
>  
> http://archives.postgresql.org/message-id/4D39D5EC0200002500039A19@gw.wicourts.gov
>  
> Also, that opposition appears to be based on a misunderstanding of
> the first alternative, which was for sending at most one snapshot per
> commit or rollback of a serializable read write transaction, with
> possible throttling.  The alternative needs at most two bits per
> commit or rollback of a serializable read write transaction; although
> I haven't checked whether that can be scared up without adding a
> whole byte.  Read only transactions have nothing to do with the
> traffic under either alternative.

Ok, great. When I read that before I thought that WAL might need to be
sent for implicit RO transactions. I will read it more carefully again.

Regards,Jeff Davis



pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: windows build docs
Next
From: Robert Haas
Date:
Subject: Re: Spread checkpoint sync