当前位置: 首页>>代码示例>>Python>>正文


Python utils.check_db_read_write函数代码示例

本文整理汇总了Python中utils.check_db_read_write函数的典型用法代码示例。如果您正苦于以下问题:Python check_db_read_write函数的具体用法?Python check_db_read_write怎么用?Python check_db_read_write使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了check_db_read_write函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: setup_tablets

def setup_tablets():
  # Start up a master mysql and vttablet
  utils.debug("Setting up tablets")
  utils.run_vtctl('CreateKeyspace test_keyspace')
  master_tablet.init_tablet('master', 'test_keyspace', '0')
  utils.run_vtctl('RebuildShardGraph test_keyspace/0')
  utils.run_vtctl('RebuildKeyspaceGraph test_keyspace')
  utils.validate_topology()

  setup_schema()
  replica_tablet.create_db('vt_test_keyspace')
  master_tablet.start_vttablet(memcache=True)

  replica_tablet.init_tablet('idle', 'test_keyspace', start=True, memcache=True)
  snapshot_dir = os.path.join(utils.vtdataroot, 'snapshot')
  utils.run("mkdir -p " + snapshot_dir)
  utils.run("chmod +w " + snapshot_dir)
  utils.run_vtctl('Clone -force %s %s' %
                  (master_tablet.tablet_alias, replica_tablet.tablet_alias))

  utils.run_vtctl('Ping test_nj-0000062344')
  utils.run_vtctl('SetReadWrite ' + master_tablet.tablet_alias)
  utils.check_db_read_write(62344)

  utils.validate_topology()
  utils.run_vtctl('Ping test_nj-0000062345')
  utils.run_vtctl('ChangeSlaveType test_nj-0000062345 replica')
开发者ID:ShawnShoper,项目名称:WeShare,代码行数:27,代码来源:rowcache_invalidator.py

示例2: setup_tablets

def setup_tablets():
  # Start up a master mysql and vttablet
  logging.debug("Setting up tablets")
  utils.run_vtctl('CreateKeyspace test_keyspace')
  master_tablet.init_tablet('master', 'test_keyspace', '0')
  replica_tablet.init_tablet('replica', 'test_keyspace', '0')
  utils.run_vtctl('RebuildShardGraph test_keyspace/0')
  utils.validate_topology()
  master_tablet.create_db('vt_test_keyspace')
  replica_tablet.create_db('vt_test_keyspace')

  utils.run_vtctl('RebuildKeyspaceGraph test_keyspace')
  zkocc_server = utils.zkocc_start()

  master_tablet.start_vttablet()
  replica_tablet.start_vttablet()
  utils.run_vtctl('SetReadWrite ' + master_tablet.tablet_alias)
  utils.check_db_read_write(62344)

  for t in [master_tablet, replica_tablet]:
    t.reset_replication()
  utils.run_vtctl('ReparentShard -force test_keyspace/0 ' + master_tablet.tablet_alias, auto_log=True)

  # reset counter so tests don't assert
  tablet.Tablet.tablets_running = 0
  setup_schema()
  master_tablet.vquery("set vt_schema_reload_time=86400", path="test_keyspace/0")
  replica_tablet.vquery("set vt_schema_reload_time=86400", path="test_keyspace/0")
开发者ID:ballacky13,项目名称:vitess,代码行数:28,代码来源:update_stream.py

示例3: setup_tablets

