def run_test_rebuild(): utils.run_vtctl("CreateKeyspace -force test_keyspace") tablet_62344.init_tablet("master", "test_keyspace", "0") tablet_62044.init_tablet("replica", "test_keyspace", "0") tablet_31981.init_tablet("experimental", "test_keyspace", "0") # in ny by default utils.run_vtctl("RebuildKeyspaceGraph -cells=test_nj test_keyspace", auto_log=True) utils.run_fail(utils.vtroot + "/bin/zk cat /zk/test_ny/vt/ns/test_keyspace/0/master") utils.run_vtctl("RebuildKeyspaceGraph -cells=test_ny test_keyspace", auto_log=True) real_master = utils.zk_cat("/zk/test_nj/vt/ns/test_keyspace/0/master") master_alias = utils.zk_cat("/zk/test_ny/vt/ns/test_keyspace/0/master") if real_master != master_alias: raise utils.TestError("master serving graph in all cells failed:\n%s!=\n%s" % (real_master, master_alias))
def run_test_rebuild(): utils.run_vtctl('CreateKeyspace -force test_keyspace') tablet_62344.init_tablet('master', 'test_keyspace', '0') tablet_62044.init_tablet('replica', 'test_keyspace', '0') tablet_31981.init_tablet('experimental', 'test_keyspace', '0') # in ny by default utils.run_vtctl('RebuildKeyspaceGraph -cells=test_nj test_keyspace', auto_log=True) utils.run_fail(utils.vtroot+'/bin/zk cat /zk/test_ny/vt/ns/test_keyspace/0/master') utils.run_vtctl('RebuildKeyspaceGraph -cells=test_ny test_keyspace', auto_log=True) real_master = utils.zk_cat('/zk/test_nj/vt/ns/test_keyspace/0/master') master_alias = utils.zk_cat('/zk/test_ny/vt/ns/test_keyspace/0/master') if real_master != master_alias: raise utils.TestError('master serving graph in all cells failed:\n%s!=\n%s' % (real_master, master_alias))
def _run_test_vtctl_partial_clone(create, populate, start, end): utils.zk_wipe() # Start up a master mysql and vttablet utils.run_vtctl('CreateKeyspace -force snapshot_test') tablet_62344.init_tablet('master', 'snapshot_test', '0') utils.run_vtctl('RebuildShardGraph snapshot_test/0') utils.validate_topology() tablet_62344.populate('vt_snapshot_test', create, populate) tablet_62344.start_vttablet() tablet_62044.init_tablet('idle', start=True) # FIXME(alainjobart): not sure where the right place for this is, # but it doesn't seem it should right here. It should be either in # InitTablet (running an action on the vttablet), or in PartialClone # (instead of doing a 'USE dbname' it could do a 'CREATE DATABASE # dbname'). tablet_62044.mquery('', 'stop slave') tablet_62044.create_db('vt_snapshot_test') call(["touch", "/tmp/vtSimulateFetchFailures"]) utils.run_vtctl('PartialClone -force %s %s id %s %s' % (tablet_62344.tablet_alias, tablet_62044.tablet_alias, start, end)) utils.pause("after PartialClone") # grab the new tablet definition from zk, make sure the start and # end keys are set properly out = utils.zk_cat(tablet_62044.zk_tablet_path) if '"Start": "%s"' % start not in out or '"End": "%s"' % end not in out: print "Tablet output:" print "out" raise utils.TestError('wrong Start or End') tablet_62044.assert_table_count('vt_snapshot_test', 'vt_insert_test', 2) utils.validate_topology() tablet_62344.kill_vttablet() tablet_62044.kill_vttablet()