check_password_security(opt, args, "# ") # Warn if quiet and verbosity are both specified check_verbosity(opt) # Fail if the --all option and database arguments are both specified. check_all(parser, opt, args, "databases") # Process --exclude values to remove unnecessary quotes (when used) in # order to avoid further matching issues. exclude_list = None if opt.exclude: if not opt.all: if not opt.quiet: print(WARN_OPT_ONLY_USED_WITH.format(opt='--exclude', used_with='the --all' ' option')) else: # Remove unnecessary outer quotes. exclude_list = [pattern.strip("'\"") for pattern in opt.exclude] # The --regexp option requires --exclude. if opt.use_regexp and not opt.exclude: if not opt.quiet: print(WARN_OPT_ONLY_USED_WITH.format(opt='--regexp', used_with='the --exclude' ' option')) # Check for regexp symbols check_exclude_pattern(exclude_list, opt.use_regexp)
"number of CPUs '{1}'.".format(opt.multiprocess, num_cpu)) # Warning if too many process are used. num_files = len(args) if opt.multiprocess > num_files and not opt.quiet: print("# WARNING: Number of processes '{0}' is greater than the " "number of files to import '{1}'.".format( opt.multiprocess, num_files)) # Check max bulk insert option. if opt.max_bulk_insert and opt.max_bulk_insert <= 1: parser.error("Maximum bulk insert size '{0}' must be greater than " "one.".format(opt.max_bulk_insert)) if opt.max_bulk_insert and not opt.bulk_insert and not opt.quiet: print( WARN_OPT_ONLY_USED_WITH.format(opt="--max-bulk-insert", used_with="--bulk-insert")) # Set default value for max bulk insert. max_bulk_size = opt.max_bulk_insert if opt.max_bulk_insert else 30000 # Set options for database operations. options = { "skip_tables": "tables" in skips, "skip_views": "views" in skips, "skip_triggers": "triggers" in skips, "skip_procs": "procedures" in skips, "skip_funcs": "functions" in skips, "skip_events": "events" in skips, "skip_grants": "grants" in skips, "skip_create": "create_db" in skips, "skip_data": "data" in skips, "skip_blobs": opt.skip_blobs,
if opt.log_type == LOG_TYPE_RELAY: if opt.bin_log_basename: print( WARN_OPT_NOT_REQUIRED_FOR_TYPE.format( opt='--bin-log-basename', type='{0} log'.format(LOG_TYPE_RELAY))) if opt.bin_log_index: print( WARN_OPT_NOT_REQUIRED_FOR_TYPE.format( opt='--bin-log-index', type='{0} log'.format(LOG_TYPE_RELAY))) # Check use of the --skip-flush-binlogs option. if not opt.server and opt.skip_flush_binlogs: print( WARN_OPT_ONLY_USED_WITH.format(opt='--skip-flush-binlogs', used_with='--server')) # Create dictionary of options options = { 'verbosity': 0 if opt.verbosity is None else opt.verbosity, 'log_type': opt.log_type, 'sequence': sequence_list, 'modified_before': modified_before, 'skip_flush_binlogs': opt.skip_flush_binlogs, } # Relocate binary log files. try: # Relocate binary log files based for specified server. if server_val: binlog_admin.move_binlogs_from_server(
print("# WARNING: Number of processes '{0}' is greater than the " "number of CPUs '{1}'.".format(opt.multiprocess, num_cpu)) # Warning if too many process are used. num_files = len(args) if opt.multiprocess > num_files and not opt.quiet: print("# WARNING: Number of processes '{0}' is greater than the " "number of files to import '{1}'.".format(opt.multiprocess, num_files)) # Check max bulk insert option. if opt.max_bulk_insert and opt.max_bulk_insert <= 1: parser.error("Maximum bulk insert size '{0}' must be greater than " "one.".format(opt.max_bulk_insert)) if opt.max_bulk_insert and not opt.bulk_insert and not opt.quiet: print(WARN_OPT_ONLY_USED_WITH.format(opt="--max-bulk-insert", used_with="--bulk-insert")) # Set default value for max bulk insert. max_bulk_size = opt.max_bulk_insert if opt.max_bulk_insert else 30000 # Set options for database operations. options = { "skip_tables": "tables" in skips, "skip_views": "views" in skips, "skip_triggers": "triggers" in skips, "skip_procs": "procedures" in skips, "skip_funcs": "functions" in skips, "skip_events": "events" in skips, "skip_grants": "grants" in skips, "skip_create": "create_db" in skips, "skip_data": "data" in skips, "skip_blobs": opt.skip_blobs,
print(WARN_OPT_NOT_REQUIRED_FOR_TYPE.format( opt='--relay-log-index', type='{0}log'.format(LOG_TYPE_BIN))) if opt.log_type == LOG_TYPE_RELAY: if opt.bin_log_basename: print(WARN_OPT_NOT_REQUIRED_FOR_TYPE.format( opt='--bin-log-basename', type='{0} log'.format(LOG_TYPE_RELAY))) if opt.bin_log_index: print(WARN_OPT_NOT_REQUIRED_FOR_TYPE.format( opt='--bin-log-index', type='{0} log'.format(LOG_TYPE_RELAY))) # Check use of the --skip-flush-binlogs option. if not opt.server and opt.skip_flush_binlogs: print(WARN_OPT_ONLY_USED_WITH.format(opt='--skip-flush-binlogs', used_with='--server')) # Create dictionary of options options = { 'verbosity': 0 if opt.verbosity is None else opt.verbosity, 'log_type': opt.log_type, 'sequence': sequence_list, 'modified_before': modified_before, 'skip_flush_binlogs': opt.skip_flush_binlogs, } # Relocate binary log files. try: # Relocate binary log files based for specified server. if server_val: binlog_admin.move_binlogs_from_server(
# Check security settings check_password_security(opt, args, "# ") # Warn if quiet and verbosity are both specified check_verbosity(opt) # Fail if the --all option and database arguments are both specified. check_all(parser, opt, args, "databases") # Process --exclude values to remove unnecessary quotes (when used) in # order to avoid further matching issues. exclude_list = None if opt.exclude: if not opt.all: print(WARN_OPT_ONLY_USED_WITH.format(opt='--exclude', used_with='the --all option')) else: # Remove unnecessary outer quotes. exclude_list = [pattern.strip("'\"") for pattern in opt.exclude] # The --regexp option requires --exclude. if opt.use_regexp and not opt.exclude: print(WARN_OPT_ONLY_USED_WITH.format(opt='--regexp', used_with='the --exclude option')) # check unique keys ukey_regexp = re.compile(r'(?:(?:;){{0,1}}{0}\.{0})' ''.format(REGEXP_OBJ_NAME)) db_idxes_l = None