def setup_tablets():
    # Start up a master mysql and vttablet
    utils.debug("Setting up tablets")
    utils.run_vtctl("CreateKeyspace test_keyspace")
    master_tablet.init_tablet("master", "test_keyspace", "0")
    utils.run_vtctl("RebuildShardGraph test_keyspace/0")
    utils.run_vtctl("RebuildKeyspaceGraph test_keyspace")
    utils.validate_topology()

    setup_schema()
    replica_tablet.create_db("vt_test_keyspace")
    # master_tablet.start_vttablet(auth=True)
    master_tablet.start_vttablet()

    replica_tablet.init_tablet("idle", "test_keyspace", start=True)
    snapshot_dir = os.path.join(utils.vtdataroot, "snapshot")
    utils.run("mkdir -p " + snapshot_dir)
    utils.run("chmod +w " + snapshot_dir)
    utils.run_vtctl("Clone -force %s %s" % (master_tablet.tablet_alias, replica_tablet.tablet_alias))

    utils.run_vtctl("Ping test_nj-0000062344")
    utils.run_vtctl("SetReadWrite " + master_tablet.tablet_alias)
    utils.check_db_read_write(62344)

    utils.validate_topology()
    utils.run_vtctl("Ping test_nj-0000062345")

    # reset counter so tests don't assert
    tablet.Tablet.tablets_running = 0
开发者ID:johnvilsack,项目名称:golang-stuff,代码行数:29,代码来源:update_stream.py

示例4: _test_sanity

  def _test_sanity(self):
    # Start up a master mysql and vttablet
    utils.run_vtctl(['CreateKeyspace', '-force', 'test_keyspace'])
    utils.run_vtctl(['createshard', '-force', 'test_keyspace/0'])
    tablet_62344.init_tablet('master', 'test_keyspace', '0', parent=False)
    utils.run_vtctl(
        ['RebuildKeyspaceGraph', '-rebuild_srv_shards', 'test_keyspace'])
    utils.validate_topology()
    self._check_srv_shard()

    # if these statements don't run before the tablet it will wedge
    # waiting for the db to become accessible. this is more a bug than
    # a feature.
    tablet_62344.populate('vt_test_keyspace', self._create_vt_select_test,
                          self._populate_vt_select_test)

    tablet_62344.start_vttablet()

    # make sure the query service is started right away
    qr = tablet_62344.execute('select * from vt_select_test')
    self.assertEqual(len(qr['rows']), 4,
                     'expected 4 rows in vt_select_test: %s' % str(qr))

    # make sure direct dba queries work
    query_result = utils.run_vtctl_json(
        ['ExecuteFetchAsDba', '-json', tablet_62344.tablet_alias,
         'select * from vt_test_keyspace.vt_select_test'])
    self.assertEqual(
        len(query_result['rows']), 4,
        'expected 4 rows in vt_select_test: %s' % str(query_result))
    self.assertEqual(
        len(query_result['fields']), 2,
        'expected 2 fields in vt_select_test: %s' % str(query_result))

    # check Ping / RefreshState
    utils.run_vtctl(['Ping', tablet_62344.tablet_alias])
    utils.run_vtctl(['RefreshState', tablet_62344.tablet_alias])

    # Quickly check basic actions.
    utils.run_vtctl(['SetReadOnly', tablet_62344.tablet_alias])
    utils.wait_db_read_only(62344)

    utils.run_vtctl(['SetReadWrite', tablet_62344.tablet_alias])
    utils.check_db_read_write(62344)

    utils.run_vtctl(['DemoteMaster', tablet_62344.tablet_alias])
    utils.wait_db_read_only(62344)

    utils.validate_topology()
    utils.run_vtctl(['ValidateKeyspace', 'test_keyspace'])
    # not pinging tablets, as it enables replication checks, and they
    # break because we only have a single master, no slaves
    utils.run_vtctl(['ValidateShard', '-ping-tablets=false',
                     'test_keyspace/0'])
    self._check_srv_shard()

    tablet_62344.kill_vttablet()
开发者ID:ateleshev,项目名称:youtube-vitess,代码行数:57,代码来源:tabletmanager.py

示例5: setUpModule

