http://git-wip-us.apache.org/repos/asf/hive/blob/90a92b74/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java
----------------------------------------------------------------------
diff --git 
a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java
 
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java
index cf2b517..b020351 100644
--- 
a/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java
+++ 
b/itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenarios.java
@@ -17,6 +17,7 @@
  */
 package org.apache.hadoop.hive.ql.parse;
 
+import org.apache.commons.io.FileUtils;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hive.cli.CliSessionState;
@@ -26,11 +27,20 @@ import org.apache.hadoop.hive.metastore.IMetaStoreClient;
 import org.apache.hadoop.hive.metastore.InjectableBehaviourObjectStore;
 import 
org.apache.hadoop.hive.metastore.InjectableBehaviourObjectStore.BehaviourInjection;
 import org.apache.hadoop.hive.metastore.MetaStoreUtils;
+import org.apache.hadoop.hive.metastore.ObjectStore;
+import org.apache.hadoop.hive.metastore.api.ForeignKeysRequest;
 import org.apache.hadoop.hive.metastore.api.NoSuchObjectException;
+import org.apache.hadoop.hive.metastore.api.NotNullConstraintsRequest;
 import org.apache.hadoop.hive.metastore.api.NotificationEvent;
 import org.apache.hadoop.hive.metastore.api.NotificationEventResponse;
 import org.apache.hadoop.hive.metastore.api.Partition;
+import org.apache.hadoop.hive.metastore.api.PrimaryKeysRequest;
+import org.apache.hadoop.hive.metastore.api.SQLForeignKey;
+import org.apache.hadoop.hive.metastore.api.SQLNotNullConstraint;
+import org.apache.hadoop.hive.metastore.api.SQLPrimaryKey;
+import org.apache.hadoop.hive.metastore.api.SQLUniqueConstraint;
 import org.apache.hadoop.hive.metastore.api.Table;
+import org.apache.hadoop.hive.metastore.api.UniqueConstraintsRequest;
 import org.apache.hadoop.hive.metastore.messaging.MessageFactory;
 import org.apache.hadoop.hive.metastore.messaging.event.filters.AndFilter;
 import 
org.apache.hadoop.hive.metastore.messaging.event.filters.DatabaseAndTableFilter;
@@ -79,15 +89,18 @@ public class TestReplicationScenarios {
       "org.apache.hive.hcatalog.listener.DbNotificationListener";
       // FIXME : replace with hive copy once that is copied
   private final static String tid =
-      TestReplicationScenarios.class.getCanonicalName().replace('.','_') + "_" 
+ System.currentTimeMillis();
+      
TestReplicationScenarios.class.getCanonicalName().toLowerCase().replace('.','_')
 + "_" + System.currentTimeMillis();
   private final static String TEST_PATH =
       System.getProperty("test.warehouse.dir", "/tmp") + Path.SEPARATOR + tid;
 
   private static HiveConf hconf;
-  private static boolean useExternalMS = false;
   private static int msPort;
   private static Driver driver;
   private static HiveMetaStoreClient metaStoreClient;
+  static HiveConf hconfMirror;
+  static int msPortMirror;
+  static Driver driverMirror;
+  static HiveMetaStoreClient metaStoreClientMirror;
 
   @Rule
   public TestRule replV1BackwardCompatibleRule =
@@ -111,7 +124,6 @@ public class TestReplicationScenarios {
     String metastoreUri = 
System.getProperty("test."+HiveConf.ConfVars.METASTOREURIS.varname);
     if (metastoreUri != null) {
       hconf.setVar(HiveConf.ConfVars.METASTOREURIS, metastoreUri);
-      useExternalMS = true;
       return;
     }
 
@@ -140,6 +152,18 @@ public class TestReplicationScenarios {
     driver = new Driver(hconf);
     SessionState.start(new CliSessionState(hconf));
     metaStoreClient = new HiveMetaStoreClient(hconf);
+
+    FileUtils.deleteDirectory(new File("metastore_db2"));
+    HiveConf hconfMirrorServer = new HiveConf();
+    hconfMirrorServer.set(HiveConf.ConfVars.METASTORECONNECTURLKEY.varname, 
"jdbc:derby:;databaseName=metastore_db2;create=true");
+    msPortMirror = MetaStoreUtils.startMetaStore(hconfMirrorServer);
+    hconfMirror = new HiveConf(hconf);
+    hconfMirror.setVar(HiveConf.ConfVars.METASTOREURIS, "thrift://localhost:"
+        + msPortMirror);
+    driverMirror = new Driver(hconfMirror);
+    metaStoreClientMirror = new HiveMetaStoreClient(hconfMirror);
+
+    ObjectStore.setTwoMetastoreTesting(true);
   }
 
   @AfterClass
@@ -150,6 +174,7 @@ public class TestReplicationScenarios {
   @Before
   public void setUp(){
     // before each test
+    SessionState.get().setCurrentDatabase("default");
   }
 
   @After
@@ -199,18 +224,18 @@ public class TestReplicationScenarios {
     if (null != limit) {
       dumpCmd = dumpCmd + " LIMIT " + limit;
     }
-    run(dumpCmd);
-    String dumpLocation = getResult(0, 0);
-    String lastReplId = getResult(0, 1, true);
+    run(dumpCmd, driver);
+    String dumpLocation = getResult(0, 0, driver);
+    String lastReplId = getResult(0, 1, true, driver);
     LOG.info("Dumped to {} with id {} for command: {}", dumpLocation, 
lastReplId, dumpCmd);
     return new Tuple(dumpLocation, lastReplId);
   }
 
   private void loadAndVerify(String replDbName, String dumpLocation, String 
lastReplId) throws IOException {
-    run("EXPLAIN REPL LOAD " + replDbName + " FROM '" + dumpLocation + "'");
-    printOutput();
-    run("REPL LOAD " + replDbName + " FROM '" + dumpLocation + "'");
-    verifyRun("REPL STATUS " + replDbName, lastReplId);
+    run("EXPLAIN REPL LOAD " + replDbName + " FROM '" + dumpLocation + "'", 
driverMirror);
+    printOutput(driverMirror);
+    run("REPL LOAD " + replDbName + " FROM '" + dumpLocation + "'", 
driverMirror);
+    verifyRun("REPL STATUS " + replDbName, lastReplId, driverMirror);
     return;
   }
 
@@ -223,11 +248,11 @@ public class TestReplicationScenarios {
   @Test
   public void testBasic() throws IOException {
     String name = testName.getMethodName();
-    String dbName = createDB(name);
-    run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE");
-    run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b int) 
STORED AS TEXTFILE");
-    run("CREATE TABLE " + dbName + ".unptned_empty(a string) STORED AS 
TEXTFILE");
-    run("CREATE TABLE " + dbName + ".ptned_empty(a string) partitioned by (b 
int) STORED AS TEXTFILE");
+    String dbName = createDB(name, driver);
+    run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE", 
driver);
+    run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b int) 
STORED AS TEXTFILE", driver);
+    run("CREATE TABLE " + dbName + ".unptned_empty(a string) STORED AS 
TEXTFILE", driver);
+    run("CREATE TABLE " + dbName + ".ptned_empty(a string) partitioned by (b 
int) STORED AS TEXTFILE", driver);
 
     String[] unptn_data = new String[]{ "eleven" , "twelve" };
     String[] ptn_data_1 = new String[]{ "thirteen", "fourteen", "fifteen"};
@@ -242,33 +267,33 @@ public class TestReplicationScenarios {
     createTestDataFile(ptn_locn_1, ptn_data_1);
     createTestDataFile(ptn_locn_2, ptn_data_2);
 
-    run("LOAD DATA LOCAL INPATH '" + unptn_locn + "' OVERWRITE INTO TABLE " + 
dbName + ".unptned");
-    verifySetup("SELECT * from " + dbName + ".unptned", unptn_data);
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b=1)");
-    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=1", ptn_data_1);
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b=2)");
-    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=2", ptn_data_2);
-    verifySetup("SELECT a from " + dbName + ".ptned_empty", empty);
-    verifySetup("SELECT * from " + dbName + ".unptned_empty", empty);
+    run("LOAD DATA LOCAL INPATH '" + unptn_locn + "' OVERWRITE INTO TABLE " + 
dbName + ".unptned", driver);
+    verifySetup("SELECT * from " + dbName + ".unptned", unptn_data, driver);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b=1)", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=1", ptn_data_1, 
driver);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b=2)", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=2", ptn_data_2, 
driver);
+    verifySetup("SELECT a from " + dbName + ".ptned_empty", empty, driver);
+    verifySetup("SELECT * from " + dbName + ".unptned_empty", empty, driver);
 
     String replicatedDbName = dbName + "_dupe";
     bootstrapLoadAndVerify(dbName, replicatedDbName);
 
-    verifyRun("SELECT * from " + replicatedDbName + ".unptned", unptn_data);
-    verifyRun("SELECT a from " + replicatedDbName + ".ptned WHERE b=1", 
ptn_data_1);
-    verifyRun("SELECT a from " + replicatedDbName + ".ptned WHERE b=2", 
ptn_data_2);
-    verifyRun("SELECT a from " + dbName + ".ptned_empty", empty);
-    verifyRun("SELECT * from " + dbName + ".unptned_empty", empty);
+    verifyRun("SELECT * from " + replicatedDbName + ".unptned", unptn_data, 
driverMirror);
+    verifyRun("SELECT a from " + replicatedDbName + ".ptned WHERE b=1", 
ptn_data_1, driverMirror);
+    verifyRun("SELECT a from " + replicatedDbName + ".ptned WHERE b=2", 
ptn_data_2, driverMirror);
+    verifyRun("SELECT a from " + dbName + ".ptned_empty", empty, driverMirror);
+    verifyRun("SELECT * from " + dbName + ".unptned_empty", empty, 
driverMirror);
   }
 
   @Test
   public void testBasicWithCM() throws Exception {
     String name = testName.getMethodName();
-    String dbName = createDB(name);
-    run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE");
-    run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b int) 
STORED AS TEXTFILE");
-    run("CREATE TABLE " + dbName + ".unptned_empty(a string) STORED AS 
TEXTFILE");
-    run("CREATE TABLE " + dbName + ".ptned_empty(a string) partitioned by (b 
int) STORED AS TEXTFILE");
+    String dbName = createDB(name, driver);
+    run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE", 
driver);
+    run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b int) 
STORED AS TEXTFILE", driver);
+    run("CREATE TABLE " + dbName + ".unptned_empty(a string) STORED AS 
TEXTFILE", driver);
+    run("CREATE TABLE " + dbName + ".ptned_empty(a string) partitioned by (b 
int) STORED AS TEXTFILE", driver);
 
     String[] unptn_data = new String[]{ "eleven" , "twelve" };
     String[] ptn_data_1 = new String[]{ "thirteen", "fourteen", "fifteen"};
@@ -286,29 +311,29 @@ public class TestReplicationScenarios {
     createTestDataFile(ptn_locn_2, ptn_data_2);
     createTestDataFile(ptn_locn_2_later, ptn_data_2_later);
 
-    run("LOAD DATA LOCAL INPATH '" + unptn_locn + "' OVERWRITE INTO TABLE " + 
dbName + ".unptned");
-    run("SELECT * from " + dbName + ".unptned");
-    verifyResults(unptn_data);
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b=1)");
-    run("SELECT a from " + dbName + ".ptned WHERE b=1");
-    verifyResults(ptn_data_1);
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b=2)");
-    run("SELECT a from " + dbName + ".ptned WHERE b=2");
-    verifyResults(ptn_data_2);
-    run("SELECT a from " + dbName + ".ptned_empty");
-    verifyResults(empty);
-    run("SELECT * from " + dbName + ".unptned_empty");
-    verifyResults(empty);
-
-    advanceDumpDir();
-    run("REPL DUMP " + dbName);
-    String replDumpLocn = getResult(0,0);
-    String replDumpId = getResult(0,1,true);
+    run("LOAD DATA LOCAL INPATH '" + unptn_locn + "' OVERWRITE INTO TABLE " + 
dbName + ".unptned", driver);
+    run("SELECT * from " + dbName + ".unptned", driver);
+    verifyResults(unptn_data, driver);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b=1)", driver);
+    run("SELECT a from " + dbName + ".ptned WHERE b=1", driver);
+    verifyResults(ptn_data_1, driver);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b=2)", driver);
+    run("SELECT a from " + dbName + ".ptned WHERE b=2", driver);
+    verifyResults(ptn_data_2, driver);
+    run("SELECT a from " + dbName + ".ptned_empty", driver);
+    verifyResults(empty, driver);
+    run("SELECT * from " + dbName + ".unptned_empty", driver);
+    verifyResults(empty, driver);
+
+    advanceDumpDir();
+    run("REPL DUMP " + dbName, driver);
+    String replDumpLocn = getResult(0,0, driver);
+    String replDumpId = getResult(0,1,true, driver);
 
     // Table dropped after "repl dump"
