File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
mongodb_consistent_backup/Oplog/Tailer Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change 3
3
4
4
# Skip bson in requirements , pymongo provides
5
5
# noinspection PyPackageRequirements
6
+ from bson .codec_options import CodecOptions
6
7
from multiprocessing import Process
7
8
from pymongo import CursorType
8
9
from pymongo .errors import AutoReconnect
@@ -67,13 +68,14 @@ def run(self):
67
68
self .conn = DB (self .uri , self .config , True , 'secondary' ).connection ()
68
69
db = self .conn ['local' ]
69
70
oplog = self .oplog ()
71
+ oplog_rs = db .oplog .rs .with_options (codec_options = CodecOptions (unicode_decode_error_handler = "ignore" ))
70
72
71
- tail_start_ts = db . oplog . rs .find ().sort ('$natural' , - 1 )[0 ]['ts' ]
73
+ tail_start_ts = oplog_rs .find ().sort ('$natural' , - 1 )[0 ]['ts' ]
72
74
self .state .set ('running' , True )
73
75
while not self .do_stop .is_set ():
74
76
# http://api.mongodb.com/python/current/examples/tailable.html
75
77
query = {'ts' :{'$gt' :tail_start_ts }}
76
- cursor = db . oplog . rs .find (query , cursor_type = CursorType .TAILABLE_AWAIT , oplog_replay = True )
78
+ cursor = oplog_rs .find (query , cursor_type = CursorType .TAILABLE_AWAIT , oplog_replay = True )
77
79
try :
78
80
while not self .do_stop .is_set ():
79
81
try :
You can’t perform that action at this time.
0 commit comments