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

Ian Eslick eslick at csail.mit.edu
Tue Jun 12 14:20:52 UTC 2007


Actually, I now remember that I had intended to implement psets as  
ordinary classes to avoid allocating two persistent objects as the  
patch now does.  The actual bug was not remembering the oid of the  
btree, but the new fix is probably cleaner anyway.

Ian

On Jun 12, 2007, at 10:18 AM, Ian Eslick wrote:

> Well, that was a silly bug.  I just checked in a patch.  Please let  
> me know if it works for you now.
>
> Ian
>
> On Jun 8, 2007, at 8:49 PM, Brian Seitz wrote:
>
>> 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
>> _______________________________________________
>> elephant-devel site list
>> elephant-devel at common-lisp.net
>> http://common-lisp.net/mailman/listinfo/elephant-devel
>
> _______________________________________________
> elephant-devel site list
> elephant-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/elephant-devel




More information about the elephant-devel mailing list