@Test
  public void externalTableReplicationDropDatabase() throws Throwable {
    String primaryDb = "primarydb1";
    String replicaDb = "repldb1";
    String tableName = "t1";
    List<String> withClauseOptions = getStagingLocationConfig(primary.repldDir, false);
    WarehouseInstance.Tuple tuple = primary
            .run("create database " + primaryDb)
            .run("alter database "+ primaryDb + " set dbproperties('repl.source.for'='1,2,3')")
            .run("use " + primaryDb)
            .run("create external table " +  tableName + " (id int)")
            .run("insert into table " + tableName + " values (500)")
            .dump(primaryDb, withClauseOptions);

    replica.load(replicaDb, primaryDb, withClauseOptions)
            .run("use " + replicaDb)
            .run("show tables like '" + tableName + "'")
            .verifyResult(tableName)
            .run("select id from " + tableName)
            .verifyResult("500");

    Path dbDataLocPrimary = new Path(primary.externalTableWarehouseRoot, primaryDb + ".db");
    Path extTableBase = new Path(replica.getConf().get(HiveConf.ConfVars.REPL_EXTERNAL_TABLE_BASE_DIR.varname));
    Path dbDataLocReplica = new Path(extTableBase + dbDataLocPrimary.toUri().getPath());
    verifyTableDataExists(primary, dbDataLocPrimary, tableName, true);
    verifyTableDataExists(replica, dbDataLocReplica, tableName, true);

    primary.run("show databases like '" + primaryDb + "'")
            .verifyResult(primaryDb);
    replica.run("show databases like '" + replicaDb + "'")
            .verifyResult(replicaDb);
    primary.run("drop database " + primaryDb + " cascade");
    replica.run("drop database " + replicaDb + " cascade");
    primary.run("show databases like '" + primaryDb + "'")
            .verifyResult(null);
    replica.run("show databases like '" + replicaDb + "'")
            .verifyResult(null);

    verifyTableDataExists(primary, dbDataLocPrimary, tableName, false);
    verifyTableDataExists(replica, dbDataLocReplica, tableName, true);
  }
Test replication scenarios with staging on replica.
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosExclusiveReplica.java