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

This commit is contained in:
Hiram Chirino 2013-10-10 14:52:07 -04:00
parent c643e7f631
commit e90ce1aabb
2 changed files with 24 additions and 21 deletions

View File

@ -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,6 +684,8 @@ class LevelDBClient(store: LevelDBStore) {
var last_reported_pos = 0L
try {
while (pos < limit) {
if( print_progress ) {
val now = System.currentTimeMillis();
if( now > last_reported_at+1000 ) {
val at = pos-from
@ -704,6 +706,7 @@ class LevelDBClient(store: LevelDBStore) {
last_reported_at = now
last_reported_pos = pos
}
}
log.read(pos).map {
@ -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 {

View File

@ -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)
}
}
}