adoroszlai commented on code in PR #9770:
URL: https://github.com/apache/ozone/pull/9770#discussion_r3035492123


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/snapshot/RocksDbPersistentList.java:
##########
@@ -49,15 +47,13 @@ public RocksDbPersistentList(ManagedRocksDB db,
 
   @Override
   public boolean add(E entry) {
-    try {
-      byte[] rawKey = codecRegistry.asRawData(currentIndex++);
-      byte[] rawValue = codecRegistry.asRawData(entry);
-      db.get().put(columnFamilyHandle, rawKey, rawValue);
-      return true;
-    } catch (IOException | RocksDBException exception) {
-      // TODO: [SNAPSHOT] Fail gracefully.
-      throw new RuntimeException(exception);
-    }
+    return SnapshotStorageException.wrap(
+        "Failed to append list entry", () -> {
+          byte[] rawKey = codecRegistry.asRawData(currentIndex++);
+          byte[] rawValue = codecRegistry.asRawData(entry);
+          db.get().put(columnFamilyHandle, rawKey, rawValue);
+          return true;
+        });

Review Comment:
   I prefer keeping the simple `try-catch` blocks (in all similar places), and 
adding a helper method to convert the exception only if thrown.
   
   - Avoids eager creation of `Runnable`/`Supplier` instance.
   - Reduces change.



-- 
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]

Reply via email to