@Test
  public void externalTableReplicationWithDefaultPaths() throws Throwable {
    //creates external tables with partitions
    WarehouseInstance.Tuple tuple = primary
        .run("use " + primaryDbName)
        .run("create external table t1 (id int)")
        .run("insert into table t1 values (1)")
        .run("insert into table t1 values (2)")
        .run("create external table t2 (place string) partitioned by (country string)")
        .run("insert into table t2 partition(country='india') values ('bangalore')")
        .run("insert into table t2 partition(country='us') values ('austin')")
        .run("insert into table t2 partition(country='france') values ('paris')")
        .dumpWithCommand("repl dump " + primaryDbName);

    // verify that the external table list is not written as metadata only replication
    ReplicationTestUtils.assertFalseExternalFileList(primary, tuple.dumpLocation);

    List<String> withClauseOptions = ReplicationTestUtils.includeExternalTableClause(true);

    replica.load(replicatedDbName, primaryDbName, withClauseOptions)
        .run("use " + replicatedDbName)
        .run("show tables like 't1'")
        .verifyResult("t1")
        .run("show tables like 't2'")
        .verifyResult("t2")
        .run("repl status " + replicatedDbName)
        .verifyResult(tuple.lastReplicationId)
        .run("select country from t2 where country = 'us'")
        .verifyResult(null)
        .run("select country from t2 where country = 'france'")
        .verifyResult(null)
        .run("show partitions t2").verifyResults(new String[] {"country=france", "country=india", "country=us"});

    // Ckpt should be set on bootstrapped db.
    String hiveDumpLocation = tuple.dumpLocation + File.separator + REPL_HIVE_BASE_DIR;
    replica.verifyIfCkptSet(replicatedDbName, hiveDumpLocation);

    tuple = primary.run("use " + primaryDbName)
        .run("create external table t3 (id int)")
        .run("insert into table t3 values (10)")
        .run("create external table t4 as select id from t3")
        .dumpWithCommand("repl dump " + primaryDbName);

    // verify that the external table list is written correctly for incremental
    ReplicationTestUtils.assertFalseExternalFileList(primary, tuple.dumpLocation);

    replica.load(replicatedDbName, primaryDbName, withClauseOptions)
        .run("use " + replicatedDbName)
        .run("show tables like 't3'")
        .verifyResult("t3")
        .run("select id from t3")
        .verifyResult(null)
        .run("select id from t4")
        .verifyResult(null);

    tuple = primary.run("use " + primaryDbName)
        .run("drop table t1")
        .dumpWithCommand("repl dump " + primaryDbName);

    // verify that the external table list is written correctly for incremental
    ReplicationTestUtils.assertFalseExternalFileList(primary, tuple.dumpLocation);
  }
TestMetadataReplicationScenariosExternalTables - Test metadata only replication.
for external tables.
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosExternalTablesMetaDataOnly.java