captainzmc commented on a change in pull request #1677:
URL: https://github.com/apache/ozone/pull/1677#discussion_r545536353
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketCreateRequest.java
##########
@@ -314,7 +314,9 @@ private BucketEncryptionInfoProto getBeinfo(
*/
private void checkQuotaInNamespace(OmVolumeArgs omVolumeArgs,
long allocatedNamespace) throws IOException {
- if (omVolumeArgs.getQuotaInNamespace() != OzoneConsts.QUOTA_RESET) {
+ // Client has ensured that no negative values other than -1 (clear quota)
+ // will occur when quota is set.
+ if (omVolumeArgs.getQuotaInNamespace() > OzoneConsts.QUOTA_RESET) {
Review comment:
Thanks for @linyiqun's feedback.
Current there are two case -1 or -2 (old volume/bucket) not check quota,
actually we have guarantee on the client, [user cann’t set negative
quota](https://github.com/apache/ozone/blob/master/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/client/OzoneQuota.java#L194),
Therefore, except for clear quota and old quota, there is no negative case.
If add omVolumeArgs. getQuotaInNamespace ()! = 2. The judgment condition
will increase too much and the code will not be clear enough, we can use
omVolumeArgs. getQuotaInNamespace () > 0, this will make the code much cleaner.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]