zookeeper-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Wenjun Ruan (Jira)" <j...@apache.org>
Subject [jira] [Created] (ZOOKEEPER-4294) FileSnap#findNValidSnapshots should not declare IOException
Date Sun, 16 May 2021 16:00:06 GMT
Wenjun Ruan created ZOOKEEPER-4294:
--------------------------------------

             Summary: FileSnap#findNValidSnapshots should not declare IOException
                 Key: ZOOKEEPER-4294
                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4294
             Project: ZooKeeper
          Issue Type: Bug
          Components: server
            Reporter: Wenjun Ruan


The IOException has already been caught
{code:java}
protected List<File> findNValidSnapshots(int n) throws IOException {
    List<File> files = Util.sortDataDir(snapDir.listFiles(), SNAPSHOT_FILE_PREFIX, false);
    int count = 0;
    List<File> list = new ArrayList<File>();
    for (File f : files) {
        // we should catch the exceptions
        // from the valid snapshot and continue
        // until we find a valid one
        try {
            if (SnapStream.isValidSnapshot(f)) {
                list.add(f);
                count++;
                if (count == n) {
                    break;
                }
            }
        } catch (IOException e) {
            LOG.warn("invalid snapshot {}", f, e);
        }
    }
    return list;
}
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Mime
View raw message