def setUpModule():
  global vtgate_server
  global vtgate_port
  global vtgate_socket_file
  global master_start_position

  try:
    environment.topo_server_setup()

    # start mysql instance external to the test
    setup_procs = [master_tablet.init_mysql(),
                   replica_tablet.init_mysql()
                   ]
    utils.wait_procs(setup_procs)

    # Start up a master mysql and vttablet
    logging.debug("Setting up tablets")
    utils.run_vtctl(['CreateKeyspace', 'test_keyspace'])
    master_tablet.init_tablet('master', 'test_keyspace', '0')
    replica_tablet.init_tablet('replica', 'test_keyspace', '0')
    utils.run_vtctl(['RebuildShardGraph', 'test_keyspace/0'])
    utils.validate_topology()
    master_tablet.create_db('vt_test_keyspace')
    master_tablet.create_db('other_database')
    replica_tablet.create_db('vt_test_keyspace')
    replica_tablet.create_db('other_database')

    utils.run_vtctl(['RebuildKeyspaceGraph', 'test_keyspace'])

    vtgate_socket_file = environment.tmproot + '/vtgate.sock'
    vtgate_server, vtgate_port = utils.vtgate_start(socket_file=vtgate_socket_file)

    master_tablet.start_vttablet()
    replica_tablet.start_vttablet()
    utils.run_vtctl(['SetReadWrite', master_tablet.tablet_alias])
    utils.check_db_read_write(master_tablet.tablet_uid)

    for t in [master_tablet, replica_tablet]:
      t.reset_replication()
    utils.run_vtctl(['ReparentShard', '-force', 'test_keyspace/0',
                     master_tablet.tablet_alias], auto_log=True)

    # reset counter so tests don't assert
    tablet.Tablet.tablets_running = 0

    master_start_position = _get_master_current_position()
    master_tablet.mquery('vt_test_keyspace', _create_vt_insert_test)
    master_tablet.mquery('vt_test_keyspace', _create_vt_a)
    master_tablet.mquery('vt_test_keyspace', _create_vt_b)

    utils.run_vtctl(['ReloadSchema', master_tablet.tablet_alias])
    utils.run_vtctl(['ReloadSchema', replica_tablet.tablet_alias])

  except:
    tearDownModule()
    raise
开发者ID:c0mpsc1,项目名称:vitess,代码行数:56,代码来源:update_stream.py

示例6: setUpModule

def setUpModule():
  global master_start_position

  try:
    environment.topo_server().setup()

    # start mysql instance external to the test
    setup_procs = [master_tablet.init_mysql(),
                   replica_tablet.init_mysql()]
    utils.wait_procs(setup_procs)

    # start a vtctld so the vtctl insert commands are just RPCs, not forks
    utils.Vtctld().start()

    # Start up a master mysql and vttablet
    logging.debug('Setting up tablets')
    utils.run_vtctl(['CreateKeyspace', 'test_keyspace'])
    master_tablet.init_tablet('master', 'test_keyspace', '0')
    replica_tablet.init_tablet('replica', 'test_keyspace', '0')
    utils.run_vtctl(['RebuildShardGraph', 'test_keyspace/0'])
    utils.validate_topology()
    master_tablet.create_db('vt_test_keyspace')
    master_tablet.create_db('other_database')
    replica_tablet.create_db('vt_test_keyspace')
    replica_tablet.create_db('other_database')

    utils.run_vtctl(['RebuildKeyspaceGraph', 'test_keyspace'])

    utils.VtGate().start()

    master_tablet.start_vttablet()
    replica_tablet.start_vttablet()
    utils.run_vtctl(['SetReadWrite', master_tablet.tablet_alias])
    utils.check_db_read_write(master_tablet.tablet_uid)

    for t in [master_tablet, replica_tablet]:
      t.reset_replication()
    utils.run_vtctl(['InitShardMaster', 'test_keyspace/0',
                     master_tablet.tablet_alias], auto_log=True)

    # reset counter so tests don't assert
    tablet.Tablet.tablets_running = 0

    master_start_position = _get_master_current_position()
    master_tablet.mquery('vt_test_keyspace', _create_vt_insert_test)
    master_tablet.mquery('vt_test_keyspace', _create_vt_a)
    master_tablet.mquery('vt_test_keyspace', _create_vt_b)

    utils.run_vtctl(['ReloadSchema', master_tablet.tablet_alias])
    utils.run_vtctl(['ReloadSchema', replica_tablet.tablet_alias])

  except:
    tearDownModule()
    raise
