Pankaj Kumar created HBASE-15394:
------------------------------------

             Summary: Orphan daughter region directories are not cleared which 
have been left around from previous split attempt
                 Key: HBASE-15394
                 URL: https://issues.apache.org/jira/browse/HBASE-15394
             Project: HBase
          Issue Type: Improvement
            Reporter: Pankaj Kumar
            Assignee: Pankaj Kumar
            Priority: Minor


This is the case where daughter region A is created successfully under table 
dir but region server crashed during creating daughter region B. 
So split failed and left an orphan daughter dir in the filesystem.

Currently we are just clearing the ".split" directory not the orphan daughter 
regions which might be moved out under the table directory during previous 
failed SPLIT operation.

{code}
void cleanupAnySplitDetritus() throws IOException {
    Path splitdir = this.getSplitsDir();
    if (!fs.exists(splitdir)) return;
    // Look at the splitdir.  It could have the encoded names of the daughter
    // regions we tried to make.  See if the daughter regions actually got made
    // out under the tabledir.  If here under splitdir still, then the split did
    // not complete.  Try and do cleanup.  This code WILL NOT catch the case
    // where we successfully created daughter a but regionserver crashed during
    // the creation of region b.  In this case, there'll be an orphan daughter
    // dir in the filesystem.  TOOD: Fix.
    FileStatus[] daughters = FSUtils.listStatus(fs, splitdir, new 
FSUtils.DirFilter(fs));
    if (daughters != null) {
      for (FileStatus daughter: daughters) {
        Path daughterDir = new Path(getTableDir(), 
daughter.getPath().getName());
        if (fs.exists(daughterDir) && !deleteDir(daughterDir)) {
          throw new IOException("Failed delete of " + daughterDir);
        }
      }
    }
    cleanupSplitsDir();
    LOG.info("Cleaned up old failed split transaction detritus: " + splitdir);
  }
{code}

Creating this JIRA is to track these changes.



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

Reply via email to