You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "hemantk-12 (via GitHub)" <gi...@apache.org> on 2023/06/14 00:47:37 UTC

[GitHub] [ozone] hemantk-12 commented on a diff in pull request #4884: HDDS-8842. Limit number of open files for snapshot db in Snapshot cache

hemantk-12 commented on code in PR #4884:
URL: https://github.com/apache/ozone/pull/4884#discussion_r1228834947


##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/DBStoreBuilder.java:
##########
@@ -182,6 +183,17 @@ private void applyDBDefinition(DBDefinition definition) {
     }
   }
 
+  public DBStoreBuilder setMaxNumberOfOpenFiles(Integer maxNumberOfOpenFiles) {
+    this.maxNumberOfOpenFiles = maxNumberOfOpenFiles;
+    return this;
+  }
+
+  private void setDBOptionsProps(ManagedDBOptions dbOptions) {

Review Comment:
   Neither `setDBOptionsProps` function is used anywhere nor `dbOptions` passed is used.  



##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/DBStoreBuilder.java:
##########
@@ -182,6 +183,17 @@ private void applyDBDefinition(DBDefinition definition) {
     }
   }
 
+  public DBStoreBuilder setMaxNumberOfOpenFiles(Integer maxNumberOfOpenFiles) {

Review Comment:
   nit: Can you please move it to next to other setters?



##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/DBStoreBuilder.java:
##########
@@ -200,7 +212,7 @@ public DBStore build() throws IOException {
       if (rocksDBOption == null) {
         rocksDBOption = getDefaultDBOptions(tableConfigs);
       }
-
+      setDBOptions(rocksDBOption);

Review Comment:
   What is this line doing? Setting itself again with the same value?



##########
hadoop-hdds/common/src/main/resources/ozone-default.xml:
##########
@@ -3894,6 +3894,18 @@
     </description>
   </property>
 
+  <property>
+    <name>ozone.om.snapshot.db.max.open.files</name>
+    <value>100</value>
+    <tag>OZONE, OM</tag>
+    <description>
+      Max number of open files for each snapshot db present in the snapshot cache.

Review Comment:
   What if `snapshot db` is not added to cache?



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OmMetadataManagerImpl.java:
##########
@@ -380,7 +380,7 @@ private OmMetadataManagerImpl(OzoneConfiguration conf, File dir, String name)
         checkSnapshotDirExist(checkpoint);
       }
       setStore(loadDB(conf, metaDir, dbName, false,
-          java.util.Optional.of(Boolean.TRUE), false, false));
+          java.util.Optional.of(Boolean.TRUE), Optional.of(maxOpenFiles), false, false));

Review Comment:
   I don't think optional is good idea to use for primitives e.g. `maxOpenFiles`. Someone can  pass `maxOpenFiles` as zero or negative. Would it work as expected in the case?
   
   I think you should check that it is non-zero positive number [here](https://github.com/apache/ozone/pull/4884/files#diff-d4e4dbf0e95db46eded21d40936d1b18cd738dc19fa10ec45dc88211b4b498e3R562) or in the `setMaxNumberOfOpenFiles`.



-- 
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-unsubscribe@ozone.apache.org

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


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