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] [Updated] (ZOOKEEPER-4294) FileSnap#findNValidSnapshots should not declare IOException
Date Sun, 16 May 2021 16:04:00 GMT

     [ https://issues.apache.org/jira/browse/ZOOKEEPER-4294?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Wenjun Ruan updated ZOOKEEPER-4294:
-----------------------------------
    Issue Type: Improvement  (was: Bug)

> FileSnap#findNValidSnapshots should not declare IOException
> -----------------------------------------------------------
>
>                 Key: ZOOKEEPER-4294
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-4294
>             Project: ZooKeeper
>          Issue Type: Improvement
>          Components: server
>            Reporter: Wenjun Ruan
>            Priority: Trivial
>
> 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