You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by ss...@apache.org on 2023/03/15 09:38:36 UTC

[ozone] branch master updated: HDDS-8163 Use try-with-resources to ensure close rockdb connection in SstFilteringService (#4402)

This is an automated email from the ASF dual-hosted git repository.

sshenoy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 365f80dad2 HDDS-8163 Use try-with-resources to ensure close rockdb connection in SstFilteringService (#4402)
365f80dad2 is described below

commit 365f80dad239c3af799cd7c5794de697ede24cca
Author: DaveTeng0 <10...@users.noreply.github.com>
AuthorDate: Wed Mar 15 02:38:28 2023 -0700

    HDDS-8163 Use try-with-resources to ensure close rockdb connection in SstFilteringService (#4402)
---
 .../java/org/apache/hadoop/ozone/om/SstFilteringService.java   | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/SstFilteringService.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/SstFilteringService.java
index 17be6142d8..43effdcc0c 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/SstFilteringService.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/SstFilteringService.java
@@ -143,12 +143,12 @@ public class SstFilteringService extends BackgroundService {
 
           String dbName = OM_DB_NAME + snapshotInfo.getCheckpointDirName();
 
-          RDBStore rdbStore = (RDBStore) OmMetadataManagerImpl
+          try (RDBStore rdbStore = (RDBStore) OmMetadataManagerImpl
               .loadDB(ozoneManager.getConfiguration(), new File(snapshotDir),
-                  dbName, true);
-          RocksDatabase db = rdbStore.getDb();
-          db.deleteFilesNotMatchingPrefix(prefixPairs, filterFunction);
-          rdbStore.close();
+                  dbName, true)) {
+            RocksDatabase db = rdbStore.getDb();
+            db.deleteFilesNotMatchingPrefix(prefixPairs, filterFunction);
+          }
 
           // mark the snapshot as filtered by writing to the file
           String content = snapshotInfo.getSnapshotID() + "\n";


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org