Thanks, Ian. This solved my problem for new objects. Now, is there an easy way to re-index existing objects?
Cheers. Kevin Ian Eslick wrote: > I don't have time to dive into the details of 'why' this is failing, > but here is a workaround in the meantime. > > (defmethod cursor-set-range :around ((cursor bdb-cursor) key) > (multiple-value-bind (valid? k v) > (cursor-set cursor key) > (if valid? > (values valid? k v) > (cursor-next cursor)))) > > This is in the db-bdb package. > > For some reason cursor-next does the comparison properly while cursor- > set-range does not. Something about the types returned by (get- > universal-time) cause the serializer to do something unexpected and it > will take some time to track it down due to issues of visibility in > the serializer buffer streams. > > Let me know if this gets you unstuck. > > Ian > > On Nov 6, 2008, at 11:14 PM, Kevin Raison wrote: > >> Given this class defined with elephant-unstable in sbcl 10.22 using >> berkeleydb 4.6: >> >> (defpclass test-class () >> ((host :accessor host :initarg :host :type string :initform >> "" :index t) >> (timestamp :accessor timestamp :initarg :timestamp :initform >> (get-universal-time) >> :type integer :index t)) >> (:index t)) >> >> Can someone help me understand why this works: >> >> CL-USER> (make-instance 'test-class :host "test1" :timestamp >> 10000000000) >> #<TEST-CLASS oid:791> >> CL-USER> (get-instances-by-range 'test-class 'timestamp 0 10000000001) >> (#<TEST-CLASS oid:791>) >> >> But this does not: >> CL-USER> (make-instance 'test-class :host "test1" :timestamp >> (get-universal-time)) >> #<TEST-CLASS oid:795> >> CL-USER> (get-instances-by-range 'test-class 'timestamp 0 >> (get-universal-time)) >> NIL >> CL-USER> (get-instances-by-range 'test-class 'timestamp 0 10000000001) >> NIL >> >> When (type-of (get-universal-time)) is (INTEGER 0 1152921504606846975) >> >> >> If I do not drop all instances between the above two command sets, I >> get >> this: >> CL-USER> (make-instance 'test-class :host "test1" :timestamp >> 10000000000) >> #<TEST-CLASS oid:798> >> CL-USER> (get-instances-by-range 'test-class 'timestamp 0 10000000001) >> (#<TEST-CLASS oid:798>) >> CL-USER> (make-instance 'test-class :host "test1" :timestamp >> (get-universal-time)) >> #<TEST-CLASS oid:799> >> CL-USER> (get-instances-by-range 'test-class 'timestamp 0 >> (get-universal-time)) >> (#<TEST-CLASS oid:798>) >> CL-USER> (get-instances-by-range 'test-class 'timestamp 0 10000000001) >> (#<TEST-CLASS oid:798>) >> >> >> I have tried a number of variations, including not specifying types in >> the class definition, specifying "number" as the type of timestamp, >> coercing (get-universal-time) to an integer. Nothing has worked. Can >> anyone shed light on this for me? Am I missing something obvious? >> The >> hyperspec specifies that universal time "is an absolute time >> represented >> as a single non-negative integer." So why would it not be indexed >> like >> any other integer? >> >> Thanks in advance. >> >> Kevin Raison >> >> _______________________________________________ >> 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 _______________________________________________ elephant-devel site list elephant-devel@common-lisp.net http://common-lisp.net/mailman/listinfo/elephant-devel