Skip to content

Add "--backup.mongodump.force_table_scan" option #302

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions mongodb_consistent_backup/Backup/Mongodump/MongodumpThread.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@ def close(self, exit_code=None, frame=None):
def do_ssl(self):
return parse_config_bool(self.config.ssl.enabled)

def force_table_scan(self):
return parse_config_bool(self.config.backup.mongodump.force_table_scan)

def do_ssl_insecure(self):
return parse_config_bool(self.config.ssl.insecure)

Expand Down Expand Up @@ -209,6 +212,10 @@ def mongodump_cmd(self):
logging.fatal("Mongodump must be >= 2.6.0 to enable SSL encryption!")
sys.exit(1)

if self.force_table_scan():
logging.info("Enabling mongodump --forceTableScan option")
mongodump_flags.append("--forceTableScan")

mongodump_cmd.extend(mongodump_flags)
return mongodump_cmd

Expand Down
7 changes: 7 additions & 0 deletions mongodb_consistent_backup/Backup/Mongodump/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,11 @@ def config(parser):
parser.add_argument("--backup.mongodump.threads", dest="backup.mongodump.threads",
help="Number of threads to use for each mongodump process. There is 1 x mongodump per shard, be careful! (default: shards/CPUs)",
default=0, type=int)
# for a detailled explanation see
# see https://jira.mongodb.org/browse/TOOLS-845?focusedCommentId=988298&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-988298
# and https://jira.mongodb.org/browse/TOOLS-845?focusedCommentId=988414&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-988414
parser.add_argument("--backup.mongodump.force_table_scan", dest="backup.mongodump.force_table_scan", default=False,
action="store_true", help="Enables mongodump's forceTableScan option. Useful if custom ids are "
"used or id values are large. ONLY use with WiredTiger! (default: false)")

return parser