[rucksack-devel] Error when deleting indexed objects

Brad Beveridge brad.beveridge at gmail.com
Mon Jan 21 03:26:50 UTC 2008


I've run into an error when deleting classes that have slots that are
indexed by string.  The problem only occurs when you close & reopen
the Rucksack before deleting, which makes me suspect it is something
to do with the proxying.  I've tried to debug this, but I'm so far not
getting much traction :)
I'm going to keep looking at it, in the meantime here is a repro testcase.

Cheers,
Brad

(with-rucksack (rs *test-suite* :if-exists :supersede)
  ; Works
  (with-transaction ()
    (defclass broken ()
      ((string-key :initarg :data :accessor string-key
		   :index :string-index))
      (:index t)
      (:metaclass persistent-class))
    (make-instance 'broken :data "foo1")
    (make-instance 'broken :data "foo2")
    (rucksack-map-class rs 'broken
		       (lambda (obj)
			 (format t "Found ~A~%" (string-key obj))))
    (rucksack-map-slot rs 'broken 'string-key
		       (lambda (obj)
			 (rucksack::rucksack-delete-object rs obj))
		       :equal "foo1")
    (rucksack-map-class rs 'broken
		       (lambda (obj)
			 (format t "Found ~A~%" (string-key obj))))
  ))

(progn
  ; Broken
  (with-rucksack (rs *test-suite* :if-exists :supersede)
    (with-transaction ()
      (defclass broken ()
	((string-key :initarg :data :accessor string-key
		     :index :string-index))
	(:index t)
	(:metaclass persistent-class))
      (make-instance 'broken :data "foo1")
      (make-instance 'broken :data "foo2")
      (rucksack-map-class rs 'broken
			  (lambda (obj)
			    (format t "Found ~A~%" (string-key obj))))
      ))

  (with-rucksack (rs *test-suite*)
    (with-transaction ()

      (rucksack-map-slot rs 'broken 'string-key
			 (lambda (obj)
			   (rucksack::rucksack-delete-object rs obj))
			 :equal "foo1")
      (rucksack-map-class rs 'broken
			  (lambda (obj)
			    (format t "Found ~A~%" (string-key obj))))
      )))



More information about the rucksack-devel mailing list