This is an automated email from the ASF dual-hosted git repository.
jojochuang 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 2b89cbb50ae HDDS-15199. Fix StartQuotaRepair client ignoring bucket
list (#10208)
2b89cbb50ae is described below
commit 2b89cbb50aee5019b37682c435780dbe14cb3655
Author: Jason O'Sullivan <[email protected]>
AuthorDate: Thu May 14 19:25:13 2026 +0100
HDDS-15199. Fix StartQuotaRepair client ignoring bucket list (#10208)
---
...OzoneManagerProtocolClientSideTranslatorPB.java | 2 +
...OzoneManagerProtocolClientSideTranslatorPB.java | 102 +++++++++++++++++++++
2 files changed, 104 insertions(+)
diff --git
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java
index 2131eaaf906..9ca5ff63f8b 100644
---
a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java
+++
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java
@@ -2676,8 +2676,10 @@ public String getQuotaRepairStatus() throws IOException {
@Override
public void startQuotaRepair(List<String> buckets) throws IOException {
+ Objects.requireNonNull(buckets, "buckets == null");
OzoneManagerProtocolProtos.StartQuotaRepairRequest startQuotaRepairRequest
=
OzoneManagerProtocolProtos.StartQuotaRepairRequest.newBuilder()
+ .addAllBuckets(buckets)
.build();
OMRequest omRequest = createOMRequest(Type.StartQuotaRepair)
.setStartQuotaRepairRequest(startQuotaRepairRequest).build();
diff --git
a/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/TestOzoneManagerProtocolClientSideTranslatorPB.java
b/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/TestOzoneManagerProtocolClientSideTranslatorPB.java
new file mode 100644
index 00000000000..e08d1e35df7
--- /dev/null
+++
b/hadoop-ozone/common/src/test/java/org/apache/hadoop/ozone/om/protocolPB/TestOzoneManagerProtocolClientSideTranslatorPB.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.hadoop.ozone.om.protocolPB;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.verifyNoInteractions;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMRequest;
+import
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.OMResponse;
+import
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.StartQuotaRepairRequest;
+import
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.StartQuotaRepairResponse;
+import
org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Status;
+import org.apache.hadoop.ozone.protocol.proto.OzoneManagerProtocolProtos.Type;
+import org.junit.jupiter.api.Test;
+import org.mockito.ArgumentCaptor;
+
+class TestOzoneManagerProtocolClientSideTranslatorPB {
+
+ private final OmTransport omTransport = mock(OmTransport.class);
+ private final OzoneManagerProtocolClientSideTranslatorPB pb = new
OzoneManagerProtocolClientSideTranslatorPB(
+ omTransport, "test-client-id");
+
+ @Test
+ void testStartQuotaRepair() throws IOException {
+ StartQuotaRepairResponse response =
StartQuotaRepairResponse.newBuilder().build();
+ when(omTransport.submitRequest(any(OMRequest.class))).thenReturn(
+ OMResponse.newBuilder()
+ .setCmdType(Type.StartQuotaRepair)
+ .setStatus(Status.OK)
+ .setStartQuotaRepairResponse(response)
+ .build());
+
+ ArgumentCaptor<OMRequest> captor =
ArgumentCaptor.forClass(OMRequest.class);
+
+ pb.startQuotaRepair(Collections.emptyList());
+
+ verify(omTransport).submitRequest(captor.capture());
+
+ OMRequest request = captor.getValue();
+ assertThat(request.getCmdType()).isEqualTo(Type.StartQuotaRepair);
+
+ StartQuotaRepairRequest startQuotaRepairRequest =
request.getStartQuotaRepairRequest();
+ assertThat(startQuotaRepairRequest.getBucketsList()).isEmpty();
+ }
+
+ @Test
+ void testStartQuotaRepairWithSpecifiedBuckets() throws IOException {
+ StartQuotaRepairResponse response =
StartQuotaRepairResponse.newBuilder().build();
+ when(omTransport.submitRequest(any(OMRequest.class))).thenReturn(
+ OMResponse.newBuilder()
+ .setCmdType(Type.StartQuotaRepair)
+ .setStatus(Status.OK)
+ .setStartQuotaRepairResponse(response)
+ .build());
+
+ ArgumentCaptor<OMRequest> captor =
ArgumentCaptor.forClass(OMRequest.class);
+
+ List<String> buckets = Collections.singletonList("Bucket1");
+
+ pb.startQuotaRepair(buckets);
+
+ verify(omTransport).submitRequest(captor.capture());
+
+ OMRequest request = captor.getValue();
+ assertThat(request.getCmdType()).isEqualTo(Type.StartQuotaRepair);
+
+ StartQuotaRepairRequest startQuotaRepairRequest =
request.getStartQuotaRepairRequest();
+ assertThat(startQuotaRepairRequest.getBucketsList()).isEqualTo(buckets);
+ }
+
+ @Test
+ void testStartQuotaRepairWithNullBuckets() {
+ assertThatThrownBy(() -> pb.startQuotaRepair(null))
+ .isInstanceOf(NullPointerException.class)
+ .hasMessageContaining("buckets == null");
+ verifyNoInteractions(omTransport);
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]