Skip to content

Commit 7416ebb

Browse files
Fix infra 785 - FD issue (#19)
* Update Mongodump.py * Update MongodumpThread.py * Update VERSION
1 parent 822c9b4 commit 7416ebb

File tree

3 files changed

+31
-22
lines changed

3 files changed

+31
-22
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.8
1+
1.4.9

mongodb_consistent_backup/Backup/Mongodump/Mongodump.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,12 +131,12 @@ def run(self):
131131
secondary = self.replsets[shard].find_secondary()
132132
mongo_uri = secondary['uri']
133133
self.states[shard] = OplogState(self.manager, mongo_uri)
134-
135-
# Check if mongo_uri passes the check_or_cfg function
136-
oplog = self.oplog_enabled
137-
if self.check_or_cfg(mongo_uri.str()):
138-
oplog = False
139-
logging.info("No Oplog for %s as it belongs to objectrocket.com" % (mongo_uri.str()))
134+
135+
if tuple(map(int, "4.4.20".split("."))) < tuple(map(int, self.version.split("."))):
136+
# Check if mongo_uri passes the check_or_cfg function
137+
if self.check_or_cfg(mongo_uri.str()):
138+
self.oplog_enabled = False
139+
logging.info("No Oplog for %s as it belongs to objectrocket.com" % (mongo_uri.str()))
140140

141141
thread = MongodumpThread(
142142
self.states[shard],
@@ -147,7 +147,7 @@ def run(self):
147147
self.version,
148148
self.threads(),
149149
self.do_gzip(),
150-
oplog
150+
self.oplog_enabled
151151
)
152152
self.dump_threads.append(thread)
153153
except Exception, e:

mongodb_consistent_backup/Backup/Mongodump/MongodumpThread.py

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -122,21 +122,30 @@ def handle_failure(self, line):
122122

123123
def wait(self):
124124
try:
125-
while self._process.stderr:
126-
poll = select([self._process.stderr.fileno()], [], [])
127-
if len(poll) >= 1:
128-
for fd in poll[0]:
125+
while self._process.stderr and not self._process.stderr.closed:
126+
read = None
127+
fd = self._process.stderr.fileno()
128+
if fd >= 1024:
129+
read = self._process.stderr.readline()
130+
else:
131+
poll = select([fd], [], [])
132+
if poll[0]:
129133
read = self._process.stderr.readline()
130-
line = self.parse_mongodump_line(read)
131-
if not line:
132-
continue
133-
elif self.is_password_prompt(read):
134-
self.handle_password_prompt()
135-
elif self.is_failed_line(read):
136-
self.handle_failure(read)
137-
break
138-
else:
139-
logging.info(line)
134+
135+
if read is not None:
136+
if not read:
137+
break
138+
line = self.parse_mongodump_line(read)
139+
if not line:
140+
continue
141+
elif self.is_password_prompt(read):
142+
self.handle_password_prompt()
143+
elif self.is_failed_line(read):
144+
self.handle_failure(read)
145+
break
146+
else:
147+
logging.info(line)
148+
140149
if self._process.poll() is not None:
141150
break
142151
except Exception, e:

0 commit comments

Comments
 (0)