Skip to content

Commit 4f27f0a

Browse files
committed
ignore bson unicode decode error
1 parent d84c041 commit 4f27f0a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

mongodb_consistent_backup/Oplog/Oplog.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
from gzip import GzipFile
55
from bson import BSON, decode_file_iter
6+
from bson.codec_options import CodecOptions
67

78
from mongodb_consistent_backup.Errors import OperationError
89

@@ -44,7 +45,7 @@ def load(self):
4445
try:
4546
oplog = self.open()
4647
logging.debug("Reading oplog file %s" % self.oplog_file)
47-
for change in decode_file_iter(oplog):
48+
for change in decode_file_iter(oplog, CodecOptions(unicode_decode_error_handler="ignore")):
4849
if 'ts' in change:
4950
self._last_ts = change['ts']
5051
if self._first_ts is None and self._last_ts is not None:

0 commit comments

Comments
 (0)