-    run("DROP TABLE " + dbName + ".unptned");
+    run("DROP TABLE " + dbName + ".unptned", driver);
     // Partition droppped after "repl dump"
-    run("ALTER TABLE " + dbName + ".ptned " + "DROP PARTITION(b=1)");
+    run("ALTER TABLE " + dbName + ".ptned " + "DROP PARTITION(b=1)", driver);
     // File changed after "repl dump"
     Partition p = metaStoreClient.getPartition(dbName, "ptned", "b=2");
     Path loc = new Path(p.getSd().getLocation());
@@ -317,25 +342,25 @@ public class TestReplicationScenarios {
     fs.delete(file, false);
     fs.copyFromLocalFile(new Path(ptn_locn_2_later), file);
 
-    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'");
-    printOutput();
-    run("REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'");
+    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'", 
driverMirror);
+    printOutput(driverMirror);
+    run("REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'", 
driverMirror);
 
-    run("REPL STATUS " + dbName + "_dupe");
-    verifyResults(new String[] {replDumpId});
+    run("REPL STATUS " + dbName + "_dupe", driverMirror);
+    verifyResults(new String[] {replDumpId}, driverMirror);
 
-    run("SELECT * from " + dbName + "_dupe.unptned");
-    verifyResults(unptn_data);
-    run("SELECT a from " + dbName + "_dupe.ptned WHERE b=1");
-    verifyResults(ptn_data_1);
+    run("SELECT * from " + dbName + "_dupe.unptned", driverMirror);
+    verifyResults(unptn_data, driverMirror);
+    run("SELECT a from " + dbName + "_dupe.ptned WHERE b=1", driverMirror);
+    verifyResults(ptn_data_1, driverMirror);
     // Since partition(b=2) changed manually, Hive cannot find
     // it in original location and cmroot, thus empty
-    run("SELECT a from " + dbName + "_dupe.ptned WHERE b=2");
-    verifyResults(empty);
-    run("SELECT a from " + dbName + ".ptned_empty");
-    verifyResults(empty);
-    run("SELECT * from " + dbName + ".unptned_empty");
-    verifyResults(empty);
+    run("SELECT a from " + dbName + "_dupe.ptned WHERE b=2", driverMirror);
+    verifyResults(empty, driverMirror);
+    run("SELECT a from " + dbName + ".ptned_empty", driverMirror);
+    verifyResults(empty, driverMirror);
+    run("SELECT * from " + dbName + ".unptned_empty", driverMirror);
+    verifyResults(empty, driverMirror);
   }
 
   @Test
@@ -344,58 +369,58 @@ public class TestReplicationScenarios {
     LOG.info("Testing "+testName);
     String dbName = testName + "_" + tid;
 
-    run("CREATE DATABASE " + dbName);
-    run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE");
+    run("CREATE DATABASE " + dbName, driver);
+    run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE", 
driver);
 
     String[] unptn_data = new String[]{ "eleven" , "twelve" };
     String unptn_locn = new Path(TEST_PATH , testName + 
"_unptn").toUri().getPath();
     createTestDataFile(unptn_locn, unptn_data);
 
-    run("LOAD DATA LOCAL INPATH '" + unptn_locn + "' OVERWRITE INTO TABLE " + 
dbName + ".unptned");
-    verifySetup("SELECT * from " + dbName + ".unptned ORDER BY a", unptn_data);
+    run("LOAD DATA LOCAL INPATH '" + unptn_locn + "' OVERWRITE INTO TABLE " + 
dbName + ".unptned", driver);
+    verifySetup("SELECT * from " + dbName + ".unptned ORDER BY a", unptn_data, 
driver);
 
     // Create an empty database to load
-    run("CREATE DATABASE " + dbName + "_empty");
+    run("CREATE DATABASE " + dbName + "_empty", driverMirror);
 
     advanceDumpDir();
-    run("REPL DUMP " + dbName);
-    String replDumpLocn = getResult(0,0);
-    String replDumpId = getResult(0,1,true);
+    run("REPL DUMP " + dbName, driver);
+    String replDumpLocn = getResult(0,0,driver);
+    String replDumpId = getResult(0,1,true,driver);
     // Load to an empty database
-    run("REPL LOAD " + dbName + "_empty FROM '" + replDumpLocn + "'");
+    run("REPL LOAD " + dbName + "_empty FROM '" + replDumpLocn + "'", 
driverMirror);
 
     // REPL STATUS should return same repl ID as dump
-    verifyRun("REPL STATUS " + dbName + "_empty", replDumpId);
-    verifyRun("SELECT * from " + dbName + "_empty.unptned", unptn_data);
+    verifyRun("REPL STATUS " + dbName + "_empty", replDumpId, driverMirror);
+    verifyRun("SELECT * from " + dbName + "_empty.unptned", unptn_data, 
driverMirror);
 
     String[] nullReplId = new String[]{ "NULL" };
 
     // Create a database with a table
-    run("CREATE DATABASE " + dbName + "_withtable");
-    run("CREATE TABLE " + dbName + "_withtable.unptned(a string) STORED AS 
TEXTFILE");
+    run("CREATE DATABASE " + dbName + "_withtable", driverMirror);
+    run("CREATE TABLE " + dbName + "_withtable.unptned(a string) STORED AS 
TEXTFILE", driverMirror);
     // Load using same dump to a DB with table. It should fail as DB is not 
empty.
-    verifyFail("REPL LOAD " + dbName + "_withtable FROM '" + replDumpLocn + 
"'");
+    verifyFail("REPL LOAD " + dbName + "_withtable FROM '" + replDumpLocn + 
"'", driverMirror);
 
     // REPL STATUS should return NULL
-    verifyRun("REPL STATUS " + dbName + "_withtable", nullReplId);
+    verifyRun("REPL STATUS " + dbName + "_withtable", nullReplId, 
driverMirror);
 
     // Create a database with a view
-    run("CREATE DATABASE " + dbName + "_withview");
-    run("CREATE TABLE " + dbName + "_withview.unptned(a string) STORED AS 
TEXTFILE");
-    run("CREATE VIEW " + dbName + "_withview.view AS SELECT * FROM " + dbName 
+ "_withview.unptned");
+    run("CREATE DATABASE " + dbName + "_withview", driverMirror);
+    run("CREATE TABLE " + dbName + "_withview.unptned(a string) STORED AS 
TEXTFILE", driverMirror);
+    run("CREATE VIEW " + dbName + "_withview.view AS SELECT * FROM " + dbName 
+ "_withview.unptned", driverMirror);
     // Load using same dump to a DB with view. It should fail as DB is not 
empty.
-    verifyFail("REPL LOAD " + dbName + "_withview FROM '" + replDumpLocn + 
"'");
+    verifyFail("REPL LOAD " + dbName + "_withview FROM '" + replDumpLocn + 
"'", driverMirror);
 
     // REPL STATUS should return NULL
-    verifyRun("REPL STATUS " + dbName + "_withview", nullReplId);
+    verifyRun("REPL STATUS " + dbName + "_withview", nullReplId, driverMirror);
   }
 
   @Test
   public void testBootstrapWithConcurrentDropTable() throws IOException {
     String name = testName.getMethodName();
-    String dbName = createDB(name);
-    run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE");
-    run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b int) 
STORED AS TEXTFILE");
+    String dbName = createDB(name, driver);
+    run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE", 
driver);
+    run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b int) 
STORED AS TEXTFILE", driver);
 
     String[] unptn_data = new String[]{ "eleven" , "twelve" };
     String[] ptn_data_1 = new String[]{ "thirteen", "fourteen", "fifteen"};
@@ -410,12 +435,12 @@ public class TestReplicationScenarios {
     createTestDataFile(ptn_locn_1, ptn_data_1);
     createTestDataFile(ptn_locn_2, ptn_data_2);
 
-    run("LOAD DATA LOCAL INPATH '" + unptn_locn + "' OVERWRITE INTO TABLE " + 
dbName + ".unptned");
-    verifySetup("SELECT * from " + dbName + ".unptned", unptn_data);
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b=1)");
-    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=1", ptn_data_1);
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b=2)");
-    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=2", ptn_data_2);
+    run("LOAD DATA LOCAL INPATH '" + unptn_locn + "' OVERWRITE INTO TABLE " + 
dbName + ".unptned", driver);
+    verifySetup("SELECT * from " + dbName + ".unptned", unptn_data, driver);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b=1)", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=1", ptn_data_1, 
driver);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b=2)", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=2", ptn_data_2, 
driver);
 
     advanceDumpDir();
 
@@ -435,41 +460,41 @@ public class TestReplicationScenarios {
     InjectableBehaviourObjectStore.setGetTableBehaviour(ptnedTableNuller);
 
     // The ptned table will not be dumped as getTable will return null
-    run("REPL DUMP " + dbName);
+    run("REPL DUMP " + dbName, driver);
     ptnedTableNuller.assertInjectionsPerformed(true,true);
     InjectableBehaviourObjectStore.resetGetTableBehaviour(); // reset the 
behaviour
 
-    String replDumpLocn = getResult(0, 0);
-    String replDumpId = getResult(0, 1, true);
+    String replDumpLocn = getResult(0, 0, driver);
+    String replDumpId = getResult(0, 1, true, driver);
     LOG.info("Bootstrap-Dump: Dumped to {} with id {}", replDumpLocn, 
replDumpId);
-    run("REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'");
+    run("REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'", 
driverMirror);
 
     // The ptned table should miss in target as the table was marked virtually 
as dropped
-    verifyRun("SELECT * from " + dbName + "_dupe.unptned", unptn_data);
-    verifyFail("SELECT a from " + dbName + "_dupe.ptned WHERE b=1");
-    verifyIfTableNotExist(dbName + "_dupe", "ptned");
+    verifyRun("SELECT * from " + dbName + "_dupe.unptned", unptn_data, 
driverMirror);
+    verifyFail("SELECT a from " + dbName + "_dupe.ptned WHERE b=1", 
driverMirror);
+    verifyIfTableNotExist(dbName + "_dupe", "ptned", metaStoreClient);
 
     // Verify if Drop table on a non-existing table is idempotent
-    run("DROP TABLE " + dbName + ".ptned");
-    verifyIfTableNotExist(dbName, "ptned");
+    run("DROP TABLE " + dbName + ".ptned", driver);
+    verifyIfTableNotExist(dbName, "ptned", metaStoreClient);
 
     advanceDumpDir();
-    run("REPL DUMP " + dbName + " FROM " + replDumpId);
-    String postDropReplDumpLocn = getResult(0,0);
-    String postDropReplDumpId = getResult(0,1,true);
+    run("REPL DUMP " + dbName + " FROM " + replDumpId, driver);
+    String postDropReplDumpLocn = getResult(0,0, driver);
+    String postDropReplDumpId = getResult(0,1,true,driver);
     LOG.info("Dumped to {} with id {}->{}", postDropReplDumpLocn, replDumpId, 
postDropReplDumpId);
-    assert(run("REPL LOAD " + dbName + "_dupe FROM '" + postDropReplDumpLocn + 
"'", true));
+    assert(run("REPL LOAD " + dbName + "_dupe FROM '" + postDropReplDumpLocn + 
"'", true, driverMirror));
 
-    verifyRun("SELECT * from " + dbName + "_dupe.unptned", unptn_data);
-    verifyIfTableNotExist(dbName + "_dupe", "ptned");
-    verifyFail("SELECT a from " + dbName + "_dupe.ptned WHERE b=1");
+    verifyRun("SELECT * from " + dbName + "_dupe.unptned", unptn_data, 
driverMirror);
+    verifyIfTableNotExist(dbName + "_dupe", "ptned", metaStoreClientMirror);
+    verifyFail("SELECT a from " + dbName + "_dupe.ptned WHERE b=1", 
driverMirror);
   }
 
   @Test
   public void testBootstrapWithConcurrentDropPartition() throws IOException {
     String name = testName.getMethodName();
-    String dbName = createDB(name);
-    run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b int) 
STORED AS TEXTFILE");
+    String dbName = createDB(name, driver);
+    run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b int) 
STORED AS TEXTFILE", driver);
 
     String[] ptn_data_1 = new String[]{ "thirteen", "fourteen", "fifteen"};
     String[] ptn_data_2 = new String[]{ "fifteen", "sixteen", "seventeen"};
