Package com.mysql.jdbc

Examples of com.mysql.jdbc.ReplicationConnection.commit()


    ReplicationConnectionGroupManager.removeMasterHost(replicationGroup1, firstHost);

    conn2.createStatement().execute("SELECT 1");
    assertFalse(conn2.isClosed());

    conn2.commit();

    // validate that queries are successful:
    conn2.createStatement().execute("SELECT 1");
    assertTrue(conn2.isHostMaster(secondHost));
View Full Code Here


    // check that we're waiting until transaction
    // boundary to fail over.
//    assertTrue(conn2.hasPendingNewMaster());
    assertFalse(conn2.isClosed());
    conn2.commit();
    assertFalse(conn2.isClosed());
    assertTrue(conn2.isHostMaster(secondHost));
    assertFalse(conn2.isClosed());
    assertTrue(conn2.isMasterConnection());
    assertFalse(conn2.isClosed());
View Full Code Here

    assertTrue("Is not actually on master!", conn2.isMasterConnection());

   
    conn2.setAutoCommit(false);

    conn2.commit();
    // go to slaves:
    conn2.setReadOnly(true);
   
    // should succeed, as slave2 has not yet been activated:
    conn2.createStatement().execute("/* ping */ SELECT 1");
View Full Code Here

    // allow connections to slave2:
    UnreliableSocketFactory.dontDownHost("slave2");
    // force next re-balance to slave2:
    ForcedLoadBalanceStrategy.forceFutureServer("slave2:" + portNumber, -1);
    // re-balance:
    conn2.commit();
    // down slave1 (active but not selected slave connection):
    UnreliableSocketFactory.downHost("slave1");
    // should succeed, as slave2 is currently selected:
    conn2.createStatement().execute("/* ping */ SELECT 1");
   
View Full Code Here

    // make all hosts available
    UnreliableSocketFactory.flushAllHostLists();
   
    // peg connection to slave2:
    ForcedLoadBalanceStrategy.forceFutureServer("slave2:" + portNumber, -1);
    conn2.commit();

    rs = conn2.createStatement().executeQuery("SELECT CONNECTION_ID()");
    rs.next();
    int slave2id = rs.getInt(1);
View Full Code Here

    rs.next();
    int slave2id = rs.getInt(1);

    // peg connection to slave1 now:
    ForcedLoadBalanceStrategy.forceFutureServer("slave1:" + portNumber, -1);
    conn2.commit();
   
   
    // this is a really hacky way to confirm ping was processed
    // by an inactive load-balanced connection, but we lack COM_PING
    // counters on the server side, and need to create infrastructure
View Full Code Here

    rs.next();
    assertTrue("Processlist should be less than 2 seconds due to ping", rs.getInt(1) < 2);
   
    // peg connection to slave2:
    ForcedLoadBalanceStrategy.forceFutureServer("slave2:" + portNumber, -1);
    conn2.commit();
    // leaving connection tied to slave2, bring slave2 down and slave1 up:
    UnreliableSocketFactory.downHost("slave2");
   
    try {
      conn2.createStatement().execute("/* ping */ SELECT 1");
View Full Code Here

    conn2.setAutoCommit(false);
    // go to slaves:
    conn2.setReadOnly(true);

    // on slave1 now:
    conn2.commit();
   
    ForcedLoadBalanceStrategy.forceFutureServer("slave2:" + portNumber, -1);
    // on slave2 now:
    conn2.commit();
   
View Full Code Here

    // on slave1 now:
    conn2.commit();
   
    ForcedLoadBalanceStrategy.forceFutureServer("slave2:" + portNumber, -1);
    // on slave2 now:
    conn2.commit();
   
    // disable master:
    UnreliableSocketFactory.downHost("master");
   
    // ping should succeed, because we're still attached to slaves:
View Full Code Here

   
    // bring master back up:
    UnreliableSocketFactory.dontDownHost("master");

    // get back to master, confirm it's recovered:
    conn2.commit();
    conn2.createStatement().execute("/* ping */ SELECT 1");
    try{
      conn2.setReadOnly(false);
    } catch (SQLException e) {}
   
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.