Re: Idea for cleaner representation of snapshots - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: Idea for cleaner representation of snapshots
Date
Msg-id 20070324202144.GB1089@svana.org
Whole thread Raw
In response to Idea for cleaner representation of snapshots  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Idea for cleaner representation of snapshots
List pgsql-hackers
On Sat, Mar 24, 2007 at 02:00:30PM -0400, Tom Lane wrote:
> I had an idea about how to make this cleaner and faster at
> the same time.  Make all snapshots be real pointers to
> SnapshotData structures (except InvalidSnapshot, which remains
> an alias for NULL).  Add a struct field that is a pointer to
> the satifies function for the snapshot type.  Then
> HeapTupleSatisfiesVisibility reduces to something like
>
>     ((*(snapshot)->satisfies) ((tuple)->t_data, snapshot, buffer))
>
> which ought to be faster than it is now.  We could also add
> an "mvcc" bool field to simplify IsMVCCSnapshot() --- or just
> make it test the contents of the satisfies-function field.

Sounds like a winner. Essentially snapshots becomes objects that have
methods you can use to interact with them. Make a new shapshot type,
most of the code doesn't need to care.

So yep, good idea.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Idea for cleaner representation of snapshots
Next
From: Tom Lane
Date:
Subject: Re: Idea for cleaner representation of snapshots