[elephant-devel] Class indexes dropped after database restart?

Ian Eslick eslick at media.mit.edu
Wed Sep 23 16:50:28 UTC 2009


Which darcs repository?  There is the old 0.91 release and the new  
elephant-1.0 branch...

Ian

On Sep 22, 2009, at 8:41 PM, Red Daly wrote:

> I should also note that I am using the version of elephant from  
> darcs.  And I discovered that when the program went down it was due  
> to a segfault (I believe in emacs).  However, all instances had been  
> created under many different transactions that did not abort.
>
> Here is some more fiddling around:
>
> CL-USER> (lisp-implementation-version)
> "1.0.29.54.rc1"
> BOOKS> (ele::get-db-schemas *ele-db* 'material)
> NIL
> BOOKS> (ele::controller-instance-class-index *ele-db*)
> #<BDB-BTREE-INDEX oid:13701>
> BOOKS> (ele:map-btree #'(lambda (key val)
>                           (format t "~S => ~S~%" key val))
>                       (ele::controller-instance-class-index *ele-db*))
> 307 => 307
> NIL
>
>
> Red
>
> On Tue, Sep 22, 2009 at 8:08 PM, Red Daly <reddaly at gmail.com> wrote:
> I noticed there was a disparity between get-instances-by-class and  
> map-inverted-index.  I will let the code speak for itself:
>
> BOOKS> (length (ele:map-inverted-index #'(lambda (isbn obj) obj)  
> 'material 'isbn :collect t))
> 1945
> BOOKS> (length (ele:get-instances-by-class 'material))
> 0
> BOOKS> (defparameter f (make-instance 'material :title "Fake Book"))
> F
> BOOKS> (length (ele:get-instances-by-class 'material))
> 1
> BOOKS> (length (ele:map-inverted-index #'(lambda (isbn obj) obj)  
> 'material 'isbn :collect t))
> 1946
>
> There is a similar problem with the university class.
>
> BOOKS> (length (ele:get-instances-by-class 'university))
> 0
> BOOKS> *stanford-university*
> #<UNIVERSITY oid:204>
> BOOKS> (official-name *stanford-university*)
> "Stanford University"
>
> All of the instances in the database were created in a prior  
> session.  Then I shut down the DB and restarted Lisp.  Now MAP-CLASS  
> and GET-INSTANCES-BY-CLASS return nil for all classes.  It seems  
> like new instances get added to the "class index," but older  
> instances are not found.  However, these classes persist in the  
> inverted slot indexes.  Can anybody diagnose what's going on?
>
> here are the definitions of the classes:
>
> (defclass department ()
>   ((university :initarg :university :initform nil :accessor  
> department-university
>                :index t)
>    (official-name :initarg :official-name :initform nil :accessor  
> official-name)
>    (common-name :initarg :common-name :initform nil :accessor common- 
> name)
>    (abbreviation :initarg :abbreviation :initform nil :accessor  
> abbreviation
>                  :index t))
>   (:metaclass ele:persistent-metaclass)
>   (:documentation "A department has a bunch of course listings."))
>
> (defclass material ()
>   ((title :initarg :title :initform nil :accessor material-title
>           :index t)
>    (authors :initarg :authors :initform nil :accessor material- 
> authors) ;; a list of authors
>    (edition :initarg :edition :initform nil :accessor material- 
> edition)
>    (isbn :initarg :isbn :initform nil :accessor material-isbn
>          :index t)
>    (asin :initarg :asin :initform nil :accessor material-asin
>          :index t
>          :documentation "An Amazon.com identifier that uniquely  
> identifies the material")
>    (image-uri :initarg :image-uri :initform nil :accessor material- 
> image-uri))
>   (:metaclass ele:persistent-metaclass))
>
> Thanks,
> Red
>
>
> _______________________________________________
> elephant-devel site list
> elephant-devel at common-lisp.net
> http://common-lisp.net/mailman/listinfo/elephant-devel

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/elephant-devel/attachments/20090923/24b952c1/attachment.html>


More information about the elephant-devel mailing list