You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by ca...@apache.org on 2020/12/29 09:57:10 UTC
[ozone] branch master updated: HDDS-4588. If volume's quota is
enabled then bucket's quota cannot be cleared (#1723)
This is an automated email from the ASF dual-hosted git repository.
captainzmc pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 2e4caa2 HDDS-4588. If volume's quota is enabled then bucket's quota cannot be cleared (#1723)
2e4caa2 is described below
commit 2e4caa26a5ccf61e140dac24f6c99498865134cd
Author: micah zhao <mi...@tencent.com>
AuthorDate: Tue Dec 29 17:56:50 2020 +0800
HDDS-4588. If volume's quota is enabled then bucket's quota cannot be cleared (#1723)
* fix clear bucket quota.
---
.../org/apache/hadoop/ozone/om/exceptions/OMException.java | 4 +++-
.../dist/src/main/smoketest/basic/ozone-shell-lib.robot | 12 ++++++------
.../hadoop/ozone/client/rpc/TestOzoneRpcClientAbstract.java | 6 +++++-
.../interface-client/src/main/proto/OmClientProtocol.proto | 2 ++
.../ozone/om/request/bucket/OMBucketSetPropertyRequest.java | 7 +++++++
5 files changed, 23 insertions(+), 8 deletions(-)
diff --git a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/exceptions/OMException.java b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/exceptions/OMException.java
index a2f4d6a..b676bca 100644
--- a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/exceptions/OMException.java
+++ b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/exceptions/OMException.java
@@ -231,7 +231,9 @@ public class OMException extends IOException {
PARTIAL_RENAME,
- QUOTA_EXCEEDED
+ QUOTA_EXCEEDED,
+
+ QUOTA_ERROR
}
}
diff --git a/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-lib.robot b/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-lib.robot
index 0a1c855..d65b8fd 100644
--- a/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-lib.robot
+++ b/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-lib.robot
@@ -58,18 +58,18 @@ Test ozone shell
${result} = Execute ozone sh bucket list ${protocol}${server}/${volume}/ | jq -r '. | select(.name=="bb1") | .volumeName'
Should Be Equal ${result} ${volume}
Run Keyword Test key handling ${protocol} ${server} ${volume}
- Execute ozone sh bucket clrquota --space-quota ${protocol}${server}/${volume}/bb1
- ${result} = Execute ozone sh bucket info ${protocol}${server}/${volume}/bb1 | jq -r '. | select(.name=="bb1") | .quotaInBytes'
- Should Be Equal ${result} -1
- Execute ozone sh bucket clrquota --namespace-quota ${protocol}${server}/${volume}/bb1
- ${result} = Execute ozone sh bucket info ${protocol}${server}/${volume}/bb1 | jq -r '. | select(.name=="bb1") | .quotaInNamespace'
- Should Be Equal ${result} -1
Execute ozone sh volume clrquota --space-quota ${protocol}${server}/${volume}
${result} = Execute ozone sh volume info ${protocol}${server}/${volume} | jq -r '. | select(.name=="${volume}") | .quotaInBytes'
Should Be Equal ${result} -1
Execute ozone sh volume clrquota --namespace-quota ${protocol}${server}/${volume}
${result} = Execute ozone sh volume info ${protocol}${server}/${volume} | jq -r '. | select(.name=="${volume}") | .quotaInNamespace'
Should Be Equal ${result} -1
+ Execute ozone sh bucket clrquota --space-quota ${protocol}${server}/${volume}/bb1
+ ${result} = Execute ozone sh bucket info ${protocol}${server}/${volume}/bb1 | jq -r '. | select(.name=="bb1") | .quotaInBytes'
+ Should Be Equal ${result} -1
+ Execute ozone sh bucket clrquota --namespace-quota ${protocol}${server}/${volume}/bb1
+ ${result} = Execute ozone sh bucket info ${protocol}${server}/${volume}/bb1 | jq -r '. | select(.name=="bb1") | .quotaInNamespace'
+ Should Be Equal ${result} -1
Execute ozone sh bucket delete ${protocol}${server}/${volume}/bb1
Execute ozone sh volume delete ${protocol}${server}/${volume}
Execute ozone sh volume create ${protocol}${server}/${volume}
diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneRpcClientAbstract.java b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneRpcClientAbstract.java
index eada2f7..770a693 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneRpcClientAbstract.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneRpcClientAbstract.java
@@ -280,7 +280,7 @@ public abstract class TestOzoneRpcClientAbstract {
}
@Test
- public void testSetAndClrQuota() throws IOException {
+ public void testSetAndClrQuota() throws Exception {
String volumeName = UUID.randomUUID().toString();
String bucketName = UUID.randomUUID().toString();
OzoneVolume volume = null;
@@ -314,6 +314,10 @@ public abstract class TestOzoneRpcClientAbstract {
ozoneBucket.getQuotaInBytes());
Assert.assertEquals(1000L, ozoneBucket.getQuotaInNamespace());
+ LambdaTestUtils.intercept(IOException.class, "Can not clear bucket" +
+ " spaceQuota because volume spaceQuota is not cleared.",
+ () -> ozoneBucket.clearSpaceQuota());
+
store.getVolume(volumeName).clearSpaceQuota();
store.getVolume(volumeName).clearNamespaceQuota();
OzoneVolume clrVolume = store.getVolume(volumeName);
diff --git a/hadoop-ozone/interface-client/src/main/proto/OmClientProtocol.proto b/hadoop-ozone/interface-client/src/main/proto/OmClientProtocol.proto
index 694bc77..d024e9e 100644
--- a/hadoop-ozone/interface-client/src/main/proto/OmClientProtocol.proto
+++ b/hadoop-ozone/interface-client/src/main/proto/OmClientProtocol.proto
@@ -318,6 +318,8 @@ enum Status {
QUOTA_EXCEEDED = 66;
+ QUOTA_ERROR = 67;
+
}
/**
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketSetPropertyRequest.java b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketSetPropertyRequest.java
index 3312991..21416d3 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketSetPropertyRequest.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/bucket/OMBucketSetPropertyRequest.java
@@ -228,6 +228,13 @@ public class OMBucketSetPropertyRequest extends OMClientRequest {
throws IOException {
long quotaInBytes = omBucketArgs.getQuotaInBytes();
+ if (quotaInBytes == OzoneConsts.QUOTA_RESET &&
+ omVolumeArgs.getQuotaInBytes() != OzoneConsts.QUOTA_RESET) {
+ throw new OMException("Can not clear bucket spaceQuota because" +
+ " volume spaceQuota is not cleared.",
+ OMException.ResultCodes.QUOTA_ERROR);
+ }
+
if (quotaInBytes == 0) {
return false;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ozone.apache.org
For additional commands, e-mail: commits-help@ozone.apache.org