开发者ID:ruiaylin,项目名称:vitess,代码行数:54,代码来源:update_stream.py

示例7: setUpModule

def setUpModule():
    global master_start_position

    try:
        environment.topo_server().setup()

        # start mysql instance external to the test
        setup_procs = [master_tablet.init_mysql(), replica_tablet.init_mysql()]
        utils.wait_procs(setup_procs)

        # Start up a master mysql and vttablet
        logging.debug("Setting up tablets")
        utils.run_vtctl(["CreateKeyspace", "test_keyspace"])
        master_tablet.init_tablet("master", "test_keyspace", "0")
        replica_tablet.init_tablet("replica", "test_keyspace", "0")
        utils.run_vtctl(["RebuildShardGraph", "test_keyspace/0"])
        utils.validate_topology()
        master_tablet.create_db("vt_test_keyspace")
        master_tablet.create_db("other_database")
        replica_tablet.create_db("vt_test_keyspace")
        replica_tablet.create_db("other_database")

        utils.run_vtctl(["RebuildKeyspaceGraph", "test_keyspace"])

        utils.VtGate().start(socket_file=environment.tmproot + "/vtgate.sock")

        master_tablet.start_vttablet()
        replica_tablet.start_vttablet()
        utils.run_vtctl(["SetReadWrite", master_tablet.tablet_alias])
        utils.check_db_read_write(master_tablet.tablet_uid)

        for t in [master_tablet, replica_tablet]:
            t.reset_replication()
        utils.run_vtctl(["InitShardMaster", "test_keyspace/0", master_tablet.tablet_alias], auto_log=True)

        # reset counter so tests don't assert
        tablet.Tablet.tablets_running = 0

        master_start_position = _get_master_current_position()
        master_tablet.mquery("vt_test_keyspace", _create_vt_insert_test)
        master_tablet.mquery("vt_test_keyspace", _create_vt_a)
        master_tablet.mquery("vt_test_keyspace", _create_vt_b)

        utils.run_vtctl(["ReloadSchema", master_tablet.tablet_alias])
        utils.run_vtctl(["ReloadSchema", replica_tablet.tablet_alias])

    except:
        tearDownModule()
        raise
开发者ID:pranjal5215,项目名称:vitess,代码行数:49,代码来源:update_stream.py

示例8: _test_sanity

    def _test_sanity(self):
        # Start up a master mysql and vttablet
        utils.run_vtctl(["CreateKeyspace", "-force", "test_keyspace"])
        utils.run_vtctl(["createshard", "-force", "test_keyspace/0"])
        tablet_62344.init_tablet("master", "test_keyspace", "0", parent=False)
        utils.run_vtctl(["RebuildKeyspaceGraph", "-rebuild_srv_shards", "test_keyspace"])
        utils.validate_topology()
        self._check_srv_shard()

        # if these statements don't run before the tablet it will wedge
        # waiting for the db to become accessible. this is more a bug than
        # a feature.
        tablet_62344.populate("vt_test_keyspace", self._create_vt_select_test, self._populate_vt_select_test)

        tablet_62344.start_vttablet()

        # make sure the query service is started right away
        qr = tablet_62344.execute("select * from vt_select_test")
        self.assertEqual(len(qr["rows"]), 4, "expected 4 rows in vt_select_test: %s" % str(qr))

        # make sure direct dba queries work
        query_result = utils.run_vtctl_json(
            ["ExecuteFetchAsDba", "-json", tablet_62344.tablet_alias, "select * from vt_test_keyspace.vt_select_test"]
        )
        self.assertEqual(len(query_result["rows"]), 4, "expected 4 rows in vt_select_test: %s" % str(query_result))
        self.assertEqual(len(query_result["fields"]), 2, "expected 2 fields in vt_select_test: %s" % str(query_result))

        # check Ping / RefreshState
        utils.run_vtctl(["Ping", tablet_62344.tablet_alias])
        utils.run_vtctl(["RefreshState", tablet_62344.tablet_alias])

        # Quickly check basic actions.
        utils.run_vtctl(["SetReadOnly", tablet_62344.tablet_alias])
        utils.wait_db_read_only(62344)

        utils.run_vtctl(["SetReadWrite", tablet_62344.tablet_alias])
        utils.check_db_read_write(62344)

        utils.run_vtctl(["DemoteMaster", tablet_62344.tablet_alias])
        utils.wait_db_read_only(62344)

        utils.validate_topology()
        utils.run_vtctl(["ValidateKeyspace", "test_keyspace"])
        # not pinging tablets, as it enables replication checks, and they
        # break because we only have a single master, no slaves
        utils.run_vtctl(["ValidateShard", "-ping-tablets=false", "test_keyspace/0"])
        self._check_srv_shard()

        tablet_62344.kill_vttablet()