@@ -481,10 +506,10 @@ public class TestReplicationScenarios {
     createTestDataFile(ptn_locn_1, ptn_data_1);
     createTestDataFile(ptn_locn_2, ptn_data_2);
 
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b=1)");
-    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=1", ptn_data_1);
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b=2)");
-    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=2", ptn_data_2);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b=1)", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=1", ptn_data_1, 
driver);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b=2)", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=2", ptn_data_2, 
driver);
 
     advanceDumpDir();
 
@@ -500,58 +525,58 @@ public class TestReplicationScenarios {
     
InjectableBehaviourObjectStore.setListPartitionNamesBehaviour(listPartitionNamesNuller);
 
     // None of the partitions will be dumped as the partitions list was empty
-    run("REPL DUMP " + dbName);
+    run("REPL DUMP " + dbName, driver);
     listPartitionNamesNuller.assertInjectionsPerformed(true, false);
     InjectableBehaviourObjectStore.resetListPartitionNamesBehaviour(); // 
reset the behaviour
 
-    String replDumpLocn = getResult(0, 0);
-    String replDumpId = getResult(0, 1, true);
+    String replDumpLocn = getResult(0, 0, driver);
+    String replDumpId = getResult(0, 1, true, driver);
     LOG.info("Bootstrap-Dump: Dumped to {} with id {}", replDumpLocn, 
replDumpId);
-    run("REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'");
+    run("REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'", 
driverMirror);
 
     // All partitions should miss in target as it was marked virtually as 
dropped
-    verifyRun("SELECT a from " + dbName + "_dupe.ptned WHERE b=1", empty);
-    verifyRun("SELECT a from " + dbName + "_dupe.ptned WHERE b=2", empty);
-    verifyIfPartitionNotExist(dbName + "_dupe", "ptned", new 
ArrayList<>(Arrays.asList("1")));
-    verifyIfPartitionNotExist(dbName + "_dupe", "ptned", new 
ArrayList<>(Arrays.asList("2")));
+    verifyRun("SELECT a from " + dbName + "_dupe.ptned WHERE b=1", empty, 
driverMirror);
+    verifyRun("SELECT a from " + dbName + "_dupe.ptned WHERE b=2", empty, 
driverMirror);
+    verifyIfPartitionNotExist(dbName + "_dupe", "ptned", new 
ArrayList<>(Arrays.asList("1")), metaStoreClientMirror);
+    verifyIfPartitionNotExist(dbName + "_dupe", "ptned", new 
ArrayList<>(Arrays.asList("2")), metaStoreClientMirror);
 
     // Verify if drop partition on a non-existing partition is idempotent and 
just a noop.
-    run("ALTER TABLE " + dbName + ".ptned DROP PARTITION (b=1)");
-    run("ALTER TABLE " + dbName + ".ptned DROP PARTITION (b=2)");
-    verifyIfPartitionNotExist(dbName, "ptned", new 
ArrayList<>(Arrays.asList("1")));
-    verifyIfPartitionNotExist(dbName, "ptned", new 
ArrayList<>(Arrays.asList("2")));
-    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=1", empty);
-    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=2", empty);
+    run("ALTER TABLE " + dbName + ".ptned DROP PARTITION (b=1)", driver);
+    run("ALTER TABLE " + dbName + ".ptned DROP PARTITION (b=2)", driver);
+    verifyIfPartitionNotExist(dbName, "ptned", new 
ArrayList<>(Arrays.asList("1")), metaStoreClient);
+    verifyIfPartitionNotExist(dbName, "ptned", new 
ArrayList<>(Arrays.asList("2")), metaStoreClient);
+    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=1", empty, driver);
+    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=2", empty, driver);
 
     advanceDumpDir();
-    run("REPL DUMP " + dbName + " FROM " + replDumpId);
-    String postDropReplDumpLocn = getResult(0,0);
-    String postDropReplDumpId = getResult(0,1,true);
+    run("REPL DUMP " + dbName + " FROM " + replDumpId, driver);
+    String postDropReplDumpLocn = getResult(0,0,driver);
+    String postDropReplDumpId = getResult(0,1,true,driver);
     LOG.info("Dumped to {} with id {}->{}", postDropReplDumpLocn, replDumpId, 
postDropReplDumpId);
-    assert(run("REPL LOAD " + dbName + "_dupe FROM '" + postDropReplDumpLocn + 
"'", true));
+    assert(run("REPL LOAD " + dbName + "_dupe FROM '" + postDropReplDumpLocn + 
"'", true, driverMirror));
 
-    verifyIfPartitionNotExist(dbName + "_dupe", "ptned", new 
ArrayList<>(Arrays.asList("1")));
-    verifyIfPartitionNotExist(dbName + "_dupe", "ptned", new 
ArrayList<>(Arrays.asList("2")));
-    verifyRun("SELECT a from " + dbName + "_dupe.ptned WHERE b=1", empty);
-    verifyRun("SELECT a from " + dbName + "_dupe.ptned WHERE b=2", empty);
+    verifyIfPartitionNotExist(dbName + "_dupe", "ptned", new 
ArrayList<>(Arrays.asList("1")), metaStoreClientMirror);
+    verifyIfPartitionNotExist(dbName + "_dupe", "ptned", new 
ArrayList<>(Arrays.asList("2")), metaStoreClientMirror);
+    verifyRun("SELECT a from " + dbName + "_dupe.ptned WHERE b=1", empty, 
driverMirror);
+    verifyRun("SELECT a from " + dbName + "_dupe.ptned WHERE b=2", empty, 
driverMirror);
   }
 
   @Test
   public void testIncrementalAdds() throws IOException {
     String name = testName.getMethodName();
-    String dbName = createDB(name);
+    String dbName = createDB(name, driver);
 
-    run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE");
-    run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b int) 
STORED AS TEXTFILE");
-    run("CREATE TABLE " + dbName + ".unptned_empty(a string) STORED AS 
TEXTFILE");
-    run("CREATE TABLE " + dbName + ".ptned_empty(a string) partitioned by (b 
int) STORED AS TEXTFILE");
+    run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE", 
driver);
+    run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b int) 
STORED AS TEXTFILE", driver);
+    run("CREATE TABLE " + dbName + ".unptned_empty(a string) STORED AS 
TEXTFILE", driver);
+    run("CREATE TABLE " + dbName + ".ptned_empty(a string) partitioned by (b 
int) STORED AS TEXTFILE", driver);
 
     advanceDumpDir();
-    run("REPL DUMP " + dbName);
-    String replDumpLocn = getResult(0,0);
-    String replDumpId = getResult(0,1,true);
+    run("REPL DUMP " + dbName, driver);
+    String replDumpLocn = getResult(0,0,driver);
+    String replDumpId = getResult(0,1,true,driver);
     LOG.info("Dumped to {} with id {}",replDumpLocn,replDumpId);
-    run("REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'");
+    run("REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'", 
driverMirror);
 
     String[] unptn_data = new String[]{ "eleven" , "twelve" };
     String[] ptn_data_1 = new String[]{ "thirteen", "fourteen", "fifteen"};
@@ -566,79 +591,79 @@ public class TestReplicationScenarios {
     createTestDataFile(ptn_locn_1, ptn_data_1);
     createTestDataFile(ptn_locn_2, ptn_data_2);
 
-    verifySetup("SELECT a from " + dbName + ".ptned_empty", empty);
-    verifySetup("SELECT * from " + dbName + ".unptned_empty", empty);
+    verifySetup("SELECT a from " + dbName + ".ptned_empty", empty, 
driverMirror);
+    verifySetup("SELECT * from " + dbName + ".unptned_empty", empty, 
driverMirror);
 
     // Now, we load data into the tables, and see if an incremental
     // repl drop/load can duplicate it.
 
-    run("LOAD DATA LOCAL INPATH '" + unptn_locn + "' OVERWRITE INTO TABLE " + 
dbName + ".unptned");
-    verifySetup("SELECT * from " + dbName + ".unptned", unptn_data);
-    run("CREATE TABLE " + dbName + ".unptned_late AS SELECT * from " + dbName 
+ ".unptned");
-    verifySetup("SELECT * from " + dbName + ".unptned_late", unptn_data);
+    run("LOAD DATA LOCAL INPATH '" + unptn_locn + "' OVERWRITE INTO TABLE " + 
dbName + ".unptned", driver);
+    verifySetup("SELECT * from " + dbName + ".unptned", unptn_data, driver);
+    run("CREATE TABLE " + dbName + ".unptned_late AS SELECT * from " + dbName 
+ ".unptned", driver);
+    verifySetup("SELECT * from " + dbName + ".unptned_late", unptn_data, 
driver);
 
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b=1)");
-    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=1", ptn_data_1);
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b=2)");
-    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=2", ptn_data_2);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b=1)", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=1", ptn_data_1, 
driver);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b=2)", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=2", ptn_data_2, 
driver);
 
-    run("CREATE TABLE " + dbName + ".ptned_late(a string) PARTITIONED BY (b 
int) STORED AS TEXTFILE");
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned_late PARTITION(b=1)");
-    verifySetup("SELECT a from " + dbName + ".ptned_late WHERE 
b=1",ptn_data_1);
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned_late PARTITION(b=2)");
-    verifySetup("SELECT a from " + dbName + ".ptned_late WHERE b=2", 
ptn_data_2);
+    run("CREATE TABLE " + dbName + ".ptned_late(a string) PARTITIONED BY (b 
int) STORED AS TEXTFILE", driver);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned_late PARTITION(b=1)", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned_late WHERE 
b=1",ptn_data_1, driver);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned_late PARTITION(b=2)", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned_late WHERE b=2", 
ptn_data_2, driver);
 
     // Perform REPL-DUMP/LOAD
     advanceDumpDir();
