adoroszlai commented on code in PR #8691:
URL: https://github.com/apache/ozone/pull/8691#discussion_r2179618892
##########
hadoop-hdds/managed-rocksdb/src/main/java/org/apache/hadoop/hdds/utils/db/RocksDatabaseException.java:
##########
@@ -28,9 +28,13 @@ private static String getStatus(RocksDBException e) {
return e.getStatus() == null ? "NULL_STATUS" :
e.getStatus().getCodeString();
}
+ private static String getMessage(String message, Exception cause) {
+ return cause instanceof RocksDBException ? getStatus((RocksDBException)
cause) + ": " + message : message;
+ }
+
/** Construct from the given {@link RocksDBException} cause. */
Review Comment:
```suggestion
/** Construct from the given cause. */
```
##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBStore.java:
##########
@@ -175,14 +174,10 @@ public class RDBStore implements DBStore {
throw new IllegalStateException("Failed to create RDBStore from " +
dbFile, e);
} catch (Exception e) {
exception = e;
- throw new IOException("Failed to create RDBStore from " + dbFile, e);
+ throw new RocksDatabaseException("Failed to create RDBStore from " +
dbFile, e);
} finally {
if (exception != null) {
- try {
- close();
- } catch (IOException e) {
- exception.addSuppressed(e);
- }
+ close();
Review Comment:
I think we can simplify this to a single `catch` block without `finally`,
always throwing `RocksDatabaseException`.
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/utils/DatanodeStoreCache.java:
##########
@@ -118,11 +114,7 @@ public void shutdownCache() {
}
for (Map.Entry<String, RawDB> entry : datanodeStoreMap.entrySet()) {
- try {
- entry.getValue().getStore().stop();
- } catch (Exception e) {
- LOG.warn("Stop DatanodeStore: {} failed", entry.getKey(), e);
- }
+ entry.getValue().getStore().stop();
Review Comment:
Can iterate `values()`.
Also, should we still catch, to ensure unchecked exception does not prevent
stopping further items?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]