Sijie Guo created BOOKKEEPER-493:
------------------------------------

             Summary: moveLedgerIndexFile might have chance pickup same 
directory
                 Key: BOOKKEEPER-493
                 URL: https://issues.apache.org/jira/browse/BOOKKEEPER-493
             Project: Bookkeeper
          Issue Type: Bug
            Reporter: Sijie Guo
             Fix For: 4.2.0


{code}

    public void addToFilledDirs(File dir) {
        if (!filledDirs.contains(dir)) {
            LOG.warn(dir + " is out of space."
                    + " Adding it to filled dirs list");
            // Update filled dirs list
            List<File> updatedFilledDirs = new ArrayList<File>(filledDirs);
            updatedFilledDirs.add(dir);
            filledDirs = updatedFilledDirs;
            // Update the writable ledgers list
            List<File> newDirs = new ArrayList<File>(writableLedgerDirectories);
            newDirs.removeAll(filledDirs);
            writableLedgerDirectories = newDirs;
            // Notify listeners about disk full
            for (LedgerDirsListener listener : listeners) {
                listener.diskFull(dir);
            }   
        }   
    }

{code}

When a directory is putting into filledDirs, it might not be removed from 
writableLedgerDirectories. The directory still has chance to be picked up to 
move index file.

we need same synchronization and check to guarantee that we don't move to same 
directory.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to