-    run("REPL DUMP " + dbName + " FROM " + replDumpId );
-    String incrementalDumpLocn = getResult(0,0);
-    String incrementalDumpId = getResult(0,1,true);
+    run("REPL DUMP " + dbName + " FROM " + replDumpId, driver);
+    String incrementalDumpLocn = getResult(0,0,driver);
+    String incrementalDumpId = getResult(0,1,true,driver);
     LOG.info("Dumped to {} with id {}", incrementalDumpLocn, 
incrementalDumpId);
-    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + 
"'");
-    printOutput();
-    run("REPL LOAD " + dbName + "_dupe FROM '"+incrementalDumpLocn+"'");
+    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + 
"'", driverMirror);
+    printOutput(driverMirror);
+    run("REPL LOAD " + dbName + "_dupe FROM '"+incrementalDumpLocn+"'", 
driverMirror);
 
-    run("REPL STATUS " + dbName + "_dupe");
-    verifyResults(new String[] {incrementalDumpId});
+    run("REPL STATUS " + dbName + "_dupe", driverMirror);
+    verifyResults(new String[] {incrementalDumpId}, driverMirror);
 
     // VERIFY tables and partitions on destination for equivalence.
 
-    verifyRun("SELECT * from " + dbName + "_dupe.unptned_empty", empty);
-    verifyRun("SELECT a from " + dbName + "_dupe.ptned_empty", empty);
+    verifyRun("SELECT * from " + dbName + "_dupe.unptned_empty", empty, 
driverMirror);
+    verifyRun("SELECT a from " + dbName + "_dupe.ptned_empty", empty, 
driverMirror);
 
 //    verifyRun("SELECT * from " + dbName + "_dupe.unptned", unptn_data);
     // TODO :this does not work because LOAD DATA LOCAL INPATH into an unptned 
table seems
     // to use ALTER_TABLE only - it does not emit an INSERT or CREATE - 
re-enable after
     // fixing that.
-    verifyRun("SELECT * from " + dbName + "_dupe.unptned_late", unptn_data);
+    verifyRun("SELECT * from " + dbName + "_dupe.unptned_late", unptn_data, 
driverMirror);
 
-    verifyRun("SELECT a from " + dbName + "_dupe.ptned WHERE b=1", ptn_data_1);
-    verifyRun("SELECT a from " + dbName + "_dupe.ptned WHERE b=2", ptn_data_2);
+    verifyRun("SELECT a from " + dbName + "_dupe.ptned WHERE b=1", ptn_data_1, 
driverMirror);
+    verifyRun("SELECT a from " + dbName + "_dupe.ptned WHERE b=2", ptn_data_2, 
driverMirror);
 
-    verifyRun("SELECT a from " + dbName + "_dupe.ptned_late WHERE b=1", 
ptn_data_1);
-    verifyRun("SELECT a from " + dbName + "_dupe.ptned_late WHERE b=2", 
ptn_data_2);
+    verifyRun("SELECT a from " + dbName + "_dupe.ptned_late WHERE b=1", 
ptn_data_1, driverMirror);
+    verifyRun("SELECT a from " + dbName + "_dupe.ptned_late WHERE b=2", 
ptn_data_2, driverMirror);
   }
 
   @Test
   public void testIncrementalLoadWithVariableLengthEventId() throws 
IOException, TException {
     String testName = "incrementalLoadWithVariableLengthEventId";
-    String dbName = createDB(testName);
-    run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE");
-    run("INSERT INTO TABLE " + dbName + ".unptned values('ten')");
+    String dbName = createDB(testName, driver);
+    run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE", 
driver);
+    run("INSERT INTO TABLE " + dbName + ".unptned values('ten')", driver);
 
     advanceDumpDir();
-    run("REPL DUMP " + dbName);
-    String replDumpLocn = getResult(0, 0);
-    String replDumpId = getResult(0, 1, true);
+    run("REPL DUMP " + dbName, driver);
+    String replDumpLocn = getResult(0, 0, driver);
+    String replDumpId = getResult(0, 1, true, driver);
     LOG.info("Bootstrap-Dump: Dumped to {} with id {}", replDumpLocn, 
replDumpId);
-    run("REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'");
+    run("REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'", 
driverMirror);
 
     // CREATE_TABLE - TRUNCATE - INSERT - The result is just one record.
     // Creating dummy table to control the event ID of TRUNCATE not to be 10 
or 100 or 1000...
     String[] unptn_data = new String[]{ "eleven" };
-    run("CREATE TABLE " + dbName + ".dummy(a string) STORED AS TEXTFILE");
-    run("TRUNCATE TABLE " + dbName + ".unptned");
-    run("INSERT INTO TABLE " + dbName + ".unptned values('" + unptn_data[0] + 
"')");
+    run("CREATE TABLE " + dbName + ".dummy(a string) STORED AS TEXTFILE", 
driver);
+    run("TRUNCATE TABLE " + dbName + ".unptned", driver);
+    run("INSERT INTO TABLE " + dbName + ".unptned values('" + unptn_data[0] + 
"')", driver);
 
     // Inject a behaviour where all events will get ID less than 100 except 
TRUNCATE which will get ID 100.
     // This enesures variable length of event ID in the incremental dump
@@ -713,28 +738,28 @@ public class TestReplicationScenarios {
                + " TO " + 
String.valueOf(metaStoreClient.getCurrentNotificationEventId().getEventId()*100);
 
     advanceDumpDir();
-    run(cmd);
+    run(cmd, driver);
     eventIdModifier.assertInjectionsPerformed(true,false);
     InjectableBehaviourObjectStore.resetGetNextNotificationBehaviour(); // 
reset the behaviour
 
-    String incrementalDumpLocn = getResult(0, 0);
-    String incrementalDumpId = getResult(0, 1, true);
+    String incrementalDumpLocn = getResult(0, 0, driver);
+    String incrementalDumpId = getResult(0, 1, true, driver);
     LOG.info("Incremental-Dump: Dumped to {} with id {} from {}", 
incrementalDumpLocn, incrementalDumpId, replDumpId);
-    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + 
"'");
-    printOutput();
-    run("REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + "'");
-    verifyRun("SELECT a from " + dbName + "_dupe.unptned ORDER BY a", 
unptn_data);
+    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + 
"'", driverMirror);
+    printOutput(driverMirror);
+    run("REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + "'", 
driverMirror);
+    verifyRun("SELECT a from " + dbName + "_dupe.unptned ORDER BY a", 
unptn_data, driverMirror);
   }
 
   @Test
   public void testDrops() throws IOException {
 
     String name = testName.getMethodName();
-    String dbName = createDB(name);
-    run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE");
-    run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b string) 
STORED AS TEXTFILE");
-    run("CREATE TABLE " + dbName + ".ptned2(a string) partitioned by (b 
string) STORED AS TEXTFILE");
-    run("CREATE TABLE " + dbName + ".ptned3(a string) partitioned by (b int) 
STORED AS TEXTFILE");
+    String dbName = createDB(name, driver);
+    run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE", 
driver);
+    run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b string) 
STORED AS TEXTFILE", driver);
+    run("CREATE TABLE " + dbName + ".ptned2(a string) partitioned by (b 
string) STORED AS TEXTFILE", driver);
+    run("CREATE TABLE " + dbName + ".ptned3(a string) partitioned by (b int) 
STORED AS TEXTFILE", driver);
 
     String[] unptn_data = new String[]{ "eleven" , "twelve" };
     String[] ptn_data_1 = new String[]{ "thirteen", "fourteen", "fifteen"};
@@ -749,85 +774,85 @@ public class TestReplicationScenarios {
     createTestDataFile(ptn_locn_1, ptn_data_1);
     createTestDataFile(ptn_locn_2, ptn_data_2);
 
-    run("LOAD DATA LOCAL INPATH '" + unptn_locn + "' OVERWRITE INTO TABLE " + 
dbName + ".unptned");
-    verifySetup("SELECT * from " + dbName + ".unptned", unptn_data);
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b='1')");
-    verifySetup("SELECT a from " + dbName + ".ptned WHERE b='1'", ptn_data_1);
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b='2')");
-    verifySetup("SELECT a from " + dbName + ".ptned WHERE b='2'", ptn_data_2);
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned2 PARTITION(b='1')");
-    verifySetup("SELECT a from " + dbName + ".ptned2 WHERE b='1'", ptn_data_1);
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned2 PARTITION(b='2')");
-    verifySetup("SELECT a from " + dbName + ".ptned2 WHERE b='2'", ptn_data_2);
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned3 PARTITION(b=1)");
-    verifySetup("SELECT a from " + dbName + ".ptned2 WHERE b=1", ptn_data_1);
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned3 PARTITION(b=2)");
-    verifySetup("SELECT a from " + dbName + ".ptned2 WHERE b=2", ptn_data_2);
+    run("LOAD DATA LOCAL INPATH '" + unptn_locn + "' OVERWRITE INTO TABLE " + 
dbName + ".unptned", driver);
+    verifySetup("SELECT * from " + dbName + ".unptned", unptn_data, driver);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b='1')", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned WHERE b='1'", ptn_data_1, 
driver);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b='2')", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned WHERE b='2'", ptn_data_2, 
driver);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned2 PARTITION(b='1')", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned2 WHERE b='1'", ptn_data_1, 
driver);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned2 PARTITION(b='2')", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned2 WHERE b='2'", ptn_data_2, 
driver);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned3 PARTITION(b=1)", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned2 WHERE b=1", ptn_data_1, 
driver);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned3 PARTITION(b=2)", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned2 WHERE b=2", ptn_data_2, 
driver);
 
     // At this point, we've set up all the tables and ptns we're going to test 
drops across
     // Replicate it first, and then we'll drop it on the source.
 
     advanceDumpDir();
-    run("REPL DUMP " + dbName);
-    String replDumpLocn = getResult(0,0);
-    String replDumpId = getResult(0,1,true);
-    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'");
-    printOutput();
-    run("REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'");
-    verifySetup("REPL STATUS " + dbName + "_dupe", new String[]{replDumpId});
+    run("REPL DUMP " + dbName, driver);
+    String replDumpLocn = getResult(0,0,driver);
+    String replDumpId = getResult(0,1,true,driver);
+    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'", 
driverMirror);
+    printOutput(driverMirror);
+    run("REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'", 
driverMirror);
+    verifySetup("REPL STATUS " + dbName + "_dupe", new String[]{replDumpId}, 
driverMirror);
 
-    verifySetup("SELECT * from " + dbName + "_dupe.unptned", unptn_data);
-    verifySetup("SELECT a from " + dbName + "_dupe.ptned WHERE b='1'", 
ptn_data_1);
-    verifySetup("SELECT a from " + dbName + "_dupe.ptned WHERE b='2'", 
ptn_data_2);
-    verifySetup("SELECT a from " + dbName + "_dupe.ptned2 WHERE b='1'", 
ptn_data_1);
-    verifySetup("SELECT a from " + dbName + "_dupe.ptned2 WHERE b='2'", 
ptn_data_2);
-    verifySetup("SELECT a from " + dbName + "_dupe.ptned3 WHERE b=1", 
ptn_data_1);
-    verifySetup("SELECT a from " + dbName + "_dupe.ptned3 WHERE b=2", 
ptn_data_2);
+    verifySetup("SELECT * from " + dbName + "_dupe.unptned", unptn_data, 
driverMirror);
+    verifySetup("SELECT a from " + dbName + "_dupe.ptned WHERE b='1'", 
ptn_data_1, driverMirror);
+    verifySetup("SELECT a from " + dbName + "_dupe.ptned WHERE b='2'", 
ptn_data_2, driverMirror);
+    verifySetup("SELECT a from " + dbName + "_dupe.ptned2 WHERE b='1'", 
ptn_data_1, driverMirror);
+    verifySetup("SELECT a from " + dbName + "_dupe.ptned2 WHERE b='2'", 
ptn_data_2, driverMirror);
+    verifySetup("SELECT a from " + dbName + "_dupe.ptned3 WHERE b=1", 
ptn_data_1, driverMirror);
+    verifySetup("SELECT a from " + dbName + "_dupe.ptned3 WHERE b=2", 
ptn_data_2, driverMirror);
 
     // All tables good on destination, drop on source.
 
