зеркало из https://github.com/github/vitess-gh.git
Resetting replication at the beginning of tests.
So they are more predictable.
This commit is contained in:
Родитель
bea520579d
Коммит
72ba4115f5
|
@ -4,9 +4,6 @@
|
|||
# Use of this source code is governed by a BSD-style license that can
|
||||
# be found in the LICENSE file.
|
||||
|
||||
# FIXME(alainjobart) This test does not pass. It is a work in progress
|
||||
# for resharding.
|
||||
|
||||
import utils
|
||||
import tablet
|
||||
|
||||
|
@ -127,6 +124,8 @@ def run_test_resharding():
|
|||
shard_1_replica.start_vttablet()
|
||||
|
||||
# reparent to make the tablets work
|
||||
for t in [shard_0_master, shard_0_replica, shard_1_master, shard_1_replica]:
|
||||
t.reset_replication()
|
||||
utils.run_vtctl('ReparentShard -force test_keyspace/-80 ' + shard_0_master.tablet_alias, auto_log=True)
|
||||
utils.run_vtctl('ReparentShard -force test_keyspace/80- ' + shard_1_master.tablet_alias, auto_log=True)
|
||||
|
||||
|
|
|
@ -109,6 +109,9 @@ def run_test_complex_schema():
|
|||
shard_1_replica1.start_vttablet()
|
||||
|
||||
# make sure all replication is good
|
||||
for t in [shard_0_master, shard_0_replica1, shard_0_replica2,
|
||||
shard_0_rdonly, shard_0_backup, shard_1_master, shard_1_replica1]:
|
||||
t.reset_replication()
|
||||
utils.run_vtctl('ReparentShard -force test_keyspace/0 ' + shard_0_master.tablet_alias, auto_log=True)
|
||||
utils.run_vtctl('ReparentShard -force test_keyspace/1 ' + shard_1_master.tablet_alias, auto_log=True)
|
||||
utils.run_vtctl('ValidateKeyspace -ping-tablets test_keyspace')
|
||||
|
|
|
@ -213,6 +213,8 @@ def run_test_secure():
|
|||
})
|
||||
|
||||
# Reparent using SSL
|
||||
for t in [shard_0_master, shard_0_slave]:
|
||||
t.reset_replication()
|
||||
utils.run_vtctl('ReparentShard -force test_keyspace/0 ' + shard_0_master.tablet_alias, auto_log=True)
|
||||
|
||||
# then get the topology and check it
|
||||
|
|
|
@ -126,6 +126,8 @@ def run_test_sharding():
|
|||
# start zkocc, we'll use it later
|
||||
zkocc_server = utils.zkocc_start()
|
||||
|
||||
for t in [shard_0_master, shard_0_replica, shard_1_master, shard_1_replica]:
|
||||
t.reset_replication()
|
||||
utils.run_vtctl('ReparentShard -force test_keyspace/-80 ' + shard_0_master.tablet_alias, auto_log=True)
|
||||
utils.run_vtctl('ReparentShard -force test_keyspace/80- ' + shard_1_master.tablet_alias, auto_log=True)
|
||||
|
||||
|
|
|
@ -140,6 +140,14 @@ class Tablet(object):
|
|||
if result[0][0] != n:
|
||||
raise utils.TestError("expected %u rows in %s" % (n, table), result)
|
||||
|
||||
def reset_replication(self):
|
||||
self.mquery('', [
|
||||
'RESET MASTER',
|
||||
'STOP SLAVE',
|
||||
'RESET SLAVE',
|
||||
'CHANGE MASTER TO MASTER_HOST = ""',
|
||||
])
|
||||
|
||||
def populate(self, dbname, create_sql, insert_sqls=[]):
|
||||
self.create_db(dbname)
|
||||
if isinstance(create_sql, basestring):
|
||||
|
|
|
@ -665,6 +665,8 @@ def run_test_reparent_down_master():
|
|||
utils.validate_topology()
|
||||
|
||||
# Force the slaves to reparent assuming that all the datasets are identical.
|
||||
for t in [tablet_62344, tablet_62044, tablet_41983, tablet_31981]:
|
||||
t.reset_replication()
|
||||
utils.run_vtctl('ReparentShard -force test_keyspace/0 ' + tablet_62344.tablet_alias, auto_log=True)
|
||||
utils.validate_topology()
|
||||
|
||||
|
@ -763,6 +765,8 @@ def _run_test_reparent_graceful(shard_id):
|
|||
utils.validate_topology()
|
||||
|
||||
# Force the slaves to reparent assuming that all the datasets are identical.
|
||||
for t in [tablet_62344, tablet_62044, tablet_41983, tablet_31981]:
|
||||
t.reset_replication()
|
||||
utils.pause("force ReparentShard?")
|
||||
utils.run_vtctl('ReparentShard -force test_keyspace/%s %s' % (shard_id, tablet_62344.tablet_alias))
|
||||
utils.validate_topology(ping_tablets=True)
|
||||
|
@ -832,6 +836,8 @@ def run_test_reparent_slave_offline(shard_id='0'):
|
|||
utils.validate_topology()
|
||||
|
||||
# Force the slaves to reparent assuming that all the datasets are identical.
|
||||
for t in [tablet_62344, tablet_62044, tablet_41983, tablet_31981]:
|
||||
t.reset_replication()
|
||||
utils.run_vtctl('ReparentShard -force test_keyspace/%s %s' % (shard_id, tablet_62344.tablet_alias))
|
||||
utils.validate_topology(ping_tablets=True)
|
||||
|
||||
|
@ -864,10 +870,8 @@ def _run_test_reparent_from_outside(brutal=False):
|
|||
utils.run_vtctl('CreateKeyspace test_keyspace')
|
||||
|
||||
# create the database so vttablets start, as they are serving
|
||||
tablet_62344.create_db('vt_test_keyspace')
|
||||
tablet_62044.create_db('vt_test_keyspace')
|
||||
tablet_41983.create_db('vt_test_keyspace')
|
||||
tablet_31981.create_db('vt_test_keyspace')
|
||||
for t in [tablet_62344, tablet_62044, tablet_41983, tablet_31981]:
|
||||
t.create_db('vt_test_keyspace')
|
||||
|
||||
# Start up a master mysql and vttablet
|
||||
tablet_62344.init_tablet('master', 'test_keyspace', '0', start=True)
|
||||
|
@ -878,7 +882,9 @@ def _run_test_reparent_from_outside(brutal=False):
|
|||
tablet_31981.init_tablet('replica', 'test_keyspace', '0', start=True)
|
||||
|
||||
# Reparent as a starting point
|
||||
utils.run_vtctl('ReparentShard -force test_keyspace/0 %s' % tablet_62344.tablet_alias)
|
||||
for t in [tablet_62344, tablet_62044, tablet_41983, tablet_31981]:
|
||||
t.reset_replication()
|
||||
utils.run_vtctl('ReparentShard -force test_keyspace/0 %s' % tablet_62344.tablet_alias, auto_log=True)
|
||||
|
||||
# now manually reparent 1 out of 2 tablets
|
||||
# 62044 will be the new master
|
||||
|
@ -964,6 +970,8 @@ def run_test_reparent_lag_slave(shard_id='0'):
|
|||
utils.validate_topology()
|
||||
|
||||
# Force the slaves to reparent assuming that all the datasets are identical.
|
||||
for t in [tablet_62344, tablet_62044, tablet_41983, tablet_31981]:
|
||||
t.reset_replication()
|
||||
utils.run_vtctl('ReparentShard -force test_keyspace/%s %s' % (shard_id, tablet_62344.tablet_alias))
|
||||
utils.validate_topology(ping_tablets=True)
|
||||
|
||||
|
|
|
@ -99,6 +99,9 @@ class TestDbTopo(unittest.TestCase):
|
|||
|
||||
scrap.scrap()
|
||||
|
||||
for t in [shard_0_master, shard_0_replica, shard_0_spare,
|
||||
shard_1_master, shard_1_replica, idle, scrap]:
|
||||
t.reset_replication()
|
||||
utils.run_vtctl('ReparentShard -force test_keyspace/-80 ' + shard_0_master.tablet_alias, auto_log=True)
|
||||
utils.run_vtctl('ReparentShard -force test_keyspace/80- ' + shard_1_master.tablet_alias, auto_log=True)
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче