Skip to content

Commit 1b51991

Browse files
Merge pull request #5 from objectrocket/SRE-2645-added-more-loging
Sre 2645 added more loging
2 parents 687d621 + e1376fd commit 1b51991

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

mongodb_consistent_backup/Oplog/Resolver/Resolver.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,5 +148,7 @@ def run(self):
148148
self.stopped = True
149149

150150
for shard in self.resolver_state:
151+
logging.info("Getting shard oplog state %s" % (shard))
151152
self.resolver_summary[shard] = self.resolver_state[shard].get()
153+
logging.info("Returning self.resolver_summary")
152154
return self.resolver_summary

mongodb_consistent_backup/Oplog/Tailer/TailThread.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def status(self):
8989

9090
def connect(self):
9191
if not self.db:
92-
self.db = DB(self.uri, self.config, True, 'secondary', True)
92+
self.db = DB(self.uri, self.config, False, 'secondary', True)
9393
return self.db.connection()
9494

9595
def run(self):
@@ -169,6 +169,7 @@ def run(self):
169169
self.stopped = True
170170
self.state.set('running', False)
171171
self.timer.stop(self.timer_name)
172+
logging.info("Thread is stopped and marked as stopped %s" % self.uri)
172173

173174
if self.exit_code == 0:
174175
log_msg_extra = "%i oplog changes" % self.count

mongodb_consistent_backup/Oplog/Tailer/Tailer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ def stop(self, kill=False, sleep_secs=3):
102102
logging.warning("Could not get current optime from PRIMARY! Using now as a stop time")
103103
timestamp = Timestamp(int(time()), 0)
104104

105-
# wait for replication to get in sync
106-
while state.get('last_ts') and state.get('last_ts') < timestamp:
105+
# wait for replication to get in sync making sure cursor has not been stopped in a race condition
106+
while state.get('last_ts') and state.get('last_ts') < timestamp and not self.shards[shard]['thread'].stopped:
107107
logging.info('Waiting for %s tailer to reach ts: %s, currrent: %s' % (uri, timestamp, state.get('last_ts')))
108108
sleep(sleep_secs)
109109

0 commit comments

Comments
 (0)