-    run("DROP TABLE " + dbName + ".unptned");
-    run("ALTER TABLE " + dbName + ".ptned DROP PARTITION (b='2')");
-    run("DROP TABLE " + dbName + ".ptned2");
-    run("ALTER TABLE " + dbName + ".ptned3 DROP PARTITION (b=1)");
-    verifySetup("SELECT a from " + dbName + ".ptned WHERE b='2'", empty);
-    verifySetup("SELECT a from " + dbName + ".ptned", ptn_data_1);
-    verifySetup("SELECT a from " + dbName + ".ptned3 WHERE b=1",empty);
-    verifySetup("SELECT a from " + dbName + ".ptned3", ptn_data_2);
+    run("DROP TABLE " + dbName + ".unptned", driver);
+    run("ALTER TABLE " + dbName + ".ptned DROP PARTITION (b='2')", driver);
+    run("DROP TABLE " + dbName + ".ptned2", driver);
+    run("ALTER TABLE " + dbName + ".ptned3 DROP PARTITION (b=1)", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned WHERE b='2'", empty, 
driver);
+    verifySetup("SELECT a from " + dbName + ".ptned", ptn_data_1, driver);
+    verifySetup("SELECT a from " + dbName + ".ptned3 WHERE b=1",empty, driver);
+    verifySetup("SELECT a from " + dbName + ".ptned3", ptn_data_2, driver);
 
     // replicate the incremental drops
 
     advanceDumpDir();
-    run("REPL DUMP " + dbName + " FROM " + replDumpId);
-    String postDropReplDumpLocn = getResult(0,0);
-    String postDropReplDumpId = getResult(0,1,true);
+    run("REPL DUMP " + dbName + " FROM " + replDumpId, driver);
+    String postDropReplDumpLocn = getResult(0,0,driver);
+    String postDropReplDumpId = getResult(0,1,true,driver);
     LOG.info("Dumped to {} with id {}->{}", postDropReplDumpLocn, replDumpId, 
postDropReplDumpId);
-    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + postDropReplDumpLocn 
+ "'");
-    printOutput();
-    run("REPL LOAD " + dbName + "_dupe FROM '" + postDropReplDumpLocn + "'");
+    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + postDropReplDumpLocn 
+ "'", driverMirror);
+    printOutput(driverMirror);
+    run("REPL LOAD " + dbName + "_dupe FROM '" + postDropReplDumpLocn + "'", 
driverMirror);
 
     // verify that drops were replicated. This can either be from tables or 
ptns
     // not existing, and thus, throwing a NoSuchObjectException, or returning 
nulls
     // or select * returning empty, depending on what we're testing.
 
-    verifyIfTableNotExist(dbName + "_dupe", "unptned");
+    verifyIfTableNotExist(dbName + "_dupe", "unptned", metaStoreClientMirror);
 
-    verifyRun("SELECT a from " + dbName + "_dupe.ptned WHERE b='2'", empty);
-    verifyRun("SELECT a from " + dbName + "_dupe.ptned", ptn_data_1);
-    verifyRun("SELECT a from " + dbName + "_dupe.ptned3 WHERE b=1", empty);
-    verifyRun("SELECT a from " + dbName + "_dupe.ptned3", ptn_data_2);
+    verifyRun("SELECT a from " + dbName + "_dupe.ptned WHERE b='2'", empty, 
driverMirror);
+    verifyRun("SELECT a from " + dbName + "_dupe.ptned", ptn_data_1, 
driverMirror);
+    verifyRun("SELECT a from " + dbName + "_dupe.ptned3 WHERE b=1", empty, 
driverMirror);
+    verifyRun("SELECT a from " + dbName + "_dupe.ptned3", ptn_data_2, 
driverMirror);
 
-    verifyIfTableNotExist(dbName + "_dupe", "ptned2");
+    verifyIfTableNotExist(dbName + "_dupe", "ptned2", metaStoreClientMirror);
   }
 
   @Test
   public void testDropsWithCM() throws IOException {
 
     String testName = "drops_with_cm";
-    String dbName = createDB(testName);
-    run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE");
-    run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b string) 
STORED AS TEXTFILE");
-    run("CREATE TABLE " + dbName + ".ptned2(a string) partitioned by (b 
string) STORED AS TEXTFILE");
+    String dbName = createDB(testName, driver);
+    run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE", 
driver);
+    run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b string) 
STORED AS TEXTFILE", driver);
+    run("CREATE TABLE " + dbName + ".ptned2(a string) partitioned by (b 
string) STORED AS TEXTFILE", driver);
 
     String[] unptn_data = new String[]{ "eleven" , "twelve" };
     String[] ptn_data_1 = new String[]{ "thirteen", "fourteen", "fifteen"};
@@ -842,79 +867,79 @@ public class TestReplicationScenarios {
     createTestDataFile(ptn_locn_1, ptn_data_1);
     createTestDataFile(ptn_locn_2, ptn_data_2);
 
-    run("LOAD DATA LOCAL INPATH '" + unptn_locn + "' OVERWRITE INTO TABLE " + 
dbName + ".unptned");
-    run("SELECT * from " + dbName + ".unptned");
-    verifyResults(unptn_data);
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b='1')");
-    run("SELECT a from " + dbName + ".ptned WHERE b='1'");
-    verifyResults(ptn_data_1);
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b='2')");
-    run("SELECT a from " + dbName + ".ptned WHERE b='2'");
-    verifyResults(ptn_data_2);
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned2 PARTITION(b='1')");
-    run("SELECT a from " + dbName + ".ptned2 WHERE b='1'");
-    verifyResults(ptn_data_1);
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned2 PARTITION(b='2')");
-    run("SELECT a from " + dbName + ".ptned2 WHERE b='2'");
-    verifyResults(ptn_data_2);
-
-    advanceDumpDir();
-    run("REPL DUMP " + dbName);
-    String replDumpLocn = getResult(0,0);
-    String replDumpId = getResult(0,1,true);
-    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'");
-    printOutput();
-    run("REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'");
-
-    run("REPL STATUS " + dbName + "_dupe");
-    verifyResults(new String[] {replDumpId});
-
-    run("SELECT * from " + dbName + "_dupe.unptned");
-    verifyResults(unptn_data);
-    run("SELECT a from " + dbName + "_dupe.ptned WHERE b='1'");
-    verifyResults(ptn_data_1);
-    run("SELECT a from " + dbName + "_dupe.ptned WHERE b='2'");
-    verifyResults(ptn_data_2);
-    run("SELECT a from " + dbName + "_dupe.ptned2 WHERE b='1'");
-    verifyResults(ptn_data_1);
-    run("SELECT a from " + dbName + "_dupe.ptned2 WHERE b='2'");
-    verifyResults(ptn_data_2);
-
-    run("CREATE TABLE " + dbName + ".unptned_copy" + " AS SELECT a FROM " + 
dbName + ".unptned");
-    run("CREATE TABLE " + dbName + ".ptned_copy" + " LIKE " + dbName + 
".ptned");
+    run("LOAD DATA LOCAL INPATH '" + unptn_locn + "' OVERWRITE INTO TABLE " + 
dbName + ".unptned", driver);
+    run("SELECT * from " + dbName + ".unptned", driver);
+    verifyResults(unptn_data, driver);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b='1')", driver);
+    run("SELECT a from " + dbName + ".ptned WHERE b='1'", driver);
+    verifyResults(ptn_data_1, driver);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b='2')", driver);
+    run("SELECT a from " + dbName + ".ptned WHERE b='2'", driver);
+    verifyResults(ptn_data_2, driver);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned2 PARTITION(b='1')", driver);
+    run("SELECT a from " + dbName + ".ptned2 WHERE b='1'", driver);
+    verifyResults(ptn_data_1, driver);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned2 PARTITION(b='2')", driver);
+    run("SELECT a from " + dbName + ".ptned2 WHERE b='2'", driver);
+    verifyResults(ptn_data_2, driver);
+
+    advanceDumpDir();
+    run("REPL DUMP " + dbName, driver);
+    String replDumpLocn = getResult(0,0,driver);
+    String replDumpId = getResult(0,1,true,driver);
+    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'", 
driverMirror);
+    printOutput(driverMirror);
+    run("REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'", 
driverMirror);
+
+    run("REPL STATUS " + dbName + "_dupe", driverMirror);
+    verifyResults(new String[] {replDumpId}, driverMirror);
+
+    run("SELECT * from " + dbName + "_dupe.unptned", driverMirror);
+    verifyResults(unptn_data, driverMirror);
+    run("SELECT a from " + dbName + "_dupe.ptned WHERE b='1'", driverMirror);
+    verifyResults(ptn_data_1, driverMirror);
+    run("SELECT a from " + dbName + "_dupe.ptned WHERE b='2'", driverMirror);
+    verifyResults(ptn_data_2, driverMirror);
+    run("SELECT a from " + dbName + "_dupe.ptned2 WHERE b='1'", driverMirror);
+    verifyResults(ptn_data_1, driverMirror);
+    run("SELECT a from " + dbName + "_dupe.ptned2 WHERE b='2'", driverMirror);
+    verifyResults(ptn_data_2, driverMirror);
+
+    run("CREATE TABLE " + dbName + ".unptned_copy" + " AS SELECT a FROM " + 
dbName + ".unptned", driver);
+    run("CREATE TABLE " + dbName + ".ptned_copy" + " LIKE " + dbName + 
".ptned", driver);
     run("INSERT INTO TABLE " + dbName + ".ptned_copy" + " PARTITION(b='1') 
SELECT a FROM " +
-        dbName + ".ptned WHERE b='1'");
-    run("SELECT a from " + dbName + ".unptned_copy");
-    verifyResults(unptn_data);
-    run("SELECT a from " + dbName + ".ptned_copy");
-    verifyResults(ptn_data_1);
-
-    run("DROP TABLE " + dbName + ".unptned");
-    run("ALTER TABLE " + dbName + ".ptned DROP PARTITION (b='2')");
-    run("DROP TABLE " + dbName + ".ptned2");
-    run("SELECT a from " + dbName + ".ptned WHERE b=2");
-    verifyResults(empty);
-    run("SELECT a from " + dbName + ".ptned");
-    verifyResults(ptn_data_1);
-
-    advanceDumpDir();
-    run("REPL DUMP " + dbName + " FROM " + replDumpId);
-    String postDropReplDumpLocn = getResult(0,0);
-    String postDropReplDumpId = getResult(0,1,true);
+        dbName + ".ptned WHERE b='1'", driver);
+    run("SELECT a from " + dbName + ".unptned_copy", driver);
+    verifyResults(unptn_data, driver);
+    run("SELECT a from " + dbName + ".ptned_copy", driver);
+    verifyResults(ptn_data_1, driver);
+
+    run("DROP TABLE " + dbName + ".unptned", driver);
+    run("ALTER TABLE " + dbName + ".ptned DROP PARTITION (b='2')", driver);
+    run("DROP TABLE " + dbName + ".ptned2", driver);
+    run("SELECT a from " + dbName + ".ptned WHERE b=2", driver);
+    verifyResults(empty, driver);
+    run("SELECT a from " + dbName + ".ptned", driver);
+    verifyResults(ptn_data_1, driver);
+
+    advanceDumpDir();
+    run("REPL DUMP " + dbName + " FROM " + replDumpId, driver);
+    String postDropReplDumpLocn = getResult(0,0,driver);
+    String postDropReplDumpId = getResult(0,1,true,driver);
     LOG.info("Dumped to {} with id {}->{}", postDropReplDumpLocn, replDumpId, 
postDropReplDumpId);
 
     // Drop table after dump
