예제 #1
0
                       files[i],
                       log_path="serve-output-%d" % i,
                       executable_path=driver.find_rethinkdb_executable())
        for i in xrange(num_nodes)
    ]
    time.sleep(10)
    print "Creating table..."
    http = http_admin.ClusterAccess([("localhost", p.http_port)
                                     for p in processes])
    dc = http.add_datacenter()
    for machine_id in http.machines:
        http.move_server_to_datacenter(machine_id, dc)
    db = http.add_database(name="test")
    ns = http.add_table(primary=dc, name="test", primary_key="foo")
    time.sleep(10)
    host, port = driver.get_table_host(processes)
    cluster.check()

    rdb_workload_common.insert_many(host=host,
                                    port=port,
                                    table="test",
                                    count=10000)

    print "Splitting into two shards..."
    http.add_table_shard(ns, "t")
    time.sleep(10)
    cluster.check()

    print "Merging shards together again..."
    http.remove_table_shard(ns, "t")
    time.sleep(10)
예제 #2
0
    process2.wait_until_started_up()

    print "Creating namespace..."
    http = http_admin.ClusterAccess([("localhost", p.http_port) for p in [process1, process2]])
    dc = http.add_datacenter()
    http.move_server_to_datacenter(process1.files.machine_name, dc)
    http.move_server_to_datacenter(process2.files.machine_name, dc)
    db = http.add_database()
    ns = http.add_table(primary = dc,
                        affinities = {dc: 1}, ack_expectations = {dc: 2}, database=db.name)
    http.do_query("POST", "/ajax/semilattice/rdb_namespaces/%s/primary_pinnings" % ns.uuid,
        {"[\"\",null]": http.find_machine(process1.files.machine_name).uuid})
    http.wait_until_blueprint_satisfied(ns)
    cluster.check()
    http.check_no_issues()
    host, port = driver.get_table_host([process1, process2])

    rdb_workload_common.insert_many(host=host, port=port, database=db.name, table=ns.name, count=10000)

    if opts["fast-workload"]:
        print "Stopping release-mode processes."
        process1.check_and_stop()
        process2.check_and_stop()
        print "Starting original-mode processes."
        process1 = driver.Process(cluster, files1, log_path = "serve-output-1",
            executable_path = executable_path, command_prefix = command_prefix, extra_options = serve_options)
        process2 = driver.Process(cluster, files2, log_path = "serve-output-2",
            executable_path = executable_path, command_prefix = command_prefix, extra_options = serve_options)
        process1.wait_until_started_up()
        process2.wait_until_started_up()
        http = http_admin.ClusterAccess([("localhost", p.http_port) for p in [process1, process2]])
예제 #3
0
        for i in xrange(2)]
    for process in processes:
        process.wait_until_started_up()
    print "Creating table..."
    http = http_admin.ClusterAccess([("localhost", p.http_port) for p in processes])
    dc = http.add_datacenter()
    for machine_id in http.machines:
        http.move_server_to_datacenter(machine_id, dc)
    ns = http.add_table(primary = dc)
    http.wait_until_blueprint_satisfied(ns)

    print "Getting distribution first time."
    distribution = http.get_distribution(ns)

    print "Inserting a bunch."
    host, port = driver.get_table_host(processes)
    with r.connect(host, port) as conn:
        r.table_create('distribution').run(conn)
        batch = []
        for i in range(10000):
            batch.append({'id': str(i) * 10, 'val': str(i)*20})
            if (i + 1) % 100 == 0:
                r.table('distribution').insert(batch).run(conn)
                batch = []
                print i + 1,
                sys.stdout.flush()
        print

    time.sleep(1)

    print "Getting distribution second time."
예제 #4
0
    dc = http.add_datacenter()
    http.move_server_to_datacenter(process1.files.machine_name, dc)
    http.move_server_to_datacenter(process2.files.machine_name, dc)
    db = http.add_database()
    ns = http.add_table(primary=dc,
                        affinities={dc: 1},
                        ack_expectations={dc: 2},
                        database=db.name)
    http.do_query(
        "POST",
        "/ajax/semilattice/rdb_namespaces/%s/primary_pinnings" % ns.uuid,
        {"[\"\",null]": http.find_machine(process1.files.machine_name).uuid})
    http.wait_until_blueprint_satisfied(ns)
    cluster.check()
    http.check_no_issues()
    host, port = driver.get_table_host([process1, process2])

    rdb_workload_common.insert_many(host=host,
                                    port=port,
                                    database=db.name,
                                    table=ns.name,
                                    count=10000)

    if opts["fast-workload"]:
        print "Stopping release-mode processes."
        process1.check_and_stop()
        process2.check_and_stop()
        print "Starting original-mode processes."
        process1 = driver.Process(cluster,
                                  files1,
                                  log_path="serve-output-1",