public static boolean checkClusterIdExists(FileSystem fs, Path rootdir, long wait)
    throws IOException {
    while (true) {
      try {
        Path filePath = new Path(rootdir, HConstants.CLUSTER_ID_FILE_NAME);
        return fs.exists(filePath);
      } catch (IOException ioe) {
        if (wait > 0L) {
          LOG.warn("Unable to check cluster ID file in {}, retrying in {}ms", rootdir, wait, ioe);
          try {
            Thread.sleep(wait);
          } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw (InterruptedIOException) new InterruptedIOException().initCause(e);
          }
        } else {
          throw ioe;
        }
      }
    }
  }
Checks that a cluster ID file exists in the HBase root directory
@param fs      the root directory FileSystem
@param rootdir the HBase root directory in HDFS
@param wait    how long to wait between retries
@return <code>true</code> if the file exists, otherwise <code>false</code>
@throws IOException if checking the FileSystem fails
hbase-server/src/main/java/org/apache/hadoop/hbase/util/FSUtils.java