Skip to content

Commit f424830

Browse files
OREO-13395 Oplog Disable (#18)
* Update Mongodump.py for Oplog * Update VERSION
1 parent 9af93b9 commit f424830

File tree

2 files changed

+27
-2
lines changed

2 files changed

+27
-2
lines changed

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.4.7
1+
1.4.8

mongodb_consistent_backup/Backup/Mongodump/Mongodump.py

+26-1
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,13 @@ 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()))
140+
134141
thread = MongodumpThread(
135142
self.states[shard],
136143
mongo_uri,
@@ -140,7 +147,7 @@ def run(self):
140147
self.version,
141148
self.threads(),
142149
self.do_gzip(),
143-
self.oplog_enabled
150+
oplog
144151
)
145152
self.dump_threads.append(thread)
146153
except Exception, e:
@@ -179,3 +186,21 @@ def close(self):
179186
pass
180187
logging.info("Stopped all mongodump threads")
181188
self.stopped = True
189+
190+
def check_or_cfg(self, uri):
191+
"""
192+
Checks whether the given URI contains the domain 'objectrocket.com'
193+
and the substring 'cfg' within the domain.
194+
195+
Args:
196+
uri (str): The URI to be checked, typically in the form of 'rs/domain.com'.
197+
198+
Returns:
199+
bool:
200+
- True if the URI contains the domain 'objectrocket.com' and 'cfg' in the domain part.
201+
- False otherwise
202+
"""
203+
rs, domain = uri.split("/", 1)
204+
if "objectrocket.com" in domain and "cfg" in domain:
205+
return True
206+
return False

0 commit comments

Comments
 (0)