Skip to content

Commit e8ba302

Browse files
Improved logging + balancer stop timer
1 parent 187498f commit e8ba302

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

Diff for: mongodb_consistent_backup/Oplog/Resolver/Resolver.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ def get_consistent_end_ts(self):
6767
return ts
6868

6969
def run(self):
70-
logging.info("Resolving oplogs using %i threads max" % self.threads())
70+
logging.info("Resolving oplogs (options: threads=%s,compression=%s)" % (self.threads(), self.compression()))
7171
self.timer.start()
7272

73-
self.end_ts = self.get_consistent_end_ts()
73+
self.end_ts = self.get_consistent_end_ts()
7474
for host in self.backup_oplogs:
7575
for port in self.backup_oplogs[host]:
7676
backup_oplog = self.backup_oplogs[host][port]

Diff for: mongodb_consistent_backup/Sharding.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from time import sleep
44

5-
from Common import DB, validate_hostname
5+
from mongodb_consistent_backup.Common import DB, Timer, validate_hostname
66
from mongodb_consistent_backup.Replication import Replset
77

88

@@ -89,15 +89,17 @@ def restore_balancer_state(self):
8989
def stop_balancer(self):
9090
logging.info("Stopping the balancer and waiting a max of %i sec" % self.balancer_wait_secs)
9191
wait_cnt = 0
92+
stop_timer = Timer()
93+
stop_timer.start()
9294
self.set_balancer(False)
9395
while wait_cnt < self.balancer_wait_secs:
9496
if self.check_balancer_running():
9597
wait_cnt += self.balancer_sleep
9698
logging.info("Balancer is still running, sleeping for %i sec(s)" % self.balancer_sleep)
9799
sleep(self.balancer_sleep)
98100
else:
99-
sleep(self.balancer_sleep)
100-
logging.info("Balancer is now stopped")
101+
stop_timer.stop()
102+
logging.info("Balancer stopped after %s seconds" % stop_timer.duration())
101103
return
102104
logging.fatal("Could not stop balancer: %s:%i!" % (self.db.host, self.db.port))
103105
raise Exception, "Could not stop balancer: %s:%i" % (self.db.host, self.db.port), None

0 commit comments

Comments
 (0)