-    run("DROP TABLE " + dbName + ".unptned_copy");
+    run("DROP TABLE " + dbName + ".unptned_copy", driver);
     // Drop partition after dump
-    run("ALTER TABLE " + dbName + ".ptned_copy DROP PARTITION(b='1')");
+    run("ALTER TABLE " + dbName + ".ptned_copy DROP PARTITION(b='1')", driver);
 
-    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + postDropReplDumpLocn 
+ "'");
-    printOutput();
-    run("REPL LOAD " + dbName + "_dupe FROM '" + postDropReplDumpLocn + "'");
+    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + postDropReplDumpLocn 
+ "'", driverMirror);
+    printOutput(driverMirror);
+    run("REPL LOAD " + dbName + "_dupe FROM '" + postDropReplDumpLocn + "'", 
driverMirror);
 
     Exception e = null;
     try {
-      Table tbl = metaStoreClient.getTable(dbName + "_dupe", "unptned");
+      Table tbl = metaStoreClientMirror.getTable(dbName + "_dupe", "unptned");
       assertNull(tbl);
     } catch (TException te) {
       e = te;
@@ -922,28 +947,28 @@ public class TestReplicationScenarios {
     assertNotNull(e);
     assertEquals(NoSuchObjectException.class, e.getClass());
 
-    run("SELECT a from " + dbName + "_dupe.ptned WHERE b=2");
-    verifyResults(empty);
-    run("SELECT a from " + dbName + "_dupe.ptned");
-    verifyResults(ptn_data_1);
+    run("SELECT a from " + dbName + "_dupe.ptned WHERE b=2", driverMirror);
+    verifyResults(empty, driverMirror);
+    run("SELECT a from " + dbName + "_dupe.ptned", driverMirror);
+    verifyResults(ptn_data_1, driverMirror);
 
-    verifyIfTableNotExist(dbName +"_dupe", "ptned2");
+    verifyIfTableNotExist(dbName +"_dupe", "ptned2", metaStoreClientMirror);
 
-    run("SELECT a from " + dbName + "_dupe.unptned_copy");
-    verifyResults(unptn_data);
-    run("SELECT a from " + dbName + "_dupe.ptned_copy");
-    verifyResults(ptn_data_1);
+    run("SELECT a from " + dbName + "_dupe.unptned_copy", driverMirror);
+    verifyResults(unptn_data, driverMirror);
+    run("SELECT a from " + dbName + "_dupe.ptned_copy", driverMirror);
+    verifyResults(ptn_data_1, driverMirror);
   }
 
   @Test
   public void testAlters() throws IOException {
 
     String testName = "alters";
-    String dbName = createDB(testName);
-    run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE");
-    run("CREATE TABLE " + dbName + ".unptned2(a string) STORED AS TEXTFILE");
-    run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b string) 
STORED AS TEXTFILE");
-    run("CREATE TABLE " + dbName + ".ptned2(a string) partitioned by (b 
string) STORED AS TEXTFILE");
+    String dbName = createDB(testName, driver);
+    run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE", 
driver);
+    run("CREATE TABLE " + dbName + ".unptned2(a string) STORED AS TEXTFILE", 
driver);
+    run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b string) 
STORED AS TEXTFILE", driver);
+    run("CREATE TABLE " + dbName + ".ptned2(a string) partitioned by (b 
string) STORED AS TEXTFILE", driver);
 
     String[] unptn_data = new String[]{ "eleven" , "twelve" };
     String[] ptn_data_1 = new String[]{ "thirteen", "fourteen", "fifteen"};
@@ -958,51 +983,51 @@ public class TestReplicationScenarios {
     createTestDataFile(ptn_locn_1, ptn_data_1);
     createTestDataFile(ptn_locn_2, ptn_data_2);
 
-    run("LOAD DATA LOCAL INPATH '" + unptn_locn + "' OVERWRITE INTO TABLE " + 
dbName + ".unptned");
-    verifySetup("SELECT * from " + dbName + ".unptned", unptn_data);
-    run("LOAD DATA LOCAL INPATH '" + unptn_locn + "' OVERWRITE INTO TABLE " + 
dbName + ".unptned2");
-    verifySetup("SELECT * from " + dbName + ".unptned2", unptn_data);
+    run("LOAD DATA LOCAL INPATH '" + unptn_locn + "' OVERWRITE INTO TABLE " + 
dbName + ".unptned", driver);
+    verifySetup("SELECT * from " + dbName + ".unptned", unptn_data, driver);
+    run("LOAD DATA LOCAL INPATH '" + unptn_locn + "' OVERWRITE INTO TABLE " + 
dbName + ".unptned2", driver);
+    verifySetup("SELECT * from " + dbName + ".unptned2", unptn_data, driver);
 
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b='1')");
-    verifySetup("SELECT a from " + dbName + ".ptned WHERE b='1'", ptn_data_1);
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b='2')");
-    verifySetup("SELECT a from " + dbName + ".ptned WHERE b='2'", ptn_data_2);
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned2 PARTITION(b='1')");
-    verifySetup("SELECT a from " + dbName + ".ptned2 WHERE b='1'",ptn_data_1);
-    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned2 PARTITION(b='2')");
-    verifySetup("SELECT a from " + dbName + ".ptned2 WHERE b='2'", ptn_data_2);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b='1')", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned WHERE b='1'", ptn_data_1, 
driver);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned PARTITION(b='2')", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned WHERE b='2'", ptn_data_2, 
driver);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned2 PARTITION(b='1')", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned2 WHERE b='1'",ptn_data_1, 
driver);
+    run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName + ".ptned2 PARTITION(b='2')", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned2 WHERE b='2'", ptn_data_2, 
driver);
 
     // base tables set up, let's replicate them over
 
     advanceDumpDir();
-    run("REPL DUMP " + dbName);
-    String replDumpLocn = getResult(0,0);
-    String replDumpId = getResult(0,1,true);
-    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'");
-    printOutput();
-    run("REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'");
+    run("REPL DUMP " + dbName, driver);
+    String replDumpLocn = getResult(0,0,driver);
+    String replDumpId = getResult(0,1,true,driver);
+    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'", 
driverMirror);
+    printOutput(driverMirror);
+    run("REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'", 
driverMirror);
 
-    run("REPL STATUS " + dbName + "_dupe");
-    verifyResults(new String[] {replDumpId});
+    run("REPL STATUS " + dbName + "_dupe", driverMirror);
+    verifyResults(new String[] {replDumpId}, driverMirror);
 
-    verifySetup("SELECT * from " + dbName + "_dupe.unptned", unptn_data);
-    verifySetup("SELECT * from " + dbName + "_dupe.unptned2", unptn_data);
-    verifySetup("SELECT a from " + dbName + "_dupe.ptned WHERE b='1'", 
ptn_data_1);
-    verifySetup("SELECT a from " + dbName + "_dupe.ptned WHERE b='2'", 
ptn_data_2);
-    verifySetup("SELECT a from " + dbName + "_dupe.ptned2 WHERE b='1'", 
ptn_data_1);
-    verifySetup("SELECT a from " + dbName + "_dupe.ptned2 WHERE b='2'", 
ptn_data_2);
+    verifySetup("SELECT * from " + dbName + "_dupe.unptned", unptn_data, 
driverMirror);
+    verifySetup("SELECT * from " + dbName + "_dupe.unptned2", unptn_data, 
driverMirror);
+    verifySetup("SELECT a from " + dbName + "_dupe.ptned WHERE b='1'", 
ptn_data_1, driverMirror);
+    verifySetup("SELECT a from " + dbName + "_dupe.ptned WHERE b='2'", 
ptn_data_2, driverMirror);
+    verifySetup("SELECT a from " + dbName + "_dupe.ptned2 WHERE b='1'", 
ptn_data_1, driverMirror);
+    verifySetup("SELECT a from " + dbName + "_dupe.ptned2 WHERE b='2'", 
ptn_data_2, driverMirror);
 
     // tables have been replicated over, and verified to be identical. Now, we 
do a couple of
     // alters on the source
 
     // Rename unpartitioned table
-    run("ALTER TABLE " + dbName + ".unptned RENAME TO " + dbName + 
".unptned_rn");
-    verifySetup("SELECT * from " + dbName + ".unptned_rn", unptn_data);
+    run("ALTER TABLE " + dbName + ".unptned RENAME TO " + dbName + 
".unptned_rn", driver);
+    verifySetup("SELECT * from " + dbName + ".unptned_rn", unptn_data, driver);
 
     // Alter unpartitioned table set table property
     String testKey = "blah";
     String testVal = "foo";
