HBASE-17259 API to remove space quotas on a table/namespace
This commit is contained in:
parent
34ba143fc8
commit
6c9082fe16
|
@ -315,6 +315,17 @@ public class QuotaSettingsFactory {
|
||||||
return new SpaceLimitSettings(tableName, sizeLimit, violationPolicy);
|
return new SpaceLimitSettings(tableName, sizeLimit, violationPolicy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a {@link QuotaSettings} object to remove the FileSystem space quota for the given
|
||||||
|
* table.
|
||||||
|
*
|
||||||
|
* @param tableName The name of the table to remove the quota for.
|
||||||
|
* @return A {@link QuotaSettings} object.
|
||||||
|
*/
|
||||||
|
public static QuotaSettings removeTableSpaceLimit(TableName tableName) {
|
||||||
|
return new SpaceLimitSettings(tableName, true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a {@link QuotaSettings} object to limit the FileSystem space usage for the given
|
* Creates a {@link QuotaSettings} object to limit the FileSystem space usage for the given
|
||||||
* namespace to the given size in bytes. When the space usage is exceeded by all tables in the
|
* namespace to the given size in bytes. When the space usage is exceeded by all tables in the
|
||||||
|
@ -329,4 +340,15 @@ public class QuotaSettingsFactory {
|
||||||
final String namespace, long sizeLimit, final SpaceViolationPolicy violationPolicy) {
|
final String namespace, long sizeLimit, final SpaceViolationPolicy violationPolicy) {
|
||||||
return new SpaceLimitSettings(namespace, sizeLimit, violationPolicy);
|
return new SpaceLimitSettings(namespace, sizeLimit, violationPolicy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a {@link QuotaSettings} object to remove the FileSystem space quota for the given
|
||||||
|
* namespace.
|
||||||
|
*
|
||||||
|
* @param namespace The namespace to remove the quota on.
|
||||||
|
* @return A {@link QuotaSettings} object.
|
||||||
|
*/
|
||||||
|
public static QuotaSettings removeNamespaceSpaceLimit(String namespace) {
|
||||||
|
return new SpaceLimitSettings(namespace, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -422,7 +422,11 @@ public class QuotaTableUtil {
|
||||||
boolean hasSettings = false;
|
boolean hasSettings = false;
|
||||||
hasSettings |= quotas.hasThrottle();
|
hasSettings |= quotas.hasThrottle();
|
||||||
hasSettings |= quotas.hasBypassGlobals();
|
hasSettings |= quotas.hasBypassGlobals();
|
||||||
hasSettings |= quotas.hasSpace();
|
// Only when there is a space quota, make sure there's actually both fields provided
|
||||||
|
// Otherwise, it's a noop.
|
||||||
|
if (quotas.hasSpace()) {
|
||||||
|
hasSettings |= (quotas.getSpace().hasSoftLimit() && quotas.getSpace().hasViolationPolicy());
|
||||||
|
}
|
||||||
return !hasSettings;
|
return !hasSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,15 @@ class SpaceLimitSettings extends QuotaSettings {
|
||||||
if (0L > sizeLimit) {
|
if (0L > sizeLimit) {
|
||||||
throw new IllegalArgumentException("Size limit must be a non-negative value.");
|
throw new IllegalArgumentException("Size limit must be a non-negative value.");
|
||||||
}
|
}
|
||||||
proto = buildProtoQuota(sizeLimit, Objects.requireNonNull(violationPolicy));
|
proto = buildProtoAddQuota(sizeLimit, Objects.requireNonNull(violationPolicy));
|
||||||
|
}
|
||||||
|
|
||||||
|
SpaceLimitSettings(TableName tableName, boolean remove) {
|
||||||
|
super(null, Objects.requireNonNull(tableName), null);
|
||||||
|
if (!remove) {
|
||||||
|
throw new IllegalArgumentException("A value of 'false' for removing a quota makes no sense");
|
||||||
|
}
|
||||||
|
proto = buildProtoRemoveQuota();
|
||||||
}
|
}
|
||||||
|
|
||||||
SpaceLimitSettings(String namespace, long sizeLimit, SpaceViolationPolicy violationPolicy) {
|
SpaceLimitSettings(String namespace, long sizeLimit, SpaceViolationPolicy violationPolicy) {
|
||||||
|
@ -49,7 +57,15 @@ class SpaceLimitSettings extends QuotaSettings {
|
||||||
if (0L > sizeLimit) {
|
if (0L > sizeLimit) {
|
||||||
throw new IllegalArgumentException("Size limit must be a non-negative value.");
|
throw new IllegalArgumentException("Size limit must be a non-negative value.");
|
||||||
}
|
}
|
||||||
proto = buildProtoQuota(sizeLimit, Objects.requireNonNull(violationPolicy));
|
proto = buildProtoAddQuota(sizeLimit, Objects.requireNonNull(violationPolicy));
|
||||||
|
}
|
||||||
|
|
||||||
|
SpaceLimitSettings(String namespace, boolean remove) {
|
||||||
|
super(null, null, Objects.requireNonNull(namespace));
|
||||||
|
if (!remove) {
|
||||||
|
throw new IllegalArgumentException("A value of 'false' for removing a quota makes no sense");
|
||||||
|
}
|
||||||
|
proto = buildProtoRemoveQuota();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -59,7 +75,8 @@ class SpaceLimitSettings extends QuotaSettings {
|
||||||
* @param violationPolicy The action to take when the quota is exceeded.
|
* @param violationPolicy The action to take when the quota is exceeded.
|
||||||
* @return The protobuf SpaceQuota representation.
|
* @return The protobuf SpaceQuota representation.
|
||||||
*/
|
*/
|
||||||
private SpaceLimitRequest buildProtoQuota(long sizeLimit, SpaceViolationPolicy violationPolicy) {
|
private SpaceLimitRequest buildProtoAddQuota(
|
||||||
|
long sizeLimit, SpaceViolationPolicy violationPolicy) {
|
||||||
return SpaceLimitRequest.newBuilder().setQuota(
|
return SpaceLimitRequest.newBuilder().setQuota(
|
||||||
SpaceQuota.newBuilder()
|
SpaceQuota.newBuilder()
|
||||||
.setSoftLimit(sizeLimit)
|
.setSoftLimit(sizeLimit)
|
||||||
|
@ -68,6 +85,19 @@ class SpaceLimitSettings extends QuotaSettings {
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Builds a {@link SpaceQuota} protobuf object to remove a quota.
|
||||||
|
*
|
||||||
|
* @return The protobuf SpaceQuota representation.
|
||||||
|
*/
|
||||||
|
private SpaceLimitRequest buildProtoRemoveQuota() {
|
||||||
|
return SpaceLimitRequest.newBuilder().setQuota(
|
||||||
|
SpaceQuota.newBuilder()
|
||||||
|
.setRemove(true)
|
||||||
|
.build())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns a copy of the internal state of <code>this</code>
|
* Returns a copy of the internal state of <code>this</code>
|
||||||
*/
|
*/
|
||||||
|
@ -159,8 +189,12 @@ class SpaceLimitSettings extends QuotaSettings {
|
||||||
if (null != getNamespace()) {
|
if (null != getNamespace()) {
|
||||||
sb.append(", NAMESPACE => ").append(getNamespace());
|
sb.append(", NAMESPACE => ").append(getNamespace());
|
||||||
}
|
}
|
||||||
sb.append(", LIMIT => ").append(proto.getQuota().getSoftLimit());
|
if (proto.getQuota().getRemove()) {
|
||||||
sb.append(", VIOLATION_POLICY => ").append(proto.getQuota().getViolationPolicy());
|
sb.append(", REMOVE => ").append(proto.getQuota().getRemove());
|
||||||
|
} else {
|
||||||
|
sb.append(", LIMIT => ").append(proto.getQuota().getSoftLimit());
|
||||||
|
sb.append(", VIOLATION_POLICY => ").append(proto.getQuota().getViolationPolicy());
|
||||||
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,5 +144,25 @@ public class TestQuotaSettingsFactory {
|
||||||
SpaceQuota quota = protoRequest.getQuota();
|
SpaceQuota quota = protoRequest.getQuota();
|
||||||
assertEquals(sizeLimit, quota.getSoftLimit());
|
assertEquals(sizeLimit, quota.getSoftLimit());
|
||||||
assertEquals(violationPolicy, ProtobufUtil.toViolationPolicy(quota.getViolationPolicy()));
|
assertEquals(violationPolicy, ProtobufUtil.toViolationPolicy(quota.getViolationPolicy()));
|
||||||
|
assertFalse("The remove attribute should be false", quota.getRemove());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testSpaceLimitSettingsForDeletes() {
|
||||||
|
final String ns = "ns1";
|
||||||
|
final TableName tn = TableName.valueOf("tn1");
|
||||||
|
QuotaSettings nsSettings = QuotaSettingsFactory.removeNamespaceSpaceLimit(ns);
|
||||||
|
assertNotNull("QuotaSettings should not be null", nsSettings);
|
||||||
|
assertTrue("Should be an instance of SpaceLimitSettings", nsSettings instanceof SpaceLimitSettings);
|
||||||
|
SpaceLimitRequest nsProto = ((SpaceLimitSettings) nsSettings).getProto();
|
||||||
|
assertTrue("Request should have a SpaceQuota", nsProto.hasQuota());
|
||||||
|
assertTrue("The remove attribute should be true", nsProto.getQuota().getRemove());
|
||||||
|
|
||||||
|
QuotaSettings tableSettings = QuotaSettingsFactory.removeTableSpaceLimit(tn);
|
||||||
|
assertNotNull("QuotaSettings should not be null", tableSettings);
|
||||||
|
assertTrue("Should be an instance of SpaceLimitSettings", tableSettings instanceof SpaceLimitSettings);
|
||||||
|
SpaceLimitRequest tableProto = ((SpaceLimitSettings) tableSettings).getProto();
|
||||||
|
assertTrue("Request should have a SpaceQuota", tableProto.hasQuota());
|
||||||
|
assertTrue("The remove attribute should be true", tableProto.getQuota().getRemove());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4833,6 +4833,23 @@ public final class QuotaProtos {
|
||||||
* <code>optional .hbase.pb.SpaceViolationPolicy violation_policy = 2;</code>
|
* <code>optional .hbase.pb.SpaceViolationPolicy violation_policy = 2;</code>
|
||||||
*/
|
*/
|
||||||
org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceViolationPolicy getViolationPolicy();
|
org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceViolationPolicy getViolationPolicy();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* When true, remove the quota.
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* <code>optional bool remove = 3 [default = false];</code>
|
||||||
|
*/
|
||||||
|
boolean hasRemove();
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* When true, remove the quota.
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* <code>optional bool remove = 3 [default = false];</code>
|
||||||
|
*/
|
||||||
|
boolean getRemove();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* <pre>
|
* <pre>
|
||||||
|
@ -4852,6 +4869,7 @@ public final class QuotaProtos {
|
||||||
private SpaceQuota() {
|
private SpaceQuota() {
|
||||||
softLimit_ = 0L;
|
softLimit_ = 0L;
|
||||||
violationPolicy_ = 1;
|
violationPolicy_ = 1;
|
||||||
|
remove_ = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@java.lang.Override
|
@java.lang.Override
|
||||||
|
@ -4898,6 +4916,11 @@ public final class QuotaProtos {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 24: {
|
||||||
|
bitField0_ |= 0x00000004;
|
||||||
|
remove_ = input.readBool();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (org.apache.hadoop.hbase.shaded.com.google.protobuf.InvalidProtocolBufferException e) {
|
} catch (org.apache.hadoop.hbase.shaded.com.google.protobuf.InvalidProtocolBufferException e) {
|
||||||
|
@ -4970,6 +4993,29 @@ public final class QuotaProtos {
|
||||||
return result == null ? org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceViolationPolicy.DISABLE : result;
|
return result == null ? org.apache.hadoop.hbase.shaded.protobuf.generated.QuotaProtos.SpaceViolationPolicy.DISABLE : result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final int REMOVE_FIELD_NUMBER = 3;
|
||||||
|
private boolean remove_;
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* When true, remove the quota.
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* <code>optional bool remove = 3 [default = false];</code>
|
||||||
|
*/
|
||||||
|
public boolean hasRemove() {
|
||||||
|
return ((bitField0_ & 0x00000004) == 0x00000004);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* When true, remove the quota.
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* <code>optional bool remove = 3 [default = false];</code>
|
||||||
|
*/
|
||||||
|
public boolean getRemove() {
|
||||||
|
return remove_;
|
||||||
|
}
|
||||||
|
|
||||||
private byte memoizedIsInitialized = -1;
|
private byte memoizedIsInitialized = -1;
|
||||||
public final boolean isInitialized() {
|
public final boolean isInitialized() {
|
||||||
byte isInitialized = memoizedIsInitialized;
|
byte isInitialized = memoizedIsInitialized;
|
||||||
|
@ -4988,6 +5034,9 @@ public final class QuotaProtos {
|
||||||
if (((bitField0_ & 0x00000002) == 0x00000002)) {
|
if (((bitField0_ & 0x00000002) == 0x00000002)) {
|
||||||
output.writeEnum(2, violationPolicy_);
|
output.writeEnum(2, violationPolicy_);
|
||||||
}
|
}
|
||||||
|
if (((bitField0_ & 0x00000004) == 0x00000004)) {
|
||||||
|
output.writeBool(3, remove_);
|
||||||
|
}
|
||||||
unknownFields.writeTo(output);
|
unknownFields.writeTo(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5004,6 +5053,10 @@ public final class QuotaProtos {
|
||||||
size += org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedOutputStream
|
size += org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedOutputStream
|
||||||
.computeEnumSize(2, violationPolicy_);
|
.computeEnumSize(2, violationPolicy_);
|
||||||
}
|
}
|
||||||
|
if (((bitField0_ & 0x00000004) == 0x00000004)) {
|
||||||
|
size += org.apache.hadoop.hbase.shaded.com.google.protobuf.CodedOutputStream
|
||||||
|
.computeBoolSize(3, remove_);
|
||||||
|
}
|
||||||
size += unknownFields.getSerializedSize();
|
size += unknownFields.getSerializedSize();
|
||||||
memoizedSize = size;
|
memoizedSize = size;
|
||||||
return size;
|
return size;
|
||||||
|
@ -5030,6 +5083,11 @@ public final class QuotaProtos {
|
||||||
if (hasViolationPolicy()) {
|
if (hasViolationPolicy()) {
|
||||||
result = result && violationPolicy_ == other.violationPolicy_;
|
result = result && violationPolicy_ == other.violationPolicy_;
|
||||||
}
|
}
|
||||||
|
result = result && (hasRemove() == other.hasRemove());
|
||||||
|
if (hasRemove()) {
|
||||||
|
result = result && (getRemove()
|
||||||
|
== other.getRemove());
|
||||||
|
}
|
||||||
result = result && unknownFields.equals(other.unknownFields);
|
result = result && unknownFields.equals(other.unknownFields);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -5050,6 +5108,11 @@ public final class QuotaProtos {
|
||||||
hash = (37 * hash) + VIOLATION_POLICY_FIELD_NUMBER;
|
hash = (37 * hash) + VIOLATION_POLICY_FIELD_NUMBER;
|
||||||
hash = (53 * hash) + violationPolicy_;
|
hash = (53 * hash) + violationPolicy_;
|
||||||
}
|
}
|
||||||
|
if (hasRemove()) {
|
||||||
|
hash = (37 * hash) + REMOVE_FIELD_NUMBER;
|
||||||
|
hash = (53 * hash) + org.apache.hadoop.hbase.shaded.com.google.protobuf.Internal.hashBoolean(
|
||||||
|
getRemove());
|
||||||
|
}
|
||||||
hash = (29 * hash) + unknownFields.hashCode();
|
hash = (29 * hash) + unknownFields.hashCode();
|
||||||
memoizedHashCode = hash;
|
memoizedHashCode = hash;
|
||||||
return hash;
|
return hash;
|
||||||
|
@ -5176,6 +5239,8 @@ public final class QuotaProtos {
|
||||||
bitField0_ = (bitField0_ & ~0x00000001);
|
bitField0_ = (bitField0_ & ~0x00000001);
|
||||||
violationPolicy_ = 1;
|
violationPolicy_ = 1;
|
||||||
bitField0_ = (bitField0_ & ~0x00000002);
|
bitField0_ = (bitField0_ & ~0x00000002);
|
||||||
|
remove_ = false;
|
||||||
|
bitField0_ = (bitField0_ & ~0x00000004);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5208,6 +5273,10 @@ public final class QuotaProtos {
|
||||||
to_bitField0_ |= 0x00000002;
|
to_bitField0_ |= 0x00000002;
|
||||||
}
|
}
|
||||||
result.violationPolicy_ = violationPolicy_;
|
result.violationPolicy_ = violationPolicy_;
|
||||||
|
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
|
||||||
|
to_bitField0_ |= 0x00000004;
|
||||||
|
}
|
||||||
|
result.remove_ = remove_;
|
||||||
result.bitField0_ = to_bitField0_;
|
result.bitField0_ = to_bitField0_;
|
||||||
onBuilt();
|
onBuilt();
|
||||||
return result;
|
return result;
|
||||||
|
@ -5256,6 +5325,9 @@ public final class QuotaProtos {
|
||||||
if (other.hasViolationPolicy()) {
|
if (other.hasViolationPolicy()) {
|
||||||
setViolationPolicy(other.getViolationPolicy());
|
setViolationPolicy(other.getViolationPolicy());
|
||||||
}
|
}
|
||||||
|
if (other.hasRemove()) {
|
||||||
|
setRemove(other.getRemove());
|
||||||
|
}
|
||||||
this.mergeUnknownFields(other.unknownFields);
|
this.mergeUnknownFields(other.unknownFields);
|
||||||
onChanged();
|
onChanged();
|
||||||
return this;
|
return this;
|
||||||
|
@ -5383,6 +5455,54 @@ public final class QuotaProtos {
|
||||||
onChanged();
|
onChanged();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean remove_ ;
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* When true, remove the quota.
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* <code>optional bool remove = 3 [default = false];</code>
|
||||||
|
*/
|
||||||
|
public boolean hasRemove() {
|
||||||
|
return ((bitField0_ & 0x00000004) == 0x00000004);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* When true, remove the quota.
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* <code>optional bool remove = 3 [default = false];</code>
|
||||||
|
*/
|
||||||
|
public boolean getRemove() {
|
||||||
|
return remove_;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* When true, remove the quota.
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* <code>optional bool remove = 3 [default = false];</code>
|
||||||
|
*/
|
||||||
|
public Builder setRemove(boolean value) {
|
||||||
|
bitField0_ |= 0x00000004;
|
||||||
|
remove_ = value;
|
||||||
|
onChanged();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* <pre>
|
||||||
|
* When true, remove the quota.
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* <code>optional bool remove = 3 [default = false];</code>
|
||||||
|
*/
|
||||||
|
public Builder clearRemove() {
|
||||||
|
bitField0_ = (bitField0_ & ~0x00000004);
|
||||||
|
remove_ = false;
|
||||||
|
onChanged();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
public final Builder setUnknownFields(
|
public final Builder setUnknownFields(
|
||||||
final org.apache.hadoop.hbase.shaded.com.google.protobuf.UnknownFieldSet unknownFields) {
|
final org.apache.hadoop.hbase.shaded.com.google.protobuf.UnknownFieldSet unknownFields) {
|
||||||
return super.setUnknownFields(unknownFields);
|
return super.setUnknownFields(unknownFields);
|
||||||
|
@ -7426,24 +7546,25 @@ public final class QuotaProtos {
|
||||||
"edQuota\"r\n\006Quotas\022\035\n\016bypass_globals\030\001 \001(" +
|
"edQuota\"r\n\006Quotas\022\035\n\016bypass_globals\030\001 \001(" +
|
||||||
"\010:\005false\022$\n\010throttle\030\002 \001(\0132\022.hbase.pb.Th" +
|
"\010:\005false\022$\n\010throttle\030\002 \001(\0132\022.hbase.pb.Th" +
|
||||||
"rottle\022#\n\005space\030\003 \001(\0132\024.hbase.pb.SpaceQu" +
|
"rottle\022#\n\005space\030\003 \001(\0132\024.hbase.pb.SpaceQu" +
|
||||||
"ota\"\014\n\nQuotaUsage\"Z\n\nSpaceQuota\022\022\n\nsoft_" +
|
"ota\"\014\n\nQuotaUsage\"q\n\nSpaceQuota\022\022\n\nsoft_" +
|
||||||
"limit\030\001 \001(\004\0228\n\020violation_policy\030\002 \001(\0162\036." +
|
"limit\030\001 \001(\004\0228\n\020violation_policy\030\002 \001(\0162\036." +
|
||||||
"hbase.pb.SpaceViolationPolicy\"8\n\021SpaceLi" +
|
"hbase.pb.SpaceViolationPolicy\022\025\n\006remove\030" +
|
||||||
"mitRequest\022#\n\005quota\030\001 \001(\0132\024.hbase.pb.Spa",
|
"\003 \001(\010:\005false\"8\n\021SpaceLimitRequest\022#\n\005quo",
|
||||||
"ceQuota\"X\n\020SpaceQuotaStatus\022.\n\006policy\030\001 " +
|
"ta\030\001 \001(\0132\024.hbase.pb.SpaceQuota\"X\n\020SpaceQ" +
|
||||||
"\001(\0162\036.hbase.pb.SpaceViolationPolicy\022\024\n\014i" +
|
"uotaStatus\022.\n\006policy\030\001 \001(\0162\036.hbase.pb.Sp" +
|
||||||
"n_violation\030\002 \001(\010\"^\n\022SpaceQuotaSnapshot\022" +
|
"aceViolationPolicy\022\024\n\014in_violation\030\002 \001(\010" +
|
||||||
"*\n\006status\030\001 \001(\0132\032.hbase.pb.SpaceQuotaSta" +
|
"\"^\n\022SpaceQuotaSnapshot\022*\n\006status\030\001 \001(\0132\032" +
|
||||||
"tus\022\r\n\005usage\030\002 \001(\004\022\r\n\005limit\030\003 \001(\004*&\n\nQuo" +
|
".hbase.pb.SpaceQuotaStatus\022\r\n\005usage\030\002 \001(" +
|
||||||
"taScope\022\013\n\007CLUSTER\020\001\022\013\n\007MACHINE\020\002*v\n\014Thr" +
|
"\004\022\r\n\005limit\030\003 \001(\004*&\n\nQuotaScope\022\013\n\007CLUSTE" +
|
||||||
"ottleType\022\022\n\016REQUEST_NUMBER\020\001\022\020\n\014REQUEST" +
|
"R\020\001\022\013\n\007MACHINE\020\002*v\n\014ThrottleType\022\022\n\016REQU" +
|
||||||
"_SIZE\020\002\022\020\n\014WRITE_NUMBER\020\003\022\016\n\nWRITE_SIZE\020" +
|
"EST_NUMBER\020\001\022\020\n\014REQUEST_SIZE\020\002\022\020\n\014WRITE_" +
|
||||||
"\004\022\017\n\013READ_NUMBER\020\005\022\r\n\tREAD_SIZE\020\006*$\n\tQuo" +
|
"NUMBER\020\003\022\016\n\nWRITE_SIZE\020\004\022\017\n\013READ_NUMBER\020" +
|
||||||
"taType\022\014\n\010THROTTLE\020\001\022\t\n\005SPACE\020\002*]\n\024Space",
|
"\005\022\r\n\tREAD_SIZE\020\006*$\n\tQuotaType\022\014\n\010THROTTL",
|
||||||
"ViolationPolicy\022\013\n\007DISABLE\020\001\022\031\n\025NO_WRITE" +
|
"E\020\001\022\t\n\005SPACE\020\002*]\n\024SpaceViolationPolicy\022\013" +
|
||||||
"S_COMPACTIONS\020\002\022\r\n\tNO_WRITES\020\003\022\016\n\nNO_INS" +
|
"\n\007DISABLE\020\001\022\031\n\025NO_WRITES_COMPACTIONS\020\002\022\r" +
|
||||||
"ERTS\020\004BH\n1org.apache.hadoop.hbase.shaded" +
|
"\n\tNO_WRITES\020\003\022\016\n\nNO_INSERTS\020\004BH\n1org.apa" +
|
||||||
".protobuf.generatedB\013QuotaProtosH\001\210\001\001\240\001\001"
|
"che.hadoop.hbase.shaded.protobuf.generat" +
|
||||||
|
"edB\013QuotaProtosH\001\210\001\001\240\001\001"
|
||||||
};
|
};
|
||||||
org.apache.hadoop.hbase.shaded.com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
org.apache.hadoop.hbase.shaded.com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||||
new org.apache.hadoop.hbase.shaded.com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
|
new org.apache.hadoop.hbase.shaded.com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
|
||||||
|
@ -7493,7 +7614,7 @@ public final class QuotaProtos {
|
||||||
internal_static_hbase_pb_SpaceQuota_fieldAccessorTable = new
|
internal_static_hbase_pb_SpaceQuota_fieldAccessorTable = new
|
||||||
org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
|
org.apache.hadoop.hbase.shaded.com.google.protobuf.GeneratedMessageV3.FieldAccessorTable(
|
||||||
internal_static_hbase_pb_SpaceQuota_descriptor,
|
internal_static_hbase_pb_SpaceQuota_descriptor,
|
||||||
new java.lang.String[] { "SoftLimit", "ViolationPolicy", });
|
new java.lang.String[] { "SoftLimit", "ViolationPolicy", "Remove", });
|
||||||
internal_static_hbase_pb_SpaceLimitRequest_descriptor =
|
internal_static_hbase_pb_SpaceLimitRequest_descriptor =
|
||||||
getDescriptor().getMessageTypes().get(6);
|
getDescriptor().getMessageTypes().get(6);
|
||||||
internal_static_hbase_pb_SpaceLimitRequest_fieldAccessorTable = new
|
internal_static_hbase_pb_SpaceLimitRequest_fieldAccessorTable = new
|
||||||
|
|
|
@ -89,6 +89,7 @@ enum SpaceViolationPolicy {
|
||||||
message SpaceQuota {
|
message SpaceQuota {
|
||||||
optional uint64 soft_limit = 1; // The limit of bytes for this quota
|
optional uint64 soft_limit = 1; // The limit of bytes for this quota
|
||||||
optional SpaceViolationPolicy violation_policy = 2; // The action to take when the quota is violated
|
optional SpaceViolationPolicy violation_policy = 2; // The action to take when the quota is violated
|
||||||
|
optional bool remove = 3 [default = false]; // When true, remove the quota.
|
||||||
}
|
}
|
||||||
|
|
||||||
// The Request to limit space usage (to allow for schema evolution not tied to SpaceQuota).
|
// The Request to limit space usage (to allow for schema evolution not tied to SpaceQuota).
|
||||||
|
|
|
@ -4658,6 +4658,24 @@ public final class QuotaProtos {
|
||||||
* </pre>
|
* </pre>
|
||||||
*/
|
*/
|
||||||
org.apache.hadoop.hbase.protobuf.generated.QuotaProtos.SpaceViolationPolicy getViolationPolicy();
|
org.apache.hadoop.hbase.protobuf.generated.QuotaProtos.SpaceViolationPolicy getViolationPolicy();
|
||||||
|
|
||||||
|
// optional bool remove = 3 [default = false];
|
||||||
|
/**
|
||||||
|
* <code>optional bool remove = 3 [default = false];</code>
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* When true, remove the quota.
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
boolean hasRemove();
|
||||||
|
/**
|
||||||
|
* <code>optional bool remove = 3 [default = false];</code>
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* When true, remove the quota.
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
boolean getRemove();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Protobuf type {@code hbase.pb.SpaceQuota}
|
* Protobuf type {@code hbase.pb.SpaceQuota}
|
||||||
|
@ -4730,6 +4748,11 @@ public final class QuotaProtos {
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case 24: {
|
||||||
|
bitField0_ |= 0x00000004;
|
||||||
|
remove_ = input.readBool();
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
|
||||||
|
@ -4818,9 +4841,34 @@ public final class QuotaProtos {
|
||||||
return violationPolicy_;
|
return violationPolicy_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// optional bool remove = 3 [default = false];
|
||||||
|
public static final int REMOVE_FIELD_NUMBER = 3;
|
||||||
|
private boolean remove_;
|
||||||
|
/**
|
||||||
|
* <code>optional bool remove = 3 [default = false];</code>
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* When true, remove the quota.
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
public boolean hasRemove() {
|
||||||
|
return ((bitField0_ & 0x00000004) == 0x00000004);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* <code>optional bool remove = 3 [default = false];</code>
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* When true, remove the quota.
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
public boolean getRemove() {
|
||||||
|
return remove_;
|
||||||
|
}
|
||||||
|
|
||||||
private void initFields() {
|
private void initFields() {
|
||||||
softLimit_ = 0L;
|
softLimit_ = 0L;
|
||||||
violationPolicy_ = org.apache.hadoop.hbase.protobuf.generated.QuotaProtos.SpaceViolationPolicy.DISABLE;
|
violationPolicy_ = org.apache.hadoop.hbase.protobuf.generated.QuotaProtos.SpaceViolationPolicy.DISABLE;
|
||||||
|
remove_ = false;
|
||||||
}
|
}
|
||||||
private byte memoizedIsInitialized = -1;
|
private byte memoizedIsInitialized = -1;
|
||||||
public final boolean isInitialized() {
|
public final boolean isInitialized() {
|
||||||
|
@ -4840,6 +4888,9 @@ public final class QuotaProtos {
|
||||||
if (((bitField0_ & 0x00000002) == 0x00000002)) {
|
if (((bitField0_ & 0x00000002) == 0x00000002)) {
|
||||||
output.writeEnum(2, violationPolicy_.getNumber());
|
output.writeEnum(2, violationPolicy_.getNumber());
|
||||||
}
|
}
|
||||||
|
if (((bitField0_ & 0x00000004) == 0x00000004)) {
|
||||||
|
output.writeBool(3, remove_);
|
||||||
|
}
|
||||||
getUnknownFields().writeTo(output);
|
getUnknownFields().writeTo(output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4857,6 +4908,10 @@ public final class QuotaProtos {
|
||||||
size += com.google.protobuf.CodedOutputStream
|
size += com.google.protobuf.CodedOutputStream
|
||||||
.computeEnumSize(2, violationPolicy_.getNumber());
|
.computeEnumSize(2, violationPolicy_.getNumber());
|
||||||
}
|
}
|
||||||
|
if (((bitField0_ & 0x00000004) == 0x00000004)) {
|
||||||
|
size += com.google.protobuf.CodedOutputStream
|
||||||
|
.computeBoolSize(3, remove_);
|
||||||
|
}
|
||||||
size += getUnknownFields().getSerializedSize();
|
size += getUnknownFields().getSerializedSize();
|
||||||
memoizedSerializedSize = size;
|
memoizedSerializedSize = size;
|
||||||
return size;
|
return size;
|
||||||
|
@ -4890,6 +4945,11 @@ public final class QuotaProtos {
|
||||||
result = result &&
|
result = result &&
|
||||||
(getViolationPolicy() == other.getViolationPolicy());
|
(getViolationPolicy() == other.getViolationPolicy());
|
||||||
}
|
}
|
||||||
|
result = result && (hasRemove() == other.hasRemove());
|
||||||
|
if (hasRemove()) {
|
||||||
|
result = result && (getRemove()
|
||||||
|
== other.getRemove());
|
||||||
|
}
|
||||||
result = result &&
|
result = result &&
|
||||||
getUnknownFields().equals(other.getUnknownFields());
|
getUnknownFields().equals(other.getUnknownFields());
|
||||||
return result;
|
return result;
|
||||||
|
@ -4911,6 +4971,10 @@ public final class QuotaProtos {
|
||||||
hash = (37 * hash) + VIOLATION_POLICY_FIELD_NUMBER;
|
hash = (37 * hash) + VIOLATION_POLICY_FIELD_NUMBER;
|
||||||
hash = (53 * hash) + hashEnum(getViolationPolicy());
|
hash = (53 * hash) + hashEnum(getViolationPolicy());
|
||||||
}
|
}
|
||||||
|
if (hasRemove()) {
|
||||||
|
hash = (37 * hash) + REMOVE_FIELD_NUMBER;
|
||||||
|
hash = (53 * hash) + hashBoolean(getRemove());
|
||||||
|
}
|
||||||
hash = (29 * hash) + getUnknownFields().hashCode();
|
hash = (29 * hash) + getUnknownFields().hashCode();
|
||||||
memoizedHashCode = hash;
|
memoizedHashCode = hash;
|
||||||
return hash;
|
return hash;
|
||||||
|
@ -5028,6 +5092,8 @@ public final class QuotaProtos {
|
||||||
bitField0_ = (bitField0_ & ~0x00000001);
|
bitField0_ = (bitField0_ & ~0x00000001);
|
||||||
violationPolicy_ = org.apache.hadoop.hbase.protobuf.generated.QuotaProtos.SpaceViolationPolicy.DISABLE;
|
violationPolicy_ = org.apache.hadoop.hbase.protobuf.generated.QuotaProtos.SpaceViolationPolicy.DISABLE;
|
||||||
bitField0_ = (bitField0_ & ~0x00000002);
|
bitField0_ = (bitField0_ & ~0x00000002);
|
||||||
|
remove_ = false;
|
||||||
|
bitField0_ = (bitField0_ & ~0x00000004);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5064,6 +5130,10 @@ public final class QuotaProtos {
|
||||||
to_bitField0_ |= 0x00000002;
|
to_bitField0_ |= 0x00000002;
|
||||||
}
|
}
|
||||||
result.violationPolicy_ = violationPolicy_;
|
result.violationPolicy_ = violationPolicy_;
|
||||||
|
if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
|
||||||
|
to_bitField0_ |= 0x00000004;
|
||||||
|
}
|
||||||
|
result.remove_ = remove_;
|
||||||
result.bitField0_ = to_bitField0_;
|
result.bitField0_ = to_bitField0_;
|
||||||
onBuilt();
|
onBuilt();
|
||||||
return result;
|
return result;
|
||||||
|
@ -5086,6 +5156,9 @@ public final class QuotaProtos {
|
||||||
if (other.hasViolationPolicy()) {
|
if (other.hasViolationPolicy()) {
|
||||||
setViolationPolicy(other.getViolationPolicy());
|
setViolationPolicy(other.getViolationPolicy());
|
||||||
}
|
}
|
||||||
|
if (other.hasRemove()) {
|
||||||
|
setRemove(other.getRemove());
|
||||||
|
}
|
||||||
this.mergeUnknownFields(other.getUnknownFields());
|
this.mergeUnknownFields(other.getUnknownFields());
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -5214,6 +5287,55 @@ public final class QuotaProtos {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// optional bool remove = 3 [default = false];
|
||||||
|
private boolean remove_ ;
|
||||||
|
/**
|
||||||
|
* <code>optional bool remove = 3 [default = false];</code>
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* When true, remove the quota.
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
public boolean hasRemove() {
|
||||||
|
return ((bitField0_ & 0x00000004) == 0x00000004);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* <code>optional bool remove = 3 [default = false];</code>
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* When true, remove the quota.
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
public boolean getRemove() {
|
||||||
|
return remove_;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* <code>optional bool remove = 3 [default = false];</code>
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* When true, remove the quota.
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
public Builder setRemove(boolean value) {
|
||||||
|
bitField0_ |= 0x00000004;
|
||||||
|
remove_ = value;
|
||||||
|
onChanged();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* <code>optional bool remove = 3 [default = false];</code>
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* When true, remove the quota.
|
||||||
|
* </pre>
|
||||||
|
*/
|
||||||
|
public Builder clearRemove() {
|
||||||
|
bitField0_ = (bitField0_ & ~0x00000004);
|
||||||
|
remove_ = false;
|
||||||
|
onChanged();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
// @@protoc_insertion_point(builder_scope:hbase.pb.SpaceQuota)
|
// @@protoc_insertion_point(builder_scope:hbase.pb.SpaceQuota)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7126,24 +7248,25 @@ public final class QuotaProtos {
|
||||||
"edQuota\"r\n\006Quotas\022\035\n\016bypass_globals\030\001 \001(" +
|
"edQuota\"r\n\006Quotas\022\035\n\016bypass_globals\030\001 \001(" +
|
||||||
"\010:\005false\022$\n\010throttle\030\002 \001(\0132\022.hbase.pb.Th" +
|
"\010:\005false\022$\n\010throttle\030\002 \001(\0132\022.hbase.pb.Th" +
|
||||||
"rottle\022#\n\005space\030\003 \001(\0132\024.hbase.pb.SpaceQu" +
|
"rottle\022#\n\005space\030\003 \001(\0132\024.hbase.pb.SpaceQu" +
|
||||||
"ota\"\014\n\nQuotaUsage\"Z\n\nSpaceQuota\022\022\n\nsoft_" +
|
"ota\"\014\n\nQuotaUsage\"q\n\nSpaceQuota\022\022\n\nsoft_" +
|
||||||
"limit\030\001 \001(\004\0228\n\020violation_policy\030\002 \001(\0162\036." +
|
"limit\030\001 \001(\004\0228\n\020violation_policy\030\002 \001(\0162\036." +
|
||||||
"hbase.pb.SpaceViolationPolicy\"8\n\021SpaceLi" +
|
"hbase.pb.SpaceViolationPolicy\022\025\n\006remove\030" +
|
||||||
"mitRequest\022#\n\005quota\030\001 \001(\0132\024.hbase.pb.Spa",
|
"\003 \001(\010:\005false\"8\n\021SpaceLimitRequest\022#\n\005quo",
|
||||||
"ceQuota\"X\n\020SpaceQuotaStatus\022.\n\006policy\030\001 " +
|
"ta\030\001 \001(\0132\024.hbase.pb.SpaceQuota\"X\n\020SpaceQ" +
|
||||||
"\001(\0162\036.hbase.pb.SpaceViolationPolicy\022\024\n\014i" +
|
"uotaStatus\022.\n\006policy\030\001 \001(\0162\036.hbase.pb.Sp" +
|
||||||
"n_violation\030\002 \001(\010\"^\n\022SpaceQuotaSnapshot\022" +
|
"aceViolationPolicy\022\024\n\014in_violation\030\002 \001(\010" +
|
||||||
"*\n\006status\030\001 \001(\0132\032.hbase.pb.SpaceQuotaSta" +
|
"\"^\n\022SpaceQuotaSnapshot\022*\n\006status\030\001 \001(\0132\032" +
|
||||||
"tus\022\r\n\005usage\030\002 \001(\004\022\r\n\005limit\030\003 \001(\004*&\n\nQuo" +
|
".hbase.pb.SpaceQuotaStatus\022\r\n\005usage\030\002 \001(" +
|
||||||
"taScope\022\013\n\007CLUSTER\020\001\022\013\n\007MACHINE\020\002*v\n\014Thr" +
|
"\004\022\r\n\005limit\030\003 \001(\004*&\n\nQuotaScope\022\013\n\007CLUSTE" +
|
||||||
"ottleType\022\022\n\016REQUEST_NUMBER\020\001\022\020\n\014REQUEST" +
|
"R\020\001\022\013\n\007MACHINE\020\002*v\n\014ThrottleType\022\022\n\016REQU" +
|
||||||
"_SIZE\020\002\022\020\n\014WRITE_NUMBER\020\003\022\016\n\nWRITE_SIZE\020" +
|
"EST_NUMBER\020\001\022\020\n\014REQUEST_SIZE\020\002\022\020\n\014WRITE_" +
|
||||||
"\004\022\017\n\013READ_NUMBER\020\005\022\r\n\tREAD_SIZE\020\006*$\n\tQuo" +
|
"NUMBER\020\003\022\016\n\nWRITE_SIZE\020\004\022\017\n\013READ_NUMBER\020" +
|
||||||
"taType\022\014\n\010THROTTLE\020\001\022\t\n\005SPACE\020\002*]\n\024Space",
|
"\005\022\r\n\tREAD_SIZE\020\006*$\n\tQuotaType\022\014\n\010THROTTL",
|
||||||
"ViolationPolicy\022\013\n\007DISABLE\020\001\022\031\n\025NO_WRITE" +
|
"E\020\001\022\t\n\005SPACE\020\002*]\n\024SpaceViolationPolicy\022\013" +
|
||||||
"S_COMPACTIONS\020\002\022\r\n\tNO_WRITES\020\003\022\016\n\nNO_INS" +
|
"\n\007DISABLE\020\001\022\031\n\025NO_WRITES_COMPACTIONS\020\002\022\r" +
|
||||||
"ERTS\020\004BA\n*org.apache.hadoop.hbase.protob" +
|
"\n\tNO_WRITES\020\003\022\016\n\nNO_INSERTS\020\004BA\n*org.apa" +
|
||||||
"uf.generatedB\013QuotaProtosH\001\210\001\001\240\001\001"
|
"che.hadoop.hbase.protobuf.generatedB\013Quo" +
|
||||||
|
"taProtosH\001\210\001\001\240\001\001"
|
||||||
};
|
};
|
||||||
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
|
||||||
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
|
||||||
|
@ -7185,7 +7308,7 @@ public final class QuotaProtos {
|
||||||
internal_static_hbase_pb_SpaceQuota_fieldAccessorTable = new
|
internal_static_hbase_pb_SpaceQuota_fieldAccessorTable = new
|
||||||
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
|
||||||
internal_static_hbase_pb_SpaceQuota_descriptor,
|
internal_static_hbase_pb_SpaceQuota_descriptor,
|
||||||
new java.lang.String[] { "SoftLimit", "ViolationPolicy", });
|
new java.lang.String[] { "SoftLimit", "ViolationPolicy", "Remove", });
|
||||||
internal_static_hbase_pb_SpaceLimitRequest_descriptor =
|
internal_static_hbase_pb_SpaceLimitRequest_descriptor =
|
||||||
getDescriptor().getMessageTypes().get(6);
|
getDescriptor().getMessageTypes().get(6);
|
||||||
internal_static_hbase_pb_SpaceLimitRequest_fieldAccessorTable = new
|
internal_static_hbase_pb_SpaceLimitRequest_fieldAccessorTable = new
|
||||||
|
|
|
@ -89,6 +89,7 @@ enum SpaceViolationPolicy {
|
||||||
message SpaceQuota {
|
message SpaceQuota {
|
||||||
optional uint64 soft_limit = 1; // The limit of bytes for this quota
|
optional uint64 soft_limit = 1; // The limit of bytes for this quota
|
||||||
optional SpaceViolationPolicy violation_policy = 2; // The action to take when the quota is violated
|
optional SpaceViolationPolicy violation_policy = 2; // The action to take when the quota is violated
|
||||||
|
optional bool remove = 3 [default = false]; // When true, remove the quota.
|
||||||
}
|
}
|
||||||
|
|
||||||
// The Request to limit space usage (to allow for schema evolution not tied to SpaceQuota).
|
// The Request to limit space usage (to allow for schema evolution not tied to SpaceQuota).
|
||||||
|
|
|
@ -454,7 +454,14 @@ public class MasterQuotaManager implements RegionStateListener {
|
||||||
*/
|
*/
|
||||||
void applySpaceLimit(final Quotas.Builder quotas, final SpaceLimitRequest req) {
|
void applySpaceLimit(final Quotas.Builder quotas, final SpaceLimitRequest req) {
|
||||||
if (req.hasQuota()) {
|
if (req.hasQuota()) {
|
||||||
applySpaceQuota(quotas, req.getQuota());
|
SpaceQuota spaceQuota = req.getQuota();
|
||||||
|
// If we have the remove flag, unset the space quota.
|
||||||
|
if (spaceQuota.getRemove()) {
|
||||||
|
quotas.setSpace(SpaceQuota.getDefaultInstance());
|
||||||
|
} else {
|
||||||
|
// Otherwise, update the new quota
|
||||||
|
applySpaceQuota(quotas, req.getQuota());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,6 +47,7 @@ import org.junit.experimental.categories.Category;
|
||||||
import com.google.common.collect.Iterables;
|
import com.google.common.collect.Iterables;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNull;
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
import static org.junit.Assert.fail;
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
|
@ -246,7 +247,7 @@ public class TestQuotaAdmin {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSetAndGetSpaceQuota() throws Exception {
|
public void testSetGetRemoveSpaceQuota() throws Exception {
|
||||||
Admin admin = TEST_UTIL.getAdmin();
|
Admin admin = TEST_UTIL.getAdmin();
|
||||||
final TableName tn = TableName.valueOf("table1");
|
final TableName tn = TableName.valueOf("table1");
|
||||||
final long sizeLimit = 1024L * 1024L * 1024L * 1024L * 5L; // 5TB
|
final long sizeLimit = 1024L * 1024L * 1024L * 1024L * 5L; // 5TB
|
||||||
|
@ -274,10 +275,32 @@ public class TestQuotaAdmin {
|
||||||
} finally {
|
} finally {
|
||||||
scanner.close();
|
scanner.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now, remove the quota
|
||||||
|
QuotaSettings removeQuota = QuotaSettingsFactory.removeTableSpaceLimit(tn);
|
||||||
|
admin.setQuota(removeQuota);
|
||||||
|
|
||||||
|
// Verify that the record doesn't exist in the table
|
||||||
|
try (Table quotaTable = TEST_UTIL.getConnection().getTable(QuotaTableUtil.QUOTA_TABLE_NAME)) {
|
||||||
|
ResultScanner rs = quotaTable.getScanner(new Scan());
|
||||||
|
try {
|
||||||
|
assertNull("Did not expect to find a quota entry", rs.next());
|
||||||
|
} finally {
|
||||||
|
rs.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify that we can also not fetch it via the API
|
||||||
|
scanner = QuotaRetriever.open(admin.getConfiguration());
|
||||||
|
try {
|
||||||
|
assertNull("Did not expect to find a quota entry", scanner.next());
|
||||||
|
} finally {
|
||||||
|
scanner.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSetAndModifyQuota() throws Exception {
|
public void testSetModifyRemoveQuota() throws Exception {
|
||||||
Admin admin = TEST_UTIL.getAdmin();
|
Admin admin = TEST_UTIL.getAdmin();
|
||||||
final TableName tn = TableName.valueOf("table1");
|
final TableName tn = TableName.valueOf("table1");
|
||||||
final long originalSizeLimit = 1024L * 1024L * 1024L * 1024L * 5L; // 5TB
|
final long originalSizeLimit = 1024L * 1024L * 1024L * 1024L * 5L; // 5TB
|
||||||
|
@ -334,6 +357,28 @@ public class TestQuotaAdmin {
|
||||||
} finally {
|
} finally {
|
||||||
quotaScanner.close();
|
quotaScanner.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Now, remove the quota
|
||||||
|
QuotaSettings removeQuota = QuotaSettingsFactory.removeTableSpaceLimit(tn);
|
||||||
|
admin.setQuota(removeQuota);
|
||||||
|
|
||||||
|
// Verify that the record doesn't exist in the table
|
||||||
|
try (Table quotaTable = TEST_UTIL.getConnection().getTable(QuotaTableUtil.QUOTA_TABLE_NAME)) {
|
||||||
|
ResultScanner scanner = quotaTable.getScanner(new Scan());
|
||||||
|
try {
|
||||||
|
assertNull("Did not expect to find a quota entry", scanner.next());
|
||||||
|
} finally {
|
||||||
|
scanner.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Verify that we can also not fetch it via the API
|
||||||
|
quotaScanner = QuotaRetriever.open(admin.getConfiguration());
|
||||||
|
try {
|
||||||
|
assertNull("Did not expect to find a quota entry", quotaScanner.next());
|
||||||
|
} finally {
|
||||||
|
quotaScanner.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertNumResults(int expected, final QuotaFilter filter) throws Exception {
|
private void assertNumResults(int expected, final QuotaFilter filter) throws Exception {
|
||||||
|
|
Loading…
Reference in New Issue