That's interesting. I'll have to look into that further because any existing database should either have the btree already or create it on startup...

yes, add-class-derived-index has been deprecated in favor of a defclass form. There is a more detailed e-mail I sent out on this awhile back with some of the tradeoffs and the rationale behind the decisions.

((slot1 :accessor slot1)
 (slot2 :accessor slot2)
 (dslot :accessor dslot :derived-fn 'my-fn :slots-deps (slot1 slot2)))

my-fn is the usual derived index key function.

The property that I wanted most is that classes in the store will always be updated to match the current defclass definition.

Thanks,
Ian

On May 18, 2008, at 9:05 AM, Leslie P. Polzer wrote:


Loading a BDB database created by stable with the new branch gives me:

debugger invoked on a UNBOUND-SLOT in thread #<THREAD "initial thread" {A725821}>: The slot DB-BDB::INDICES is unbound in the object #<BDB-INDEXED- BTREE oid:-3>.

Type HELP for debugger help, or (SB-EXT:QUIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
 0: [USE-VALUE  ] Return a value as the slot-value.
 1: [STORE-VALUE] Store and return a value as the slot-value.
 2: [ABORT      ] Exit debugger, returning to top level.

((SB-PCL::FAST-METHOD SLOT-UNBOUND (T T T))
#<unavailable argument>
#<unavailable argument>
#<unavailable argument>
#<BDB-INDEXED-BTREE oid:-3>
DB-BDB::INDICES)
0] :ba

0: ((SB-PCL::FAST-METHOD SLOT-UNBOUND (T T T))
   #<unavailable argument>
   #<unavailable argument>
   #<unavailable argument>
   #<BDB-INDEXED-BTREE oid:-3>
   DB-BDB::INDICES)
1: ((SB-PCL::FAST-METHOD ELEPHANT::PERSISTENT-SLOT-READER
    (DB-BDB::BDB-STORE-CONTROLLER T T))
   #<unavailable argument>
   #<unavailable argument>
   #<unavailable argument>
   #<unavailable argument>
   #<unavailable argument>)
2: (SLOT-VALUE #<BDB-INDEXED-BTREE oid:-3> DB-BDB::INDICES)
3: ((SB-PCL::FAST-METHOD SHARED-INITIALIZE :AFTER
(DB-BDB::BDB-INDEXED-BTREE T)) #<unavailable lambda list>) [:EXTERNAL]
4: ((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.))
   #<unused argument>
   #<unused argument>
   #<BDB-INDEXED-BTREE oid:-3>
(ELEPHANT::OID ELEPHANT::SPEC ELEPHANT:CACHE-MODE DB-BDB::INDICES- CACHE)
   -304096854
   4)
5: ((SB-PCL::FAST-METHOD SHARED-INITIALIZE :AROUND
    (ELEPHANT:PERSISTENT-OBJECT T))
   #<unavailable argument>
   #<unavailable argument>
   #<unavailable argument>
   #<unavailable argument>)[:EXTERNAL]
6: ((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.))
   #<unused argument>
   #<unused argument>
   #<BDB-INDEXED-BTREE oid:-3>
   -304096814
   4)
7: ((SB-PCL::FAST-METHOD MAKE-INSTANCE (CLASS))
   #<unavailable argument>
   #<unavailable argument>
#<ELEPHANT:PERSISTENT-METACLASS DB-BDB::BDB-INDEXED-BTREE>) [:EXTERNAL]
8: ((LAMBDA ()) #<unavailable lambda list>)
9: ((SB-PCL::FAST-METHOD ELEPHANT::EXECUTE-TRANSACTION
    (DB-BDB::BDB-STORE-CONTROLLER T))
   #<unavailable argument>
   #<unavailable argument>
   #<BDB-STORE-CONTROLLER /home/sky/projects/mystic/backup-world.bdb/>
   #<CLOSURE (LAMBDA #) {B69A775}>)[:EXTERNAL]
10: ((SB-PCL::FAST-METHOD ELEPHANT::OPEN-CONTROLLER
(DB-BDB::BDB-STORE-CONTROLLER)) #<unavailable lambda list>) [:EXTERNAL]
11: ((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.))
    #<unused argument>
    #<unused argument>
#<BDB-STORE-CONTROLLER /home/sky/projects/mystic/backup- world.bdb/>
    -304096650
    6)
12: (ELEPHANT:OPEN-STORE (:BDB "/home/sky/projects/mystic/backup- world.bdb/"))[:EXTERNAL]
13: (MYSTIC-ENGINE:START)[:EXTERNAL]
14: (SB-INT:SIMPLE-EVAL-IN-LEXENV (MYSTIC-ENGINE:START) #<NULL- LEXENV>)
15: (INTERACTIVE-EVAL (MYSTIC-ENGINE:START))
16: (SB-ACLREPL::REP-ONE)
17: (SB-ACLREPL::REPL)[:EXTERNAL]
18: ((LAMBDA (SB-ACLREPL::NOPRINT)) NIL)
19: ((LAMBDA ()))
20: ((LAMBDA ()))[:EXTERNAL]
21: (SB-IMPL::%WITH-REBOUND-IO-SYNTAX #<CLOSURE (LAMBDA #) {AB6E79D}>)
22: (SB-IMPL::TOPLEVEL-REPL NIL)
23: (SB-IMPL::TOPLEVEL-INIT)
24: ((LABELS SB-IMPL::RESTART-LISP))

Amending SHARED-INITIALIZE :AFTER in bdb-collections.lisp to read:

(defmethod shared-initialize :after ((instance bdb-indexed-btree) slot-names
                                    &rest rest)
 (declare (ignore slot-names rest))
 (unless (slot-boundp instance 'indices)
   (setf (indices instance) (make-hash-table)))
 (setf (indices-cache instance) (indices instance)))

seems to do the job. How I hate uninitialized slots.

The next issue I encountered was the absence of ADD-CLASS-DERIVED- INDEX.
So this is really gone now? What's the replacement?

I'm going to answer your messages regarding caching later today, Ian.

 Leslie

_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel

_______________________________________________
elephant-devel site list
elephant-devel@common-lisp.net
http://common-lisp.net/mailman/listinfo/elephant-devel

Reply via email to