Here is the patch. I identified a boostrapping issue: (setf (instances-cache instance) (indices instance)) was being called on an instance of BDB-INDEXED-BDB, forcing a deserialization of the persistent INDICES slot. Unfortunately at this point in bootstrapping the database, instance-table is not yet set up, so deserialization does not quite work to fetch the persistent value of the INDICES slot.
I correct this bug by defining a custom reader that lazily loads the indices-cache slot. Not the smoothest bug fix, but it seems to work. - Red On Sat, Jul 10, 2010 at 1:00 PM, Red Daly <redd...@gmail.com> wrote: > When I try to open a controller of mine, I get this error: > > The slot ELEPHANT::INSTANCE-TABLE is unbound in the object > #<BDB-STORE-CONTROLLER ...> > > It seems that this is caused by a bug with how the instance-table is > established in a new controller, since the stack trace indicates this > bug occurs when the INSTANCE-TABLE slot is being set up. > Specifically, at this line in bdb-controller.lisp: > > > (setf (slot-value sc 'instance-table) > (if (or new-p (elephant::prior-version-p > (database-version sc) '(0 9 1))) > ;; When opening the DB equal or prior to 0.9.1, > always get the indices initialized, > ;; regardless of the indices is initialized before. > ;; Even the indices is serialized before(in the case > that open the <=0.9.1 DB file for the second time), > ;; it still can not be unserialized here, because > its persistent object's oid > ;; does not match the hardcoded one in > oid->schema-id, which only work on the DB file > ;; created in release > 0.9.1. > (make-instance 'bdb-indexed-btree :from-oid -3 :sc > sc :indices (make-hash-table)) >>>>> (make-instance 'bdb-indexed-btree :from-oid -3 :sc sc))) >>>>> <<<< > > > I will work on a fix now. If anybody has insights, gotchas, etc. let > me know. A patch soon to follow... > > The slot ELEPHANT::INSTANCE-TABLE is unbound in the object > #<BDB-STORE-CONTROLLER /apps/bookllama-dev/server/data/production/>. > [Condition of type UNBOUND-SLOT] > > Restarts: > 0: [USE-VALUE] Return a value as the slot-value. > 1: [STORE-VALUE] Store and return a value as the slot-value. > 2: [RETRY] Retry SLIME REPL evaluation request. > 3: [ABORT] Return to SLIME's top level. > 4: [TERMINATE-THREAD] Terminate this thread (#<THREAD > "new-repl-thread" RUNNING {10054B88F1}>) > > Backtrace: > 0: ((SB-PCL::FAST-METHOD SLOT-UNBOUND (T T T)) ..) > 1: (SB-PCL::SLOT-UNBOUND-INTERNAL #<BDB-STORE-CONTROLLER > /apps/bookllama-dev/server/data/production/> 9) > 2: ((SB-PCL::FAST-METHOD ELEPHANT::OID->SCHEMA-ID (T > ELEPHANT:STORE-CONTROLLER)) #<unavailable lambda list>) > 3: ((SB-PCL::FAST-METHOD ELEPHANT::GET-INSTANCE-CLASS > (ELEPHANT:STORE-CONTROLLER T)) #<unavailable lambda list>) > 4: ((FLET SB-THREAD::WITH-RECURSIVE-LOCK-THUNK)) > 5: ((FLET #:WITHOUT-INTERRUPTS-BODY-[CALL-WITH-RECURSIVE-LOCK]324)) > 6: (SB-THREAD::CALL-WITH-RECURSIVE-LOCK ..) > 7: ((FLET #:FORM-FUN-[CONTROLLER-RECREATE-INSTANCE]14)) > 8: ((SB-PCL::FAST-METHOD ELEPHANT::CONTROLLER-RECREATE-INSTANCE > (ELEPHANT:STORE-CONTROLLER T)) ..) > 9: ((LABELS ELEPHANT-SERIALIZER2::%DESERIALIZE) > #S(ELEPHANT-MEMUTIL:BUFFER-STREAM :BUFFER > #<SB-ALIEN-INTERNALS:ALIEN-VALUE :SAP #X00650120 :TYPE (* #)> :SIZE 76 > :POSITION 76 :LENGTH 80)) > 10: ((LABELS ELEPHANT-SERIALIZER2::%DESERIALIZE) > #S(ELEPHANT-MEMUTIL:BUFFER-STREAM :BUFFER > #<SB-ALIEN-INTERNALS:ALIEN-VALUE :SAP #X00650120 :TYPE (* #)> :SIZE 76 > :POSITION 76 :LENGTH 80)) > 11: (ELEPHANT-SERIALIZER2::DESERIALIZE ..) > 12: ((FLET #:FORM-FUN-[DESERIALIZE]2)) > 13: (ELEPHANT::DESERIALIZE ..) > 14: ((LAMBDA ()) #<unavailable lambda list>) > 15: (SLOT-VALUE #<BDB-INDEXED-BTREE oid:-3> DB-BDB::INDICES) > 16: ((SB-PCL::FAST-METHOD SHARED-INITIALIZE :AFTER > (DB-BDB::BDB-INDEXED-BTREE T)) #<unavailable lambda list>)[:EXTERNAL] > 17: ((LAMBDA (SB-PCL::.PV. SB-PCL::.NEXT-METHOD-CALL. SB-PCL::.ARG0. > SB-PCL::.ARG1. SB-INT:&MORE SB-PCL::.DFUN-MORE-CONTEXT. > SB-PCL::.DFUN-MORE-COUNT.)) ..) > 18: ((SB-PCL::FAST-METHOD SHARED-INITIALIZE :AROUND > (ELEPHANT:PERSISTENT-OBJECT T)) #<unavailable argument> #<unavailable > argument> #<unavailable argument> #<unavailable argument>)[:EXTERNAL] > 19: ((LAMBDA (SB-PCL::.PV. SB-PCL::.NEXT-METHOD-CALL. SB-PCL::.ARG0. > SB-INT:&MORE SB-PCL::.DFUN-MORE-CONTEXT. SB-PCL::.DFUN-MORE-COUNT.)) > ..) > 20: (SB-PCL::FAST-MAKE-INSTANCE #<unavailable argument>)[:EXTERNAL] > 21: ((LAMBDA ())) > 22: ((SB-PCL::FAST-METHOD ELEPHANT::EXECUTE-TRANSACTION > (DB-BDB::BDB-STORE-CONTROLLER T)) #<unavailable argument> > #<unavailable argument> #<unavailable argument> #<unavailable > argument>)[:EXTERNAL] > 23: ((SB-PCL::FAST-METHOD ELEPHANT::OPEN-CONTROLLER > (DB-BDB::BDB-STORE-CONTROLLER)) #(13 NIL 9 NIL 3 NIL ...) #<unused > argument> #<BDB-STORE-CONTROLLER > /apps/bookllama-dev/server/data/production/>)[:EXTER.. > 24: ((LAMBDA (SB-PCL::.PV. SB-PCL::.NEXT-METHOD-CALL. SB-PCL::.ARG0. > SB-INT:&MORE SB-PCL::.DFUN-MORE-CONTEXT. SB-PCL::.DFUN-MORE-COUNT.)) > ..) > 25: (ELEPHANT:OPEN-STORE #<unavailable lambda list>)[:EXTERNAL] > > > -- Red _______________________________________________ elephant-devel site list elephant-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/elephant-devel