captainzmc edited a comment on pull request #1746:
URL: https://github.com/apache/ozone/pull/1746#issuecomment-755055918


   > > Let's look at another example,this also has the same problem:
   > > ozone sh volume setquota vol1 --space-quota 10TB (This should be success)
   > > ozone sh volume setquota vol1 --space-quota 10TB --namespace-quota 0 
(This should be unsuccessful)
   > 
   > @captainzmc , this will be not a problem. 
   
   We can reproduce the case I mentioned above using UT in the current master 
code. Add the following test code in UT:
   
![image](https://user-images.githubusercontent.com/13825159/103725011-9ede4e00-5010-11eb-800a-d9a11f52388a.png)
   Set the breakpoint in SetQuotaHandler. Execute the test. We can see that 
although namespace quota was not specified, 0 was passed in anyway. Because 
when this field is not defined get the default value (0) of long.
   
![image](https://user-images.githubusercontent.com/13825159/103725289-393e9180-5011-11eb-81ee-8868f7b07769.png)
   
   The first case can also reproduce with the testShQuota UT, adding a 
breakpoint at CreateVolumeHandler. Execute the test. 
   
![image](https://user-images.githubusercontent.com/13825159/103725508-b4a04300-5011-11eb-86cb-6cabd6ac8d9e.png)
   
   > For first case that don't specified namespace quota, now the real meaning 
is the quota unset not means namepsace quota was 0.
   > So I prefer only to make the adjustment that don't allow 0 can be set in 
this PR change.
   
   I agree that we need to distinguish between these two different behaviors of 
the user. ”Don't allow 0 can be set“ It's our purpose,also agree this. The 
point is, how do we do that?
   We need to distinguish whether this '0' was set by the user actively or user 
didn't set this field so that the code uses the default value of long. 
   Is there anything better solution than replacing a long with a string (which 
is easier to judge because the default value of a String is null not 0)? Any 
advice here?
   
   
   


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

Reply via email to