activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r1205552 - in /activemq/activemq-apollo/trunk: apollo-bdb/src/test/scala/org/apache/activemq/apollo/broker/store/bdb/ apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/store/ apollo-jdbm2/src/test/scala/org/apache/activemq/apol...
Date Wed, 23 Nov 2011 19:54:38 GMT
Author: chirino
Date: Wed Nov 23 19:54:37 2011
New Revision: 1205552

URL: http://svn.apache.org/viewvc?rev=1205552&view=rev
Log:
the level db store now is passing tests on windows, windows did not support file linking.
 We now detect this and fallback to using file copies

Modified:
    activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/broker/store/bdb/BDBStoreTest.scala
  (contents, props changed)
    activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/store/StoreFunSuiteSupport.scala
  (contents, props changed)
    activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2StoreTest.scala
  (contents, props changed)
    activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBClient.scala
  (contents, props changed)
    activemq/activemq-apollo/trunk/apollo-leveldb/src/test/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBStoreTest.scala
  (contents, props changed)
    activemq/activemq-apollo/trunk/apollo-leveldb/src/test/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/PureJavaLevelDBStoreTest.scala
  (contents, props changed)

Modified: activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/broker/store/bdb/BDBStoreTest.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/broker/store/bdb/BDBStoreTest.scala?rev=1205552&r1=1205551&r2=1205552&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/broker/store/bdb/BDBStoreTest.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/broker/store/bdb/BDBStoreTest.scala
Wed Nov 23 19:54:37 2011
@@ -28,7 +28,7 @@ class BDBStoreTest extends StoreFunSuite
   def create_store(flushDelay:Long):Store = {
     val rc = new BDBStore({
       val rc = new BDBStoreDTO
-      rc.directory = basedir / "target" / "apollo-data"
+      rc.directory = data_directory
       rc
     })
     rc.config.flush_delay = flushDelay

Propchange: activemq/activemq-apollo/trunk/apollo-bdb/src/test/scala/org/apache/activemq/apollo/broker/store/bdb/BDBStoreTest.scala
------------------------------------------------------------------------------
    svn:executable = *

Modified: activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/store/StoreFunSuiteSupport.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/store/StoreFunSuiteSupport.scala?rev=1205552&r1=1205551&r2=1205552&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/store/StoreFunSuiteSupport.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/store/StoreFunSuiteSupport.scala
Wed Nov 23 19:54:37 2011
@@ -19,10 +19,11 @@ package org.apache.activemq.apollo.broke
 import org.fusesource.hawtbuf.AsciiBuffer._
 import org.fusesource.hawtdispatch.TaskTracker
 import java.util.concurrent.{TimeUnit, CountDownLatch}
-import org.scalatest.BeforeAndAfterEach
 import collection.mutable.ListBuffer
 import org.apache.activemq.apollo.util.{LoggingTracker, FunSuiteSupport, LongCounter}
-import java.util.concurrent.atomic.AtomicLong
+import org.scalatest.BeforeAndAfterEach
+import java.io.File
+import org.apache.activemq.apollo.util.FileSupport._
 
 /**
  * <p>Implements generic testing of Store implementations.</p>
@@ -54,8 +55,11 @@ abstract class StoreFunSuiteSupport exte
     rc.value
   }
 
+  def data_directory = basedir / "target" / "apollo-data"
 
   override protected def beforeAll() = {
+    super.beforeAll()
+    data_directory.recursive_delete
     store = create_store(5*1000)
     val tracker = new LoggingTracker("store startup")
     tracker.start(store)
@@ -66,6 +70,7 @@ abstract class StoreFunSuiteSupport exte
     val tracker = new LoggingTracker("store stop")
     tracker.stop(store)
     tracker.await
+    super.afterAll()
   }
 
   override protected def beforeEach() = {

Propchange: activemq/activemq-apollo/trunk/apollo-broker/src/test/scala/org/apache/activemq/apollo/broker/store/StoreFunSuiteSupport.scala
------------------------------------------------------------------------------
    svn:executable = *

Modified: activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2StoreTest.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2StoreTest.scala?rev=1205552&r1=1205551&r2=1205552&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2StoreTest.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2StoreTest.scala
Wed Nov 23 19:54:37 2011
@@ -28,7 +28,7 @@ class JDBM2StoreTest extends StoreFunSui
   def create_store(flushDelay:Long):Store = {
     val rc = new JDBM2Store({
       val rc = new JDBM2StoreDTO
-      rc.directory = basedir / "activemq-data"
+      rc.directory = data_directory
       rc
     })
     rc.config.flush_delay = flushDelay

Propchange: activemq/activemq-apollo/trunk/apollo-jdbm2/src/test/scala/org/apache/activemq/apollo/broker/store/jdbm2/JDBM2StoreTest.scala
------------------------------------------------------------------------------
    svn:executable = *

Modified: activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/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/leveldb/LevelDBClient.scala?rev=1205552&r1=1205551&r2=1205552&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBClient.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBClient.scala
Wed Nov 23 19:54:37 2011
@@ -99,6 +99,26 @@ object LevelDBClient extends Log {
       size += value
     }
   }
+  
+  var link_strategy = 0
+  def link(source:File, target:File):Unit = {
+    link_strategy match {
+      case 0 =>
+        try {
+          Util.link(source, target)
+        } catch {
+          case e:IOException => throw e
+          case e:Throwable =>
+            // Fallback.. to a slower impl..
+            link_strategy = 100
+          link(source, target)
+        }
+
+      case _ =>
+        // this strategy is slow but sure to work.
+        source.copy_to(target)
+    }
+  }
 
 }
 
@@ -229,7 +249,7 @@ class LevelDBClient(store: LevelDBStore)
         // Resume log replay from a snapshot of the index..
         try {
           file.list_files.foreach { file =>
-            Util.link(file, dirty_index_file / file.getName)
+            link(file, dirty_index_file / file.getName)
           }
         } catch {
           case e:Exception =>
@@ -365,9 +385,8 @@ class LevelDBClient(store: LevelDBStore)
     try {
 
       // Hard link all the index files.
-      dirty_index_file.list_files.foreach {
-        file =>
-          Util.link(file, tmp_dir / file.getName)
+      dirty_index_file.list_files.foreach { file =>
+        link(file, tmp_dir / file.getName)
       }
 
       // Rename to signal that the snapshot is complete.

Propchange: activemq/activemq-apollo/trunk/apollo-leveldb/src/main/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBClient.scala
------------------------------------------------------------------------------
    svn:executable = *

Modified: activemq/activemq-apollo/trunk/apollo-leveldb/src/test/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBStoreTest.scala
URL: http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-leveldb/src/test/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBStoreTest.scala?rev=1205552&r1=1205551&r2=1205552&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-leveldb/src/test/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBStoreTest.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-leveldb/src/test/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBStoreTest.scala
Wed Nov 23 19:54:37 2011
@@ -28,7 +28,7 @@ class LevelDBStoreTest extends StoreFunS
   def create_store(flushDelay:Long):Store = {
     new LevelDBStore({
       val rc = new LevelDBStoreDTO
-      rc.directory = basedir / "target" / "apollo-data"
+      rc.directory = data_directory
       rc.flush_delay = flushDelay
       rc
     })

Propchange: activemq/activemq-apollo/trunk/apollo-leveldb/src/test/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/LevelDBStoreTest.scala
------------------------------------------------------------------------------
    svn:executable = *

Modified: activemq/activemq-apollo/trunk/apollo-leveldb/src/test/scala/org/apache/activemq/apollo/broker/store/leveldb/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/leveldb/PureJavaLevelDBStoreTest.scala?rev=1205552&r1=1205551&r2=1205552&view=diff
==============================================================================
--- activemq/activemq-apollo/trunk/apollo-leveldb/src/test/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/PureJavaLevelDBStoreTest.scala
(original)
+++ activemq/activemq-apollo/trunk/apollo-leveldb/src/test/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/PureJavaLevelDBStoreTest.scala
Wed Nov 23 19:54:37 2011
@@ -30,7 +30,7 @@ class PureJavaLevelDBStoreTest extends S
     new LevelDBStore({
       val rc = new LevelDBStoreDTO
       rc.index_factory = "org.iq80.leveldb.impl.Iq80DBFactory"
-      rc.directory = basedir / "target" / "apollo-data"
+      rc.directory = data_directory
       rc.flush_delay = flushDelay
       rc
     })

Propchange: activemq/activemq-apollo/trunk/apollo-leveldb/src/test/scala/org/apache/activemq/apollo/broker/store/leveldb/leveldb/PureJavaLevelDBStoreTest.scala
------------------------------------------------------------------------------
    svn:executable = *



Mime
View raw message