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

ieslick ieslick at common-lisp.net
Wed Apr 25 02:28:01 UTC 2007


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

Modified Files:
	bdb-collections.lisp bdb-controller.lisp bdb-transactions.lisp 
	berkeley-db.lisp libberkeley-db.c 
Log Message:
Export bdb performance tweaks; lots more documentation; new ops for libberkeley-db

--- /project/elephant/cvsroot/elephant/src/db-bdb/bdb-collections.lisp	2007/04/12 02:47:23	1.22
+++ /project/elephant/cvsroot/elephant/src/db-bdb/bdb-collections.lisp	2007/04/25 02:27:58	1.23
@@ -676,8 +676,7 @@
   (error "cursor-get-both-range not implemented on secondary indices.  Use cursor-pget-both-range."))
 
 (defmethod cursor-put ((cursor bdb-secondary-cursor) value &rest rest)
-  "Puts are forbidden on secondary indices.  Try adding to
-the primary."
+  "Puts are forbidden on secondary indices.  Try adding to the primary."
   (declare (ignore rest value)
          (ignorable cursor))
   (error "Puts are forbidden on secondary indices.  Try adding to the primary."))
--- /project/elephant/cvsroot/elephant/src/db-bdb/bdb-controller.lisp	2007/04/21 17:22:36	1.34
+++ /project/elephant/cvsroot/elephant/src/db-bdb/bdb-controller.lisp	2007/04/25 02:27:58	1.35
@@ -83,13 +83,14 @@
 					       :name "%ELEPHANT")))))
     (setf (controller-environment sc) env)
     (db-env-set-flags env 0 :auto-commit t)
+    (db-env-set-cachesize env 0 elephant::*berkeley-db-cachesize* 1)
+    (db-env-set-timeout env 100000 :set-transaction-timeout t)
+    (db-env-set-timeout env 100000 :set-lock-timeout t)
     (db-env-open env (namestring (second (controller-spec sc)))
 		 :create t :init-rep nil :init-mpool t :thread thread
 		 :init-lock t :init-log t :init-txn t 
 		 :recover recover :recover-fatal recover-fatal
 		 )
-    (db-env-set-timeout env 100000 :set-transaction-timeout t)
-    (db-env-set-timeout env 100000 :set-lock-timeout t)
     (let ((metadata (db-create env))
 	  (db (db-create env))
 	  (btrees (db-create env))
@@ -111,26 +112,30 @@
       ;; Open main class, slot-value and index databases
       (setf (controller-db sc) db)
       (db-open db :file "%ELEPHANT" :database "%ELEPHANTDB" 
-	       :auto-commit t :type DB-BTREE :create t :thread thread)
+	       :auto-commit t :type DB-BTREE :create t :thread thread
+	       :read-uncommitted t)
 
       (setf (controller-btrees sc) btrees)
       (db-bdb::db-set-lisp-compare btrees (controller-serializer-version sc))
       (db-open btrees :file "%ELEPHANT" :database "%ELEPHANTBTREES" 
-	       :auto-commit t :type DB-BTREE :create t :thread thread)
+	       :auto-commit t :type DB-BTREE :create t :thread thread
+	       :read-uncommitted t)
 
       (setf (controller-indices sc) indices)
       (db-bdb::db-set-lisp-compare indices (controller-serializer-version sc))
       (db-bdb::db-set-lisp-dup-compare indices (controller-serializer-version sc))
       (db-set-flags indices :dup-sort t)
       (db-open indices :file "%ELEPHANT" :database "%ELEPHANTINDICES" 
-	       :auto-commit t :type DB-BTREE :create t :thread thread)
+	       :auto-commit t :type DB-BTREE :create t :thread thread
+	       :read-uncommitted t)
 
       (setf (controller-indices-assoc sc) indices-assoc)
       (db-bdb::db-set-lisp-compare indices-assoc (controller-serializer-version sc))
       (db-bdb::db-set-lisp-dup-compare indices-assoc (controller-serializer-version sc))
       (db-set-flags indices-assoc :dup-sort t)
       (db-open indices-assoc :file "%ELEPHANT" :database "%ELEPHANTINDICES" 
-	       :auto-commit t :type DB-UNKNOWN :thread thread) ;; :rdonly t)
+	       :auto-commit t :type DB-UNKNOWN :thread thread
+	       :read-uncommitted t)
       (db-bdb::db-fake-associate btrees indices-assoc :auto-commit t)
       
       (let ((db (db-create env)))
--- /project/elephant/cvsroot/elephant/src/db-bdb/bdb-transactions.lisp	2007/04/12 02:47:23	1.13
+++ /project/elephant/cvsroot/elephant/src/db-bdb/bdb-transactions.lisp	2007/04/25 02:27:58	1.14
@@ -25,7 +25,7 @@
 				&key 
 				transaction parent environment
 				(retries 100) 
-				degree-2 dirty-read txn-nosync txn-nowait txn-sync)
+				degree-2 read-uncommitted txn-nosync txn-nowait txn-sync)
   (let ((env (if environment environment (controller-environment sc))))
     (loop 
        for count fixnum from 1 to retries
@@ -36,7 +36,7 @@
 		  (db-transaction-begin env
 					:parent (if parent parent +NULL-VOID+)
 					:degree-2 degree-2
-					:dirty-read dirty-read
+					:read-uncommitted read-uncommitted
 					:txn-nosync txn-nosync
 					:txn-nowait txn-nowait
 					:txn-sync txn-sync))))