开发者ID:aaijazi,项目名称:vitess,代码行数:49,代码来源:tabletmanager.py

示例9: setup_tablets

def setup_tablets():
  # Start up a master mysql and vttablet
  logging.debug("Setting up tablets")
  utils.run_vtctl('CreateKeyspace %s' % TEST_KEYSPACE)
  shard_0_master.init_tablet('master', keyspace=TEST_KEYSPACE, shard='0')
  shard_0_replica.init_tablet('replica', keyspace=TEST_KEYSPACE, shard='0')
  shard_1_master.init_tablet('master', keyspace=TEST_KEYSPACE, shard='1')
  shard_1_replica.init_tablet('replica', keyspace=TEST_KEYSPACE, shard='1')

  utils.run_vtctl('RebuildShardGraph %s/0' % TEST_KEYSPACE, auto_log=True)
  utils.run_vtctl('RebuildShardGraph %s/1' % TEST_KEYSPACE, auto_log=True)
  utils.validate_topology()
  shard_0_master.create_db(shard_0_master.dbname)
  shard_0_replica.create_db(shard_0_master.dbname)
  shard_1_master.create_db(shard_0_master.dbname)
  shard_1_replica.create_db(shard_0_master.dbname)
  setup_schema()

  utils.run_vtctl('RebuildKeyspaceGraph %s' % TEST_KEYSPACE, auto_log=True)

  zkocc_server = utils.zkocc_start()

  shard_0_master.start_vttablet()
  shard_0_replica.start_vttablet()
  shard_1_master.start_vttablet()
  shard_1_replica.start_vttablet()

  utils.run_vtctl('SetReadWrite ' + shard_0_master.tablet_alias)
  utils.run_vtctl('SetReadWrite ' + shard_1_master.tablet_alias)
  utils.check_db_read_write(62344)


  for t in [shard_0_master, shard_0_replica]:
    t.reset_replication()
  utils.run_vtctl('ReparentShard -force test_keyspace/0 ' + shard_0_master.tablet_alias, auto_log=True)

  for t in [shard_1_master, shard_1_replica]:
    t.reset_replication()
  utils.run_vtctl('ReparentShard -force test_keyspace/1 ' + shard_1_master.tablet_alias, auto_log=True)


  # then get the topology and check it
  zkocc_client = zkocc.ZkOccConnection("localhost:%u" % utils.zkocc_port_base,
                                       "test_nj", 30.0)
  topology.read_keyspaces(zkocc_client)
  shard_0_master_addrs = topology.get_host_port_by_name(zkocc_client, "test_keyspace.0.master:_vtocc")
  logging.debug(shard_0_master_addrs)
