This is an automated email from the ASF dual-hosted git repository.
maoling pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zookeeper.git
The following commit(s) were added to refs/heads/master by this push:
new 26001aa ZOOKEEPER-4294: Remove unused IOException on
FileSnap#findNValidSnapshots
26001aa is described below
commit 26001aacfeff519ccd6b0991b0cc38ab10ad6564
Author: ruanwenjun <[email protected]>
AuthorDate: Wed Sep 22 19:04:37 2021 +0800
ZOOKEEPER-4294: Remove unused IOException on FileSnap#findNValidSnapshots
Author: ruanwenjun <[email protected]>
Reviewers: Enrico Olivelli <[email protected]>, maoling
<[email protected]>
Closes #1752 from ruanwenjun/dev_wenjun_patch-4294
---
.../main/java/org/apache/zookeeper/server/persistence/FileSnap.java | 5 ++---
.../java/org/apache/zookeeper/server/persistence/FileTxnSnapLog.java | 3 +--
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git
a/zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/FileSnap.java
b/zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/FileSnap.java
index 00f9b02..df8a59c 100644
---
a/zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/FileSnap.java
+++
b/zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/FileSnap.java
@@ -139,7 +139,7 @@ public class FileSnap implements SnapShot {
* find the most recent snapshot in the database.
* @return the file containing the most recent snapshot
*/
- public File findMostRecentSnapshot() throws IOException {
+ public File findMostRecentSnapshot() {
List<File> files = findNValidSnapshots(1);
if (files.size() == 0) {
return null;
@@ -157,9 +157,8 @@ public class FileSnap implements SnapShot {
* @param n the number of most recent snapshots
* @return the last n snapshots (the number might be
* less than n in case enough snapshots are not available).
- * @throws IOException
*/
- protected List<File> findNValidSnapshots(int n) throws IOException {
+ protected List<File> findNValidSnapshots(int n) {
List<File> files = Util.sortDataDir(snapDir.listFiles(),
SNAPSHOT_FILE_PREFIX, false);
int count = 0;
List<File> list = new ArrayList<File>();
diff --git
a/zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/FileTxnSnapLog.java
b/zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/FileTxnSnapLog.java
index a4670ec..403720b 100644
---
a/zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/FileTxnSnapLog.java
+++
b/zookeeper-server/src/main/java/org/apache/zookeeper/server/persistence/FileTxnSnapLog.java
@@ -561,9 +561,8 @@ public class FileTxnSnapLog {
* @param n the number of recent valid snapshots
* @return the list of n recent valid snapshots, with
* the most recent in front
- * @throws IOException
*/
- public List<File> findNValidSnapshots(int n) throws IOException {
+ public List<File> findNValidSnapshots(int n) {
FileSnap snaplog = new FileSnap(snapDir);
return snaplog.findNValidSnapshots(n);
}