@Override
    public boolean accept(Path p) {
      if (enabled) {
        String name = p.getName();
        return StringUtils.isEmpty(fallbackNonEncryptedCmRootDir)
                ? (!name.contains(cmRootDir) && !name.contains(encryptedCmRootDir))
                : (!name.contains(cmRootDir) && !name.contains(encryptedCmRootDir)
                && !name.contains(fallbackNonEncryptedCmRootDir));
      }
      return true;
    }
Thread to clear old files of cmroot recursively
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/ReplChangeManager.java