def test_regular_operation(self):
    # Use a dedicated worker to run all vtworker commands.
    worker_proc, _, worker_rpc_port = utils.run_vtworker_bg(
        ['--cell', 'test_nj'],
        auto_log=True)
    vtworker_endpoint = "localhost:" + str(worker_rpc_port)

    automation_server_proc, automation_server_port = utils.run_automation_server()

    keyspace = 'test_keyspace'
    source_shard_list = '0'
    dest_shard_list = '-80,80-'
    _, vtctld_endpoint = utils.vtctld.rpc_endpoint()
    utils.run(environment.binary_argstr('automation_client') +
              ' --server localhost:' + str(automation_server_port) +
              ' --task HorizontalReshardingTask' +
              ' --param keyspace=' + keyspace +
              ' --param source_shard_list=' + source_shard_list +
              ' --param dest_shard_list=' + dest_shard_list +
              ' --param source_shard_rdonly_list=' +
              worker.shard_rdonly1.tablet_alias +
              ' --param dest_shard_rdonly_list=' +
              worker.shard_0_rdonly1.tablet_alias + ',' +
              worker.shard_1_rdonly1.tablet_alias +
              ' --param vtctld_endpoint=' + vtctld_endpoint +
              ' --param vtworker_endpoint=' + vtworker_endpoint)

    self.assert_shard_data_equal(0, worker.shard_master,
                                 worker.shard_0_tablets.replica)
    self.assert_shard_data_equal(1, worker.shard_master,
                                 worker.shard_1_tablets.replica)

    utils.kill_sub_process(automation_server_proc, soft=True)
    utils.kill_sub_process(worker_proc, soft=True)
    def test_regular_operation(self):
        # Use a dedicated worker to run all vtworker commands.
        worker_proc, _, worker_rpc_port = utils.run_vtworker_bg(["--cell", "test_nj"], auto_log=True)
        vtworker_endpoint = "localhost:" + str(worker_rpc_port)

        automation_server_proc, automation_server_port = utils.run_automation_server()

        source_shard_list = "0"
        dest_shard_list = "-80,80-"
        _, vtctld_endpoint = utils.vtctld.rpc_endpoint()
        utils.run(
            environment.binary_argstr("automation_client")
            + " --server localhost:"
            + str(automation_server_port)
            + " --task HorizontalReshardingTask"
            + " --param keyspace="
            + self.KEYSPACE
            + " --param source_shard_list="
            + source_shard_list
            + " --param dest_shard_list="
            + dest_shard_list
            + " --param vtctld_endpoint="
            + vtctld_endpoint
            + " --param vtworker_endpoint="
            + vtworker_endpoint
            + " --param min_healthy_rdonly_tablets=1"
        )

        self.verify()

        utils.kill_sub_process(automation_server_proc, soft=True)
        utils.kill_sub_process(worker_proc, soft=True)
Пример #3
0
    def test_regular_operation(self):
        # Use a dedicated worker to run all vtworker commands.
        worker_proc, _, worker_rpc_port = utils.run_vtworker_bg(
            ['--cell', 'test_nj'], auto_log=True)
        vtworker_endpoint = 'localhost:' + str(worker_rpc_port)

        automation_server_proc, automation_server_port = (
            utils.run_automation_server())

        source_shard_list = '0'
        dest_shard_list = '-80,80-'
        _, vtctld_endpoint = utils.vtctld.rpc_endpoint()
        utils.run(
            environment.binary_argstr('automation_client') +
            ' --server localhost:' + str(automation_server_port) +
            ' --task HorizontalReshardingTask' + ' --param keyspace=' +
            self.KEYSPACE + ' --param source_shard_list=' + source_shard_list +
            ' --param dest_shard_list=' + dest_shard_list +
            ' --param vtctld_endpoint=' + vtctld_endpoint +
            ' --param vtworker_endpoint=' + vtworker_endpoint +
            ' --param min_healthy_rdonly_tablets=1')

        self.verify()

        utils.kill_sub_process(automation_server_proc, soft=True)
        utils.kill_sub_process(worker_proc, soft=True)
  def test_regular_operation(self):
    # Use a dedicated worker to run all vtworker commands.
    worker_proc, _, worker_rpc_port = utils.run_vtworker_bg(
        ['--cell', 'test_nj'],
        auto_log=True)
    vtworker_endpoint = 'localhost:' + str(worker_rpc_port)

    automation_server_proc, automation_server_port = (
        utils.run_automation_server())

    source_shard_list = '0'
    dest_shard_list = '-80,80-'
    _, vtctld_endpoint = utils.vtctld.rpc_endpoint()
    utils.run(
        environment.binary_argstr('automation_client') +
        ' --server localhost:' + str(automation_server_port) +
        ' --task HorizontalReshardingTask' +
        ' --param keyspace=' + self.KEYSPACE +
        ' --param source_shard_list=' + source_shard_list +
        ' --param dest_shard_list=' + dest_shard_list +
        ' --param vtctld_endpoint=' + vtctld_endpoint +
        ' --param vtworker_endpoint=' + vtworker_endpoint +
        ' --param min_healthy_rdonly_endpoints=1')

    self.verify()

    utils.kill_sub_process(automation_server_proc, soft=True)
    utils.kill_sub_process(worker_proc, soft=True)
