[elephant-cvs] CVS elephant/src/db-bdb

ieslick ieslick at common-lisp.net
Fri Feb 16 07:11:02 UTC 2007


Update of /project/elephant/cvsroot/elephant/src/db-bdb
In directory clnet:/tmp/cvs-serv28850/src/db-bdb

Modified Files:
	bdb-collections.lisp bdb-controller.lisp package.lisp 
Log Message:
Cleaned up optimize-storage for BDB backends with optimize-layout generic function on stores and btrees

--- /project/elephant/cvsroot/elephant/src/db-bdb/bdb-collections.lisp	2007/02/14 04:36:09	1.18
+++ /project/elephant/cvsroot/elephant/src/db-bdb/bdb-collections.lisp	2007/02/16 07:11:02	1.19
@@ -72,6 +72,13 @@
       (db-delete-buffered (controller-btrees sc)
 			  key-buf))))
 
+(defmethod optimize-layout ((bt bdb-btree) &key (freelist-only t) (free-space nil) &allow-other-keys)
+  (optimize-layout (get-con bt)
+		    :start-key (oid bt)
+		    :end-key (oid bt)
+		    :freelist-only freelist-only
+		    :free-space free-space))
+
 ;; Secondary indices
 
 (defclass bdb-indexed-btree (indexed-btree bdb-btree)
@@ -232,7 +239,7 @@
     (buffer-write-oid (oid bt) key-buf)
     (serialize key key-buf (get-con bt))
     (let ((buf (db-get-key-buffered 
-		(controller-indices-assoc (get-con bt)) 
+		(controller-indices-assoc (get-con bt))
 		key-buf value-buf)))
       (if buf (values (deserialize buf (get-con bt)) T)
 	  (values nil nil)))))
--- /project/elephant/cvsroot/elephant/src/db-bdb/bdb-controller.lisp	2007/02/16 03:43:47	1.25
+++ /project/elephant/cvsroot/elephant/src/db-bdb/bdb-controller.lisp	2007/02/16 07:11:02	1.26
@@ -251,23 +251,29 @@
 ;; Take advantage of release 4.4's compact storage feature.  Feature of BDB only
 ;;
 
-(defmethod optimize-storage ((ctrl bdb-store-controller) &key start-key stop-key 
-			     (freelist-only nil) (free-space t)
-			     &allow-other-keys)
+(defmethod optimize-layout ((ctrl bdb-store-controller) &key start-key stop-key 
+			    (freelist-only t) (free-space nil)
+			    &allow-other-keys)
   "Tell the backend to optimize and reclaim storage between key values"
   (with-buffer-streams (start stop end)
-    (if (null start)
+    (if (null start-key)
 	(progn 
-	  (db-compact (controller-db ctrl) nil nil end)
-	  (db-compact (controller-btrees ctrl) nil nil end)
 	  (db-compact (controller-indices ctrl) nil nil end)
-	  (db-compact (controller-indices-assoc ctrl) nil nil end)
-	  (db-compact (controller-oid-db ctrl) nil nil end))
+	  (db-compact (controller-db ctrl) nil nil end)
+	  (db-compact (controller-btrees ctrl) nil nil end))
 	(progn
 	  (serialize start-key start ctrl)
-	  (db-compact (controller-db ctrl) start
-		      (when stop-key (serialize stop-key stop ctrl) stop)
-		      end
+	  (when stop-key (serialize stop-key stop ctrl))
+	  (db-compact (controller-indices ctrl) start
+		      (when stop-key stop) end
+		      :freelist-only freelist-only
+		      :free-space free-space)
+	  (db-compact (controller-db ctrl) nil
+		      (when stop-key stop) end
+		      :freelist-only freelist-only
+		      :free-space free-space)
+	  (db-compact (controller-btrees ctrl) nil
+		      (when stop-key stop) end
 		      :freelist-only freelist-only
 		      :free-space free-space)))
     (values (deserialize end ctrl))))
--- /project/elephant/cvsroot/elephant/src/db-bdb/package.lisp	2007/02/14 04:36:10	1.4
+++ /project/elephant/cvsroot/elephant/src/db-bdb/package.lisp	2007/02/16 07:11:02	1.5
@@ -41,4 +41,4 @@
   (:import-from :ccl
 		#:byte-length)
   (:export
-   #:optimize-storage))
+   #:optimize-layout))




More information about the Elephant-cvs mailing list