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 a7857ebcc4e HDDS-17810. Cleanup XceiverServerSpi (#12056)
a7857ebcc4e is described below

commit a7857ebcc4e546cdd55d121972be752d275d6b0d
Author: Tsz-Wo Nicholas Sze <[email protected]>
AuthorDate: Mon Nov 16 03:29:17 2026 -0800

    HDDS-17810. Cleanup XceiverServerSpi (#12056)
---
 .../org/apache/hadoop/hdds/ratis/RatisHelper.java  | 11 +--
 .../hadoop/hdds/scm/pipeline/PipelineID.java       |  8 ++
 .../common/impl/BlockDeletingService.java          |  4 +-
 .../CloseContainerCommandHandler.java              | 10 +--
 .../ClosePipelineCommandHandler.java               | 13 ++--
 .../CreatePipelineCommandHandler.java              | 11 +--
 .../server/XceiverServerDomainSocket.java          | 17 +----
 .../common/transport/server/XceiverServerGrpc.java | 19 +----
 .../common/transport/server/XceiverServerSpi.java  | 30 +-------
 .../transport/server/ratis/XceiverServerRatis.java | 88 ++++++----------------
 .../protocol/commands/CreatePipelineCommand.java   | 40 ++++------
 .../TestCloseContainerCommandHandler.java          |  6 +-
 .../TestClosePipelineCommandHandler.java           | 16 ++--
 .../TestCreatePipelineCommandHandler.java          | 12 +--
 .../hdds/scm/pipeline/RatisPipelineProvider.java   |  8 +-
 .../hadoop/hdds/scm/node/TestCommandQueue.java     |  2 +-
 .../hadoop/hdds/scm/node/TestSCMNodeManager.java   |  2 +-
 .../hadoop/ozone/container/OzoneTestHelper.java    |  7 +-
 18 files changed, 97 insertions(+), 207 deletions(-)

diff --git 
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/ratis/RatisHelper.java
 
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/ratis/RatisHelper.java
index 4a30248f4a7..eb858a74dbe 100644
--- 
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/ratis/RatisHelper.java
+++ 
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/ratis/RatisHelper.java
@@ -201,8 +201,7 @@ public static RaftGroup newRaftGroup(RaftGroupId groupId,
   }
 
   public static RaftGroup newRaftGroup(Pipeline pipeline) {
-    return RaftGroup.valueOf(RaftGroupId.valueOf(pipeline.getId().getId()),
-        toRaftPeers(pipeline));
+    return RaftGroup.valueOf(pipeline.getId().getGroupId(), 
toRaftPeers(pipeline));
   }
 
   /**
@@ -222,7 +221,7 @@ public static RaftClient newRaftClient(RpcType rpcType, 
Pipeline pipeline,
     return newRaftClient(rpcType,
         toRaftPeerId(pipeline.getLeaderNode()),
         toRaftPeer(pipeline.getClosestNode()),
-        newRaftGroup(RaftGroupId.valueOf(pipeline.getId().getId()),
+        newRaftGroup(pipeline.getId().getGroupId(),
             pipeline.getNodes()), retryPolicy, tlsConfig, ozoneConfiguration);
   }
 
@@ -437,12 +436,6 @@ public static RetryPolicy 
createRetryPolicy(ConfigurationSource conf) {
     }
   }
 
-  public static Long getMinReplicatedIndex(
-      Collection<RaftProtos.CommitInfoProto> commitInfos) {
-    return commitInfos.stream().map(RaftProtos.CommitInfoProto::getCommitIndex)
-        .min(Long::compareTo).orElse(null);
-  }
-
   private static boolean datanodeUseHostName() {
     return CONF.getBoolean(
             HddsConfigKeys.HDDS_DATANODE_USE_DN_HOSTNAME,
diff --git 
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineID.java
 
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineID.java
index bb2aa7cc626..3fb1a7e5568 100644
--- 
a/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineID.java
+++ 
b/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineID.java
@@ -26,6 +26,7 @@
 import org.apache.hadoop.hdds.utils.db.DelegatedCodec;
 import org.apache.hadoop.hdds.utils.db.UuidCodec;
 import org.apache.hadoop.ozone.util.UUIDUtil;
+import org.apache.ratis.protocol.RaftGroupId;
 import org.apache.ratis.util.MemoizedSupplier;
 
 /**
@@ -40,6 +41,7 @@ public final class PipelineID {
 
   private final UUID id;
   private final Supplier<HddsProtos.PipelineID> protoSupplier;
+  private final Supplier<RaftGroupId> groupIdSupplier;
 
   public static Codec<PipelineID> getCodec() {
     return CODEC;
@@ -48,6 +50,7 @@ public static Codec<PipelineID> getCodec() {
   private PipelineID(UUID id) {
     this.id = id;
     this.protoSupplier = MemoizedSupplier.valueOf(() -> buildProtobuf(id));
+    this.groupIdSupplier = MemoizedSupplier.valueOf(() -> 
RaftGroupId.valueOf(id));
   }
 
   public static PipelineID randomId() {
@@ -79,6 +82,11 @@ public UUID getId() {
     return id;
   }
 
+  @JsonIgnore
+  public RaftGroupId getGroupId() {
+    return groupIdSupplier.get();
+  }
+
   @JsonIgnore
   public HddsProtos.PipelineID getProtobuf() {
     return protoSupplier.get();
diff --git 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/BlockDeletingService.java
 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/BlockDeletingService.java
index c2191a18ccd..6be12762fe6 100644
--- 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/BlockDeletingService.java
+++ 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/impl/BlockDeletingService.java
@@ -270,7 +270,7 @@ private boolean isDeletionAllowed(ContainerData 
containerData,
           return false;
         }
         // in case the ratis group does not exist, just mark it for deletion.
-        if (!ratisServer.isExist(pipelineID.getProtobuf())) {
+        if (!ratisServer.isExist(pipelineID)) {
           return true;
         }
         try {
@@ -290,7 +290,7 @@ private boolean isDeletionAllowed(ContainerData 
containerData,
         } catch (IOException ioe) {
           // in case of any exception check again whether the pipeline exist
           // and in case the pipeline got destroyed, just mark it for deletion
-          if (!ratisServer.isExist(pipelineID.getProtobuf())) {
+          if (!ratisServer.isExist(pipelineID)) {
             return true;
           } else {
             LOG.info("Skipping deletes for container {} due to exception: {}",
diff --git 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/CloseContainerCommandHandler.java
 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/CloseContainerCommandHandler.java
index 364cbd9d193..9330bf84b90 100644
--- 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/CloseContainerCommandHandler.java
+++ 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/CloseContainerCommandHandler.java
@@ -30,6 +30,7 @@
 import 
org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerCommandRequestProto;
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.CloseContainerCommandProto;
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.SCMCommandProto;
+import org.apache.hadoop.hdds.scm.pipeline.PipelineID;
 import org.apache.hadoop.hdds.tracing.TracingUtil;
 import org.apache.hadoop.metrics2.lib.MetricsRegistry;
 import org.apache.hadoop.metrics2.lib.MutableRate;
@@ -114,16 +115,15 @@ public void handle(SCMCommand<?> command, OzoneContainer 
ozoneContainer,
         switch (container.getContainerState()) {
         case OPEN:
         case CLOSING:
-          // If the container is part of open pipeline, close it via
-          // write channel
-          if (ozoneContainer.getWriteChannel()
-              .isExist(closeCommand.getPipelineID())) {
+          final PipelineID pipelineID = ((CloseContainerCommand) 
command).getPipelineID();
+          // If the container is part of open pipeline, close it via write 
channel
+          if (ozoneContainer.getWriteChannel().isExist(pipelineID)) {
             ContainerCommandRequestProto request =
                 getContainerCommandRequestProto(datanodeDetails,
                     closeCommand.getContainerID(),
                     command.getEncodedToken());
             ozoneContainer.getWriteChannel()
-                .submitRequest(request, closeCommand.getPipelineID());
+                .submitRequest(request, pipelineID);
           } else if (closeCommand.getForce()) {
             // Non-RATIS containers should have the force close flag set, so
             // they are moved to CLOSED immediately rather than going to
diff --git 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/ClosePipelineCommandHandler.java
 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/ClosePipelineCommandHandler.java
index a279d4c4c31..c6b79ef5f4e 100644
--- 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/ClosePipelineCommandHandler.java
+++ 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/ClosePipelineCommandHandler.java
@@ -30,7 +30,6 @@
 import java.util.function.BiFunction;
 import org.apache.hadoop.hdds.conf.ConfigurationSource;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
-import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.SCMCommandProto;
 import org.apache.hadoop.hdds.ratis.RatisHelper;
 import org.apache.hadoop.hdds.scm.client.HddsClientUtils;
@@ -127,19 +126,18 @@ public void handle(SCMCommand<?> command, OzoneContainer 
ozoneContainer,
         invocationCount.incrementAndGet();
         final long startTime = Time.monotonicNow();
         final DatanodeDetails dn = context.getParent().getDatanodeDetails();
-        final HddsProtos.PipelineID pipelineIdProto = pipelineID.getProtobuf();
 
         try {
           XceiverServerSpi server = ozoneContainer.getWriteChannel();
-          if (server.isExist(pipelineIdProto)) {
+          if (server.isExist(pipelineID)) {
             if (server instanceof XceiverServerRatis) {
               // TODO: Refactor Ratis logic to XceiverServerRatis
               // Propagate the group remove to the other Raft peers in the 
pipeline
               XceiverServerRatis ratisServer = (XceiverServerRatis) server;
-              final RaftGroupId raftGroupId = 
RaftGroupId.valueOf(pipelineID.getId());
+              final RaftGroupId raftGroupId = pipelineID.getGroupId();
               final boolean shouldDeleteRatisLogDirectory = 
ratisServer.getShouldDeleteRatisLogDirectory();
               // This might throw GroupMismatchException if the Ratis group 
has been closed by other datanodes
-              final Collection<RaftPeer> peers = 
ratisServer.getRaftPeersInPipeline(pipelineID);
+              final Collection<RaftPeer> peers = 
ratisServer.getRaftPeers(raftGroupId);
               // Try to send remove group for the other datanodes first, 
ignoring GroupMismatchException
               // if the Ratis group has been closed in the other datanodes
               peers.stream()
@@ -159,10 +157,9 @@ public void handle(SCMCommand<?> command, OzoneContainer 
ozoneContainer,
                           raftGroupId, pipelineID, peer, ioe);
                     }
                   });
+              // Remove group locally, might throw GroupMismatchException as 
well.
+              ratisServer.removeGroup(raftGroupId);
             }
-            // Remove the Ratis group from the current datanode pipeline, 
might throw GroupMismatchException as
-            // well. It is a no-op for XceiverServerSpi implementations (e.g. 
XceiverServerGrpc)
-            server.removeGroup(pipelineIdProto);
             LOG.info("Close Pipeline {} command on datanode {}.", pipelineID, 
dn);
           } else {
             LOG.debug("Ignoring close pipeline command for pipeline {} on 
datanode {} " +
diff --git 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/CreatePipelineCommandHandler.java
 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/CreatePipelineCommandHandler.java
index 19f7b7c1633..3e30f599032 100644
--- 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/CreatePipelineCommandHandler.java
+++ 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/CreatePipelineCommandHandler.java
@@ -30,7 +30,6 @@
 import java.util.function.BiFunction;
 import org.apache.hadoop.hdds.conf.ConfigurationSource;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
-import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.SCMCommandProto;
 import org.apache.hadoop.hdds.ratis.RatisHelper;
 import org.apache.hadoop.hdds.scm.pipeline.PipelineID;
@@ -46,7 +45,6 @@
 import org.apache.ratis.client.RaftClient;
 import org.apache.ratis.grpc.GrpcTlsConfig;
 import org.apache.ratis.protocol.RaftGroup;
-import org.apache.ratis.protocol.RaftGroupId;
 import org.apache.ratis.protocol.RaftPeer;
 import org.apache.ratis.protocol.exceptions.AlreadyExistsException;
 import org.slf4j.Logger;
@@ -115,17 +113,14 @@ public void handle(SCMCommand<?> command, OzoneContainer 
ozoneContainer,
         invocationCount.incrementAndGet();
         final long startTime = Time.monotonicNow();
         final DatanodeDetails dn = context.getParent().getDatanodeDetails();
-        final HddsProtos.PipelineID pipelineIdProto = pipelineID.getProtobuf();
         final List<DatanodeDetails> peers = createCommand.getNodeList();
         final List<Integer> priorityList = createCommand.getPriorityList();
 
         try {
           XceiverServerSpi server = ozoneContainer.getWriteChannel();
-          if (!server.isExist(pipelineIdProto)) {
-            final RaftGroupId groupId = 
RaftGroupId.valueOf(pipelineID.getId());
-            final RaftGroup group =
-                RatisHelper.newRaftGroup(groupId, peers, priorityList);
-            server.addGroup(pipelineIdProto, peers, priorityList);
+          if (!server.isExist(pipelineID)) {
+            final RaftGroup group = 
RatisHelper.newRaftGroup(pipelineID.getGroupId(), peers, priorityList);
+            server.addGroup(pipelineID, peers, priorityList);
             peers.stream().filter(d -> !d.getID().equals(dn.getID()))
                 .forEach(d -> {
                   final RaftPeer peer = RatisHelper.toRaftPeer(d);
diff --git 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/XceiverServerDomainSocket.java
 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/XceiverServerDomainSocket.java
index c1826d38d2c..f99bab42a82 100644
--- 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/XceiverServerDomainSocket.java
+++ 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/XceiverServerDomainSocket.java
@@ -32,9 +32,9 @@
 import org.apache.hadoop.hdds.conf.ConfigurationSource;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
 import 
org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerCommandRequestProto;
-import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.PipelineReport;
 import org.apache.hadoop.hdds.scm.OzoneClientConfig;
+import org.apache.hadoop.hdds.scm.pipeline.PipelineID;
 import org.apache.hadoop.hdds.scm.storage.DomainPeer;
 import org.apache.hadoop.hdds.scm.storage.DomainSocketFactory;
 import org.apache.hadoop.hdds.utils.FaultInjector;
@@ -129,16 +129,6 @@ public int getIPCPort() {
     return this.port;
   }
 
-  /**
-   * Returns the Replication type supported by this end-point.
-   *
-   * @return enum STAND_ALONE
-   */
-  @Override
-  public HddsProtos.ReplicationType getServerType() {
-    return HddsProtos.ReplicationType.STAND_ALONE;
-  }
-
   @Override
   public void start() throws IOException {
     if (isRunning.compareAndSet(false, true)) {
@@ -187,13 +177,12 @@ public boolean isStarted() {
   }
 
   @Override
-  public void submitRequest(ContainerCommandRequestProto request,
-      HddsProtos.PipelineID pipelineID) throws IOException {
+  public void submitRequest(ContainerCommandRequestProto request, PipelineID 
pipelineID) throws IOException {
     throw new UnsupportedOperationException("Operation is not supported for " 
+ this.getClass().getSimpleName());
   }
 
   @Override
-  public boolean isExist(HddsProtos.PipelineID pipelineId) {
+  public boolean isExist(PipelineID pipelineId) {
     throw new UnsupportedOperationException("Operation is not supported for " 
+ this.getClass().getSimpleName());
   }
 
diff --git 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/XceiverServerGrpc.java
 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/XceiverServerGrpc.java
index 93078adf2bd..9d19a921c94 100644
--- 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/XceiverServerGrpc.java
+++ 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/XceiverServerGrpc.java
@@ -36,9 +36,9 @@
 import org.apache.hadoop.hdds.protocol.DatanodeID;
 import org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos;
 import 
org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerCommandRequestProto;
-import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.PipelineReport;
 import 
org.apache.hadoop.hdds.scm.container.common.helpers.StorageContainerException;
+import org.apache.hadoop.hdds.scm.pipeline.PipelineID;
 import org.apache.hadoop.hdds.security.SecurityConfig;
 import 
org.apache.hadoop.hdds.security.x509.certificate.client.CertificateClient;
 import org.apache.hadoop.hdds.tracing.GrpcServerInterceptor;
@@ -192,16 +192,6 @@ public int getIPCPort() {
     return this.port;
   }
 
-  /**
-   * Returns the Replication type supported by this end-point.
-   *
-   * @return enum -- {Stand_Alone, Ratis, Grpc, Chained}
-   */
-  @Override
-  public HddsProtos.ReplicationType getServerType() {
-    return HddsProtos.ReplicationType.STAND_ALONE;
-  }
-
   @Override
   public void start() throws IOException {
     if (!isStarted) {
@@ -252,8 +242,7 @@ public boolean isStarted() {
   }
 
   @Override
-  public void submitRequest(ContainerCommandRequestProto request,
-      HddsProtos.PipelineID pipelineID) throws IOException {
+  public void submitRequest(ContainerCommandRequestProto request, PipelineID 
pipelineID) throws IOException {
     Span span = TracingUtil
         .importAndCreateSpan(
             "XceiverServerGrpc." + request.getCmdType().name(),
@@ -272,8 +261,8 @@ public void submitRequest(ContainerCommandRequestProto 
request,
   }
 
   @Override
-  public boolean isExist(HddsProtos.PipelineID pipelineId) {
-    return id.toPipelineID().getProtobuf().equals(pipelineId);
+  public boolean isExist(PipelineID pipelineId) {
+    return id.toPipelineID().equals(pipelineId);
   }
 
   @Override
diff --git 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/XceiverServerSpi.java
 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/XceiverServerSpi.java
index ef85f981e21..84d1cfb148e 100644
--- 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/XceiverServerSpi.java
+++ 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/XceiverServerSpi.java
@@ -21,9 +21,9 @@
 import java.util.List;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
 import 
org.apache.hadoop.hdds.protocol.datanode.proto.ContainerProtos.ContainerCommandRequestProto;
-import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.MetadataStorageReportProto;
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.PipelineReport;
+import org.apache.hadoop.hdds.scm.pipeline.PipelineID;
 
 /** A server endpoint that acts as the communication layer for Ozone 
containers. */
 public interface XceiverServerSpi {
@@ -36,49 +36,27 @@ public interface XceiverServerSpi {
   /** Get server IPC port. */
   int getIPCPort();
 
-  /**
-   * Returns the Replication type supported by this end-point.
-   * @return enum -- {Stand_Alone, Ratis, Chained}
-   */
-  HddsProtos.ReplicationType getServerType();
-
   /**
    * submits a containerRequest to be performed by the replication pipeline.
    * @param request ContainerCommandRequest
    */
-  void submitRequest(ContainerCommandRequestProto request,
-      HddsProtos.PipelineID pipelineID)
-      throws IOException;
+  void submitRequest(ContainerCommandRequestProto request, PipelineID 
pipelineID) throws IOException;
 
   /**
    * Returns true if the given pipeline exist.
    *
    * @return true if pipeline present, else false
    */
-  boolean isExist(HddsProtos.PipelineID pipelineId);
-
-  /**
-   * Join a new pipeline.
-   */
-  default void addGroup(HddsProtos.PipelineID pipelineId,
-      List<DatanodeDetails> peers) throws IOException {
-  }
+  boolean isExist(PipelineID pipelineId);
 
   /**
    * Join a new pipeline with priority.
    */
-  default void addGroup(HddsProtos.PipelineID pipelineId,
+  default void addGroup(PipelineID pipelineId,
       List<DatanodeDetails> peers,
       List<Integer> priorityList) throws IOException {
   }
 
-  /**
-   * Exit a pipeline.
-   */
-  default void removeGroup(HddsProtos.PipelineID pipelineId)
-      throws IOException {
-  }
-
   /**
    * Get pipeline report for the XceiverServer instance.
    * @return list of report for each pipeline.
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 01aa3ba0ec5..114affc314b 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
@@ -38,7 +38,6 @@
 import java.net.InetSocketAddress;
 import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
 import java.util.List;
 import java.util.Objects;
 import java.util.UUID;
@@ -85,8 +84,10 @@
 import org.apache.ratis.grpc.GrpcConfigKeys;
 import org.apache.ratis.grpc.GrpcTlsConfig;
 import org.apache.ratis.netty.NettyConfigKeys;
-import org.apache.ratis.proto.RaftProtos;
+import org.apache.ratis.proto.RaftProtos.CommitInfoProto;
+import org.apache.ratis.proto.RaftProtos.RaftPeerRole;
 import org.apache.ratis.proto.RaftProtos.RoleInfoProto;
+import org.apache.ratis.proto.RaftProtos.ServerRpcProto;
 import org.apache.ratis.protocol.ClientId;
 import org.apache.ratis.protocol.GroupInfoReply;
 import org.apache.ratis.protocol.GroupInfoRequest;
@@ -123,8 +124,6 @@ public final class XceiverServerRatis implements 
XceiverServerSpi {
   private static final Logger LOG = 
LoggerFactory.getLogger(XceiverServerRatis.class);
 
   private static final AtomicLong CALL_ID_COUNTER = new AtomicLong();
-  private static final List<Integer> DEFAULT_PRIORITY_LIST =
-      new 
ArrayList<>(Collections.nCopies(HddsProtos.ReplicationFactor.THREE_VALUE, 0));
 
   private int serverPort;
   private int adminPort;
@@ -616,16 +615,6 @@ public int getIPCPort() {
     return clientPort;
   }
 
-  /**
-   * Returns the Replication type supported by this end-point.
-   *
-   * @return enum -- {Stand_Alone, Ratis, Chained}
-   */
-  @Override
-  public HddsProtos.ReplicationType getServerType() {
-    return HddsProtos.ReplicationType.RATIS;
-  }
-
   @VisibleForTesting
   public RaftServer getServer() {
     return server;
@@ -661,8 +650,7 @@ private void processReply(RaftClientReply reply) throws 
IOException {
   }
 
   @Override
-  public void submitRequest(ContainerCommandRequestProto request,
-      HddsProtos.PipelineID pipelineID) throws IOException {
+  public void submitRequest(ContainerCommandRequestProto request, PipelineID 
pipelineID) throws IOException {
     Span span = TracingUtil
         .importAndCreateSpan(
             "XceiverServerRatis." + request.getCmdType().name(),
@@ -689,27 +677,18 @@ public void submitRequest(ContainerCommandRequestProto 
request,
   }
 
   private RaftClientRequest createRaftClientRequest(
-      ContainerCommandRequestProto request, HddsProtos.PipelineID pipelineID,
+      ContainerCommandRequestProto request, PipelineID pipelineID,
       RaftClientRequest.Type type) {
     return RaftClientRequest.newBuilder()
         .setClientId(clientId)
         .setServerId(server.getId())
-        .setGroupId(
-            RaftGroupId.valueOf(
-                PipelineID.getFromProtobuf(pipelineID).getId()))
+        .setGroupId(pipelineID.getGroupId())
         .setCallId(nextCallId())
         .setMessage(ContainerCommandRequestMessage.toMessage(request, null))
         .setType(type)
         .build();
   }
 
-  private GroupInfoRequest createGroupInfoRequest(
-      HddsProtos.PipelineID pipelineID) {
-    return new GroupInfoRequest(clientId, server.getId(),
-        RaftGroupId.valueOf(PipelineID.getFromProtobuf(pipelineID).getId()),
-        nextCallId());
-  }
-
   private void handlePipelineFailure(RaftGroupId groupId, RoleInfoProto 
roleInfoProto, String reason) {
     final RaftPeerId raftPeerId = 
RaftPeerId.valueOf(roleInfoProto.getSelf().getId());
     Preconditions.assertEquals(getServer().getId(), raftPeerId, "raftPeerId");
@@ -729,7 +708,7 @@ private void handlePipelineFailure(RaftGroupId groupId, 
RoleInfoProto roleInfoPr
       break;
     case LEADER:
       final long followerSlownessTimeoutMs = 
ratisServerConfig.getFollowerSlownessTimeout();
-      for (RaftProtos.ServerRpcProto follower : 
roleInfoProto.getLeaderInfo().getFollowerInfoList()) {
+      for (ServerRpcProto follower : 
roleInfoProto.getLeaderInfo().getFollowerInfoList()) {
         final long lastRpcElapsedTimeMs = follower.getLastRpcElapsedTimeMs();
         final boolean slow = lastRpcElapsedTimeMs > followerSlownessTimeoutMs;
         final RaftPeerId followerId = 
RaftPeerId.valueOf(follower.getId().getId());
@@ -786,9 +765,8 @@ public void triggerPipelineClose(RaftGroupId groupId, 
String detail,
   }
 
   @Override
-  public boolean isExist(HddsProtos.PipelineID pipelineId) {
-    return activePipelines.containsKey(
-        RaftGroupId.valueOf(PipelineID.getFromProtobuf(pipelineId).getId()));
+  public boolean isExist(PipelineID pipelineId) {
+    return activePipelines.containsKey(pipelineId.getGroupId());
   }
 
   @Override
@@ -813,24 +791,10 @@ public List<PipelineReport> getPipelineReport() {
   }
 
   @Override
-  public void addGroup(HddsProtos.PipelineID pipelineId,
-      List<DatanodeDetails> peers) throws IOException {
-    if (peers.size() == getDefaultPriorityList().size()) {
-      addGroup(pipelineId, peers, getDefaultPriorityList());
-    } else {
-      addGroup(pipelineId, peers,
-          new ArrayList<>(Collections.nCopies(peers.size(), 0)));
-    }
-  }
-
-  @Override
-  public void addGroup(HddsProtos.PipelineID pipelineId,
+  public void addGroup(PipelineID pipelineID,
       List<DatanodeDetails> peers,
       List<Integer> priorityList) throws IOException {
-    final PipelineID pipelineID = PipelineID.getFromProtobuf(pipelineId);
-    final RaftGroupId groupId = RaftGroupId.valueOf(pipelineID.getId());
-    final RaftGroup group =
-        RatisHelper.newRaftGroup(groupId, peers, priorityList);
+    final RaftGroup group = RatisHelper.newRaftGroup(pipelineID.getGroupId(), 
peers, priorityList);
     GroupManagementRequest request = GroupManagementRequest.newAdd(
         clientId, server.getId(), nextCallId(), group);
 
@@ -846,15 +810,12 @@ public void addGroup(HddsProtos.PipelineID pipelineId,
     LOG.info("Created group {}", pipelineID);
   }
 
-  @Override
-  public void removeGroup(HddsProtos.PipelineID pipelineId)
-      throws IOException {
+  public void removeGroup(RaftGroupId groupId) throws IOException {
     // if shouldDeleteRatisLogDirectory is set to false, the raft log
     // directory will be renamed and kept aside for debugging.
     // In case, its set to true, the raft log directory will be removed
     GroupManagementRequest request = GroupManagementRequest.newRemove(
-        clientId, server.getId(), nextCallId(),
-        RaftGroupId.valueOf(PipelineID.getFromProtobuf(pipelineId).getId()),
+        clientId, server.getId(), nextCallId(), groupId,
         shouldDeleteRatisLogDirectory, !shouldDeleteRatisLogDirectory);
 
     RaftClientReply reply;
@@ -874,8 +835,7 @@ void handleNoLeader(RaftGroupId groupId, RoleInfoProto 
roleInfoProto) {
     handlePipelineFailure(groupId, roleInfoProto, "no leader");
   }
 
-  void handleApplyTransactionFailure(RaftGroupId groupId,
-      RaftProtos.RaftPeerRole role) {
+  void handleApplyTransactionFailure(RaftGroupId groupId, RaftPeerRole role) {
     UUID dnId = RatisHelper.toDatanodeId(getServer().getId());
     String msg =
         "Ratis Transaction failure in datanode " + dnId + " with role " + role
@@ -921,14 +881,15 @@ public void handleNodeLogFailure(RaftGroupId groupId, 
Throwable t) {
   }
 
   public long getMinReplicatedIndex(PipelineID pipelineID) throws IOException {
-    GroupInfoReply reply = getServer()
-        .getGroupInfo(createGroupInfoRequest(pipelineID.getProtobuf()));
-    Long minIndex = RatisHelper.getMinReplicatedIndex(reply.getCommitInfos());
-    return minIndex == null ? -1 : minIndex;
+    final GroupInfoReply reply = getServer().getGroupInfo(
+        new GroupInfoRequest(clientId, server.getId(), 
pipelineID.getGroupId(), nextCallId()));
+    return reply.getCommitInfos().stream()
+        .map(CommitInfoProto::getCommitIndex)
+        .min(Long::compareTo)
+        .orElse(-1L);
   }
 
-  public Collection<RaftPeer> getRaftPeersInPipeline(PipelineID pipelineId) 
throws IOException {
-    final RaftGroupId groupId = RaftGroupId.valueOf(pipelineId.getId());
+  public Collection<RaftPeer> getRaftPeers(RaftGroupId groupId) throws 
IOException {
     return server.getDivision(groupId).getGroup().getPeers();
   }
 
@@ -991,11 +952,4 @@ private static List<ThreadPoolExecutor> 
createChunkExecutors(
     }
     return ImmutableList.copyOf(executors);
   }
-
-  /**
-   * @return list of default priority
-   */
-  public static List<Integer> getDefaultPriorityList() {
-    return DEFAULT_PRIORITY_LIST;
-  }
 }
diff --git 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/protocol/commands/CreatePipelineCommand.java
 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/protocol/commands/CreatePipelineCommand.java
index 1c434756202..9ca311cfb13 100644
--- 
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/protocol/commands/CreatePipelineCommand.java
+++ 
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/protocol/commands/CreatePipelineCommand.java
@@ -28,7 +28,6 @@
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.CreatePipelineCommandProto;
 import 
org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.SCMCommandProto;
 import org.apache.hadoop.hdds.scm.pipeline.PipelineID;
-import 
org.apache.hadoop.ozone.container.common.transport.server.ratis.XceiverServerRatis;
 
 /**
  * Asks datanode to create a pipeline.
@@ -38,6 +37,8 @@ public class CreatePipelineCommand
 
   private static final Integer HIGH_PRIORITY = 1;
   private static final Integer LOW_PRIORITY = 0;
+  private static final List<Integer> DEFAULT_PRIORITY_LIST
+      = Collections.nCopies(ReplicationFactor.THREE_VALUE, LOW_PRIORITY);
 
   private final PipelineID pipelineID;
   private final ReplicationFactor factor;
@@ -45,23 +46,6 @@ public class CreatePipelineCommand
   private final List<DatanodeDetails> nodelist;
   private final List<Integer> priorityList;
 
-  public CreatePipelineCommand(final PipelineID pipelineID,
-      final ReplicationType type, final ReplicationFactor factor,
-      final List<DatanodeDetails> datanodeList) {
-    super();
-    this.pipelineID = pipelineID;
-    this.factor = factor;
-    this.type = type;
-    this.nodelist = datanodeList;
-    if (datanodeList.size() ==
-        XceiverServerRatis.getDefaultPriorityList().size()) {
-      this.priorityList = XceiverServerRatis.getDefaultPriorityList();
-    } else {
-      this.priorityList =
-          new ArrayList<>(Collections.nCopies(datanodeList.size(), 0));
-    }
-  }
-
   public CreatePipelineCommand(final PipelineID pipelineID,
       final ReplicationType type, final ReplicationFactor factor,
       final List<DatanodeDetails> datanodeList,
@@ -71,19 +55,27 @@ public CreatePipelineCommand(final PipelineID pipelineID,
     this.factor = factor;
     this.type = type;
     this.nodelist = datanodeList;
-    this.priorityList = new ArrayList<>();
-    initPriorityList(datanodeList, suggestedLeader);
+    this.priorityList = newPriorityList(datanodeList, suggestedLeader);
   }
 
-  private void initPriorityList(
-      List<DatanodeDetails> dns, DatanodeDetails suggestedLeader) {
+  static List<Integer> newPriorityList(List<DatanodeDetails> dns, 
DatanodeDetails suggestedLeader) {
+    if (suggestedLeader == null) {
+      if (dns.size() == DEFAULT_PRIORITY_LIST.size()) {
+        return DEFAULT_PRIORITY_LIST;
+      } else {
+        return Collections.nCopies(dns.size(), LOW_PRIORITY);
+      }
+    }
+
+    final List<Integer> priorities = new ArrayList<>();
     for (DatanodeDetails dn : dns) {
       if (dn.equals(suggestedLeader)) {
-        priorityList.add(HIGH_PRIORITY);
+        priorities.add(HIGH_PRIORITY);
       } else {
-        priorityList.add(LOW_PRIORITY);
+        priorities.add(LOW_PRIORITY);
       }
     }
+    return Collections.unmodifiableList(priorities);
   }
 
   public CreatePipelineCommand(long cmdId, final PipelineID pipelineID,
diff --git 
a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestCloseContainerCommandHandler.java
 
b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestCloseContainerCommandHandler.java
index 0f26cf40c97..f7e6414fe4b 100644
--- 
a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestCloseContainerCommandHandler.java
+++ 
b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestCloseContainerCommandHandler.java
@@ -104,8 +104,8 @@ private void init() throws Exception {
     when(ozoneContainer.getController()).thenReturn(controller);
     when(ozoneContainer.getContainerSet()).thenReturn(containerSet);
     when(ozoneContainer.getWriteChannel()).thenReturn(writeChannel);
-    when(writeChannel.isExist(pipelineID.getProtobuf())).thenReturn(true);
-    when(writeChannel.isExist(nonExistentPipelineID.getProtobuf()))
+    when(writeChannel.isExist(pipelineID)).thenReturn(true);
+    when(writeChannel.isExist(nonExistentPipelineID))
         .thenReturn(false);
   }
 
@@ -119,7 +119,7 @@ public void 
closeContainerWithPipeline(ContainerLayoutVersion layout)
     verify(containerHandler)
         .markContainerForClose(container);
     verify(writeChannel)
-        .submitRequest(any(), eq(pipelineID.getProtobuf()));
+        .submitRequest(any(), eq(pipelineID));
     verify(containerHandler, never())
         .quasiCloseContainer(eq(container), any());
   }
diff --git 
a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestClosePipelineCommandHandler.java
 
b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestClosePipelineCommandHandler.java
index 70744efbbed..52a5ec965e2 100644
--- 
a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestClosePipelineCommandHandler.java
+++ 
b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestClosePipelineCommandHandler.java
@@ -97,20 +97,20 @@ void testPipelineClose() throws IOException {
     XceiverServerRatis writeChannel = mock(XceiverServerRatis.class);
     when(ozoneContainer.getWriteChannel()).thenReturn(writeChannel);
     
when(writeChannel.getShouldDeleteRatisLogDirectory()).thenReturn(shouldDeleteRatisLogDirectory);
-    when(writeChannel.isExist(pipelineID.getProtobuf())).thenReturn(true);
+    when(writeChannel.isExist(pipelineID)).thenReturn(true);
     Collection<RaftPeer> raftPeers = datanodes.stream()
         .map(RatisHelper::toRaftPeer)
         .collect(Collectors.toList());
     when(writeChannel.getServer()).thenReturn(mock(RaftServer.class));
     
when(writeChannel.getServer().getId()).thenReturn(RatisHelper.toRaftPeerId(currentDatanode));
-    
when(writeChannel.getRaftPeersInPipeline(pipelineID)).thenReturn(raftPeers);
+    
when(writeChannel.getRaftPeers(pipelineID.getGroupId())).thenReturn(raftPeers);
 
     final ClosePipelineCommandHandler commandHandler =
         new ClosePipelineCommandHandler((leader, tls) -> raftClient, 
MoreExecutors.directExecutor());
     commandHandler.handle(command, ozoneContainer, stateContext, 
connectionManager);
 
     verify(writeChannel, times(1))
-        .removeGroup(pipelineID.getProtobuf());
+        .removeGroup(pipelineID.getGroupId());
 
     verify(raftClientGroupManager, times(2))
         .remove(any(), eq(shouldDeleteRatisLogDirectory), 
eq(!shouldDeleteRatisLogDirectory));
@@ -128,14 +128,14 @@ void testCommandIdempotency() throws IOException {
     XceiverServerRatis writeChannel = mock(XceiverServerRatis.class);
     when(ozoneContainer.getWriteChannel()).thenReturn(writeChannel);
     // When the pipeline has been closed earlier by other datanode that 
received a close pipeline command
-    when(writeChannel.isExist(pipelineID.getProtobuf())).thenReturn(false);
+    when(writeChannel.isExist(pipelineID)).thenReturn(false);
 
     final ClosePipelineCommandHandler commandHandler =
         new ClosePipelineCommandHandler(conf, MoreExecutors.directExecutor());
     commandHandler.handle(command, ozoneContainer, stateContext, 
connectionManager);
 
     verify(writeChannel, times(0))
-        .removeGroup(pipelineID.getProtobuf());
+        .removeGroup(pipelineID.getGroupId());
 
     verify(raftClientGroupManager, times(0))
         .remove(any(), anyBoolean(), anyBoolean());
@@ -155,13 +155,13 @@ void testPendingPipelineClose() throws IOException, 
InterruptedException {
     XceiverServerRatis writeChannel = mock(XceiverServerRatis.class);
     when(ozoneContainer.getWriteChannel()).thenReturn(writeChannel);
     
when(writeChannel.getShouldDeleteRatisLogDirectory()).thenReturn(shouldDeleteRatisLogDirectory);
-    when(writeChannel.isExist(pipelineID.getProtobuf())).thenReturn(true);
+    when(writeChannel.isExist(pipelineID)).thenReturn(true);
     Collection<RaftPeer> raftPeers = datanodes.stream()
         .map(RatisHelper::toRaftPeer)
         .collect(Collectors.toList());
     when(writeChannel.getServer()).thenReturn(mock(RaftServer.class));
     
when(writeChannel.getServer().getId()).thenReturn(RatisHelper.toRaftPeerId(currentDatanode));
-    
when(writeChannel.getRaftPeersInPipeline(pipelineID)).thenReturn(raftPeers);
+    
when(writeChannel.getRaftPeers(pipelineID.getGroupId())).thenReturn(raftPeers);
 
     CountDownLatch firstCommandStarted = new CountDownLatch(1);
     CountDownLatch secondCommandSubmitted = new CountDownLatch(1);
@@ -170,7 +170,7 @@ void testPendingPipelineClose() throws IOException, 
InterruptedException {
       firstCommandStarted.countDown();
       secondCommandSubmitted.await();
       return null;
-    }).when(writeChannel).removeGroup(pipelineID.getProtobuf());
+    }).when(writeChannel).removeGroup(pipelineID.getGroupId());
 
     ExecutorService singleThreadExecutor = Executors.newSingleThreadExecutor();
 
diff --git 
a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestCreatePipelineCommandHandler.java
 
b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestCreatePipelineCommandHandler.java
index 1b5e67b9d8b..ae0147657f6 100644
--- 
a/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestCreatePipelineCommandHandler.java
+++ 
b/hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestCreatePipelineCommandHandler.java
@@ -84,12 +84,12 @@ public void testPipelineCreation() throws IOException {
     final PipelineID pipelineID = PipelineID.randomId();
     final SCMCommand<CreatePipelineCommandProto> command =
         new CreatePipelineCommand(pipelineID, HddsProtos.ReplicationType.RATIS,
-            HddsProtos.ReplicationFactor.THREE, datanodes);
+            HddsProtos.ReplicationFactor.THREE, datanodes, null);
     StateContext stateContext = 
ContainerTestUtils.getMockContext(datanodes.get(0), conf);
 
     final XceiverServerSpi writeChanel = mock(XceiverServerSpi.class);
     when(ozoneContainer.getWriteChannel()).thenReturn(writeChanel);
-    when(writeChanel.isExist(pipelineID.getProtobuf()))
+    when(writeChanel.isExist(pipelineID))
         .thenReturn(false);
 
     final CreatePipelineCommandHandler commandHandler =
@@ -102,7 +102,7 @@ public void testPipelineCreation() throws IOException {
         new ArrayList<>(Collections.nCopies(datanodes.size(), 0));
 
     verify(writeChanel, times(1))
-        .addGroup(pipelineID.getProtobuf(), datanodes, priorityList);
+        .addGroup(pipelineID, datanodes, priorityList);
 
     verify(raftClientGroupManager, times(2))
         .add(any(RaftGroup.class));
@@ -114,12 +114,12 @@ public void testCommandIdempotency() throws IOException {
     final PipelineID pipelineID = PipelineID.randomId();
     final SCMCommand<CreatePipelineCommandProto> command =
         new CreatePipelineCommand(pipelineID, HddsProtos.ReplicationType.RATIS,
-            HddsProtos.ReplicationFactor.THREE, datanodes);
+            HddsProtos.ReplicationFactor.THREE, datanodes, null);
 
     final XceiverServerSpi writeChanel = mock(XceiverServerSpi.class);
     StateContext stateContext = 
ContainerTestUtils.getMockContext(datanodes.get(0), conf);
     when(ozoneContainer.getWriteChannel()).thenReturn(writeChanel);
-    when(writeChanel.isExist(pipelineID.getProtobuf()))
+    when(writeChanel.isExist(pipelineID))
         .thenReturn(true);
 
     final CreatePipelineCommandHandler commandHandler =
@@ -129,7 +129,7 @@ public void testCommandIdempotency() throws IOException {
         connectionManager);
 
     verify(writeChanel, times(0))
-        .addGroup(pipelineID.getProtobuf(), datanodes, 
Collections.nCopies(datanodes.size(), 0));
+        .addGroup(pipelineID, datanodes, Collections.nCopies(datanodes.size(), 
0));
 
     verify(raftClientGroupManager, times(0))
         .add(any(RaftGroup.class));
diff --git 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/RatisPipelineProvider.java
 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/RatisPipelineProvider.java
index 31ba235f6cd..de4ca7bbcea 100644
--- 
a/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/RatisPipelineProvider.java
+++ 
b/hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/RatisPipelineProvider.java
@@ -185,12 +185,8 @@ public synchronized Pipeline create(RatisReplicationConfig 
replicationConfig,
         .build();
 
     // Send command to datanodes to create pipeline
-    final CreatePipelineCommand createCommand = suggestedLeader != null ?
-        new CreatePipelineCommand(pipeline.getId(), pipeline.getType(),
-            factor, dns, suggestedLeader) :
-        new CreatePipelineCommand(pipeline.getId(), pipeline.getType(),
-            factor, dns);
-
+    final CreatePipelineCommand createCommand = new CreatePipelineCommand(
+        pipeline.getId(), pipeline.getType(), factor, dns, suggestedLeader);
     createCommand.setTerm(scmContext.getTermOfLeader());
 
     dns.forEach(node -> {
diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestCommandQueue.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestCommandQueue.java
index a70cbca4477..ccf3ea48413 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestCommandQueue.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestCommandQueue.java
@@ -49,7 +49,7 @@ public void testSummaryUpdated() {
     SCMCommand<?> createPipelineCommand =
         new CreatePipelineCommand(PipelineID.randomId(),
             HddsProtos.ReplicationType.RATIS,
-            HddsProtos.ReplicationFactor.THREE, Collections.emptyList());
+            HddsProtos.ReplicationFactor.THREE, Collections.emptyList(), null);
     SCMCommand<?> replicationCommand = ContainerTestUtils
         .getReplicateContainerCommand(containerID, 
MockDatanodeDetails.randomDatanodeDetails());
 
diff --git 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java
 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java
index 5933d4202d6..da2d3951563 100644
--- 
a/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java
+++ 
b/hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestSCMNodeManager.java
@@ -1292,7 +1292,7 @@ public void testCommandCount()
     SCMCommand<?> createPipelineCommand =
         new CreatePipelineCommand(PipelineID.randomId(),
             HddsProtos.ReplicationType.RATIS,
-            HddsProtos.ReplicationFactor.THREE, emptyList());
+            HddsProtos.ReplicationFactor.THREE, emptyList(), null);
 
     nodeManager.onMessage(
         new CommandForDatanode<>(datanode1, closeContainerCommand), null);
diff --git 
a/hadoop-ozone/integration-test-utils/src/main/java/org/apache/hadoop/ozone/container/OzoneTestHelper.java
 
b/hadoop-ozone/integration-test-utils/src/main/java/org/apache/hadoop/ozone/container/OzoneTestHelper.java
index 6697ce816f5..5b6213c690d 100644
--- 
a/hadoop-ozone/integration-test-utils/src/main/java/org/apache/hadoop/ozone/container/OzoneTestHelper.java
+++ 
b/hadoop-ozone/integration-test-utils/src/main/java/org/apache/hadoop/ozone/container/OzoneTestHelper.java
@@ -300,13 +300,12 @@ public static void waitForPipelineClose(List<Pipeline> 
pipelineList,
 
     // wait for the pipeline to get destroyed in the datanodes
     for (Pipeline pipeline : pipelineList) {
-      HddsProtos.PipelineID pipelineId = pipeline.getId().getProtobuf();
       for (DatanodeDetails dn : pipeline.getNodes()) {
         XceiverServerSpi server =
             cluster.getHddsDatanodes().get(cluster.getHddsDatanodeIndex(dn))
                 .getDatanodeStateMachine().getContainer().getWriteChannel();
         assertInstanceOf(XceiverServerRatis.class, server);
-        GenericTestUtils.waitFor(() -> !server.isExist(pipelineId),
+        GenericTestUtils.waitFor(() -> !server.isExist(pipeline.getId()),
             100, 30_000);
       }
     }
@@ -324,8 +323,8 @@ public static void createPipelineOnDatanode(Pipeline 
pipeline,
                       .getWriteChannel();
       assertInstanceOf(XceiverServerRatis.class, server);
       try {
-        server.addGroup(pipeline.getId().getProtobuf(), Collections.
-                unmodifiableList(pipeline.getNodes()));
+        final List<DatanodeDetails> peers = 
Collections.unmodifiableList(pipeline.getNodes());
+        server.addGroup(pipeline.getId(), peers, 
Collections.nCopies(peers.size(), 0));
       } catch (Exception e) {
         //ignore exception
       }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to