Skip to content

Commit 1bfba53

Browse files
author
xiongjianqiang
committed
Start syncing exactly as configured
1 parent d1c67d9 commit 1bfba53

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

mongo_sync/oplog_reader.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,16 @@ def __init__(self, start):
3636
self.docman = DocManager()
3737

3838
def load_oplog(self):
39-
return self._oplog_store.load_oplog(self._last_ts)
39+
oplog = self._oplog_store.load_oplog(self._last_ts)
40+
if oplog:
41+
if oplog[0]['ts'] < self._last_ts:
42+
for n, entry in enumerate(oplog):
43+
if entry['ts'] >= self._last_ts:
44+
continue
45+
oplog = oplog[n:]
46+
return oplog
47+
else:
48+
return None
4049

4150
def replay(self, oplog):
4251
for n, entry in enumerate(oplog):

0 commit comments

Comments
 (0)