You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by eo...@apache.org on 2021/01/28 08:12:32 UTC
[bookkeeper] branch branch-4.12 updated: Fixed: DLCheckpointStore
rethrows exceptions as FNFE but swallows the rootcause
This is an automated email from the ASF dual-hosted git repository.
eolivelli pushed a commit to branch branch-4.12
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git
The following commit(s) were added to refs/heads/branch-4.12 by this push:
new b6e6619 Fixed: DLCheckpointStore rethrows exceptions as FNFE but swallows the rootcause
b6e6619 is described below
commit b6e66192fb96daa1d5c554bf75d7536d95d90025
Author: Andrey Yegorov <dl...@users.noreply.github.com>
AuthorDate: Thu Jan 28 00:12:05 2021 -0800
Fixed: DLCheckpointStore rethrows exceptions as FNFE but swallows the rootcause
DLCheckpointStore rethrows exceptions as FNFE but swallows the rootcause
Same as https://github.com/apache/bookkeeper/pull/2553 but for master branch
Descriptions of the changes in this PR:
added .initCause for the new FNFE exception to preserver it
### Motivation
got the
ERROR org.apache.bookkeeper.statelib.impl.rocksdb.checkpoint.RocksCheckpointer - Failed to restore rocksdb ...
java.io.FileNotFoundException: ..../metadata
without any additional info for the rootcause (other than stack pointing to the DLCheckpointStore)
DLCheckpointStore appears to re-throw exceptions as FNFE without preserving the rootcause
### Changes
added .initCause
Master Issue: #2552
Reviewers: Enrico Olivelli <eo...@gmail.com>
This closes #2555 from dlg99/master-fnfe
(cherry picked from commit bab5a003e84601469485cbcee4fc784171a1513d)
Signed-off-by: Enrico Olivelli <eo...@apache.org>
---
.../impl/rocksdb/checkpoint/dlog/DLCheckpointStore.java | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/stream/statelib/src/main/java/org/apache/bookkeeper/statelib/impl/rocksdb/checkpoint/dlog/DLCheckpointStore.java b/stream/statelib/src/main/java/org/apache/bookkeeper/statelib/impl/rocksdb/checkpoint/dlog/DLCheckpointStore.java
index 0e2de49..7046ef5 100644
--- a/stream/statelib/src/main/java/org/apache/bookkeeper/statelib/impl/rocksdb/checkpoint/dlog/DLCheckpointStore.java
+++ b/stream/statelib/src/main/java/org/apache/bookkeeper/statelib/impl/rocksdb/checkpoint/dlog/DLCheckpointStore.java
@@ -57,6 +57,12 @@ public class DLCheckpointStore implements CheckpointStore {
this.namespace = namespace;
}
+ private static FileNotFoundException createFileNotFoundException(String filePath, Throwable t) {
+ FileNotFoundException fnfe = new FileNotFoundException(filePath);
+ fnfe.initCause(t);
+ return fnfe;
+ }
+
@Override
public List<String> listFiles(String filePath) throws IOException {
return Lists.newArrayList(namespace.getLogs(filePath));
@@ -72,7 +78,7 @@ public class DLCheckpointStore implements CheckpointStore {
try (DistributedLogManager dlm = namespace.openLog(filePath)) {
return dlm.getLastTxId();
} catch (LogNotFoundException e) {
- throw new FileNotFoundException(filePath);
+ throw createFileNotFoundException(filePath, e);
} catch (LogEmptyException e) {
return 0;
}
@@ -86,12 +92,12 @@ public class DLCheckpointStore implements CheckpointStore {
try {
reader = dlm.openLogReader(DLSN.InitialDLSN);
} catch (LogNotFoundException | LogEmptyException e) {
- throw new FileNotFoundException(filePath);
+ throw createFileNotFoundException(filePath, e);
}
return new BufferedInputStream(
new DLInputStream(dlm, reader, 0L), 128 * 1024);
} catch (LogNotFoundException e) {
- throw new FileNotFoundException(filePath);
+ throw createFileNotFoundException(filePath, e);
}
}
@@ -107,7 +113,7 @@ public class DLCheckpointStore implements CheckpointStore {
return new BufferedOutputStream(
new DLOutputStream(dlm, writer), 128 * 1024);
} catch (LogNotFoundException le) {
- throw new FileNotFoundException(filePath);
+ throw createFileNotFoundException(filePath, le);
}
}