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


##########
hadoop-hdds/common/src/main/resources/ozone-default.xml:
##########
@@ -4245,4 +4245,12 @@
       to existing buckets till this operation is completed.
     </description>
   </property>
+  <property>
+    <name>ozone.om.max.bucket</name>

Review Comment:
   Nit: `ozone.om.max.buckets`.



##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/TypedTable.java:
##########
@@ -441,6 +441,9 @@ public String toString() {
 
   @Override
   public long getEstimatedKeyCount() throws IOException {
+    if (cache instanceof FullTableCache) {

Review Comment:
   I'd prefer adding `CacheType type()` in `TableCache`, and using 
`cache.type() == FULL_CACHE` instead of `instanceof` check.



##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketCreateRequest.java:
##########
@@ -142,6 +145,23 @@ public OMRequest preExecute(OzoneManager ozoneManager) 
throws IOException {
         .setCreateBucketRequest(newCreateBucketRequest.build()).build();
   }
 
+  private static void validateMaxBucket(OzoneManager ozoneManager)
+      throws IOException {
+    int maxBucket = ozoneManager.getConfiguration().getInt(
+        OMConfigKeys.OZONE_OM_MAX_BUCKET,
+        OMConfigKeys.OZONE_OM_MAX_BUCKET_DEFAULT);
+    if (maxBucket <= 0) {
+      maxBucket = OMConfigKeys.OZONE_OM_MAX_BUCKET_DEFAULT;
+    }
+    long nrOfBuckets = ozoneManager.getMetadataManager().getBucketTable()
+        .getEstimatedKeyCount();
+    if (nrOfBuckets >= maxBucket) {
+      throw new OMException("Number of bucket crosses limit " +

Review Comment:
   Nit: I think `"Cannot create more than " + maxBucket + " buckets"` would be 
a better message.



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