开发者ID:CERN-Stage-3,项目名称:vitess,代码行数:47,代码来源:vtdb_test.py

示例10: run_test_sanity

def run_test_sanity():
  # Start up a master mysql and vttablet
  utils.run_vtctl('CreateKeyspace -force test_keyspace')
  utils.run_vtctl('CreateShard -force test_keyspace/0')
  tablet_62344.init_tablet('master', 'test_keyspace', '0', parent=False)
  utils.run_vtctl('RebuildShardGraph test_keyspace/0')
  utils.run_vtctl('RebuildKeyspaceGraph test_keyspace')
  utils.validate_topology()

  # if these statements don't run before the tablet it will wedge waiting for the
  # db to become accessible. this is more a bug than a feature.
  tablet_62344.populate('vt_test_keyspace', create_vt_select_test,
                        populate_vt_select_test)

  tablet_62344.start_vttablet()

  # make sure the query service is started right away
  result, _ = utils.run_vtctl('Query test_nj test_keyspace "select * from vt_select_test"', trap_output=True)
  rows = result.splitlines()
  if len(rows) != 5:
    raise utils.TestError("expected 5 rows in vt_select_test", rows, result)

  # check Pings
  utils.run_vtctl('Ping ' + tablet_62344.tablet_alias)
  utils.run_vtctl('RpcPing ' + tablet_62344.tablet_alias)

  # Quickly check basic actions.
  utils.run_vtctl('SetReadOnly ' + tablet_62344.tablet_alias)
  utils.wait_db_read_only(62344)

  utils.run_vtctl('SetReadWrite ' + tablet_62344.tablet_alias)
  utils.check_db_read_write(62344)

  utils.run_vtctl('DemoteMaster ' + tablet_62344.tablet_alias)
  utils.wait_db_read_only(62344)

  utils.validate_topology()
  utils.run_vtctl('ValidateKeyspace test_keyspace')
  # not pinging tablets, as it enables replication checks, and they
  # break because we only have a single master, no slaves
  utils.run_vtctl('ValidateShard -ping-tablets=false test_keyspace/0')

  tablet_62344.kill_vttablet()

  tablet_62344.init_tablet('idle')
  tablet_62344.scrap(force=True)
开发者ID:Eric-Chen,项目名称:vitess,代码行数:46,代码来源:tabletmanager.py

示例11: setup_tablets

def setup_tablets():
  # Start up a master mysql and vttablet
  logging.debug("Setting up tablets")
  utils.run_vtctl('CreateKeyspace %s' % TEST_KEYSPACE)
  shard_0_master.init_tablet('master', keyspace=TEST_KEYSPACE, shard='0')
  shard_0_replica.init_tablet('replica', keyspace=TEST_KEYSPACE, shard='0')
  shard_1_master.init_tablet('master', keyspace=TEST_KEYSPACE, shard='1')
  shard_1_replica.init_tablet('replica', keyspace=TEST_KEYSPACE, shard='1')

  utils.run_vtctl('RebuildShardGraph %s/0' % TEST_KEYSPACE, auto_log=True)
  utils.run_vtctl('RebuildShardGraph %s/1' % TEST_KEYSPACE, auto_log=True)
  utils.validate_topology()
  shard_0_master.create_db(shard_0_master.dbname)
  shard_0_replica.create_db(shard_0_master.dbname)
  shard_1_master.create_db(shard_0_master.dbname)
  shard_1_replica.create_db(shard_0_master.dbname)

  utils.run_vtctl('RebuildKeyspaceGraph %s' % TEST_KEYSPACE, auto_log=True)

  zkocc_server = utils.zkocc_start()

  shard_0_master.start_vttablet()
  shard_0_replica.start_vttablet()
  shard_1_master.start_vttablet()
  shard_1_replica.start_vttablet()

  utils.run_vtctl('SetReadWrite ' + shard_0_master.tablet_alias)
  utils.run_vtctl('SetReadWrite ' + shard_1_master.tablet_alias)
  utils.check_db_read_write(62344)


  for t in [shard_0_master, shard_0_replica]:
    t.reset_replication()
  utils.run_vtctl('ReparentShard -force test_keyspace/0 ' + shard_0_master.tablet_alias, auto_log=True)

  for t in [shard_1_master, shard_1_replica]:
    t.reset_replication()
  utils.run_vtctl('ReparentShard -force test_keyspace/1 ' + shard_1_master.tablet_alias, auto_log=True)
  setup_schema()
  shard_0_master.vquery("set vt_schema_reload_time=86400", path="test_keyspace/0")
  shard_1_master.vquery("set vt_schema_reload_time=86400", path="test_keyspace/1")
  shard_0_replica.vquery("set vt_schema_reload_time=86400", path="test_keyspace/0")
  shard_1_replica.vquery("set vt_schema_reload_time=86400", path="test_keyspace/1")