-    run("ALTER TABLE " + dbName + ".unptned2 SET TBLPROPERTIES ('" + testKey + 
"' = '" + testVal + "')");
+    run("ALTER TABLE " + dbName + ".unptned2 SET TBLPROPERTIES ('" + testKey + 
"' = '" + testVal + "')", driver);
     if (VERIFY_SETUP_STEPS){
       try {
         Table unptn2 = metaStoreClient.getTable(dbName,"unptned2");
@@ -1014,12 +1039,12 @@ public class TestReplicationScenarios {
     }
 
     // alter partitioned table, rename partition
-    run("ALTER TABLE " + dbName + ".ptned PARTITION (b='2') RENAME TO 
PARTITION (b='22')");
-    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=2", empty);
-    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=22", ptn_data_2);
+    run("ALTER TABLE " + dbName + ".ptned PARTITION (b='2') RENAME TO 
PARTITION (b='22')", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=2", empty, driver);
+    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=22", ptn_data_2, 
driver);
 
     // alter partitioned table set table property
-    run("ALTER TABLE " + dbName + ".ptned SET TBLPROPERTIES ('" + testKey + "' 
= '" + testVal + "')");
+    run("ALTER TABLE " + dbName + ".ptned SET TBLPROPERTIES ('" + testKey + "' 
= '" + testVal + "')", driver);
     if (VERIFY_SETUP_STEPS){
       try {
         Table ptned = metaStoreClient.getTable(dbName,"ptned");
@@ -1043,46 +1068,46 @@ public class TestReplicationScenarios {
     }
 
     // rename partitioned table
-    verifySetup("SELECT a from " + dbName + ".ptned2 WHERE b=2", ptn_data_2);
-    run("ALTER TABLE " + dbName + ".ptned2 RENAME TO " + dbName + 
".ptned2_rn");
-    verifySetup("SELECT a from " + dbName + ".ptned2_rn WHERE b=2", 
ptn_data_2);
+    verifySetup("SELECT a from " + dbName + ".ptned2 WHERE b=2", ptn_data_2, 
driver);
+    run("ALTER TABLE " + dbName + ".ptned2 RENAME TO " + dbName + 
".ptned2_rn", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned2_rn WHERE b=2", 
ptn_data_2, driver);
 
     // All alters done, now we replicate them over.
 
     advanceDumpDir();
-    run("REPL DUMP " + dbName + " FROM " + replDumpId);
-    String postAlterReplDumpLocn = getResult(0,0);
-    String postAlterReplDumpId = getResult(0,1,true);
+    run("REPL DUMP " + dbName + " FROM " + replDumpId, driver);
+    String postAlterReplDumpLocn = getResult(0,0,driver);
+    String postAlterReplDumpId = getResult(0,1,true,driver);
     LOG.info("Dumped to {} with id {}->{}", postAlterReplDumpLocn, replDumpId, 
postAlterReplDumpId);
-    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + postAlterReplDumpLocn 
+ "'");
-    printOutput();
-    run("REPL LOAD " + dbName + "_dupe FROM '" + postAlterReplDumpLocn + "'");
+    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + postAlterReplDumpLocn 
+ "'", driverMirror);
+    printOutput(driverMirror);
+    run("REPL LOAD " + dbName + "_dupe FROM '" + postAlterReplDumpLocn + "'", 
driverMirror);
 
     // Replication done, we now do the following verifications:
 
     // verify that unpartitioned table rename succeeded.
-    verifyIfTableNotExist(dbName + "_dupe", "unptned");
-    verifyRun("SELECT * from " + dbName + "_dupe.unptned_rn", unptn_data);
+    verifyIfTableNotExist(dbName + "_dupe", "unptned", metaStoreClientMirror);
+    verifyRun("SELECT * from " + dbName + "_dupe.unptned_rn", unptn_data, 
driverMirror);
 
     // verify that partition rename succeded.
     try {
-      Table unptn2 = metaStoreClient.getTable(dbName + "_dupe" , "unptned2");
+      Table unptn2 = metaStoreClientMirror.getTable(dbName + "_dupe" , 
"unptned2");
       assertTrue(unptn2.getParameters().containsKey(testKey));
       assertEquals(testVal,unptn2.getParameters().get(testKey));
     } catch (TException te) {
       assertNull(te);
     }
 
-    verifyRun("SELECT a from " + dbName + "_dupe.ptned WHERE b=2", empty);
-    verifyRun("SELECT a from " + dbName + "_dupe.ptned WHERE b=22", 
ptn_data_2);
+    verifyRun("SELECT a from " + dbName + "_dupe.ptned WHERE b=2", empty, 
driverMirror);
+    verifyRun("SELECT a from " + dbName + "_dupe.ptned WHERE b=22", 
ptn_data_2, driverMirror);
 
     // verify that ptned table rename succeded.
-    verifyIfTableNotExist(dbName + "_dupe", "ptned2");
-    verifyRun("SELECT a from " + dbName + "_dupe.ptned2_rn WHERE b=2", 
ptn_data_2);
+    verifyIfTableNotExist(dbName + "_dupe", "ptned2", metaStoreClientMirror);
+    verifyRun("SELECT a from " + dbName + "_dupe.ptned2_rn WHERE b=2", 
ptn_data_2, driverMirror);
 
     // verify that ptned table property set worked
     try {
-      Table ptned = metaStoreClient.getTable(dbName + "_dupe" , "ptned");
+      Table ptned = metaStoreClientMirror.getTable(dbName + "_dupe" , "ptned");
       assertTrue(ptned.getParameters().containsKey(testKey));
       assertEquals(testVal, ptned.getParameters().get(testKey));
     } catch (TException te) {
@@ -1093,7 +1118,7 @@ public class TestReplicationScenarios {
     try {
       List<String> ptnVals1 = new ArrayList<String>();
       ptnVals1.add("1");
-      Partition ptn1 = metaStoreClient.getPartition(dbName + "_dupe", "ptned", 
ptnVals1);
+      Partition ptn1 = metaStoreClientMirror.getPartition(dbName + "_dupe", 
"ptned", ptnVals1);
       assertTrue(ptn1.getParameters().containsKey(testKey));
       assertEquals(testVal,ptn1.getParameters().get(testKey));
     } catch (TException te) {
@@ -1105,20 +1130,20 @@ public class TestReplicationScenarios {
   @Test
   public void testIncrementalLoad() throws IOException {
     String testName = "incrementalLoad";
-    String dbName = createDB(testName);
+    String dbName = createDB(testName, driver);
 
-    run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE");
-    run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b int) 
STORED AS TEXTFILE");
-    run("CREATE TABLE " + dbName + ".unptned_empty(a string) STORED AS 
TEXTFILE");
+    run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE", 
driver);
+    run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b int) 
STORED AS TEXTFILE", driver);
+    run("CREATE TABLE " + dbName + ".unptned_empty(a string) STORED AS 
TEXTFILE", driver);
     run("CREATE TABLE " + dbName
-        + ".ptned_empty(a string) partitioned by (b int) STORED AS TEXTFILE");
+        + ".ptned_empty(a string) partitioned by (b int) STORED AS TEXTFILE", 
driver);
 
     advanceDumpDir();
-    run("REPL DUMP " + dbName);
-    String replDumpLocn = getResult(0, 0);
-    String replDumpId = getResult(0, 1, true);
+    run("REPL DUMP " + dbName, driver);
+    String replDumpLocn = getResult(0, 0,driver);
+    String replDumpId = getResult(0, 1, true, driver);
     LOG.info("Bootstrap-Dump: Dumped to {} with id {}", replDumpLocn, 
replDumpId);
-    run("REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'");
+    run("REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'", 
driverMirror);
 
     String[] unptn_data = new String[] { "eleven", "twelve" };
     String[] ptn_data_1 = new String[] { "thirteen", "fourteen", "fifteen" };
@@ -1133,129 +1158,129 @@ public class TestReplicationScenarios {
     createTestDataFile(ptn_locn_1, ptn_data_1);
     createTestDataFile(ptn_locn_2, ptn_data_2);
 
-    verifySetup("SELECT a from " + dbName + ".ptned_empty", empty);
-    verifySetup("SELECT * from " + dbName + ".unptned_empty", empty);
+    verifySetup("SELECT a from " + dbName + ".ptned_empty", empty, 
driverMirror);
+    verifySetup("SELECT * from " + dbName + ".unptned_empty", empty, 
driverMirror);
 
-    run("LOAD DATA LOCAL INPATH '" + unptn_locn + "' OVERWRITE INTO TABLE " + 
dbName + ".unptned");
-    verifySetup("SELECT * from " + dbName + ".unptned", unptn_data);
-    run("CREATE TABLE " + dbName + ".unptned_late LIKE " + dbName + 
".unptned");
-    run("INSERT INTO TABLE " + dbName + ".unptned_late SELECT * FROM " + 
dbName + ".unptned");
-    verifySetup("SELECT * from " + dbName + ".unptned_late", unptn_data);
+    run("LOAD DATA LOCAL INPATH '" + unptn_locn + "' OVERWRITE INTO TABLE " + 
dbName + ".unptned", driver);
+    verifySetup("SELECT * from " + dbName + ".unptned", unptn_data, driver);
+    run("CREATE TABLE " + dbName + ".unptned_late LIKE " + dbName + 
".unptned", driver);
+    run("INSERT INTO TABLE " + dbName + ".unptned_late SELECT * FROM " + 
dbName + ".unptned", driver);
+    verifySetup("SELECT * from " + dbName + ".unptned_late", unptn_data, 
driver);
 
     advanceDumpDir();
-    run("REPL DUMP " + dbName + " FROM " + replDumpId);
-    String incrementalDumpLocn = getResult(0, 0);
-    String incrementalDumpId = getResult(0, 1, true);
+    run("REPL DUMP " + dbName + " FROM " + replDumpId, driver);
+    String incrementalDumpLocn = getResult(0, 0, driver);
+    String incrementalDumpId = getResult(0, 1, true, driver);
     LOG.info("Incremental-Dump: Dumped to {} with id {} from {}", 
incrementalDumpLocn, incrementalDumpId, replDumpId);
     replDumpId = incrementalDumpId;
-    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + 
"'");
-    printOutput();
-    run("REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + "'");
-    verifyRun("SELECT * from " + dbName + "_dupe.unptned_late", unptn_data);
+    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + 
"'", driverMirror);
+    printOutput(driverMirror);
+    run("REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + "'", 
driverMirror);
+    verifyRun("SELECT * from " + dbName + "_dupe.unptned_late", unptn_data, 
driverMirror);
 
-    run("ALTER TABLE " + dbName + ".ptned ADD PARTITION (b=1)");
+    run("ALTER TABLE " + dbName + ".ptned ADD PARTITION (b=1)", driver);
     run("LOAD DATA LOCAL INPATH '" + ptn_locn_1 + "' OVERWRITE INTO TABLE " + 
dbName
-        + ".ptned PARTITION(b=1)");
-    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=1", ptn_data_1);
+        + ".ptned PARTITION(b=1)", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=1", ptn_data_1, 
driver);
     run("LOAD DATA LOCAL INPATH '" + ptn_locn_2 + "' OVERWRITE INTO TABLE " + 
dbName
-        + ".ptned PARTITION(b=2)");
-    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=2", ptn_data_2);
+        + ".ptned PARTITION(b=2)", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned WHERE b=2", ptn_data_2, 
driver);
 
     run("CREATE TABLE " + dbName
-        + ".ptned_late(a string) PARTITIONED BY (b int) STORED AS TEXTFILE");
+        + ".ptned_late(a string) PARTITIONED BY (b int) STORED AS TEXTFILE", 
driver);
     run("INSERT INTO TABLE " + dbName + ".ptned_late PARTITION(b=1) SELECT a 
FROM " + dbName
-        + ".ptned WHERE b=1");
-    verifySetup("SELECT a from " + dbName + ".ptned_late WHERE b=1", 
ptn_data_1);
+        + ".ptned WHERE b=1", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned_late WHERE b=1", 
ptn_data_1, driver);
 
     run("INSERT INTO TABLE " + dbName + ".ptned_late PARTITION(b=2) SELECT a 
FROM " + dbName
-        + ".ptned WHERE b=2");
-    verifySetup("SELECT a from " + dbName + ".ptned_late WHERE b=2", 
ptn_data_2);
+        + ".ptned WHERE b=2", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned_late WHERE b=2", 
ptn_data_2, driver);
 
     advanceDumpDir();
-    run("REPL DUMP " + dbName + " FROM " + replDumpId);
-    incrementalDumpLocn = getResult(0, 0);
-    incrementalDumpId = getResult(0, 1, true);
+    run("REPL DUMP " + dbName + " FROM " + replDumpId, driver);
+    incrementalDumpLocn = getResult(0, 0, driver);
+    incrementalDumpId = getResult(0, 1, true, driver);
     LOG.info("Incremental-Dump: Dumped to {} with id {} from {}", 
incrementalDumpLocn, incrementalDumpId, replDumpId);
     replDumpId = incrementalDumpId;
-    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + 
"'");
-    printOutput();
-    run("REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + "'");
+    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + 
"'", driverMirror);
+    printOutput(driverMirror);
+    run("REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + "'", 
driverMirror);
 
