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


##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/DBStoreBuilder.java:
##########
@@ -213,13 +213,12 @@ public RDBStore build() throws RocksDatabaseException {
         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.");
       }
+      ManagedWriteOptions writeOptions = new ManagedWriteOptions();
+      writeOptions.setSync(rocksDBConfiguration.getSyncOption());

Review Comment:
   This is fine, but if for any reason the RocksDatabase db inside RDBStore 
construction doesn't open successfully, the writeOptions will leak.
   
   The writeOptions doesn't leak in the happy path, because the RDBStore is 
explicitly closed at the end and it closes writeOptions.



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