[elephant-devel] secondary indices

Waldo Rubinstein waldo at trianet.net
Fri Jan 13 04:37:26 UTC 2006


Robert,

I've been trying to understand the inners of indexed-btree. I have to  
admit, this exercise has helped me greatly in my quest for learning  
Lisp.

So far, I have been able to narrow down the problem to the transient  
slot INDICES-CACHE of the BDB-INDEXED-BTREE class.

Even though this slot has the same :initform as the non-transient  
version (e.g. make-hash-table), after you make an instance of indexed- 
btree, you can query (indices *instance*) and it returns the hash  
table object. However, when you (indices-cache *instance*) you get the:

Array index 4 out of bounds for #<SLOT-VECTOR  #x89BFD86> .
    [Condition of type SIMPLE-ERROR]

What I can't figure out yet is that in collections.lisp, you have:

(defmethod shared-initialize :after ((instance indexed-btree) slot-names
				     &rest rest)
   (declare (ignore slot-names rest))
   (setf (indices-cache instance) (indices instance)))

which, to my understanding, should set the value of the transient  
slot to point to the same hash-table that the INDICES slot points to.  
However, this doesn't seem to do anything. Even if you inspect  
(indices instance) before the setf, you get the hash-table, but for  
some reason, whatever (indices-cache instance) points to is not  
accepting the change.

I tried tracing it back into classes.lisp, into the:

(defmethod shared-initialize :around ((instance persistent-object)  
slot-names &rest initargs &key &allow-other-keys)
   "Initializes the persistent slots via initargs or forms.
This seems to be necessary because it is typical for
implementations to optimize setting the slots via initforms
and initargs in such a way that slot-value-using-class et al
aren't used.  Calls the next method for the transient slots."

In this method, it seems to initialize the persistent and non- 
persistent slots. At the end of the method, (indices instance) is  
properly pointing to a hash table. However, the (indices-cache  
instance) in that method is still returning the same error. Now, at  
the end of the defmethod, you have:

	  ;; let the implementation initialize the transient slots
	  (apply #'call-next-method instance transient-slot-inits  
initargs))))))

which is where I'm a bit at a loss. I would assume it's trying to  
call the next-method during the initialization process. However,  
transient-slot-inits is internally defined (flet) within this  
defmethod and it doesn't seem to be doing anything. Also, after  
inspecting all the values of the parameters passed to this defmethod,  
there is no reference to the INDICES-CACHE slot. If you inspect SLOT- 
NAMES in this method, it only has (INDICES). Could this be the reason?

I hope this may trigger something that could allow you or others to  
solve the problem or at least help me further in diagnosing it.

Anyway, I will continue hacking as much as I can.

Thanks,
Waldo

On Jan 11, 2006, at 7:39 AM, Robert L. Read wrote:

> OK, thank you.
>
> If we can get Elephant into a state that you don't have to be a  
> LISP hacker to use it,
> we will be greatly expanding its usefulness.
>
> I will try to work with Waldo Rubinstein to solve this problem for  
> openmcl.
>



More information about the elephant-devel mailing list