Jan Wieck JanWieck at Yahoo.com
Tue Sep 25 10:29:40 PDT 2007
On 9/25/2007 12:21 PM, Marko Kreen wrote:
> On 9/25/07, Jan Wieck <JanWieck at yahoo.com> wrote:
>> On 9/25/2007 5:51 AM, Marko Kreen wrote:
>> > Only question that may need discussion is the question of naming.
>> >
>> > Current APi is following:
>> >
>> >  type: txid_snapshot
>> >
>> >  get_current_txid(): int8
>> >  get_current_snapshot(): txid_snapshot
>> >  get_snapshot_xmin(sn): int8
>> >  get_snapshot_xmax(sn): int8
>> >  get_snapshot_active(sn): setof int8
>> >  txid_in_snapshot(int8, sn): bool
>> >
>> > But it seems kind of random, considering it is targeted to be core
>> > functinality in the future.  I'd prefer something more concise:
>> >
>> >  type: snapshot
>> >
>> >  current_txid(): int8
>> >  current_snapshot(): snapshot
>> >  snapshot_xmin()
>> >  snapshot_xmax()
>> >  snapshot_uncommitted()  ??
>> >  snapshot_contains()     ??
>>
>> Eventually all functions should have the txid_ prefix?
> 
> Ok, sounds reasonable too.
> 
>>    int8          txid_current()
>>    txid_snapshot txid_current_snapshot()
>>    int8          txid_snapshot_xmin(sn)
>>    int8          txid_snapshot_xmax(sn)
>>    setof int8    txid_snapshot_xip(sn)
> 
> Ok.
> 
>>    bool          txid_in_snapshot_xip(int8, sn)
> 
> Is it really a often used function?  Otherwise
> txid_snapshot_xip() should be enough?

Right, it is obsolete.

> 
>>    bool          txid_lt_snapshot(int8, sn)
>>    bool          txid_le_snapshot(int8, sn)
>>    bool          txid_ge_snapshot(int8, sn)
>>    bool          txid_gt_snapshot(int8, sn)
> 
> Why so many variants?  Isn't one enough?

Right again, only _lt_ and _gt_ make sense, because the snapshot itself 
doesn't have a particular xid associated with it, so there is no 
definition of an xid being equal to a snapshot.

> 
> And I think that should be with clearer name like
> txid_is_visible() or txid_is_committed().

txid_lt_snapshot() would then be txid_committed_before(int8, sn) and 
txid_gt_snapshot() respectively txid_committed_after(int8, sn).


Jan

> 
>> > Somewhat better but the last 2 functions are still dubious.
>> > Do you have better names?
>>
>> xip means "transactions in progress", and is used that way inside the
>> backend. So that should be clear enough.
> 
> Indeed, it's backend vocabulary.
> 


-- 
#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#================================================== JanWieck at Yahoo.com #


More information about the Slony1-hackers mailing list