activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject git commit: Don't display leveldb replication recovery progress on slave nodes.
Date Thu, 10 Oct 2013 18:52:20 GMT
Updated Branches:
  refs/heads/trunk c643e7f63 -> e90ce1aab


Don't display leveldb replication recovery progress on slave nodes.

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

Branch: refs/heads/trunk
Commit: e90ce1aabb5de8d671fdea4d1b97f0cb468637af
Parents: c643e7f
Author: Hiram Chirino <hiram@hiramchirino.com>
Authored: Thu Oct 10 14:52:07 2013 -0400
Committer: Hiram Chirino <hiram@hiramchirino.com>
Committed: Thu Oct 10 14:52:07 2013 -0400

----------------------------------------------------------------------
 .../apache/activemq/leveldb/LevelDBClient.scala | 43 +++++++++++---------
 .../leveldb/replicated/SlaveLevelDBStore.scala  |  2 +-
 2 files changed, 24 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq/blob/e90ce1aa/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/LevelDBClient.scala
----------------------------------------------------------------------
diff --git a/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/LevelDBClient.scala
b/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/LevelDBClient.scala
index 44e0a4e..a8d2e4f 100755
--- a/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/LevelDBClient.scala
+++ b/activemq-leveldb-store/src/main/scala/org/apache/activemq/leveldb/LevelDBClient.scala
@@ -674,7 +674,7 @@ class LevelDBClient(store: LevelDBStore) {
     }
   }
 
-  def replay_from(from:Long, limit:Long) = {
+  def replay_from(from:Long, limit:Long, print_progress:Boolean=true) = {
     might_fail {
       try {
         // Update the index /w what was stored on the logs..
@@ -684,25 +684,28 @@ class LevelDBClient(store: LevelDBStore) {
         var last_reported_pos = 0L
         try {
           while (pos < limit) {
-            val now = System.currentTimeMillis();
-            if( now > last_reported_at+1000 ) {
-              val at = pos-from
-              val total = limit-from
-              val rate = (pos-last_reported_pos)*1000.0 / (now - last_reported_at)
-              val eta = (total-at)/rate
-              val remaining = if(eta > 60*60) {
-                "%.2f hrs".format(eta/(60*60))
-              } else if(eta > 60) {
-                "%.2f mins".format(eta/60)
-              } else {
-                "%.0f secs".format(eta)
-              }
 
-              System.out.print("Replaying recovery log: %f%% done (%,d/%,d bytes) @ %,.2f
kb/s, %s remaining.     \r".format(
-                at*100.0/total, at, total, rate/1024, remaining))
-              showing_progress = true;
-              last_reported_at = now
-              last_reported_pos = pos
+            if( print_progress ) {
+              val now = System.currentTimeMillis();
+              if( now > last_reported_at+1000 ) {
+                val at = pos-from
+                val total = limit-from
+                val rate = (pos-last_reported_pos)*1000.0 / (now - last_reported_at)
+                val eta = (total-at)/rate
+                val remaining = if(eta > 60*60) {
+                  "%.2f hrs".format(eta/(60*60))
+                } else if(eta > 60) {
+                  "%.2f mins".format(eta/60)
+                } else {
+                  "%.0f secs".format(eta)
+                }
+
+                System.out.print("Replaying recovery log: %f%% done (%,d/%,d bytes) @ %,.2f
kb/s, %s remaining.     \r".format(
+                  at*100.0/total, at, total, rate/1024, remaining))
+                showing_progress = true;
+                last_reported_at = now
+                last_reported_pos = pos
+              }
             }
 
 
@@ -774,7 +777,7 @@ class LevelDBClient(store: LevelDBStore) {
           case e:Throwable => e.printStackTrace()
         }
         if(showing_progress) {
-          System.out.print("                                                            
          \r");
+          System.out.println("Replaying recovery log: 100% done                         
       ");
         }
 
       } catch {

http://git-wip-us.apache.org/repos/asf/activemq/blob/e90ce1aa/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 cf22cf9..8c832a7 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
@@ -146,7 +146,7 @@ class SlaveLevelDBStore extends LevelDBStore with ReplicatedLevelDBStoreTrait
{
         val old_replay_from = replay_from
         replay_from = ack.position
         client.writeExecutor {
-          client.replay_from(old_replay_from, ack.position)
+          client.replay_from(old_replay_from, ack.position, false)
         }
       }
     }


Mime
View raw message