-    verifyRun("SELECT a from " + dbName + "_dupe.ptned_late WHERE b=1", 
ptn_data_1);
-    verifyRun("SELECT a from " + dbName + "_dupe.ptned_late WHERE b=2", 
ptn_data_2);
-    verifyRun("SELECT a from " + dbName + "_dupe.ptned WHERE b=1", ptn_data_1);
-    verifyRun("SELECT a from " + dbName + "_dupe.ptned WHERE b=2", ptn_data_2);
+    verifyRun("SELECT a from " + dbName + "_dupe.ptned_late WHERE b=1", 
ptn_data_1, driverMirror);
+    verifyRun("SELECT a from " + dbName + "_dupe.ptned_late WHERE b=2", 
ptn_data_2, driverMirror);
+    verifyRun("SELECT a from " + dbName + "_dupe.ptned WHERE b=1", ptn_data_1, 
driverMirror);
+    verifyRun("SELECT a from " + dbName + "_dupe.ptned WHERE b=2", ptn_data_2, 
driverMirror);
   }
 
   @Test
   public void testIncrementalInserts() throws IOException {
     String testName = "incrementalInserts";
-    String dbName = createDB(testName);
-    run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE");
+    String dbName = createDB(testName, driver);
+    run("CREATE TABLE " + dbName + ".unptned(a string) STORED AS TEXTFILE", 
driver);
 
     advanceDumpDir();
-    run("REPL DUMP " + dbName);
-    String replDumpLocn = getResult(0, 0);
-    String replDumpId = getResult(0, 1, true);
+    run("REPL DUMP " + dbName, driver);
+    String replDumpLocn = getResult(0, 0, driver);
+    String replDumpId = getResult(0, 1, true, driver);
     LOG.info("Bootstrap-Dump: Dumped to {} with id {}", replDumpLocn, 
replDumpId);
-    run("REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'");
+    run("REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'", 
driverMirror);
 
     String[] unptn_data = new String[] { "eleven", "twelve" };
 
-    run("INSERT INTO TABLE " + dbName + ".unptned values('" + unptn_data[0] + 
"')");
-    run("INSERT INTO TABLE " + dbName + ".unptned values('" + unptn_data[1] + 
"')");
-    verifySetup("SELECT a from " + dbName + ".unptned ORDER BY a", unptn_data);
+    run("INSERT INTO TABLE " + dbName + ".unptned values('" + unptn_data[0] + 
"')", driver);
+    run("INSERT INTO TABLE " + dbName + ".unptned values('" + unptn_data[1] + 
"')", driver);
+    verifySetup("SELECT a from " + dbName + ".unptned ORDER BY a", unptn_data, 
driver);
 
-    run("CREATE TABLE " + dbName + ".unptned_late LIKE " + dbName + 
".unptned");
-    run("INSERT INTO TABLE " + dbName + ".unptned_late SELECT * FROM " + 
dbName + ".unptned");
-    verifySetup("SELECT * from " + dbName + ".unptned_late ORDER BY a", 
unptn_data);
+    run("CREATE TABLE " + dbName + ".unptned_late LIKE " + dbName + 
".unptned", driver);
+    run("INSERT INTO TABLE " + dbName + ".unptned_late SELECT * FROM " + 
dbName + ".unptned", driver);
+    verifySetup("SELECT * from " + dbName + ".unptned_late ORDER BY a", 
unptn_data, driver);
 
     advanceDumpDir();
-    run("REPL DUMP " + dbName + " FROM " + replDumpId);
-    String incrementalDumpLocn = getResult(0, 0);
-    String incrementalDumpId = getResult(0, 1, true);
+    run("REPL DUMP " + dbName + " FROM " + replDumpId, driver);
+    String incrementalDumpLocn = getResult(0, 0, driver);
+    String incrementalDumpId = getResult(0, 1, true, driver);
     LOG.info("Incremental-Dump: Dumped to {} with id {} from {}", 
incrementalDumpLocn, incrementalDumpId, replDumpId);
     replDumpId = incrementalDumpId;
-    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + 
"'");
-    printOutput();
-    run("REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + "'");
-    verifyRun("SELECT a from " + dbName + ".unptned ORDER BY a", unptn_data);
-    verifyRun("SELECT a from " + dbName + ".unptned_late ORDER BY a", 
unptn_data);
-    verifyRun("SELECT a from " + dbName + "_dupe.unptned ORDER BY a", 
unptn_data);
-    verifyRun("SELECT a from " + dbName + "_dupe.unptned_late ORDER BY a", 
unptn_data);
+    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + 
"'", driverMirror);
+    printOutput(driverMirror);
+    run("REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + "'", 
driverMirror);
+    verifyRun("SELECT a from " + dbName + ".unptned ORDER BY a", unptn_data, 
driver);
+    verifyRun("SELECT a from " + dbName + ".unptned_late ORDER BY a", 
unptn_data, driver);
+    verifyRun("SELECT a from " + dbName + "_dupe.unptned ORDER BY a", 
unptn_data, driverMirror);
+    verifyRun("SELECT a from " + dbName + "_dupe.unptned_late ORDER BY a", 
unptn_data, driverMirror);
 
     String[] unptn_data_after_ins = new String[] { "eleven", "thirteen", 
"twelve" };
     String[] data_after_ovwrite = new String[] { "hundred" };
-    run("INSERT INTO TABLE " + dbName + ".unptned_late values('" + 
unptn_data_after_ins[1] + "')");
-    verifySetup("SELECT a from " + dbName + ".unptned_late ORDER BY a", 
unptn_data_after_ins);
-    run("INSERT OVERWRITE TABLE " + dbName + ".unptned values('" + 
data_after_ovwrite[0] + "')");
-    verifySetup("SELECT a from " + dbName + ".unptned", data_after_ovwrite);
+    run("INSERT INTO TABLE " + dbName + ".unptned_late values('" + 
unptn_data_after_ins[1] + "')", driver);
+    verifySetup("SELECT a from " + dbName + ".unptned_late ORDER BY a", 
unptn_data_after_ins, driver);
+    run("INSERT OVERWRITE TABLE " + dbName + ".unptned values('" + 
data_after_ovwrite[0] + "')", driver);
+    verifySetup("SELECT a from " + dbName + ".unptned", data_after_ovwrite, 
driver);
 
     advanceDumpDir();
-    run("REPL DUMP " + dbName + " FROM " + replDumpId);
-    incrementalDumpLocn = getResult(0, 0);
-    incrementalDumpId = getResult(0, 1, true);
+    run("REPL DUMP " + dbName + " FROM " + replDumpId, driver);
+    incrementalDumpLocn = getResult(0, 0, driver);
+    incrementalDumpId = getResult(0, 1, true, driver);
     LOG.info("Incremental-Dump: Dumped to {} with id {} from {}", 
incrementalDumpLocn, incrementalDumpId, replDumpId);
     replDumpId = incrementalDumpId;
-    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + 
"'");
-    printOutput();
-    run("REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + "'");
+    run("EXPLAIN REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + 
"'", driverMirror);
+    printOutput(driverMirror);
+    run("REPL LOAD " + dbName + "_dupe FROM '" + incrementalDumpLocn + "'", 
driverMirror);
 
-    verifyRun("SELECT a from " + dbName + "_dupe.unptned_late ORDER BY a", 
unptn_data_after_ins);
+    verifyRun("SELECT a from " + dbName + "_dupe.unptned_late ORDER BY a", 
unptn_data_after_ins, driverMirror);
 
-    verifyRun("SELECT a from " + dbName + "_dupe.unptned", data_after_ovwrite);
+    verifyRun("SELECT a from " + dbName + "_dupe.unptned", data_after_ovwrite, 
driverMirror);
   }
 
   @Test
   public void testEventTypesForDynamicAddPartitionByInsert() throws 
IOException {
     String name = testName.getMethodName();
-    final String dbName = createDB(name);
+    final String dbName = createDB(name, driver);
     String replDbName = dbName + "_dupe";
-    run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b int) 
STORED AS TEXTFILE");
+    run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b int) 
STORED AS TEXTFILE", driver);
     Tuple bootstrap = bootstrapLoadAndVerify(dbName, replDbName);
 
     String[] ptn_data = new String[]{ "ten"};
-    run("INSERT INTO TABLE " + dbName + ".ptned partition(b=1) values('" + 
ptn_data[0] + "')");
+    run("INSERT INTO TABLE " + dbName + ".ptned partition(b=1) values('" + 
ptn_data[0] + "')", driver);
 
     // Inject a behaviour where it throws exception if an INSERT event is found
     // As we dynamically add a partition through INSERT INTO cmd, it should 
just add ADD_PARTITION
@@ -1291,7 +1316,7 @@ public class TestReplicationScenarios {
     eventTypeValidator.assertInjectionsPerformed(true,false);
     InjectableBehaviourObjectStore.resetGetNextNotificationBehaviour(); // 
reset the behaviour
 
-    verifyRun("SELECT a from " + replDbName + ".ptned where (b=1) ORDER BY a", 
ptn_data);
+    verifyRun("SELECT a from " + replDbName + ".ptned where (b=1) ORDER BY a", 
ptn_data, driverMirror);
   }
 
   @Test
@@ -1300,64 +1325,64 @@ public class TestReplicationScenarios {
     LOG.info("Testing " + testName);
     String dbName = testName + "_" + tid;
 
-    run("CREATE DATABASE " + dbName);
-    run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b int) 
STORED AS TEXTFILE");
+    run("CREATE DATABASE " + dbName, driver);
+    run("CREATE TABLE " + dbName + ".ptned(a string) partitioned by (b int) 
STORED AS TEXTFILE", driver);
 
     advanceDumpDir();
-    run("REPL DUMP " + dbName);
-    String replDumpLocn = getResult(0, 0);
-    String replDumpId = getResult(0, 1, true);
+    run("REPL DUMP " + dbName, driver);
+    String replDumpLocn = getResult(0, 0, driver);
+    String replDumpId = getResult(0, 1, true, driver);
     LOG.info("Bootstrap-Dump: Dumped to {} with id {}", replDumpLocn, 
replDumpId);
-    run("REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'");
+    run("REPL LOAD " + dbName + "_dupe FROM '" + replDumpLocn + "'", 
driverMirror);
 
     String[] ptn_data_1 = new String[] { "fifteen", "fourteen", "thirteen" };
     String[] ptn_data_2 = new String[] { "fifteen", "seventeen", "sixteen" };
 
-    run("INSERT INTO TABLE " + dbName + ".ptned partition(b=1) values('" + 
ptn_data_1[0] + "')");
-    run("INSERT INTO TABLE " + dbName + ".ptned partition(b=1) values('" + 
ptn_data_1[1] + "')");
-    run("INSERT INTO TABLE " + dbName + ".ptned partition(b=1) values('" + 
ptn_data_1[2] + "')");
+    run("INSERT INTO TABLE " + dbName + ".ptned partition(b=1) values('" + 
ptn_data_1[0] + "')", driver);
+    run("INSERT INTO TABLE " + dbName + ".ptned partition(b=1) values('" + 
ptn_data_1[1] + "')", driver);
+    run("INSERT INTO TABLE " + dbName + ".ptned partition(b=1) values('" + 
ptn_data_1[2] + "')", driver);
 
-    run("ALTER TABLE " + dbName + ".ptned ADD PARTITION (b=2)");
-    run("INSERT INTO TABLE " + dbName + ".ptned partition(b=2) values('" + 
ptn_data_2[0] + "')");
-    run("INSERT INTO TABLE " + dbName + ".ptned partition(b=2) values('" + 
ptn_data_2[1] + "')");
-    run("INSERT INTO TABLE " + dbName + ".ptned partition(b=2) values('" + 
ptn_data_2[2] + "')");
-    verifySetup("SELECT a from " + dbName + ".ptned where (b=1) ORDER BY a", 
ptn_data_1);
-    verifySetup("SELECT a from " + dbName + ".ptned where (b=2) ORDER BY a", 
ptn_data_2);
+    run("ALTER TABLE " + dbName + ".ptned ADD PARTITION (b=2)", driver);
+    run("INSERT INTO TABLE " + dbName + ".ptned partition(b=2) values('" + 
ptn_data_2[0] + "')", driver);
+    run("INSERT INTO TABLE " + dbName + ".ptned partition(b=2) values('" + 
ptn_data_2[1] + "')", driver);
+    run("INSERT INTO TABLE " + dbName + ".ptned partition(b=2) values('" + 
ptn_data_2[2] + "')", driver);
+    verifySetup("SELECT a from " + dbName + ".ptned where (b=1) ORDER BY a", 
ptn_data_1, driver);
+    verifySetup("SELECT a from " + dbName + ".ptned where (b=2) ORDER BY a", 
ptn_data_2, driver);
 
     advanceDumpDir();
-    run("REPL DUMP " + dbName + " FROM " + replDumpId);
-    String incrementalDumpLocn = getResult(0, 0);
-    String incrementalDumpId = getResult(0, 1, true);
+    run("REPL DUMP " + dbName + " FROM " + replDumpId, driver);
+    String incrementalDumpLocn = getResult(0, 0, driver);
+    String incrementalDumpId = getResult(0, 1, true, driver);
     LOG.info("Incremental-Dump: Dumped to {} with id {} from {}", 
incrementalDumpLocn, incrementalDumpId, replD

<TRUNCATED>

Reply via email to