activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1404338 - in /activemq/activemq-apollo/trunk: ./ apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/ apollo-leveldb/src/test/scala/org/apache/activemq/apollo/broker/store/leveldb/
Date Wed, 31 Oct 2012 20:40:56 GMT
Author: chirino
Date: Wed Oct 31 20:40:55 2012
New Revision: 1404338

URL: http://svn.apache.org/viewvc?rev=1404338&view=rev
Log:
Use the new suspend/resume compaction calls on leveldb-api 0.4. This avoids us needing close/open
db to do checkpoints.  Should slightly improve perf since the block cache is not thrown away.
 The index stats displayed will also be more meaningful.

Modified:
    activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/HelperTrait.scala
    activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/LevelDBClient.scala
    activemq/activemq-apollo/trunk/apollo-leveldb/src/test/scala/org/apache/activemq/apollo/broker/store/leveldb/PureJavaLevelDBStoreTest.scala
    activemq/activemq-apollo/trunk/pom.xml

Modified: activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/HelperTrait.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/HelperTrait.scala?rev=1404338&r1=1404337&r2=1404338&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/HelperTrait.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/HelperTrait.scala
Wed Oct 31 20:40:55 2012
@@ -175,8 +175,8 @@ object HelperTrait {
         func
       } finally {
         val duration = System.nanoTime() - start
-        // If it takes longer than 50 ms..
-        if( duration > 1000000*50 ) {
+        // If it takes longer than 100 ms..
+        if( duration > 1000000*100 ) {
           compact_needed = true
         }
       }

Modified: activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/LevelDBClient.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/LevelDBClient.scala?rev=1404338&r1=1404337&r2=1404338&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/LevelDBClient.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/LevelDBClient.scala
Wed Oct 31 20:40:55 2012
@@ -604,12 +604,11 @@ class LevelDBClient(store: LevelDBStore)
 
   def stop() = {
     // this blocks until all io completes..
-    // Suspend also deletes the index.
-    suspend()
-
-    if (log != null) {
-      log.close
-    }
+    snapshot_rw_lock.writeLock().lock()
+    store_log_refs
+    index.put(dirty_index_key, FALSE, new WriteOptions().sync(true))
+    index.close
+    log.close
     copy_dirty_index_to_snapshot
     log = null
     unlock_store
@@ -639,7 +638,7 @@ class LevelDBClient(store: LevelDBStore)
     // Close the index so that it's files are not changed async on us.
     store_log_refs
     index.put(dirty_index_key, FALSE, new WriteOptions().sync(true))
-    index.close
+    index.db.suspendCompactions
   }
 
   /**
@@ -649,7 +648,7 @@ class LevelDBClient(store: LevelDBStore)
   def resume() = {
     // re=open it..
     retry {
-      index = new RichDB(factory.open(dirty_index_file, index_options));
+      index.db.resumeCompactions
       index.put(dirty_index_key, TRUE)
     }
     snapshot_rw_lock.writeLock().unlock()
@@ -737,16 +736,18 @@ class LevelDBClient(store: LevelDBStore)
   }
 
   def purge() = {
-    suspend()
+    snapshot_rw_lock.writeLock().lock()
     try {
       log.close
+      index.close
       directory.list_files.foreach(_.recursive_delete)
       log_refs.clear()
     } finally {
       retry {
+        index = new RichDB(factory.open(dirty_index_file, index_options))
         log.open
       }
-      resume()
+      snapshot_rw_lock.writeLock().unlock()
     }
   }
 

Modified: activemq/activemq-apollo/trunk/apollo-leveldb/src/test/scala/org/apache/activemq/apollo/broker/store/leveldb/PureJavaLevelDBStoreTest.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-leveldb/src/test/scala/org/apache/activemq/apollo/broker/store/leveldb/PureJavaLevelDBStoreTest.scala?rev=1404338&r1=1404337&r2=1404338&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-leveldb/src/test/scala/org/apache/activemq/apollo/broker/store/leveldb/PureJavaLevelDBStoreTest.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-leveldb/src/test/scala/org/apache/activemq/apollo/broker/store/leveldb/PureJavaLevelDBStoreTest.scala
Wed Oct 31 20:40:55 2012
@@ -17,13 +17,13 @@ package org.apache.activemq.apollo.broke
  * limitations under the License.
  */
 
-import org.apache.activemq.apollo.broker.store.{Store, StoreFunSuiteSupport}
+import org.apache.activemq.apollo.broker.store.{StoreTests, Store, StoreFunSuiteSupport}
 import org.apache.activemq.apollo.broker.store.leveldb.dto.LevelDBStoreDTO
 
 /**
  * @author <a href="http://hiramchirino.com">Hiram Chirino</a>
  */
-class PureJavaLevelDBStoreTest extends StoreFunSuiteSupport {
+class PureJavaLevelDBStoreTest extends StoreTests {
 
   def create_store(flushDelay: Long): Store = {
     new LevelDBStore({

Modified: activemq/activemq-apollo/trunk/pom.xml
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/pom.xml?rev=1404338&r1=1404337&r2=1404338&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/pom.xml (original)
+++ activemq/activemq-apollo/trunk/pom.xml Wed Oct 31 20:40:55 2012
@@ -103,9 +103,9 @@
     
     <bdb-version>5.0.34</bdb-version>
 
-    <leveldb-api-version>0.2</leveldb-api-version>
-    <leveldb-version>0.2</leveldb-version>
-    <leveldbjni-version>1.3</leveldbjni-version>
+    <leveldb-api-version>0.4</leveldb-api-version>
+    <leveldb-version>0.4</leveldb-version>
+    <leveldbjni-version>1.4</leveldbjni-version>
 
     <jasypt-version>1.6</jasypt-version>
 



Mime
View raw message