Arun Sarin created HDDS-8367:
--------------------------------

             Summary: setquota should have a check on usedNamespace 
[NameSpacequota]
                 Key: HDDS-8367
                 URL: https://issues.apache.org/jira/browse/HDDS-8367
             Project: Apache Ozone
          Issue Type: Bug
            Reporter: Arun Sarin


This is a negative scenario that was tested

While modifying setquota NameSpacequota we should have a check on usedNamespace 
already consumed by the volume.

For Example these are the two possible scenarios:
 # In a case when namespace quota is not defined on the volume and there are 
some n numbers of buckets already created in that volume. Then if we are trying 
to setquota on that volume, there should be a check that it should not allow us 
to set a namespacequota less than usedNamespace
 # Second similiar scenario is Create volume with namespace quota --> create 
buckets --> Clear namespace quota --> Assign namespace quota less than already 
created buckets

PFB the steps to recreate Scenario 1 :

Step 1 - Create volume without namespace quota

 
{noformat}
[root@quasar-tvqwpy-1 ~]# ozone sh volume create volume3
23/04/04 04:49:13 INFO rpc.RpcClient: Creating Volume: volume3, with hdfs as 
owner and space quota set to -1 bytes, counts quota set to -1{noformat}
Step 2 - Check volume info

 

 
{noformat}
[root@quasar-tvqwpy-1 ~]# ozone sh volume info /volume3
{
  "metadata" : { },
  "name" : "volume3",
  "admin" : "hdfs",
  "owner" : "hdfs",
  "quotaInBytes" : -1,
  "quotaInNamespace" : -1,
  "usedNamespace" : 0,
  "creationTime" : "2023-04-04T04:49:13.520Z",
  "modificationTime" : "2023-04-04T04:49:13.520Z",
  "acls" : [ {
    "type" : "USER",
    "name" : "hdfs",
    "aclScope" : "ACCESS",
    "aclList" : [ "ALL" ]
  }, {
    "type" : "GROUP",
    "name" : "hdfs",
    "aclScope" : "ACCESS",
    "aclList" : [ "ALL" ]
  }, {
    "type" : "GROUP",
    "name" : "hadoop",
    "aclScope" : "ACCESS",
    "aclList" : [ "ALL" ]
  } ],
  "refCount" : 0
}{noformat}
 

Step 3 - Create buckets
{noformat}
[root@quasar-tvqwpy-1 ~]# ozone sh bucket create /volume3/bucket1
23/04/04 04:49:44 INFO rpc.RpcClient: Creating Bucket: volume3/bucket1, with 
server-side default bucket layout, hdfs as owner, Versioning false, Storage 
Type set to DISK and Encryption set to false 
[root@quasar-tvqwpy-1 ~]# ozone sh bucket create /volume3/bucket2
23/04/04 04:49:50 INFO rpc.RpcClient: Creating Bucket: volume3/bucket2, with 
server-side default bucket layout, hdfs as owner, Versioning false, Storage 
Type set to DISK and Encryption set to false 
[root@quasar-tvqwpy-1 ~]# ozone sh bucket create /volume3/bucket3
23/04/04 04:49:56 INFO rpc.RpcClient: Creating Bucket: volume3/bucket3, with 
server-side default bucket layout, hdfs as owner, Versioning false, Storage 
Type set to DISK and Encryption set to false 
[root@quasar-tvqwpy-1 ~]# ozone fs -ls ofs://ozone1/volume3
Found 3 items
drwxrwxrwx   - hdfs hdfs          0 2023-04-04 04:49 
ofs://ozone1/volume3/bucket1
drwxrwxrwx   - hdfs hdfs          0 2023-04-04 04:49 
ofs://ozone1/volume3/bucket2
drwxrwxrwx   - hdfs hdfs          0 2023-04-04 04:49 
ofs://ozone1/volume3/bucket3{noformat}
Step 4 - setquota [This must have failed]
{noformat}
[root@quasar-tvqwpy-1 ~]# ozone sh volume setquota --namespace-quota 1 
/volume3{noformat}
Step 5 - Verify
{noformat}
[root@quasar-tvqwpy-1 ~]# ozone sh volume info /volume3
{
  "metadata" : { },
  "name" : "volume3",
  "admin" : "hdfs",
  "owner" : "hdfs",
  "quotaInBytes" : -1,
  "quotaInNamespace" : 1,
  "usedNamespace" : 3,
  "creationTime" : "2023-04-04T04:49:13.520Z",
  "modificationTime" : "2023-04-04T04:50:32.568Z",
  "acls" : [ {
    "type" : "USER",
    "name" : "hdfs",
    "aclScope" : "ACCESS",
    "aclList" : [ "ALL" ]
  }, {
    "type" : "GROUP",
    "name" : "hdfs",
    "aclScope" : "ACCESS",
    "aclList" : [ "ALL" ]
  }, {
    "type" : "GROUP",
    "name" : "hadoop",
    "aclScope" : "ACCESS",
    "aclList" : [ "ALL" ]
  } ],
  "refCount" : 0
}{noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to