Exemplo n.º 1
0
 def test_retry_txn_pool_full(self):
     master_conn = vtdb_test.get_connection(db_type='master')
     master_conn._execute("set vt_transaction_cap=1", {})
     master_conn.begin()
     master_conn2 = vtdb_test.get_connection(db_type='master')
     master_conn2.begin()
     master_conn.commit()
     master_conn._execute("set vt_transaction_cap=20", {})
     master_conn.begin()
     master_conn._execute("delete from vt_insert_test", {})
     master_conn.commit()
Exemplo n.º 2
0
 def test_retry_txn_pool_full(self):
   master_conn = vtdb_test.get_connection(db_type='master')
   master_conn._execute("set vt_transaction_cap=1", {})
   master_conn.begin()
   master_conn2 = vtdb_test.get_connection(db_type='master')
   master_conn2.begin()
   master_conn.commit()
   master_conn._execute("set vt_transaction_cap=20", {})
   master_conn.begin()
   master_conn._execute("delete from vt_insert_test", {})
   master_conn.commit()
Exemplo n.º 3
0
 def test_vtgate_restart_stream_execute(self):
     try:
         replica_conn = vtdb_test.get_connection(
             db_type='replica', shard_index=self.shard_index)
     except Exception, e:
         self.fail("Connection to %s replica failed with error %s" %
                   (vtdb_test.shard_names[self.shard_index], str(e)))
Exemplo n.º 4
0
 def test_tablet_restart_read(self):
     try:
         replica_conn = vtdb_test.get_connection(
             db_type='replica', shard_index=self.shard_index)
     except Exception, e:
         self.fail("Connection to shard %s replica failed with error %s" %
                   (vtdb_test.shard_names[self.shard_index], str(e)))
Exemplo n.º 5
0
 def test_restart_mysql_failure(self):
     try:
         replica_conn = vtdb_test.get_connection(
             db_type='replica', shard_index=self.shard_index)
     except Exception, e:
         self.fail("Connection to shard0 replica failed with error %s" %
                   str(e))
Exemplo n.º 6
0
 def test_tablet_timeout(self):
     try:
         replica_conn = vtdb_test.get_connection(
             db_type='replica', shard_index=self.shard_index)
     except Exception, e:
         self.fail("Connection to shard0 replica failed with error %s" %
                   str(e))
Exemplo n.º 7
0
 def test_tablet_restart_stream_execute(self):
   try:
     replica_conn = vtdb_test.get_connection(db_type='replica', shard_index=self.shard_index)
   except Exception, e:
     self.fail("Connection to shard0 replica failed with error %s" % str(e))
Exemplo n.º 8
0
 def test_tablet_restart_read(self):
   try:
     replica_conn = vtdb_test.get_connection(db_type='replica', shard_index=self.shard_index)
   except Exception, e:
     self.fail("Connection to shard %s replica failed with error %s" % (shard_names[self.shard_index], str(e)))
Exemplo n.º 9
0
 def test_restart_mysql_failure(self):
   return
   try:
     replica_conn = vtdb_test.get_connection(db_type='replica', shard_index=self.shard_index)
   except Exception, e:
     self.fail("Connection to shard0 replica failed with error %s" % str(e))
Exemplo n.º 10
0
      master_conn.commit()
    proc = self.master_tablet.start_vttablet()
    master_conn.begin()
    master_conn._execute("delete from vt_insert_test", {})
    master_conn.commit()

  def test_query_timeout(self):
    try:
      replica_conn = vtdb_test.get_connection(db_type='replica', shard_index=self.shard_index)
    except Exception, e:
      self.fail("Connection to shard0 replica failed with error %s" % str(e))
    with self.assertRaises(dbexceptions.TimeoutError):
      replica_conn._execute("select sleep(12) from dual", {})

    try:
      master_conn = vtdb_test.get_connection(db_type='master')
    except Exception, e:
      self.fail("Connection to shard0 master failed with error %s" % str(e))
    with self.assertRaises(dbexceptions.TimeoutError):
      master_conn._execute("select sleep(12) from dual", {})

  # FIXME(shrutip): flaky test, making it NOP for now
  def test_restart_mysql_failure(self):
    return
    try:
      replica_conn = vtdb_test.get_connection(db_type='replica', shard_index=self.shard_index)
    except Exception, e:
      self.fail("Connection to shard0 replica failed with error %s" % str(e))
    utils.wait_procs([self.replica_tablet.shutdown_mysql(),])
    with self.assertRaises(dbexceptions.DatabaseError):
      replica_conn._execute("select 1 from vt_insert_test", {})
Exemplo n.º 11
0
 def test_vtgate_restart_stream_execute(self):
   try:
     replica_conn = vtdb_test.get_connection(db_type='replica', shard_index=self.shard_index)
   except Exception, e:
     self.fail("Connection to %s replica failed with error %s" % (vtdb_test.shard_names[self.shard_index], str(e)))
Exemplo n.º 12
0
 def test_tablet_restart_begin(self):
     try:
         master_conn = vtdb_test.get_connection(db_type='master')
     except Exception, e:
         self.fail("Connection to shard0 master failed with error %s" %
                   str(e))
Exemplo n.º 13
0
 def test_vtgate_fail_write(self):
     try:
         master_conn = vtdb_test.get_connection(db_type='master')
     except Exception, e:
         self.fail("Connection to shard0 master failed with error %s" %
                   str(e))
Exemplo n.º 14
0
 def test_tablet_fail_write(self):
   try:
     master_conn = vtdb_test.get_connection(db_type='master')
   except Exception, e:
     self.fail("Connection to shard0 master failed with error %s" % str(e))
Exemplo n.º 15
0
 def test_vtgate_restart_begin(self):
   try:
     master_conn = vtdb_test.get_connection(db_type='master')
   except Exception, e:
     self.fail("Connection to shard0 master failed with error %s" % str(e))
Exemplo n.º 16
0
 def test_query_timeout(self):
   try:
     replica_conn = vtdb_test.get_connection(db_type='replica', shard_index=self.shard_index)
   except Exception, e:
     self.fail("Connection to shard0 replica failed with error %s" % str(e))
Exemplo n.º 17
0
    def test_vtgate_fail_write(self):
        try:
            master_conn = vtdb_test.get_connection(db_type='master')
        except Exception, e:
            self.fail("Connection to shard0 master failed with error %s" %
                      str(e))
        with self.assertRaises(dbexceptions.OperationalError):
            master_conn.begin()
            utils.vtgate_kill(vtdb_test.vtgate_server)
            master_conn._execute("delete from vt_insert_test", {})
            master_conn.commit()
        vtdb_test.vtgate_server, vtdb_test.vtgate_port = utils.vtgate_start(
            vtdb_test.vtgate_port)
        try:
            master_conn = vtdb_test.get_connection(db_type='master')
        except Exception, e:
            self.fail("Connection to shard0 master failed with error %s" %
                      str(e))
        master_conn.begin()
        master_conn._execute("delete from vt_insert_test", {})
        master_conn.commit()

    # test timeout between py client and vtgate
    # the default timeout is 10 seconds
    def test_vtgate_timeout(self):
        try:
            replica_conn = vtdb_test.get_connection(
                db_type='replica', shard_index=self.shard_index)
        except Exception, e:
            self.fail("Connection to shard0 replica failed with error %s" %