This is an automated email from the ASF dual-hosted git repository.

adoroszlai 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 c6ab3a7274 HDDS-11062. Minor code cleanup in XceiverServerRatis (#6857)
c6ab3a7274 is described below

commit c6ab3a7274a3e6b86ce8009b19895fcaf673e651
Author: jianghuazhu <740087...@qq.com>
AuthorDate: Wed Jun 26 00:33:52 2024 +0800

    HDDS-11062. Minor code cleanup in XceiverServerRatis (#6857)
---
 .../transport/server/ratis/XceiverServerRatis.java | 26 +++++-----------------
 1 file changed, 5 insertions(+), 21 deletions(-)

diff --git 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/XceiverServerRatis.java
 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/XceiverServerRatis.java
index 75f0482a6c..e1df809c8a 100644
--- 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/XceiverServerRatis.java
+++ 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/XceiverServerRatis.java
@@ -184,7 +184,7 @@ public final class XceiverServerRatis implements 
XceiverServerSpi {
       StateContext context, ConfigurationSource conf, Parameters parameters)
       throws IOException {
     this.conf = conf;
-    Objects.requireNonNull(dd, "id == null");
+    Objects.requireNonNull(dd, "DatanodeDetails == null");
     datanodeDetails = dd;
     ratisServerConfig = conf.getObject(DatanodeRatisServerConfig.class);
     assignPorts();
@@ -372,12 +372,11 @@ public final class XceiverServerRatis implements 
XceiverServerSpi {
   }
 
   private void setRatisLeaderElectionTimeout(RaftProperties properties) {
-    long duration;
     TimeUnit leaderElectionMinTimeoutUnit =
         OzoneConfigKeys.
             HDDS_RATIS_LEADER_ELECTION_MINIMUM_TIMEOUT_DURATION_DEFAULT
             .getUnit();
-    duration = conf.getTimeDuration(
+    long duration = conf.getTimeDuration(
         
OzoneConfigKeys.HDDS_RATIS_LEADER_ELECTION_MINIMUM_TIMEOUT_DURATION_KEY,
         OzoneConfigKeys.
             HDDS_RATIS_LEADER_ELECTION_MINIMUM_TIMEOUT_DURATION_DEFAULT
@@ -393,12 +392,10 @@ public final class XceiverServerRatis implements 
XceiverServerSpi {
   }
 
   private void setTimeoutForRetryCache(RaftProperties properties) {
-    TimeUnit timeUnit;
-    long duration;
-    timeUnit =
+    TimeUnit timeUnit =
         OzoneConfigKeys.HDDS_RATIS_SERVER_RETRY_CACHE_TIMEOUT_DURATION_DEFAULT
             .getUnit();
-    duration = conf.getTimeDuration(
+    long duration = conf.getTimeDuration(
         OzoneConfigKeys.HDDS_RATIS_SERVER_RETRY_CACHE_TIMEOUT_DURATION_KEY,
         OzoneConfigKeys.HDDS_RATIS_SERVER_RETRY_CACHE_TIMEOUT_DURATION_DEFAULT
             .getDuration(), timeUnit);
@@ -515,7 +512,6 @@ public final class XceiverServerRatis implements 
XceiverServerSpi {
   }
 
   private void setPendingRequestsLimits(RaftProperties properties) {
-
     long pendingRequestsBytesLimit = (long) conf.getStorageSize(
         OzoneConfigKeys.HDDS_CONTAINER_RATIS_LEADER_PENDING_BYTES_LIMIT,
         
OzoneConfigKeys.HDDS_CONTAINER_RATIS_LEADER_PENDING_BYTES_LIMIT_DEFAULT,
@@ -819,17 +815,6 @@ public final class XceiverServerRatis implements 
XceiverServerSpi {
     }
   }
 
-  @VisibleForTesting
-  public List<PipelineID> getPipelineIds() {
-    Iterable<RaftGroupId> gids = server.getGroupIds();
-    List<PipelineID> pipelineIDs = new ArrayList<>();
-    for (RaftGroupId groupId : gids) {
-      pipelineIDs.add(PipelineID.valueOf(groupId.getUuid()));
-      LOG.info("pipeline id {}", PipelineID.valueOf(groupId.getUuid()));
-    }
-    return pipelineIDs;
-  }
-
   @Override
   public void addGroup(HddsProtos.PipelineID pipelineId,
       List<DatanodeDetails> peers) throws IOException {
@@ -939,10 +924,9 @@ public final class XceiverServerRatis implements 
XceiverServerSpi {
   }
 
   public long getMinReplicatedIndex(PipelineID pipelineID) throws IOException {
-    Long minIndex;
     GroupInfoReply reply = getServer()
         .getGroupInfo(createGroupInfoRequest(pipelineID.getProtobuf()));
-    minIndex = RatisHelper.getMinReplicatedIndex(reply.getCommitInfos());
+    Long minIndex = RatisHelper.getMinReplicatedIndex(reply.getCommitInfos());
     return minIndex == null ? -1 : minIndex;
   }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@ozone.apache.org
For additional commands, e-mail: commits-h...@ozone.apache.org

Reply via email to