You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hbase.apache.org by "Umesh Agashe (JIRA)" <ji...@apache.org> on 2016/10/21 22:50:58 UTC

[jira] [Created] (HBASE-16930) AssignmentManager.java:checkWals() function can recur infinitely

Umesh Agashe created HBASE-16930:
------------------------------------

             Summary: AssignmentManager.java:checkWals() function can recur infinitely
                 Key: HBASE-16930
                 URL: https://issues.apache.org/jira/browse/HBASE-16930
             Project: HBase
          Issue Type: Bug
          Components: Region Assignment
            Reporter: Umesh Agashe
            Assignee: Umesh Agashe


Recursion in AssignmentManager.checkWals() uses the same input argument. See the code below:
{code}
  private boolean checkWals(FileSystem fs, Path dir) throws IOException {
    if (!fs.exists(dir)) {
      LOG.debug(dir + " doesn't exist");
      return false;
    }
    if (!fs.getFileStatus(dir).isDirectory()) {
      LOG.warn(dir + " is not a directory");
      return false;
    }
    FileStatus[] files = FSUtils.listStatus(fs, dir);
    if (files == null || files.length == 0) {
      LOG.debug(dir + " has no files");
      return false;
    }
    for (int i = 0; i < files.length; i++) {
      if (files[i].isFile() && files[i].getLen() > 0) {
        LOG.debug(dir + " has a non-empty file: " + files[i].getPath());
        return true;
      } else if (files[i].isDirectory() && checkWals(fs, dir)) {
        LOG.debug(dir + " is a directory and has a non-empty file: " + files[i].getPath());
        return true;
      }
    }
    LOG.debug("Found 0 non-empty wal files for :" + dir);
    return false;
  }
{code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)