@Test
  public void testExternalTableBaseDirMandatory() throws Throwable {
    List<String> withClause = ReplicationTestUtils.includeExternalTableClause(true);
    withClause.add("'" + HiveConf.ConfVars.REPL_EXTERNAL_TABLE_BASE_DIR.varname + "'='/extTablebase'");
    WarehouseInstance.Tuple tuple = null;
    try {
      primary.run("use " + primaryDbName)
              .run("create external table t1 (id int)")
              .run("insert into table t1 values(1)")
              .dump(primaryDbName, withClause);
    } catch (SemanticException ex) {
      assertTrue(ex.getMessage().contains(
              "Fully qualified path for 'hive.repl.replica.external.table.base.dir' is required"));
    }
    withClause = ReplicationTestUtils.includeExternalTableClause(true);
    withClause.add("'" + HiveConf.ConfVars.REPL_EXTERNAL_TABLE_BASE_DIR.varname
            + "'='"+ fullyQualifiedReplicaExternalBase +"'");
    try {
      primary.run("use " + primaryDbName)
        .dump(primaryDbName, withClause);
    } catch (Exception e) {
      Assert.assertEquals(ErrorMsg.REPL_FAILED_WITH_NON_RECOVERABLE_ERROR.getErrorCode(),
        ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode());
    }
    //delete non recoverable marker
    Path dumpPath = new Path(primary.hiveConf.get(HiveConf.ConfVars.REPL_DIR.varname),
      Base64.getEncoder().encodeToString(primaryDbName.toLowerCase()
        .getBytes(StandardCharsets.UTF_8.name())));
    FileSystem fs = dumpPath.getFileSystem(conf);
    Path nonRecoverableMarker = new Path(fs.listStatus(dumpPath)[0].getPath(), ReplAck.NON_RECOVERABLE_MARKER
      .toString());
    fs.delete(nonRecoverableMarker, true);

    tuple = primary.run("use " + primaryDbName)
      .dump(primaryDbName, withClause);

    withClause = ReplicationTestUtils.includeExternalTableClause(true);
    withClause.add("'" + HiveConf.ConfVars.REPL_EXTERNAL_TABLE_BASE_DIR.varname + "'=''");
    try {
      replica.load(replicatedDbName, primaryDbName, withClause);
    } catch (SemanticException ex) {
      assertTrue(ex.getMessage().contains(
              "Fully qualified path for 'hive.repl.replica.external.table.base.dir' is required"));
    }

    withClause = ReplicationTestUtils.includeExternalTableClause(true);
    withClause.add("'" + HiveConf.ConfVars.REPL_EXTERNAL_TABLE_BASE_DIR.varname
            + "'='"+ fullyQualifiedReplicaExternalBase +"'");

    try {
      replica.load(replicatedDbName, primaryDbName, withClause);
    } catch (Exception e) {
      Assert.assertEquals(ErrorMsg.REPL_FAILED_WITH_NON_RECOVERABLE_ERROR.getErrorCode(),
        ErrorMsg.getErrorMsg(e.getMessage()).getErrorCode());
    }

    //delete non recoverable marker
    nonRecoverableMarker = new Path(tuple.dumpLocation, ReplAck.NON_RECOVERABLE_MARKER
      .toString());
    fs.delete(nonRecoverableMarker, true);

    replica.load(replicatedDbName, primaryDbName, withClause);

    replica.run("repl status " + replicatedDbName)
            .verifyResult(tuple.lastReplicationId)
            .run("use " + replicatedDbName)
            .run("show tables like 't1'")
            .verifyResults(new String[] {"t1"})
            .run("select id from t1")
            .verifyResults(new String[] {"1"})
            .verifyReplTargetProperty(replicatedDbName);
  }
@param sourceTableName  -- Provide the fully qualified table name
@param replicaTableName -- Provide the fully qualified table name
itests/hive-unit/src/test/java/org/apache/hadoop/hive/ql/parse/TestReplicationScenariosExternalTables.java