Example #1
0
def prepare_option_parser_for_split_or_continuous_workload(op, allow_between=False):
    # `--workload-during` specifies one or more workloads that will be run
    # continuously while other stuff is happening. `--extra-*` specifies how
    # many seconds to sit while the workloads are running.
    op["workload-during"] = vcoptparse.ValueFlag("--workload-during", converter=str, default=[], combiner=vcoptparse.append_combiner)
    op["extra-before"] = vcoptparse.IntFlag("--extra-before", 10)
    op["extra-between"] = vcoptparse.IntFlag("--extra-between", 10)
    op["extra-after"] = vcoptparse.IntFlag("--extra-after", 10)

    # `--workload-*` specifies a workload to run at some point in the scenario.
    # `--timeout-*` specifies the timeout to enforce for `--workload-*`.
    op["workload-before"] = vcoptparse.StringFlag("--workload-before", None)
    op["timeout-before"] = vcoptparse.IntFlag("--timeout-before", 600)
    if allow_between:
        op["workload-between"] = vcoptparse.StringFlag("--workload-between", None)
        op["timeout-between"] = vcoptparse.IntFlag("--timeout-between", 600)
    op["workload-after"] = vcoptparse.StringFlag("--workload-after", None)
    op["timeout-after"] = vcoptparse.IntFlag("--timeout-after", 600)
Example #2
0
    os.path.abspath(
        os.path.join(os.path.dirname(__file__), os.path.pardir, 'common')))
import driver, scenario_common, utils, vcoptparse

try:
    xrange
except NameError:
    xrange = range

# Don't allow someone to run this without unlimited size core files - which are really useful for debugging
assert resource.getrlimit(resource.RLIMIT_CORE)[0] == resource.RLIM_INFINITY

opts = vcoptparse.OptParser()
scenario_common.prepare_option_parser_mode_flags(opts)
opts['random-seed'] = vcoptparse.FloatFlag('--random-seed', random.random())
opts['servers'] = vcoptparse.IntFlag('--servers',
                                     1)  # Number of servers in the cluster
opts['duration'] = vcoptparse.IntFlag(
    '--duration', 900)  # Time to perform fuzzing in seconds
opts['progress'] = vcoptparse.BoolFlag(
    '--progress',
    False)  # Write messages every 10 seconds with the time remaining
opts['threads'] = vcoptparse.IntFlag(
    '--threads',
    16)  # Number of client threads to run (not counting changefeeds)
opts['changefeeds'] = vcoptparse.BoolFlag(
    '--changefeeds', False)  # Whether or not to use changefeeds
opts['kill'] = vcoptparse.BoolFlag(
    '--kill', False
)  # Randomly kill and revive servers during fuzzing - will produce a lot of noise
parsed_opts = opts.parse(sys.argv)
_, command_prefix, serve_options = scenario_common.parse_mode_flags(
Example #3
0
                if char == '-':
                    workingValue -= 1
                elif char == '+':
                    workingValue += 1
                else:
                    raise ValueError('Got a bad step value: %s' % repr(char))
                assert char in ('-', '+')
            returnValue += (workingValue, )
    return returnValue


op = vcoptparse.OptParser()
scenario_common.prepare_option_parser_mode_flags(op)
workload_runner.prepare_option_parser_for_split_or_continuous_workload(
    op, allow_between=True)
op["num-nodes"] = vcoptparse.IntFlag("--num-nodes", 3)
op["sequence"] = vcoptparse.ValueFlag("--sequence",
                                      converter=sequence_from_string,
                                      default=(2, 3))
opts = op.parse(sys.argv)
_, command_prefix, serve_options = scenario_common.parse_mode_flags(opts)


class Rebalance(rdb_unittest.RdbTestCase):
    '''Change the number of shards on a table.'''
    # keep the same number of replicas as nodes so we don't have to backfill constantly

    replicas = opts["num-nodes"]
    shards = 1

    server_command_prefix = command_prefix
Example #4
0
#!/usr/bin/env python
# Copyright 2015-2016 RethinkDB, all rights reserved.
'''Test that a backfill will resume after restarting a cluster'''

import os, pprint, sys, time

sys.path.append(
    os.path.abspath(
        os.path.join(os.path.dirname(__file__), os.path.pardir, 'common')))
import driver, scenario_common, utils, vcoptparse

op = vcoptparse.OptParser()
op["num_rows"] = vcoptparse.IntFlag("--num-rows", 50000)
scenario_common.prepare_option_parser_mode_flags(op)
opts = op.parse(sys.argv)
_, command_prefix, server_options = scenario_common.parse_mode_flags(opts)

r = utils.import_python_driver()
dbName, tableName = utils.get_test_db_table()
num_shards = 16

utils.print_with_time("Starting cluster of three servers")
with driver.Cluster(initial_servers=['source1', 'source2', 'target'],
                    output_folder='.',
                    console_output=True,
                    command_prefix=command_prefix,
                    extra_options=server_options) as cluster:
    source_a = cluster['source1']
    source_b = cluster['source2']
    target = cluster['target']
    conn = r.connect(host=source_a.host, port=source_a.driver_port)
Example #5
0
#!/usr/bin/env python
# Copyright 2010-2016 RethinkDB, all rights reserved.

import os, sys, time

sys.path.append(
    os.path.abspath(
        os.path.join(os.path.dirname(__file__), os.path.pardir, 'common')))
import driver, scenario_common, utils, vcoptparse, workload_runner

op = vcoptparse.OptParser()
scenario_common.prepare_option_parser_mode_flags(op)
op["workload1"] = vcoptparse.StringFlag("--workload-before", None)
op["workload2"] = vcoptparse.StringFlag("--workload-after", None)
op["timeout"] = vcoptparse.IntFlag("--timeout", 600)
opts = op.parse(sys.argv)
_, command_prefix, serve_options = scenario_common.parse_mode_flags(opts)

r = utils.import_python_driver()
dbName, tableName = utils.get_test_db_table()

utils.print_with_time("Starting cluster with one server")
with driver.Cluster(initial_servers=['first'],
                    output_folder='.',
                    command_prefix=command_prefix,
                    extra_options=serve_options,
                    wait_until_ready=True) as cluster:

    server1 = cluster[0]
    workload_ports1 = workload_runner.RDBPorts(host=server1.host,
                                               http_port=server1.http_port,
Example #6
0
startTime = time.time()

sys.path.append(
    os.path.abspath(
        os.path.join(os.path.dirname(__file__), os.path.pardir, 'common')))
import driver, scenario_common, utils, vcoptparse

try:
    xrange
except NameError:
    xrange = range

opts = vcoptparse.OptParser()
scenario_common.prepare_option_parser_mode_flags(opts)
opts['num-servers'] = vcoptparse.IntFlag('--num-servers', 2)
opts['num-tables'] = vcoptparse.IntFlag('--num-tables', 1)
opts['num-rows'] = vcoptparse.IntFlag('--num-rows', 10)
opts['num-shards'] = vcoptparse.IntFlag('--num-shards', 32)
opts['num-replicas'] = vcoptparse.IntFlag('--num-replicas', 1)
opts['num-phases'] = vcoptparse.IntFlag('--num-phases', 2)
parsed_opts = opts.parse(sys.argv)
_, command_prefix, serve_options = scenario_common.parse_mode_flags(
    parsed_opts)

possible_server_names = \
    list(string.ascii_lowercase) + \
    [x + y for x in string.ascii_lowercase for y in string.ascii_lowercase]
assert parsed_opts["num-servers"] <= len(possible_server_names)
server_names = possible_server_names[:parsed_opts["num-servers"]]
Example #7
0
#!/usr/bin/env python
# Copyright 2010-2015 RethinkDB, all rights reserved.

import os, sys

sys.path.append(
    os.path.abspath(
        os.path.join(os.path.dirname(__file__), os.path.pardir, 'common')))
import driver, rdb_unittest, scenario_common, utils, vcoptparse, workload_runner

op = vcoptparse.OptParser()
scenario_common.prepare_option_parser_mode_flags(op)
op["use-proxy"] = vcoptparse.BoolFlag("--use-proxy")
op["num-shards"] = vcoptparse.IntFlag("--num-shards", 2)
op["workload"] = vcoptparse.PositionalArg()
op["timeout"] = vcoptparse.IntFlag("--timeout", 1200)
opts = op.parse(sys.argv)
_, command_prefix, serve_options = scenario_common.parse_mode_flags(opts)


class StaticCluster(rdb_unittest.RdbTestCase):
    '''Run a workload on an unchanging cluster'''

    shards = opts["num-shards"]

    server_command_prefix = command_prefix
    server_extra_options = serve_options

    def test_workload(self):

        workloadServer = self.cluster[0]
Example #8
0
startTime = time.time()

sys.path.append(
    os.path.abspath(
        os.path.join(os.path.dirname(__file__), os.path.pardir, 'common')))
import driver, scenario_common, utils, vcoptparse

try:
    xrange
except NameError:
    xrange = range

opts = vcoptparse.OptParser()
scenario_common.prepare_option_parser_mode_flags(opts)
opts['random-seed'] = vcoptparse.FloatFlag('--random-seed', random.random())
opts['num-tables'] = vcoptparse.IntFlag('--num-tables',
                                        6)  # Number of tables to create
opts['table-scale'] = vcoptparse.IntFlag('--table-scale',
                                         7)  # Factor of increasing table size
opts['duration'] = vcoptparse.IntFlag(
    '--duration', 120)  # Time to perform fuzzing in seconds
opts['ignore-timeouts'] = vcoptparse.BoolFlag(
    '--ignore-timeouts')  # Ignore table_wait timeouts and continue
opts['progress'] = vcoptparse.BoolFlag(
    '--progress')  # Write messages every 10 seconds with the time remaining
parsed_opts = opts.parse(sys.argv)
_, command_prefix, serve_options = scenario_common.parse_mode_flags(
    parsed_opts)

r = utils.import_python_driver()
dbName, tableName = utils.get_test_db_table()