public static String getReplPolicyIdString(Database db) {
    if (db != null) {
      Map<String, String> m = db.getParameters();
      if ((m != null) && (m.containsKey(ReplConst.SOURCE_OF_REPLICATION))) {
        String replPolicyId = m.get(ReplConst.SOURCE_OF_REPLICATION);
        LOG.debug("repl policy for database {} is {}", db.getName(), replPolicyId);
        return replPolicyId;
      }
      LOG.debug("Repl policy is not set for database: {}", db.getName());
    }
    return null;
  }
Thread to clear old files of cmroot recursively
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/ReplChangeManager.java