public static void writeStackTrace(Throwable e, Path outputFile, HiveConf conf) throws SemanticException {
    Retryable retryable = Retryable.builder()
      .withHiveConf(conf)
      .withRetryOnException(IOException.class).withFailOnException(FileNotFoundException.class).build();
    try {
      retryable.executeCallable((Callable<Void>) () -> {
        PrintWriter pw = new PrintWriter(outputFile.getFileSystem(conf).create(outputFile));
        e.printStackTrace(pw);
        pw.close();
        return null;
      });
    } catch (Exception ex) {
      throw new SemanticException(ex);
    }
  }
Given a ReplChangeManger's encoded uri, it replaces the nameservice and returns the modified encoded uri.
ql/src/java/org/apache/hadoop/hive/ql/parse/repl/dump/Utils.java