adoroszlai commented on code in PR #3615:
URL: https://github.com/apache/ozone/pull/3615#discussion_r934376198
##########
hadoop-hdds/common/src/main/java/org/apache/hadoop/ozone/audit/SCMAction.java:
##########
@@ -49,7 +49,8 @@ public enum SCMAction implements AuditAction {
GET_CONTAINER_BALANCER_STATUS,
GET_CONTAINER_WITH_PIPELINE_BATCH,
ADD_SCM,
- GET_REPLICATION_MANAGER_REPORT;
+ GET_REPLICATION_MANAGER_REPORT,
+ RENEW_DELETED_BLOCK_RETRY_COUNT;
Review Comment:
Nit: `RENEW` -> `RESET`
##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/admin/scm/ResetDeletedBlockRetryCountSubcommand.java:
##########
@@ -0,0 +1,73 @@
+/*
+ * 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
+ * <p/>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p/>
+ * 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.admin.scm;
+
+import org.apache.hadoop.hdds.cli.HddsVersionProvider;
+import org.apache.hadoop.hdds.scm.cli.ScmSubcommand;
+import org.apache.hadoop.hdds.scm.client.ScmClient;
+import picocli.CommandLine;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * Handler of the expired deleted blocks from SCM side.
+ */
[email protected](
+ name = "resetDeletedBlockRetryCount",
+ description = "Reset deleted block transactions whose retry count is -1",
+ mixinStandardHelpOptions = true,
+ versionProvider = HddsVersionProvider.class)
+public class ResetDeletedBlockRetryCountSubcommand extends ScmSubcommand {
+
+ @CommandLine.ArgGroup(multiplicity = "1")
+ private ExclusiveGroup group;
+
+ static class ExclusiveGroup {
Review Comment:
Nit: I think `class TransactionsOption` would be a more descriptive name.
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java:
##########
@@ -783,6 +783,27 @@ public ScmInfo getScmInfo() throws IOException {
}
}
+ @Override
+ public int resetDeletedBlockRetryCount(List<Long> txIDs) throws IOException {
+ Map<String, String> auditMap = Maps.newHashMap();
+ getScm().checkAdminAccess(getRemoteUser());
+ try {
+ int count = scm.getScmBlockManager().getDeletedBlockLog().
+ resetCount(txIDs);
+ scm.getScmHAManager().asSCMHADBTransactionBuffer().flush();
+
+ auditMap.put("txIDs", txIDs.stream().map(String::valueOf).
+ collect(Collectors.joining(",")));
Review Comment:
What about simply `txIDs.toString()`?
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/replication/LegacyReplicationManager.java:
##########
@@ -1221,12 +1221,24 @@ private void handleUnderReplicatedContainer(final
ContainerInfo container,
id, misRepDelta);
}
} else {
+ replicas.stream().filter(rp -> rp.getState().equals(State.UNHEALTHY))
+ .forEach(rp -> {
+ sendDeleteCommand(container, rp.getDatanodeDetails(), true);
+ LOG.info("Send deleteCmd to force delete the unhealthy " +
+ "replica {}", rp);
+ });
+ container.setNumberOfKeys(0);
+ container.setUsedBytes(0);
+ containerManager.updateContainerState(container.containerID(),
+ HddsProtos.LifeCycleEvent.DELETE);
LOG.warn("Cannot replicate container {}, no healthy replica found.",
container.containerID());
}
} catch (IOException | IllegalStateException ex) {
LOG.warn("Exception while replicating container {}.",
container.getContainerID(), ex);
+ } catch (InvalidStateTransitionException | TimeoutException e) {
+ e.printStackTrace();
Review Comment:
This "force delete" part looks a bit fishy, and was added in a commit with
message `temp cleanup unhealthy container`. Is this intended to be part of the
final change?
--
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]