SaketaChalamchala opened a new pull request, #4013:
URL: https://github.com/apache/ozone/pull/4013

   ## What changes were proposed in this pull request?
   
   Setting Quotas on an existing bucket overwrites the replication config to 
RATIS ONE. These are the first options for ReplicationType & ReplicationFactor 
enums in 
[hdds.proto](https://github.com/apache/ozone/blob/master/hadoop-hdds/interface-client/src/main/proto/hdds.proto#L267-L279)
 which are picked up by default. 
   
   Proposed change is similar to [#3975 
](https://github.com/apache/ozone/pull/3975). Add `hasDefaultReplicationConfig` 
in OmBucketArgs.java to indicate if Replication Config is passed by the client. 
If not, avoid setting replication config in protobuf fields.
   if replication config is not explicitly passed, retain replication config of 
existing bucket when setting bucket properties in 
OMBucketSetPropertyRequest.java 
   
   ```
   # ozone sh volume create /ecvol
   22/11/29 22:52:06 INFO rpc.RpcClient: Creating Volume: ecvol, with cdpuser1 
as owner and space quota set to -1 bytes, counts quota set to -1
   # ozone sh bucket create /ecvol/ec1bucket
   22/11/29 22:52:15 INFO rpc.RpcClient: Creating Bucket: ecvol/ec1bucket, with 
the Bucket Layout null, cdpuser1 as owner, Versioning false, Storage Type set 
to DISK and Encryption set to false
   # ozone sh bucket info /ecvol/ec1bucket
   # ozone sh bucket set-replication-config -t EC -r rs-3-2-1024k 
/ecvol/ec1bucket
   # ozone sh bucket info /ecvol/ec1bucket
   {
     "metadata" : { },
     "volumeName" : "ecvol",
     "name" : "ec1bucket",
     "storageType" : "DISK",
     "versioning" : false,
     "usedBytes" : 0,
     "usedNamespace" : 0,
     "creationTime" : "2022-11-29T22:52:15.599Z",
     "modificationTime" : "2022-11-29T22:52:40.943Z",
     "quotaInBytes" : -1,
     "quotaInNamespace" : -1,
     "bucketLayout" : "LEGACY",
     "link" : false,
     "replicationConfig" : {
       "data" : 3,
       "parity" : 2,
       "ecChunkSize" : 1048576,
       "codec" : "RS",
       "replicationType" : "EC",
       "requiredNodes" : 5
     }
   }
   [root@schal-11-1 ~]# ozone sh bucket setquota --quota=1GB 
--namespace-quota=1000 /ecvol/ec1bucket
   [root@schal-11-1 ~]# ozone sh bucket info /ecvol/ec1bucket
   {
     "metadata" : { },
     "volumeName" : "ecvol",
     "name" : "ec1bucket",
     "storageType" : "DISK",
     "versioning" : false,
     "usedBytes" : 0,
     "usedNamespace" : 0,
     "creationTime" : "2022-11-29T22:52:15.599Z",
     "modificationTime" : "2022-11-29T22:54:09.507Z",
     "quotaInBytes" : 1073741824,
     "quotaInNamespace" : 1000,
     "bucketLayout" : "LEGACY",
     "link" : false,
     "replicationConfig" : {
       "replicationFactor" : "ONE",
       "requiredNodes" : 1,
       "replicationType" : "RATIS"
     }
   }
   [root@schal-11-1 ~]# ozone sh bucket create ecvol/def1bucket
   22/11/29 22:54:35 INFO rpc.RpcClient: Creating Bucket: ecvol/def1bucket, 
with the Bucket Layout null, cdpuser1 as owner, Versioning false, Storage Type 
set to DISK and Encryption set to false 
   [root@schal-11-1 ~]# ozone sh bucket info /ecvol/def1bucket
   {
     "metadata" : { },
     "volumeName" : "ecvol",
     "name" : "def1bucket",
     "storageType" : "DISK",
     "versioning" : false,
     "usedBytes" : 0,
     "usedNamespace" : 0,
     "creationTime" : "2022-11-29T22:54:35.020Z",
     "modificationTime" : "2022-11-29T22:54:35.020Z",
     "quotaInBytes" : -1,
     "quotaInNamespace" : -1,
     "bucketLayout" : "LEGACY",
     "owner" : "cdpuser1",
     "link" : false
   }
   [root@schal-11-1 ~]# ozone sh bucket setquota --quota=1GB 
--namespace-quota=1000 /ecvol/def1bucket
   [root@schal-11-1 ~]# ozone sh bucket info /ecvol/def1bucket
   {
     "metadata" : { },
     "volumeName" : "ecvol",
     "name" : "def1bucket",
     "storageType" : "DISK",
     "versioning" : false,
     "usedBytes" : 0,
     "usedNamespace" : 0,
     "creationTime" : "2022-11-29T22:54:35.020Z",
     "modificationTime" : "2022-11-29T22:55:25.420Z",
     "quotaInBytes" : 1073741824,
     "quotaInNamespace" : 1000,
     "bucketLayout" : "LEGACY",
     "link" : false,
     "replicationConfig" : {
       "replicationFactor" : "ONE",
       "requiredNodes" : 1,
       "replicationType" : "RATIS"
     }
   }
   ```
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-7526
   
   ## How was this patch tested?
   
   Added Unit Tests to verify that Replication Config is set correctly in 
OmBucketArgs and that existing default/non-default replication config is 
retained when replication config is not set explicitly by the client


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