Esempio n. 1
0
def main(port, topology, schema_dir, vschema, mysql_only, web_dir=None):
    shards = []

    for shard in topology.split(','):
        m = shard_exp.match(shard)
        if m:
            shards.append(
                vt_processes.ShardInfo(m.group(1), m.group(2), m.group(3)))
        else:
            sys.stderr.write('invalid --shard flag format: %s\n' % shard)
            sys.exit(1)

    environment.base_port = port
    with local_database.LocalDatabase(shards,
                                      schema_dir,
                                      vschema,
                                      mysql_only,
                                      web_dir=web_dir) as local_db:
        print json.dumps(local_db.config())
        sys.stdout.flush()
        try:
            raw_input()
        except EOFError:
            sys.stderr.write(
                'WARNING: %s: No empty line was received on stdin.'
                ' Instead, stdin was closed and the cluster will be shut down now.'
                ' Make sure to send the empty line instead to proactively shutdown'
                ' the local cluster. For example, did you forget the shutdown in'
                ' your test\'s tearDown()?\n' % os.path.basename(__file__))
Esempio n. 2
0
def main(port, topology, schema_dir):
    shards = []

    for shard in topology.split(','):
        m = shard_exp.match(shard)
        if m:
            shards.append(
                vt_processes.ShardInfo(m.group(1), m.group(2), m.group(3)))
        else:
            sys.stderr.write('invalid --shard flag format: %s\n' % shard)
            sys.exit(1)

    environment.base_port = port
    with local_database.LocalDatabase(shards, schema_dir) as local_db:
        print json.dumps(local_db.config())
        sys.stdout.flush()
        raw_input()
Esempio n. 3
0
def main(cmdline_options):
    shards = []

    for shard in cmdline_options.topology.split(','):
        m = shard_exp.match(shard)
        if m:
            shards.append(
                vt_processes.ShardInfo(m.group(1), m.group(2), m.group(3)))
        else:
            sys.stderr.write('invalid --shard flag format: %s\n' % shard)
            sys.exit(1)

    environment.base_port = cmdline_options.port

    init_data_opts = None
    if cmdline_options.initialize_with_random_data:
        init_data_opts = init_data_options.InitDataOptions()
        init_data_opts.rng_seed = cmdline_options.rng_seed
        init_data_opts.min_table_shard_size = cmdline_options.min_table_shard_size
        init_data_opts.max_table_shard_size = cmdline_options.max_table_shard_size
        init_data_opts.null_probability = cmdline_options.null_probability

    with local_database.LocalDatabase(
            shards,
            cmdline_options.schema_dir,
            cmdline_options.vschema,
            cmdline_options.mysql_only,
            init_data_opts,
            web_dir=cmdline_options.web_dir) as local_db:
        print json.dumps(local_db.config())
        sys.stdout.flush()
        try:
            raw_input()
        except EOFError:
            sys.stderr.write(
                'WARNING: %s: No empty line was received on stdin.'
                ' Instead, stdin was closed and the cluster will be shut down now.'
                ' Make sure to send the empty line instead to proactively shutdown'
                ' the local cluster. For example, did you forget the shutdown in'
                ' your test\'s tearDown()?\n' % os.path.basename(__file__))