开发者ID:ballacky13,项目名称:vitess,代码行数:43,代码来源:vtdb_test.py

示例12: setUpModule

def setUpModule():
  global master_start_position

  try:
    environment.topo_server().setup()

    # start mysql instance external to the test
    setup_procs = [master_tablet.init_mysql(),
                   replica_tablet.init_mysql()]
    utils.wait_procs(setup_procs)

    # start a vtctld so the vtctl insert commands are just RPCs, not forks
    utils.Vtctld().start()

    # Start up a master mysql and vttablet
    logging.debug('Setting up tablets')
    utils.run_vtctl(['CreateKeyspace', 'test_keyspace'])
    master_tablet.init_tablet('master', 'test_keyspace', '0')
    replica_tablet.init_tablet('replica', 'test_keyspace', '0')
    utils.run_vtctl(['RebuildShardGraph', 'test_keyspace/0'])
    utils.validate_topology()
    master_tablet.create_db('vt_test_keyspace')
    master_tablet.create_db('other_database')
    replica_tablet.create_db('vt_test_keyspace')
    replica_tablet.create_db('other_database')

    utils.run_vtctl(['RebuildKeyspaceGraph', 'test_keyspace'])

    utils.VtGate().start()

    master_tablet.start_vttablet()
    replica_tablet.start_vttablet()
    utils.run_vtctl(['SetReadWrite', master_tablet.tablet_alias])
    utils.check_db_read_write(master_tablet.tablet_uid)

    for t in [master_tablet, replica_tablet]:
      t.reset_replication()
    utils.run_vtctl(['InitShardMaster', 'test_keyspace/0',
                     master_tablet.tablet_alias], auto_log=True)

    # reset counter so tests don't assert
    tablet.Tablet.tablets_running = 0

    master_start_position = _get_master_current_position()
    master_tablet.mquery('vt_test_keyspace', _create_vt_insert_test)
    master_tablet.mquery('vt_test_keyspace', _create_vt_a)
    master_tablet.mquery('vt_test_keyspace', _create_vt_b)

    utils.run_vtctl(['ReloadSchema', master_tablet.tablet_alias])
    utils.run_vtctl(['ReloadSchema', replica_tablet.tablet_alias])

    # wait for the master and slave tablet's ReloadSchema to have worked
    timeout = 10
    while True:
      try:
        master_tablet.execute('select count(1) from vt_insert_test')
        replica_tablet.execute('select count(1) from vt_insert_test')
        break
      except:
        logging.exception('query failed')
        timeout = utils.wait_step('slave tablet having correct schema', timeout)
        # also re-run ReloadSchema on slave, it case the first one
        # didn't get the replicated table.
        utils.run_vtctl(['ReloadSchema', replica_tablet.tablet_alias])

  except:
    tearDownModule()
    raise
开发者ID:khanchan,项目名称:vitess,代码行数:68,代码来源:update_stream.py


注:本文中的utils.check_db_read_write函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。