priyeshkaratha commented on code in PR #9039:
URL: https://github.com/apache/ozone/pull/9039#discussion_r2354566158


##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/DBStoreBuilder.java:
##########
@@ -207,24 +207,30 @@ public RDBStore build() throws RocksDatabaseException {
     }
 
     Set<TableConfig> tableConfigs = makeTableConfigs();
-
+    ManagedWriteOptions writeOptions = null;
     try {
       if (rocksDBOption == null) {
         rocksDBOption = getDefaultDBOptions(tableConfigs);
       }
       setDBOptionsProps(rocksDBOption);
-      ManagedWriteOptions writeOptions = new ManagedWriteOptions();
-      writeOptions.setSync(rocksDBConfiguration.getSyncOption());
-
       File dbFile = getDBFile();
       if (!dbFile.getParentFile().exists()) {
         throw new RocksDatabaseException("The DB destination directory should 
exist.");
       }
+      writeOptions = new ManagedWriteOptions();
+      writeOptions.setSync(rocksDBConfiguration.getSyncOption());
 
       return new RDBStore(dbFile, rocksDBOption, statistics, writeOptions, 
tableConfigs,
           openReadOnly, dbJmxBeanNameName, enableCompactionDag,
           maxDbUpdatesSizeThreshold, createCheckpointDirs, configuration,
           enableRocksDbMetrics);
+    } catch (Exception ex) {
+      try {
+        writeOptions.close();

Review Comment:
   Thanks for the catch. Its resolved.



-- 
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: issues-unsubscr...@ozone.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@ozone.apache.org
For additional commands, e-mail: issues-h...@ozone.apache.org

Reply via email to