[elephant-devel] SQL vs BDB

Ian Eslick eslick at csail.mit.edu
Sat Feb 25 20:55:37 UTC 2006


The SQL backend was allowing duplicate key-value rows to be written on
secondary indices.  This behavior deviates from BDB which only allows
unique k-v pairs (bdb ignores duplicate k+v writes on btrees) but allows
duplicate keys with different values:

write k1 v1 => ((k1 . v1))
write k1 v2 => ((k1 . v1) (k1 . v2))
write k2 v1 => ((k1 . v1) (k1 . v2) (k2 . v1))
write k1 v2 => ((k1 . v1) (k1 . v2) (k2 . v1))  ;; write should ignore
duplicate k1 . v2 entry

I added a key-value-existsp operator to sql and use it to ensure that
duplicate secondary rows are not written in (setf get-value) for
sql-indexed-btree or in (add-index).

I've added another test to enforce the semantics that if you unindex a
slot such that the class no longer needs to be indexed, then the class
is dropped from the database.  Later, if you re-enable indexing old
instances are not indexed.  Accordingly I modified the redefine-class
and change-class protocols to properly handle this kind of index accounting.

NOTE: If you redefine a class so that no slots are indexed, the class
indexing will be dropped also and any instances not reachable from the
root are lost forever!  We will provide a class option that allows you
to specify indexing class instances without indexing any slots in 0.6.1.

On Mac OS X, Allegro 8.0 and SBCL 0.9.7 all tests, including migration,
are 100% Green.

Please test on other platforms!

Ian



More information about the elephant-devel mailing list