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 33
44# Skip bson in requirements , pymongo provides
55# noinspection PyPackageRequirements
6+ from bson .codec_options import CodecOptions
67from multiprocessing import Process
78from pymongo import CursorType
89from pymongo .errors import AutoReconnect
@@ -67,13 +68,14 @@ def run(self):
6768 self .conn = DB (self .uri , self .config , True , 'secondary' ).connection ()
6869 db = self .conn ['local' ]
6970 oplog = self .oplog ()
71+ oplog_rs = db .oplog .rs .with_options (codec_options = CodecOptions (unicode_decode_error_handler = "ignore" ))
7072
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' ]
7274 self .state .set ('running' , True )
7375 while not self .do_stop .is_set ():
7476 # http://api.mongodb.com/python/current/examples/tailable.html
7577 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 )
7779 try :
7880 while not self .do_stop .is_set ():
7981 try :
You can’t perform that action at this time.
0 commit comments