Uploaded image for project: 'ZooKeeper'
  1. ZooKeeper
  2. ZOOKEEPER-4294

FileSnap#findNValidSnapshots should not declare IOException

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • None
    • 3.8.0
    • server

    Description

      The IOException has already been caught

      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;
      }
      

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ruanwenjun Wenjun Ruan
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h