Example #1
0
        help="changes the size of the key used for compare table contents. A "
             "higher value can help to get more accurate results comparing "
             "large databases, but may slow the algorithm. Default value is "
             "{0}.".format(DEFAULT_SPAN_KEY_SIZE)
    )

    # add the use indexes option
    parser.add_option(
        "--use-indexes", action="store", type="string", default='',
        dest="use_indexes",
        help="for each table, indicate which index to use as if were a "
             "primary key (each of his columns must not allow null values)."
    )

    # Add verbosity and quiet (silent) mode
    add_verbosity(parser, True)

    # Add difftype option
    add_difftype(parser, True)

    # Add the direction (changes-for)
    add_changes_for(parser)

    # Add show reverse option
    add_reverse(parser)

    # Add regexp
    add_regexp(parser)

    # Add ssl options
    add_ssl_options(parser)
Example #2
0
parser.add_option("-x", "--exclude", action="append", dest="exclude",
                  type="string", default=None, help="exclude one or more "
                  "objects from the operation using either a specific name "
                  "(e.g. db1.t1), a LIKE pattern (e.g. db1.t% or db%.%) or a "
                  "REGEXP search pattern. To use a REGEXP search pattern for "
                  "all exclusions, you must also specify the --regexp option. "
                  "Repeat the --exclude option for multiple exclusions.")

# Add the all database options
add_all(parser, "databases")

# Add the skip common options
add_skip_options(parser)

# Add verbosity and quiet (silent) mode
add_verbosity(parser, True)

# Add engine options
add_engines(parser)

# Add locking options
add_locking(parser)

# Add regexp
add_regexp(parser)

# Replication user and password
add_rpl_user(parser, None)

# Add replication options but don't include 'both'
add_rpl_mode(parser, False, False)
Example #3
0
# Add --datadir option
parser.add_option("--datadir", action="store", dest="datadir", default=None,
                  type="string", help="the data directory for the server")

# Add --search-port
parser.add_option("--port-range", action="store", dest="ports",
                  default="3306:3333",
                  type="string", help="the port range to search for running"
                  " mysql servers on Windows systems")

# Add --show-servers option
parser.add_option("--show-servers", action="store_true", dest="show_servers",
                  help="show any known MySQL servers running on this host")

# Add verbosity mode
add_verbosity(parser, False)

# Now we process the rest of the arguments.
opt, args = parser.parse_args()

# Check port range
if os.name == 'nt':
    parts = opt.ports.split(":")
    if len(parts) != 2:
        print "# WARNING : %s is not a valid port range. Using default." % \
              opt.ports
        opt.ports = "3306:3333"

# Set options for database operations.
options = {
    "format"        : opt.format,
    parser.add_option(
        "-b",
        "--start-from-beginning",
        action="store_true",
        default=False,
        dest="from_beginning",
        help="start replication from the first event recorded "
        "in the binary logging of the master. Not valid "
        "with --master-log-file or --master-log-pos.",
    )

    # Add ssl options
    add_ssl_options(parser)

    # Add verbosity
    add_verbosity(parser)

    # Now we process the rest of the arguments.
    opt, args = parser.parse_args()

    # Check security settings
    check_password_security(opt, args)

    # option --master is required (mandatory)
    if not opt.master:
        default_val = "root@localhost:3306"
        print(WARN_OPT_USING_DEFAULT.format(default=default_val, opt="--master"))
        # Print the WARNING to force determinism if a parser error occurs.
        sys.stdout.flush()

    # option --slave is required (mandatory)
Example #5
0
    # Add the maximum age of log entries in days for the logging system
    parser.add_option("--log-age",
                      action="store",
                      dest="log_age",
                      default=7,
                      type="int",
                      help="specify maximum age of log entries in "
                      "days. Entries older than this will be purged on "
                      "startup. Default = 7 days.")

    # Add ssl options
    add_ssl_options(parser)

    # Add verbosity
    add_verbosity(parser)

    # Now we process the rest of the arguments.
    opt, args = parser.parse_args()

    # Check security settings
    check_password_security(opt, args)

    # Check if the values specified for the --report-values option are valid.
    for report in opt.report_values.split(","):
        if report.lower() not in ("health", "gtid", "uuid"):
            parser.error("The value for the option --report-values is not "
                         "valid: '{0}', the values allowed are 'health', "
                         "'gitd' or 'uuid'".format(opt.report_values))

    # Check for errors
Example #6
0
# Set limit for best
parser.add_option("--best",
                  action="store",
                  dest="best",
                  default=None,
                  help="limit index statistics to the best N indexes")

# Set limit for worst
parser.add_option("--worst",
                  action="store",
                  dest="worst",
                  default=None,
                  help="limit index statistics to the worst N indexes")

# Add verbosity mode
add_verbosity(parser, False)

# Now we process the rest of the arguments.
opt, args = parser.parse_args()

# Check to make sure at least one table specified.
if len(args) == 0:
    parser.error("You must specify at least one table or database to check.")

PERMITTED_FORMATS = ("SQL", "GRID", "TAB", "CSV", "VERTICAL")

if opt.index_format.upper() not in PERMITTED_FORMATS:
    print "WARNING : '%s' is not a valid index format. Using default." % \
          opt.index_format
    opt.index_format = "GRID"
else:
                      dest="binlog", default=None, type="string",
                      help="Binlog file name to keep (not to purge). All the "
                      "binary log files prior to the specified file will be "
                      "removed.")

    # Add the --discover-slaves-login option.
    add_discover_slaves_option(parser)

    # Add the --master option.
    add_master_option(parser)

    # Add the --slaves option.
    add_slaves_option(parser)

    # Add verbosity
    add_verbosity(parser, quiet=False)

    # Now we process the rest of the arguments.
    opt, args = parser.parse_args()

    server_val = None
    master_val = None
    slaves_val = None

    if opt.server and opt.master:
        parser.error(PARSE_ERR_OPTS_EXCLD.format(opt1="--server",
                                                 opt2="--master"))

    if opt.master is None and opt.slaves:
        parser.error(PARSE_ERR_OPT_REQ_OPT.format(opt="--slaves",
                                                  opts="--master"))
                                  False,
                                  True,
                                  server_default=None,
                                  extended_help=EXTENDED_HELP,
                                  add_ssl=True)

    # Do not Purge binlog, instead print info
    parser.add_option("--min-size",
                      action="store",
                      dest="min_size",
                      type="int",
                      help="rotate the active binlog file only if the file "
                      "size exceeds the specified value in bytes.")

    # Add verbosity
    add_verbosity(parser, quiet=False)

    # Now we process the rest of the arguments.
    opt, args = parser.parse_args()

    # Check mandatory options: --server
    if not opt.server:
        parser.error(PARSE_ERR_OPTS_REQ.format(opt="--server"))

    servers_val = None
    # Parse source connection values if --server provided or default
    try:
        ssl_opts = get_ssl_dict(opt)
        server_val = parse_connection(opt.server, None, ssl_opts)
    except FormatError as err:
        # pylint: disable=E1101