Пример #5
0
    def test_regular_operation(self):
        # Use a dedicated worker to run all vtworker commands.
        worker_proc, _, worker_rpc_port = utils.run_vtworker_bg(
            ['--cell', 'test_nj'], auto_log=True)
        vtworker_endpoint = 'localhost:' + str(worker_rpc_port)

        automation_server_proc, automation_server_port = (
            utils.run_automation_server())

        keyspace = 'test_keyspace'
        source_shard_list = '0'
        dest_shard_list = '-80,80-'
        _, vtctld_endpoint = utils.vtctld.rpc_endpoint()
        utils.run(
            environment.binary_argstr('automation_client') +
            ' --server localhost:' + str(automation_server_port) +
            ' --task HorizontalReshardingTask' + ' --param keyspace=' +
            keyspace + ' --param source_shard_list=' + source_shard_list +
            ' --param dest_shard_list=' + dest_shard_list +
            ' --param vtctld_endpoint=' + vtctld_endpoint +
            ' --param vtworker_endpoint=' + vtworker_endpoint)

        self.assert_shard_data_equal(0, worker.shard_master,
                                     worker.shard_0_tablets.replica)
        self.assert_shard_data_equal(1, worker.shard_master,
                                     worker.shard_1_tablets.replica)

        utils.kill_sub_process(automation_server_proc, soft=True)
        utils.kill_sub_process(worker_proc, soft=True)
    def test_vertical_split(self):
        # Use a dedicated worker to run all vtworker commands.
        worker_proc, _, worker_rpc_port = utils.run_vtworker_bg(
            ['--cell', 'test_nj'], auto_log=True)
        vtworker_endpoint = 'localhost:' + str(worker_rpc_port)

        automation_server_proc, automation_server_port = (
            utils.run_automation_server())

        _, vtctld_endpoint = utils.vtctld.rpc_endpoint()
        params = {
            'source_keyspace': 'source_keyspace',
            'dest_keyspace': 'destination_keyspace',
            'shard_list': '0',
            'tables': 'moving.*,view1',
            'vtctld_endpoint': vtctld_endpoint,
            'vtworker_endpoint': vtworker_endpoint,
        }
        args = [
            '--server', 'localhost:' + str(automation_server_port), '--task',
            'VerticalSplitTask'
        ]
        args.extend(['--param=' + k + '=' + v for k, v in params.items()])
        utils.run(environment.binary_args('automation_client') + args)

        # One of the two source rdonly tablets went spare after the diff.
        # Force a healthcheck on both to get them back to "rdonly".
        for t in [
                vertical_split.source_rdonly1, vertical_split.source_rdonly2
        ]:
            utils.run_vtctl(['RunHealthCheck', t.tablet_alias])

        self._check_srv_keyspace('')
        self._check_blacklisted_tables(vertical_split.source_master,
                                       ['moving.*', 'view1'])
        self._check_blacklisted_tables(vertical_split.source_replica,
                                       ['moving.*', 'view1'])
        self._check_blacklisted_tables(vertical_split.source_rdonly1,
                                       ['moving.*', 'view1'])
        self._check_blacklisted_tables(vertical_split.source_rdonly2,
                                       ['moving.*', 'view1'])

        # check the binlog player is gone now
        vertical_split.destination_master.wait_for_binlog_player_count(0)

        utils.kill_sub_process(automation_server_proc, soft=True)
        utils.kill_sub_process(worker_proc, soft=True)
Пример #7
0
  def test_vertical_split(self):
    # Use a dedicated worker to run all vtworker commands.
    worker_proc, _, worker_rpc_port = utils.run_vtworker_bg(
        ['--cell', 'test_nj'],
        auto_log=True)
    vtworker_endpoint = 'localhost:' + str(worker_rpc_port)

    automation_server_proc, automation_server_port = (
        utils.run_automation_server())

    _, vtctld_endpoint = utils.vtctld.rpc_endpoint()
    params = {'source_keyspace': 'source_keyspace',
              'dest_keyspace': 'destination_keyspace',
              'shard_list': '0',
              'tables': 'moving.*,view1',
              'vtctld_endpoint': vtctld_endpoint,
              'vtworker_endpoint': vtworker_endpoint,
             }
    args = ['--server', 'localhost:' + str(automation_server_port),
            '--task', 'VerticalSplitTask']
    args.extend(['--param=' + k + '=' + v for k, v in params.items()])
    utils.run(environment.binary_args('automation_client') + args)

    # One of the two source rdonly tablets went spare after the diff.
    # Force a healthcheck on both to get them back to "rdonly".
    for t in [vertical_split.source_rdonly1, vertical_split.source_rdonly2]:
      utils.run_vtctl(['RunHealthCheck', t.tablet_alias])

    self._check_srv_keyspace('')
    self._check_blacklisted_tables(vertical_split.source_master,
                                   ['moving.*', 'view1'])
    self._check_blacklisted_tables(vertical_split.source_replica,
                                   ['moving.*', 'view1'])
    self._check_blacklisted_tables(vertical_split.source_rdonly1,
                                   ['moving.*', 'view1'])
    self._check_blacklisted_tables(vertical_split.source_rdonly2,
                                   ['moving.*', 'view1'])

    # check the binlog player is gone now
    vertical_split.destination_master.wait_for_binlog_player_count(0)

    utils.kill_sub_process(automation_server_proc, soft=True)
    utils.kill_sub_process(worker_proc, soft=True)