You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2013/11/04 15:26:14 UTC

[2/4] git commit: leveldb replication: Lets always download the current append log just to be safe

leveldb replication: Lets always download the current append log just to be safe


Project: http://git-wip-us.apache.org/repos/asf/activemq/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq/commit/dea38e62
Tree: http://git-wip-us.apache.org/repos/asf/activemq/tree/dea38e62
Diff: http://git-wip-us.apache.org/repos/asf/activemq/diff/dea38e62

Branch: refs/heads/trunk
Commit: dea38e62f893a3ef3aa7cc21b87aef357f6fcae2
Parents: 2824a94
Author: Hiram Chirino <hi...@hiramchirino.com>
Authored: Fri Nov 1 14:17:40 2013 -0400
Committer: Hiram Chirino <hi...@hiramchirino.com>
Committed: Mon Nov 4 09:26:01 2013 -0500

----------------------------------------------------------------------
 .../leveldb/replicated/SlaveLevelDBStore.scala     | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/dea38e62/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/SlaveLevelDBStore.scala
----------------------------------------------------------------------
diff --git a/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/SlaveLevelDBStore.scala b/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/SlaveLevelDBStore.scala
index f1a47f7..7befe9d 100644
--- a/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/SlaveLevelDBStore.scala
+++ b/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/replicated/SlaveLevelDBStore.scala
@@ -332,20 +332,11 @@ class SlaveLevelDBStore extends LevelDBStore with ReplicatedLevelDBStoreTrait {
           if (stashed_file.length() == x.length )
             return stashed_file.cached_crc32 == x.crc32
 
-          if ( stashed_file.crc32(x.length) == x.crc32 ) {
-            // we don't want to truncate the log file currently being appended to.
-            if( x.file != state.append_log ) {
-              // Our log file might be longer. lets truncate to match.
-              val raf = new RandomAccessFile(stashed_file, "rw")
-              try {
-                raf.setLength(x.length)
-              } finally {
-                raf.close();
-              }
-            }
-            return true;
+          if( x.file == state.append_log ) {
+            return false;
           }
-          return false
+
+          return stashed_file.cached_crc32 == x.crc32
         }
 
         // We don't have to transfer log files that have been previously transferred.