[elephant-devel] Re: Postmodern, Act II

Alex Mizrahi killerstorm at newmail.ru
Fri May 2 20:21:36 UTC 2008


 LPP> With this enabled I sometimes get

 LPP>   Database error 55000: currval of sequence "txn_id" is not yet
 LPP>   defined in this session

can you catch a backtrace? it seems to be quite relevant here

 LPP> This should be easy to fix, either by using NEXTVAL all the time
 LPP> (not sure whether this will work or whether this is good at all)

yep, that will just break logic

 LPP> or by ensuring that at least one NEXTVAL precedes usage of CURRVAL.

that's the way it is meant to work: NEXTVAL is called in 
ensure-cache-up-to-date function,
and ensure-cache-up-to-date is called before any operation on cache -- and 
before any write to DB.

the only code path i'm aware of is
  (setf internal-get-value) on btree -> ins_upd_btree -> 
notify_btree_update -> currval
but, before calling ins_upd_btree,  (setf internal-get-value)  calls 
txn-cache-set-value, that ensures cache is up to date, calling NEXTVAL

so this code path seems to be correct -- NEXTVAL is always called before 
CURRVAL.

so only reason i can think of at moment (before looking into backtrace, at 
least) is misconfiguration -- some processes/threads you launch have global 
sync cache enabled, while others have not.
and those who don't have it enabled call CURRVAL without initializing it 
with NEXTVAL (because they are not initializing cache).






More information about the elephant-devel mailing list