Skip to content

Conversation

@sumitagrawl
Copy link
Contributor

What changes were proposed in this pull request?

BucketId comparision is added if key/folder belongs to same bucket or not for updating quota

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-7565

How was this patch tested?

Patch is tested with Unit case, and End to End scenario for quota update

@kerneltime
Copy link
Contributor

cc @duongkame

@kerneltime kerneltime requested a review from neils-dev December 5, 2022 17:20
@neils-dev
Copy link
Contributor

neils-dev commented Dec 7, 2022

Thanks @sumitagrawl for this PR. Looking at the scenario described in the jira. I haven't been able to reproduce the error. Currently, I'm doing the following and expecting the error,

bash-4.2$ ozone sh volume create /vol1
bash-4.2$ ozone sh volume setquota --namespace-quota 1 /vol1
bash-4.2$ ozone sh bucket create --layout FILE_SYSTEM_OPTIMIZED /vol1/bucket1
bash-4.2$ ozone sh bucket setquota --space-quota=10000000 /vol1/bucket1
bash-4.2$ ozone freon omkg -b bucket1 -v vol1
bash-4.2$ ozone fs -rm -r -skipTrash /vol1/bucket1

bash-4.2$ ozone sh bucket create --layout FILE_SYSTEM_OPTIMIZED /vol1/bucket1

When the bucket is re-created I do not see a problem with namespace nor size quotas for volume and bucket. Why is the error not present?

@sumitagrawl
Copy link
Contributor Author

@neils-dev Need to observe quota update in bucket info for changes, I have run above and then captured bucket info with quota,

  1. bucket info showing usedNamesapce "1000"
sumitagrawal@sumitagrawal-MBP16 bin % ./ozone sh bucket info /vol1/bucket1                           
2022-12-12 10:35:13,513 WARN  util.NativeCodeLoader (NativeCodeLoader.java:<clinit>(60)) - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
{
  "metadata" : { },
  "volumeName" : "vol1",
  "name" : "bucket1",
  "storageType" : "DISK",
  "versioning" : false,
  "usedBytes" : 0,
  "usedNamespace" : 1000,
  "creationTime" : "2022-12-12T04:58:03.668Z",
  "modificationTime" : "2022-12-12T05:04:20.651Z",
  "quotaInBytes" : 10737418240,
  "quotaInNamespace" : -1,
  "bucketLayout" : "FILE_SYSTEM_OPTIMIZED",
  "link" : false,
  "replicationConfig" : {
    "replicationFactor" : "ONE",
    "requiredNodes" : 1,
    "replicationType" : "RATIS"
  }
}

  1. remove bucket recursive and recreate a bucket and check used namespace (its "0")
sumitagrawal@sumitagrawal-MBP16 bin % ./ozone fs -rm -r -skipTrash /vol1/bucket1
2022-12-12 10:35:42,135 WARN  util.NativeCodeLoader (NativeCodeLoader.java:<clinit>(60)) - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
Deleted /vol1/bucket1

sumitagrawal@sumitagrawal-MBP16 bin % ./ozone sh bucket create --layout FILE_SYSTEM_OPTIMIZED /vol1/bucket1
2022-12-12 10:35:53,211 WARN  util.NativeCodeLoader (NativeCodeLoader.java:<clinit>(60)) - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
2022-12-12 10:35:53,827 INFO  rpc.RpcClient (RpcClient.java:createBucket(691)) - Creating Bucket: vol1/bucket1, with bucket layout FILE_SYSTEM_OPTIMIZED, sumitagrawal as owner, Versioning false, Storage Type set to DISK and Encryption set to false 
sumitagrawal@sumitagrawal-MBP16 bin % ./ozone sh bucket info /vol1/bucket1                           
2022-12-12 10:35:59,880 WARN  util.NativeCodeLoader (NativeCodeLoader.java:<clinit>(60)) - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
{
  "metadata" : { },
  "volumeName" : "vol1",
  "name" : "bucket1",
  "storageType" : "DISK",
  "versioning" : false,
  "usedBytes" : 0,
  "usedNamespace" : 0,
  "creationTime" : "2022-12-12T05:05:53.838Z",
  "modificationTime" : "2022-12-12T05:05:53.838Z",
  "quotaInBytes" : -1,
  "quotaInNamespace" : -1,
  "bucketLayout" : "FILE_SYSTEM_OPTIMIZED",
  "owner" : "sumitagrawal",
  "link" : false
}
  1. After some time, its observed namespace is changed to "-1000" which is after purge of directory is completed. This should not happen for the newly created bucket.
