You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "mingchao zhao (Jira)" <ji...@apache.org> on 2020/12/30 07:24:00 UTC

[jira] [Updated] (HDDS-4631) Fixed client set quota with 0

     [ https://issues.apache.org/jira/browse/HDDS-4631?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

mingchao zhao updated HDDS-4631:
--------------------------------
    Description: 
Currently setting Quota is invalid if set to 0. It's actually going to be set to -1.
{code:java}
store.getVolume(volumeName).getBucket(bucketName).setQuota(
        OzoneQuota.parseQuota("0GB", 0));
    Assert.assertEquals(-1, bucket.getQuotaInBytes());
    Assert.assertEquals(-1, bucket.getQuotaInNamespace());
{code}
This behavior is actually incorrect, and we should actually support quota setting to 0:
{code:java}
store.getVolume(volumeName).getBucket(bucketName).setQuota(
        OzoneQuota.parseQuota("0GB", 0));
    Assert.assertEquals(0, bucket.getQuotaInBytes());
    Assert.assertEquals(0, bucket.getQuotaInNamespace());
{code}

This problem occurs because the original client quota type is long. If the user does not specify quota, the default value for this field is 0.
A backend validation fails to verify that the user did not specify quota or set quoat to 0, since both actions are passed to the backend to be 0.
So it would be more appropriate to change the long to a string. If the user does not specify quota, it is null. It's easier to judge.

  was:
Currently setting Quota is invalid if set to 0. It's actually going to be set to -1.
{code:java}
store.getVolume(volumeName).getBucket(bucketName).setQuota(
        OzoneQuota.parseQuota("0GB", 0));
    Assert.assertEquals(-1, bucket.getQuotaInBytes());
    Assert.assertEquals(-1, bucket.getQuotaInNamespace());
{code}
This behavior is actually incorrect, and we should actually support quota setting to 0:
{code:java}
store.getVolume(volumeName).getBucket(bucketName).setQuota(
        OzoneQuota.parseQuota("0GB", 0));
    Assert.assertEquals(0, bucket.getQuotaInBytes());
    Assert.assertEquals(0, bucket.getQuotaInNamespace());
{code}


> Fixed client set quota with 0
> -----------------------------
>
>                 Key: HDDS-4631
>                 URL: https://issues.apache.org/jira/browse/HDDS-4631
>             Project: Hadoop Distributed Data Store
>          Issue Type: Sub-task
>            Reporter: mingchao zhao
>            Assignee: mingchao zhao
>            Priority: Major
>
> Currently setting Quota is invalid if set to 0. It's actually going to be set to -1.
> {code:java}
> store.getVolume(volumeName).getBucket(bucketName).setQuota(
>         OzoneQuota.parseQuota("0GB", 0));
>     Assert.assertEquals(-1, bucket.getQuotaInBytes());
>     Assert.assertEquals(-1, bucket.getQuotaInNamespace());
> {code}
> This behavior is actually incorrect, and we should actually support quota setting to 0:
> {code:java}
> store.getVolume(volumeName).getBucket(bucketName).setQuota(
>         OzoneQuota.parseQuota("0GB", 0));
>     Assert.assertEquals(0, bucket.getQuotaInBytes());
>     Assert.assertEquals(0, bucket.getQuotaInNamespace());
> {code}
> This problem occurs because the original client quota type is long. If the user does not specify quota, the default value for this field is 0.
> A backend validation fails to verify that the user did not specify quota or set quoat to 0, since both actions are passed to the backend to be 0.
> So it would be more appropriate to change the long to a string. If the user does not specify quota, it is null. It's easier to judge.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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