@@ -65,7 +65,7 @@
 					 txn-nosync
 					 txn-nowait
 					 txn-sync
-					 dirty-read
+					 read-uncommitted
 					 degree-2
 					 &allow-other-keys)
   (assert (not *current-transaction*))
@@ -74,7 +74,7 @@
 			:txn-nosync txn-nosync
 			:txn-nowait txn-nowait
 			:txn-sync txn-sync
-			:dirty-read dirty-read
+			:read-uncommitted read-uncommitted
 			:degree-2 degree-2))
 			
 
--- /project/elephant/cvsroot/elephant/src/db-bdb/berkeley-db.lisp	2007/04/12 02:47:23	1.11
+++ /project/elephant/cvsroot/elephant/src/db-bdb/berkeley-db.lisp	2007/04/25 02:27:58	1.12
@@ -1526,6 +1526,28 @@
 	    :flags (set-lock-timeout set-transaction-timeout)
 	    :documentation "Gets the timout.")
 
+(def-function ("db_env_set_cachesize" %db-env-set-cachesize)
+    ((env :pointer-void)
+     (gbytes :unsigned-int)
+     (bytes :unsigned-int)
+     (ncache :int))
+  :returning :int)
+
+(wrap-errno db-env-set-cachesize (env gbytes bytes ncache) 
+	    :documentation "Sets the size of the buffer pool cache
+            for elephant database data.  Set large if you can!")
+
+(def-function ("db_env_get_cachesize" %db-env-get-cachesize)
+    ((env :pointer-void)
+     (gbytes :unsigned-int :out)
+     (bytes :unsigned-int :out)
+     (ncache :int :out))
+  :returning :int)
+
+(wrap-errno db-env-get-cachesize (env) :outs 4
+	    :documentation "Return the current cache size of
+            the BDB environment buffer pool")
+
 (def-function ("db_env_set_lk_detect" %db-env-set-lock-detect)
     ((env :pointer-void)
      (detect :unsigned-int))
--- /project/elephant/cvsroot/elephant/src/db-bdb/libberkeley-db.c	2007/04/12 02:47:23	1.11
+++ /project/elephant/cvsroot/elephant/src/db-bdb/libberkeley-db.c	2007/04/25 02:27:58	1.12
@@ -661,6 +661,14 @@
   return env->get_timeout(env, timeoutp, flags);
 }
 
+int db_env_set_cachesize(DB_ENV *env, u_int32_t gbytes, u_int32_t bytes, int ncache) {
+  return env->set_cachesize(env, gbytes, bytes, ncache);
+}
+
+int db_env_get_cachesize(DB_ENV *env, u_int32_t *gbytes, u_int32_t *bytes, int *ncache) {
+  return env->get_cachesize(env, gbytes, bytes, ncache);
+}
+
 int db_env_set_lk_detect(DB_ENV *env, u_int32_t detect) {
     return env->set_lk_detect(env, detect);
 }
@@ -1002,7 +1010,7 @@
 #define S2_FILL_POINTER_P 0x40
 #define S2_ADJUSTABLE_P 0x80
 
-#define type_numeric2(c) (((c)<9) || ((c)==14) || ((c)==30))
+#define type_numeric2(c) (((c)<9) || ((c)==22))
 
 /******
   Serialized BTree keys have the form:




More information about the Elephant-cvs mailing list