File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
mongodb_consistent_backup Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,6 @@ def validate_hostname(hostname):
2525 try :
2626 if ":" in hostname :
2727 hostname , port = hostname .split (":" )
28- socket .gethostbyname (hostname )
28+ socket .getaddrinfo (hostname , None )
2929 except socket .error , e :
3030 raise OperationError ("Could not resolve host '%s', error: %s" % (hostname , e ))
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