[elephant-devel] btree slot of pset becomes unbound when re-opening store

Brian Seitz brian at wholok.com
Sat Jun 9 00:49:11 UTC 2007


Hey,

I've been experimenting with Elephant, and it's been really great so far.

But I've had one strange issue.  When I make a pset, its btree slot
always becomes unbound after I've closed and re-opened the store.
I've tried this with bdb, sqlite, and postgresql, all with the same
result.  Using Elephant 0.9 and SBCL 1.0.

Here's a self contained instance (using the "friends" example from the docs):

CL-USER> (require 'elephant)
NIL
CL-USER> (in-package :ele)
#<PACKAGE "ELEPHANT">
ELE> (open-store '(:bdb "/home/bseitz/eletest/"))
#<BDB-STORE-CONTROLLER /home/bseitz/eletest/>
ELE> (defpclass person ()
  ((name :accessor person-name :initarg :name)
   (friends :accessor person-friends :initarg :friends
	    :initform (make-pset))))
#<PERSISTENT-METACLASS PERSON>
ELE> (defmethod add-friend ((me person) (them person))
  (insert-item them (person-friends me)))
#<STANDARD-METHOD ADD-FRIEND (PERSON PERSON) {B24FC59}>
ELE> (defmethod remove-friend ((me person) (them person))
  (remove-item them (person-friends me)))
#<STANDARD-METHOD REMOVE-FRIEND (PERSON PERSON) {B288FD9}>
ELE> (defmethod map-friends (fn (me person))
  (map-pset fn (person-friends me)))
#<STANDARD-METHOD MAP-FRIENDS (T PERSON) {B2BA3C1}>
ELE> (setf me (make-instance 'person :name "Brian"))
#<PERSON oid:100>
ELE> (setf amigo (make-instance 'person :name "Waldo"))
#<PERSON oid:102>
ELE> (add-friend me amigo)
#<PERSON oid:102>
ELE> (map-friends #'print me)

#<PERSON oid:102>
#<DEFAULT-PSET oid:101>
ELE> (add-to-root "me" me)
#<PERSON oid:100>
ELE> (add-to-root "amigo" amigo)
#<PERSON oid:102>
ELE> (close-store)
NIL
ELE> (setf me nil)
NIL
ELE> (setf amigo nil)
NIL
ELE> (open-store '(:bdb "/home/bseitz/eletest/"))
#<BDB-STORE-CONTROLLER /home/bseitz/eletest/>
ELE> (setf me (get-from-root "me"))
#<PERSON oid:100>
ELE> (setf amigo (get-from-root "amigo"))
#<PERSON oid:102>
ELE> (describe me)
#<PERSON oid:100> is an instance of class #<PERSISTENT-METACLASS PERSON>.
The following slots have :INSTANCE allocation:
 %OID                     100
 DBCONNECTION-SPEC-PST    (:BDB "/home/bseitz/eletest/")
The following slots have allocation as shown:
 NAME :DATABASE                  "Brian"
 FRIENDS :DATABASE               #<DEFAULT-PSET oid:101>
; No value
ELE> (map-friends #'print me)
The slot BTREE is unbound in the object #<DEFAULT-PSET oid:101>.
; Evaluation aborted
ELE> (describe (person-friends me))
#<DEFAULT-PSET oid:101>
is an instance of class #<STANDARD-CLASS DEFAULT-PSET>.
The following slots have :INSTANCE allocation:
 %OID                     101
 DBCONNECTION-SPEC-PST    (:BDB "/home/bseitz/eletest/")
 BTREE                    #<unbound slot>

So the BTREE that indexes (?) the persistent set is now gone?  I've
tried to make the slot that holds the pset indexed, but that doesn't
seem to make a difference.

I greatly appreciate any help you could give.

Thanks,

Brian



More information about the elephant-devel mailing list