sumitagrawal@sumitagrawal-MBP16 bin % ./ozone sh bucket info /vol1/bucket1
2022-12-12 10:38:01,114 WARN  util.NativeCodeLoader (NativeCodeLoader.java:<clinit>(60)) - Unable to load native-hadoop library for your platform... using builtin-java classes where applicable
{
  "metadata" : { },
  "volumeName" : "vol1",
  "name" : "bucket1",
  "storageType" : "DISK",
  "versioning" : false,
  "usedBytes" : 0,
  "usedNamespace" : -1000,
  "creationTime" : "2022-12-12T05:05:53.838Z",
  "modificationTime" : "2022-12-12T05:05:53.838Z",
  "quotaInBytes" : -1,
  "quotaInNamespace" : -1,
  "bucketLayout" : "FILE_SYSTEM_OPTIMIZED",
  "owner" : "sumitagrawal",
  "link" : false
}
sumitagrawal@sumitagrawal-MBP16 bin % 

@neils-dev
Copy link
Contributor

Thanks @sumitagrawl for the patch and the changes. +1
Thanks @kerneltime for reviewing this PR.

@neils-dev neils-dev merged commit 7ca9b5d into apache:master Dec 19, 2022
errose28 added a commit to errose28/ozone that referenced this pull request Dec 21, 2022
* master: (88 commits)
  HDDS-7463. SCM Pipeline scrubber never able to cleanup allocated pipeline. (apache#4093)
  HDDS-7683. EC: ReplicationManager - UnderRep maintenance handler should not request nodes if none needed (apache#4109)
  HDDS-7635. Update failure metrics when allocate block fails in preExecute. (apache#4086)
  HDDS-7565. FSO purge directory for old bucket can update quota for new bucket (apache#4021)
  HDDS-7654. EC: ReplicationManager - merge mis-rep queue into under replicated queue (apache#4099)
  HDDS-7621. Update SCM term in datanode from heartbeat without any commands (apache#4101)
  HDDS-7649. S3 multipart upload EC release space quota wrong for old version (apache#4095)
  HDDS-7399. Enable specifying external root ca (apache#4053)
  HDDS-7398. Tool to remove old certs from the scm db (apache#3972)
  HDDS-6650. S3MultipartUpload support update bucket usedNamespace. (apache#4081)
  HDDS-7605. Improve logging in Container Balancer (apache#4067)
  HDDS-7616. EC: Refactor Unhealthy Replicated Processor (apache#4063)
  HDDS-7426. Add a new acceptance test for Streaming Pipeline. (apache#4019)
  HDDS-7478. [Ozone-Streaming] NPE in when creating a file with o3fs. (apache#3949)
  HDDS-7425. Add documentation for the new Streaming Pipeline feature. (apache#3913)
  HDDS-7438. [Ozone-Streaming] Add a createStreamKey method to OzoneBucket. (apache#3914)
  HDDS-7431. [Ozone-Streaming] Disable data steam by default. (apache#3900)
  HDDS-6955. [Ozone-streaming] Add explicit stream flag in ozone shell (apache#3559)
  HDDS-6867.  [Ozone-Streaming] PutKeyHandler should not use streaming to put EC key. (apache#3516)
  HDDS-6842. [Ozone-Streaming] Reduce the number of watch requests in StreamCommitWatcher. (apache#3492)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants