зеркало из https://github.com/github/vitess-gh.git
Родитель
d1bb0de397
Коммит
5284db3788
|
@ -31,7 +31,7 @@ import (
|
|||
topodatapb "github.com/youtube/vitess/go/vt/proto/topodata"
|
||||
)
|
||||
|
||||
var useV3ReshardingMode = flag.Bool("binlog_use_v3_resharding_mode", false, "True iff the binlog streamer should use V3-style sharding, which doesn't require a preset sharding key column.")
|
||||
var useV3ReshardingMode = flag.Bool("binlog_use_v3_resharding_mode", true, "True iff the binlog streamer should use V3-style sharding, which doesn't require a preset sharding key column.")
|
||||
|
||||
// keyspaceIDResolver is constructed for a tableMap entry in RBR. It
|
||||
// is used for each row, and passed in the value used for figuring out
|
||||
|
|
|
@ -51,7 +51,7 @@ var (
|
|||
retryDuration = flag.Duration("retry_duration", 2*time.Hour, "Amount of time we wait before giving up on a retryable action (e.g. write to destination, waiting for healthy tablets)")
|
||||
executeFetchRetryTime = flag.Duration("executefetch_retry_time", 30*time.Second, "Amount of time we should wait before retrying ExecuteFetch calls")
|
||||
remoteActionsTimeout = flag.Duration("remote_actions_timeout", time.Minute, "Amount of time to wait for remote actions (like replication stop, ...)")
|
||||
useV3ReshardingMode = flag.Bool("use_v3_resharding_mode", false, "True iff the workers should use V3-style resharding, which doesn't require a preset sharding key column.")
|
||||
useV3ReshardingMode = flag.Bool("use_v3_resharding_mode", true, "True iff the workers should use V3-style resharding, which doesn't require a preset sharding key column.")
|
||||
|
||||
healthCheckTopologyRefresh = flag.Duration("worker_healthcheck_topology_refresh", 30*time.Second, "refresh interval for re-reading the topology")
|
||||
healthcheckRetryDelay = flag.Duration("worker_healthcheck_retry_delay", 5*time.Second, "delay before retrying a failed healthcheck")
|
||||
|
|
|
@ -106,6 +106,7 @@ def setUpModule():
|
|||
# both have the full keyrange. Happens to work correctly).
|
||||
logging.debug('Running the clone worker to start binlog stream...')
|
||||
utils.run_vtworker(['--cell', 'test_nj',
|
||||
'--use_v3_resharding_mode=false',
|
||||
'SplitClone',
|
||||
'--chunk_count', '10',
|
||||
'--min_rows_per_chunk', '1',
|
||||
|
|
|
@ -48,7 +48,7 @@ class TestHorizontalReshardingWorkflow(worker.TestBaseSplitClone):
|
|||
def test_successful_resharding(self):
|
||||
"""Reshard from 1 to 2 shards by running the workflow."""
|
||||
worker_proc, _, worker_rpc_port = utils.run_vtworker_bg(
|
||||
['--cell', 'test_nj'], auto_log=True)
|
||||
['--cell', 'test_nj', '--use_v3_resharding_mode=false'], auto_log=True)
|
||||
vtworker_endpoint = 'localhost:%d' % worker_rpc_port
|
||||
|
||||
stdout = utils.run_vtctl(['WorkflowCreate', 'horizontal_resharding',
|
||||
|
|
|
@ -240,9 +240,12 @@ index by_msg (msg)
|
|||
for t in [shard_master, shard_replica, shard_rdonly1]:
|
||||
t.create_db('vt_test_keyspace')
|
||||
|
||||
shard_master.start_vttablet(wait_for_state=None)
|
||||
shard_replica.start_vttablet(wait_for_state=None)
|
||||
shard_rdonly1.start_vttablet(wait_for_state=None)
|
||||
shard_master.start_vttablet(wait_for_state=None,
|
||||
binlog_use_v3_resharding_mode=False)
|
||||
shard_replica.start_vttablet(wait_for_state=None,
|
||||
binlog_use_v3_resharding_mode=False)
|
||||
shard_rdonly1.start_vttablet(wait_for_state=None,
|
||||
binlog_use_v3_resharding_mode=False)
|
||||
|
||||
for t in [shard_master, shard_replica, shard_rdonly1]:
|
||||
t.wait_for_vttablet_state('NOT_SERVING')
|
||||
|
@ -344,7 +347,8 @@ index by_msg (msg)
|
|||
for t in [shard_0_master, shard_0_replica, shard_0_rdonly1,
|
||||
shard_1_master, shard_1_replica, shard_1_rdonly1]:
|
||||
t.create_db('vt_test_keyspace')
|
||||
t.start_vttablet(wait_for_state=None)
|
||||
t.start_vttablet(wait_for_state=None,
|
||||
binlog_use_v3_resharding_mode=False)
|
||||
|
||||
for t in [shard_0_master, shard_0_replica, shard_0_rdonly1,
|
||||
shard_1_master, shard_1_replica, shard_1_rdonly1]:
|
||||
|
@ -460,7 +464,8 @@ index by_msg (msg)
|
|||
|
||||
# Run vtworker as daemon for the following SplitClone commands.
|
||||
worker_proc, worker_port, worker_rpc_port = utils.run_vtworker_bg(
|
||||
['--cell', 'test_nj', '--command_display_interval', '10ms'],
|
||||
['--cell', 'test_nj', '--command_display_interval', '10ms',
|
||||
'--use_v3_resharding_mode=false'],
|
||||
auto_log=True)
|
||||
|
||||
# Initial clone (online).
|
||||
|
@ -549,13 +554,17 @@ index by_msg (msg)
|
|||
logging.debug('Running vtworker SplitDiff for -80')
|
||||
for t in [shard_0_rdonly1, shard_1_rdonly1]:
|
||||
utils.run_vtctl(['RunHealthCheck', t.tablet_alias])
|
||||
utils.run_vtworker(['-cell', 'test_nj', 'SplitDiff',
|
||||
utils.run_vtworker(['-cell', 'test_nj',
|
||||
'--use_v3_resharding_mode=false',
|
||||
'SplitDiff',
|
||||
'--min_healthy_rdonly_tablets', '1',
|
||||
'test_keyspace/-80'],
|
||||
auto_log=True)
|
||||
|
||||
logging.debug('Running vtworker SplitDiff for 80-')
|
||||
utils.run_vtworker(['-cell', 'test_nj', 'SplitDiff',
|
||||
utils.run_vtworker(['-cell', 'test_nj',
|
||||
'--use_v3_resharding_mode=false',
|
||||
'SplitDiff',
|
||||
'--min_healthy_rdonly_tablets', '1',
|
||||
'test_keyspace/80-'],
|
||||
auto_log=True)
|
||||
|
|
|
@ -285,7 +285,8 @@ primary key (name)
|
|||
shard_1_master, shard_1_slave1, shard_1_slave2, shard_1_ny_rdonly,
|
||||
shard_1_rdonly1]:
|
||||
t.create_db('vt_test_keyspace')
|
||||
t.start_vttablet(wait_for_state=None, full_mycnf_args=full_mycnf_args)
|
||||
t.start_vttablet(wait_for_state=None, full_mycnf_args=full_mycnf_args,
|
||||
binlog_use_v3_resharding_mode=False)
|
||||
|
||||
# wait for the tablets (replication is not setup, they won't be healthy)
|
||||
for t in [shard_0_master, shard_0_replica, shard_0_ny_rdonly,
|
||||
|
@ -326,11 +327,14 @@ primary key (name)
|
|||
|
||||
# start vttablet on the split shards (no db created,
|
||||
# so they're all not serving)
|
||||
shard_2_master.start_vttablet(wait_for_state=None)
|
||||
shard_3_master.start_vttablet(wait_for_state=None)
|
||||
shard_2_master.start_vttablet(wait_for_state=None,
|
||||
binlog_use_v3_resharding_mode=False)
|
||||
shard_3_master.start_vttablet(wait_for_state=None,
|
||||
binlog_use_v3_resharding_mode=False)
|
||||
for t in [shard_2_replica1, shard_2_replica2,
|
||||
shard_3_replica, shard_3_rdonly1]:
|
||||
t.start_vttablet(wait_for_state=None)
|
||||
t.start_vttablet(wait_for_state=None,
|
||||
binlog_use_v3_resharding_mode=False)
|
||||
for t in [shard_2_master, shard_2_replica1, shard_2_replica2,
|
||||
shard_3_master, shard_3_replica, shard_3_rdonly1]:
|
||||
t.wait_for_vttablet_state('NOT_SERVING')
|
||||
|
@ -372,6 +376,7 @@ primary key (name)
|
|||
# the rate limit is set very high.
|
||||
utils.run_vtworker(['--cell', 'test_nj',
|
||||
'--command_display_interval', '10ms',
|
||||
'--use_v3_resharding_mode=false',
|
||||
'LegacySplitClone',
|
||||
'--exclude_tables', 'unrelated',
|
||||
'--min_healthy_rdonly_tablets', '1',
|
||||
|
@ -428,7 +433,9 @@ primary key (name)
|
|||
# rdonly tablets so discovery works)
|
||||
utils.run_vtctl(['RunHealthCheck', shard_3_rdonly1.tablet_alias])
|
||||
logging.debug('Running vtworker SplitDiff')
|
||||
utils.run_vtworker(['-cell', 'test_nj', 'SplitDiff',
|
||||
utils.run_vtworker(['-cell', 'test_nj',
|
||||
'--use_v3_resharding_mode=false',
|
||||
'SplitDiff',
|
||||
'--exclude_tables', 'unrelated',
|
||||
'--min_healthy_rdonly_tablets', '1',
|
||||
'test_keyspace/c0-'],
|
||||
|
@ -570,7 +577,9 @@ primary key (name)
|
|||
|
||||
# use vtworker to compare the data again
|
||||
logging.debug('Running vtworker SplitDiff')
|
||||
utils.run_vtworker(['-cell', 'test_nj', 'SplitDiff',
|
||||
utils.run_vtworker(['-cell', 'test_nj',
|
||||
'--use_v3_resharding_mode=false',
|
||||
'SplitDiff',
|
||||
'--exclude_tables', 'unrelated',
|
||||
'--min_healthy_rdonly_tablets', '1',
|
||||
'test_keyspace/c0-'],
|
||||
|
|
|
@ -209,7 +209,8 @@ index by_msg (msg)
|
|||
shard_1_master, shard_1_replica, shard_1_rdonly,
|
||||
shard_2_master, shard_2_replica, shard_2_rdonly]:
|
||||
t.create_db('vt_test_keyspace')
|
||||
t.start_vttablet(wait_for_state=None)
|
||||
t.start_vttablet(wait_for_state=None,
|
||||
binlog_use_v3_resharding_mode=False)
|
||||
|
||||
# won't be serving, no replication state
|
||||
for t in [shard_0_master, shard_0_replica, shard_0_rdonly,
|
||||
|
@ -244,7 +245,8 @@ index by_msg (msg)
|
|||
# start vttablet on the destination shard (no db created,
|
||||
# so they're all not serving)
|
||||
for t in [shard_dest_master, shard_dest_replica, shard_dest_rdonly]:
|
||||
t.start_vttablet(wait_for_state=None)
|
||||
t.start_vttablet(wait_for_state=None,
|
||||
binlog_use_v3_resharding_mode=False)
|
||||
for t in [shard_dest_master, shard_dest_replica, shard_dest_rdonly]:
|
||||
t.wait_for_vttablet_state('NOT_SERVING')
|
||||
|
||||
|
@ -268,7 +270,8 @@ index by_msg (msg)
|
|||
# copy the data (will also start filtered replication), reset source
|
||||
# Run vtworker as daemon for the following SplitClone commands.
|
||||
worker_proc, worker_port, worker_rpc_port = utils.run_vtworker_bg(
|
||||
['--cell', 'test_nj', '--command_display_interval', '10ms'],
|
||||
['--cell', 'test_nj', '--command_display_interval', '10ms',
|
||||
'--use_v3_resharding_mode=false'],
|
||||
auto_log=True)
|
||||
|
||||
# Initial clone (online).
|
||||
|
@ -358,7 +361,9 @@ index by_msg (msg)
|
|||
# rdonly tablets so discovery works)
|
||||
utils.run_vtctl(['RunHealthCheck', shard_dest_rdonly.tablet_alias])
|
||||
logging.debug('Running vtworker SplitDiff on first half')
|
||||
utils.run_vtworker(['-cell', 'test_nj', 'SplitDiff',
|
||||
utils.run_vtworker(['-cell', 'test_nj',
|
||||
'--use_v3_resharding_mode=false',
|
||||
'SplitDiff',
|
||||
'--exclude_tables', 'unrelated',
|
||||
'--min_healthy_rdonly_tablets', '1',
|
||||
'--source_uid', '0',
|
||||
|
@ -369,7 +374,9 @@ index by_msg (msg)
|
|||
utils.run_vtctl(['ChangeSlaveType', shard_dest_rdonly.tablet_alias,
|
||||
'rdonly'], auto_log=True)
|
||||
logging.debug('Running vtworker SplitDiff on second half')
|
||||
utils.run_vtworker(['-cell', 'test_nj', 'SplitDiff',
|
||||
utils.run_vtworker(['-cell', 'test_nj',
|
||||
'--use_v3_resharding_mode=false',
|
||||
'SplitDiff',
|
||||
'--exclude_tables', 'unrelated',
|
||||
'--min_healthy_rdonly_tablets', '1',
|
||||
'--source_uid', '1',
|
||||
|
|
|
@ -472,7 +472,8 @@ primary key (name)
|
|||
shard_1_master, shard_1_slave1, shard_1_slave2, shard_1_ny_rdonly,
|
||||
shard_1_rdonly1]:
|
||||
t.create_db('vt_test_keyspace')
|
||||
t.start_vttablet(wait_for_state=None, full_mycnf_args=full_mycnf_args)
|
||||
t.start_vttablet(wait_for_state=None, full_mycnf_args=full_mycnf_args,
|
||||
binlog_use_v3_resharding_mode=False)
|
||||
|
||||
# wait for the tablets (replication is not setup, they won't be healthy)
|
||||
for t in [shard_0_master, shard_0_replica, shard_0_ny_rdonly,
|
||||
|
@ -514,11 +515,14 @@ primary key (name)
|
|||
|
||||
# start vttablet on the split shards (no db created,
|
||||
# so they're all not serving)
|
||||
shard_2_master.start_vttablet(wait_for_state=None)
|
||||
shard_3_master.start_vttablet(wait_for_state=None)
|
||||
shard_2_master.start_vttablet(wait_for_state=None,
|
||||
binlog_use_v3_resharding_mode=False)
|
||||
shard_3_master.start_vttablet(wait_for_state=None,
|
||||
binlog_use_v3_resharding_mode=False)
|
||||
for t in [shard_2_replica1, shard_2_replica2, shard_2_rdonly1,
|
||||
shard_3_replica, shard_3_rdonly1]:
|
||||
t.start_vttablet(wait_for_state=None)
|
||||
t.start_vttablet(wait_for_state=None,
|
||||
binlog_use_v3_resharding_mode=False)
|
||||
for t in [shard_2_master, shard_2_replica1, shard_2_replica2,
|
||||
shard_2_rdonly1,
|
||||
shard_3_master, shard_3_replica, shard_3_rdonly1]:
|
||||
|
@ -558,7 +562,8 @@ primary key (name)
|
|||
|
||||
# Run vtworker as daemon for the following SplitClone commands.
|
||||
worker_proc, worker_port, worker_rpc_port = utils.run_vtworker_bg(
|
||||
['--cell', 'test_nj', '--command_display_interval', '10ms'],
|
||||
['--cell', 'test_nj', '--command_display_interval', '10ms',
|
||||
'--use_v3_resharding_mode=false'],
|
||||
auto_log=True)
|
||||
|
||||
# Copy the data from the source to the destination shards.
|
||||
|
@ -734,7 +739,9 @@ primary key (name)
|
|||
# rdonly tablets so discovery works)
|
||||
utils.run_vtctl(['RunHealthCheck', shard_3_rdonly1.tablet_alias])
|
||||
logging.debug('Running vtworker SplitDiff')
|
||||
utils.run_vtworker(['-cell', 'test_nj', 'SplitDiff',
|
||||
utils.run_vtworker(['-cell', 'test_nj',
|
||||
'--use_v3_resharding_mode=false',
|
||||
'SplitDiff',
|
||||
'--exclude_tables', 'unrelated',
|
||||
'--min_healthy_rdonly_tablets', '1',
|
||||
'test_keyspace/c0-'],
|
||||
|
@ -908,7 +915,9 @@ primary key (name)
|
|||
|
||||
# use vtworker to compare the data again
|
||||
logging.debug('Running vtworker SplitDiff')
|
||||
utils.run_vtworker(['-cell', 'test_nj', 'SplitDiff',
|
||||
utils.run_vtworker(['-cell', 'test_nj',
|
||||
'--use_v3_resharding_mode=false',
|
||||
'SplitDiff',
|
||||
'--exclude_tables', 'unrelated',
|
||||
'--min_healthy_rdonly_tablets', '1',
|
||||
'test_keyspace/c0-'],
|
||||
|
|
|
@ -472,6 +472,7 @@ class Tablet(object):
|
|||
# TODO(mberlin): Assign the index automatically and remove this parameter.
|
||||
tablet_index=None,
|
||||
init_db_name_override=None,
|
||||
binlog_use_v3_resharding_mode=True,
|
||||
supports_backups=True, grace_period='1s', enable_semi_sync=True):
|
||||
# pylint: disable=g-doc-args
|
||||
"""Starts a vttablet process, and returns it.
|
||||
|
@ -561,6 +562,10 @@ class Tablet(object):
|
|||
else:
|
||||
self.dbname = 'vt_' + init_keyspace
|
||||
|
||||
# Default value for this flag is True. So, add it only if it's false.
|
||||
if not binlog_use_v3_resharding_mode:
|
||||
args.extend(['-binlog_use_v3_resharding_mode=false'])
|
||||
|
||||
if supports_backups:
|
||||
args.extend(['-restore_from_backup'] + get_backup_storage_flags())
|
||||
|
||||
|
|
|
@ -415,6 +415,7 @@ msg varchar(64)
|
|||
|
||||
utils.run_vtworker(['--cell', 'test_nj',
|
||||
'--command_display_interval', '10ms',
|
||||
'--use_v3_resharding_mode=false',
|
||||
'VerticalSplitClone',
|
||||
'--tables', '/moving/,view1',
|
||||
'--chunk_count', '10',
|
||||
|
@ -455,7 +456,9 @@ msg varchar(64)
|
|||
|
||||
# use vtworker to compare the data
|
||||
logging.debug('Running vtworker VerticalSplitDiff')
|
||||
utils.run_vtworker(['-cell', 'test_nj', 'VerticalSplitDiff',
|
||||
utils.run_vtworker(['-cell', 'test_nj',
|
||||
'--use_v3_resharding_mode=false',
|
||||
'VerticalSplitDiff',
|
||||
'--min_healthy_rdonly_tablets', '1',
|
||||
'destination_keyspace/0'], auto_log=True)
|
||||
|
||||
|
|
|
@ -195,15 +195,18 @@ class TestBaseSplitClone(unittest.TestCase, base_sharding.BaseShardingTest):
|
|||
# NOTE: The future master has to be started with type 'replica'.
|
||||
shard_tablets.master.start_vttablet(
|
||||
wait_for_state=None, init_tablet_type='replica',
|
||||
init_keyspace='test_keyspace', init_shard=shard_name)
|
||||
init_keyspace='test_keyspace', init_shard=shard_name,
|
||||
binlog_use_v3_resharding_mode=False)
|
||||
for t in shard_tablets.replicas:
|
||||
t.start_vttablet(
|
||||
wait_for_state=None, init_tablet_type='replica',
|
||||
init_keyspace='test_keyspace', init_shard=shard_name)
|
||||
init_keyspace='test_keyspace', init_shard=shard_name,
|
||||
binlog_use_v3_resharding_mode=False)
|
||||
for t in shard_tablets.rdonlys:
|
||||
t.start_vttablet(
|
||||
wait_for_state=None, init_tablet_type='rdonly',
|
||||
init_keyspace='test_keyspace', init_shard=shard_name)
|
||||
init_keyspace='test_keyspace', init_shard=shard_name,
|
||||
binlog_use_v3_resharding_mode=False)
|
||||
|
||||
# Block until tablets are up and we can enable replication.
|
||||
# All tables should be NOT_SERVING until we run InitShardMaster.
|
||||
|
@ -358,7 +361,9 @@ class TestBaseSplitClone(unittest.TestCase, base_sharding.BaseShardingTest):
|
|||
_ = source_tablets, destination_tablets
|
||||
logging.debug('Running vtworker SplitDiff for %s', keyspace_shard)
|
||||
_, _ = utils.run_vtworker(
|
||||
['-cell', 'test_nj', 'SplitDiff',
|
||||
['-cell', 'test_nj',
|
||||
'--use_v3_resharding_mode=false',
|
||||
'SplitDiff',
|
||||
'--min_healthy_rdonly_tablets', '1',
|
||||
keyspace_shard], auto_log=True)
|
||||
|
||||
|
@ -450,7 +455,7 @@ class TestBaseSplitCloneResiliency(TestBaseSplitClone):
|
|||
shard_1_master.shutdown_mysql()])
|
||||
|
||||
worker_proc, worker_port, worker_rpc_port = utils.run_vtworker_bg(
|
||||
['--cell', 'test_nj'],
|
||||
['--cell', 'test_nj', '--use_v3_resharding_mode=false'],
|
||||
auto_log=True)
|
||||
|
||||
# --max_tps is only specified to enable the throttler and ensure that the
|
||||
|
@ -557,7 +562,9 @@ class TestBaseSplitCloneResiliency(TestBaseSplitClone):
|
|||
utils.wait_for_replication_pos(shard_0_replica, shard_0_rdonly1)
|
||||
utils.wait_for_replication_pos(shard_1_replica, shard_1_rdonly1)
|
||||
# Run final offline clone to enable filtered replication.
|
||||
_, _ = utils.run_vtworker(['-cell', 'test_nj', 'SplitClone',
|
||||
_, _ = utils.run_vtworker(['-cell', 'test_nj',
|
||||
'--use_v3_resharding_mode=false',
|
||||
'SplitClone',
|
||||
'--online=false',
|
||||
'--min_healthy_rdonly_tablets', '1',
|
||||
'test_keyspace/0'], auto_log=True)
|
||||
|
@ -659,6 +666,7 @@ class TestMinHealthyRdonlyTablets(TestBaseSplitCloneResiliency):
|
|||
_, stderr = utils.run_vtworker(
|
||||
['-cell', 'test_nj',
|
||||
'--wait_for_healthy_rdonly_tablets_timeout', '1s',
|
||||
'--use_v3_resharding_mode=false',
|
||||
'SplitClone',
|
||||
'--min_healthy_rdonly_tablets', '2',
|
||||
'test_keyspace/0'],
|
||||
|
|
Загрузка…
Ссылка в новой задаче