Browse Source

HDDS-567. Rename Mapping to ContainerManager in SCM. Contributed by Nanda kumar.

(cherry picked from commit 095c269620e01ce46832ea25e696c0ab71613ea3)
Nanda kumar 6 years ago
parent
commit
5d328662a0
36 changed files with 260 additions and 254 deletions
  1. 3 3
      hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java
  2. 5 5
      hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/DatanodeDeletedBlockTransactions.java
  3. 4 4
      hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/DeletedBlockLogImpl.java
  4. 8 7
      hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/SCMBlockDeletingService.java
  5. 2 2
      hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/CloseContainerEventHandler.java
  6. 2 2
      hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/CloseContainerWatcher.java
  7. 4 3
      hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerManager.java
  8. 6 6
      hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerReportHandler.java
  9. 4 4
      hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManager.java
  10. 7 7
      hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/SCMContainerManager.java
  11. 11 11
      hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java
  12. 1 1
      hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMDatanodeProtocolServer.java
  13. 18 18
      hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManager.java
  14. 3 3
      hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/block/TestBlockManager.java
  15. 4 4
      hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/block/TestDeletedBlockLog.java
  16. 2 2
      hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/TestCloseContainerEventHandler.java
  17. 5 5
      hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/TestContainerReportHandler.java
  18. 1 1
      hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/TestContainerStateManager.java
  19. 53 55
      hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/TestSCMContainerManager.java
  20. 5 4
      hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestContainerPlacement.java
  21. 2 2
      hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestDeadNodeHandler.java
  22. 6 6
      hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/ozone/container/TestCloseContainerWatcher.java
  23. 26 26
      hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/container/TestContainerStateManagerIntegration.java
  24. 11 10
      hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestNode2PipelineMap.java
  25. 10 8
      hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestNodeFailure.java
  26. 15 13
      hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestPipelineClose.java
  27. 16 17
      hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestSCMRestart.java
  28. 3 3
      hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/OzoneTestUtils.java
  29. 1 1
      hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rest/TestOzoneRestClient.java
  30. 3 3
      hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestCloseContainerHandlingByClient.java
  31. 1 1
      hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneRpcClient.java
  32. 1 2
      hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestBlockDeletion.java
  33. 3 3
      hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestCloseContainerByPipeline.java
  34. 1 1
      hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestCloseContainerHandler.java
  35. 6 6
      hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestScmChillMode.java
  36. 7 5
      hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/scm/TestContainerSQLCli.java

+ 3 - 3
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/BlockManagerImpl.java

@@ -21,7 +21,7 @@ import org.apache.hadoop.conf.StorageUnit;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ScmOps;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ScmOps;
 import org.apache.hadoop.hdds.scm.ScmConfigKeys;
 import org.apache.hadoop.hdds.scm.ScmConfigKeys;
 import org.apache.hadoop.hdds.scm.ScmUtils;
 import org.apache.hadoop.hdds.scm.ScmUtils;
-import org.apache.hadoop.hdds.scm.container.Mapping;
+import org.apache.hadoop.hdds.scm.container.ContainerManager;
 import org.apache.hadoop.hdds.scm.container.common.helpers.AllocatedBlock;
 import org.apache.hadoop.hdds.scm.container.common.helpers.AllocatedBlock;
 import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline;
 import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline;
 import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerInfo;
 import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerInfo;
@@ -70,7 +70,7 @@ public class BlockManagerImpl implements EventHandler<Boolean>,
   // by itself and does not rely on the Block service offered by SCM.
   // by itself and does not rely on the Block service offered by SCM.
 
 
   private final NodeManager nodeManager;
   private final NodeManager nodeManager;
-  private final Mapping containerManager;
+  private final ContainerManager containerManager;
 
 
   private final long containerSize;
   private final long containerSize;
 
 
@@ -92,7 +92,7 @@ public class BlockManagerImpl implements EventHandler<Boolean>,
    * @throws IOException
    * @throws IOException
    */
    */
   public BlockManagerImpl(final Configuration conf,
   public BlockManagerImpl(final Configuration conf,
-      final NodeManager nodeManager, final Mapping containerManager,
+      final NodeManager nodeManager, final ContainerManager containerManager,
       EventPublisher eventPublisher)
       EventPublisher eventPublisher)
       throws IOException {
       throws IOException {
     this.nodeManager = nodeManager;
     this.nodeManager = nodeManager;

+ 5 - 5
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/DatanodeDeletedBlockTransactions.java

@@ -17,7 +17,7 @@
 package org.apache.hadoop.hdds.scm.block;
 package org.apache.hadoop.hdds.scm.block;
 
 
 import com.google.common.collect.ArrayListMultimap;
 import com.google.common.collect.ArrayListMultimap;
-import org.apache.hadoop.hdds.scm.container.Mapping;
+import org.apache.hadoop.hdds.scm.container.ContainerManager;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
 import org.apache.hadoop.hdds.protocol.proto
 import org.apache.hadoop.hdds.protocol.proto
     .StorageContainerDatanodeProtocolProtos.DeletedBlocksTransaction;
     .StorageContainerDatanodeProtocolProtos.DeletedBlocksTransaction;
@@ -42,15 +42,15 @@ public class DatanodeDeletedBlockTransactions {
   private int maximumAllowedTXNum;
   private int maximumAllowedTXNum;
   // Current counter of inserted TX.
   // Current counter of inserted TX.
   private int currentTXNum;
   private int currentTXNum;
-  private Mapping mappingService;
+  private ContainerManager containerManager;
   // A list of TXs mapped to a certain datanode ID.
   // A list of TXs mapped to a certain datanode ID.
   private final ArrayListMultimap<UUID, DeletedBlocksTransaction>
   private final ArrayListMultimap<UUID, DeletedBlocksTransaction>
       transactions;
       transactions;
 
 
-  DatanodeDeletedBlockTransactions(Mapping mappingService,
+  DatanodeDeletedBlockTransactions(ContainerManager containerManager,
       int maximumAllowedTXNum, int nodeNum) {
       int maximumAllowedTXNum, int nodeNum) {
     this.transactions = ArrayListMultimap.create();
     this.transactions = ArrayListMultimap.create();
-    this.mappingService = mappingService;
+    this.containerManager = containerManager;
     this.maximumAllowedTXNum = maximumAllowedTXNum;
     this.maximumAllowedTXNum = maximumAllowedTXNum;
     this.nodeNum = nodeNum;
     this.nodeNum = nodeNum;
   }
   }
@@ -60,7 +60,7 @@ public class DatanodeDeletedBlockTransactions {
     Pipeline pipeline = null;
     Pipeline pipeline = null;
     try {
     try {
       ContainerWithPipeline containerWithPipeline =
       ContainerWithPipeline containerWithPipeline =
-          mappingService.getContainerWithPipeline(tx.getContainerID());
+          containerManager.getContainerWithPipeline(tx.getContainerID());
       if (containerWithPipeline.getContainerInfo().isContainerOpen()
       if (containerWithPipeline.getContainerInfo().isContainerOpen()
           || containerWithPipeline.getPipeline().isEmpty()) {
           || containerWithPipeline.getPipeline().isEmpty()) {
         return false;
         return false;

+ 4 - 4
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/DeletedBlockLogImpl.java

@@ -29,7 +29,7 @@ import org.apache.hadoop.hdds.protocol.proto
     .DeleteBlockTransactionResult;
     .DeleteBlockTransactionResult;
 import org.apache.hadoop.hdds.scm.command
 import org.apache.hadoop.hdds.scm.command
     .CommandStatusReportHandler.DeleteBlockStatus;
     .CommandStatusReportHandler.DeleteBlockStatus;
-import org.apache.hadoop.hdds.scm.container.Mapping;
+import org.apache.hadoop.hdds.scm.container.ContainerManager;
 import org.apache.hadoop.hdds.scm.container.common.helpers.Pipeline;
 import org.apache.hadoop.hdds.scm.container.common.helpers.Pipeline;
 import org.apache.hadoop.hdds.server.events.EventHandler;
 import org.apache.hadoop.hdds.server.events.EventHandler;
 import org.apache.hadoop.hdds.server.events.EventPublisher;
 import org.apache.hadoop.hdds.server.events.EventPublisher;
@@ -92,15 +92,15 @@ public class DeletedBlockLogImpl
 
 
   private final int maxRetry;
   private final int maxRetry;
   private final MetadataStore deletedStore;
   private final MetadataStore deletedStore;
-  private final Mapping containerManager;
+  private final ContainerManager containerManager;
   private final Lock lock;
   private final Lock lock;
   // The latest id of deleted blocks in the db.
   // The latest id of deleted blocks in the db.
   private long lastTxID;
   private long lastTxID;
   // Maps txId to set of DNs which are successful in committing the transaction
   // Maps txId to set of DNs which are successful in committing the transaction
   private Map<Long, Set<UUID>> transactionToDNsCommitMap;
   private Map<Long, Set<UUID>> transactionToDNsCommitMap;
 
 
-  public DeletedBlockLogImpl(Configuration conf, Mapping containerManager)
-      throws IOException {
+  public DeletedBlockLogImpl(Configuration conf,
+     ContainerManager containerManager) throws IOException {
     maxRetry = conf.getInt(OZONE_SCM_BLOCK_DELETION_MAX_RETRY,
     maxRetry = conf.getInt(OZONE_SCM_BLOCK_DELETION_MAX_RETRY,
         OZONE_SCM_BLOCK_DELETION_MAX_RETRY_DEFAULT);
         OZONE_SCM_BLOCK_DELETION_MAX_RETRY_DEFAULT);
 
 

+ 8 - 7
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/block/SCMBlockDeletingService.java

@@ -19,7 +19,7 @@ package org.apache.hadoop.hdds.scm.block;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Preconditions;
 import com.google.common.base.Preconditions;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.conf.Configuration;
-import org.apache.hadoop.hdds.scm.container.Mapping;
+import org.apache.hadoop.hdds.scm.container.ContainerManager;
 import org.apache.hadoop.hdds.scm.events.SCMEvents;
 import org.apache.hadoop.hdds.scm.events.SCMEvents;
 import org.apache.hadoop.hdds.scm.node.NodeManager;
 import org.apache.hadoop.hdds.scm.node.NodeManager;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
@@ -63,7 +63,7 @@ public class SCMBlockDeletingService extends BackgroundService {
   // ThreadPoolSize=2, 1 for scheduler and the other for the scanner.
   // ThreadPoolSize=2, 1 for scheduler and the other for the scanner.
   private final static int BLOCK_DELETING_SERVICE_CORE_POOL_SIZE = 2;
   private final static int BLOCK_DELETING_SERVICE_CORE_POOL_SIZE = 2;
   private final DeletedBlockLog deletedBlockLog;
   private final DeletedBlockLog deletedBlockLog;
-  private final Mapping mappingService;
+  private final ContainerManager containerManager;
   private final NodeManager nodeManager;
   private final NodeManager nodeManager;
   private final EventPublisher eventPublisher;
   private final EventPublisher eventPublisher;
 
 
@@ -81,12 +81,13 @@ public class SCMBlockDeletingService extends BackgroundService {
   private int blockDeleteLimitSize;
   private int blockDeleteLimitSize;
 
 
   public SCMBlockDeletingService(DeletedBlockLog deletedBlockLog,
   public SCMBlockDeletingService(DeletedBlockLog deletedBlockLog,
-      Mapping mapper, NodeManager nodeManager, EventPublisher eventPublisher,
-      long interval, long serviceTimeout, Configuration conf) {
+      ContainerManager containerManager, NodeManager nodeManager,
+      EventPublisher eventPublisher, long interval, long serviceTimeout,
+      Configuration conf) {
     super("SCMBlockDeletingService", interval, TimeUnit.MILLISECONDS,
     super("SCMBlockDeletingService", interval, TimeUnit.MILLISECONDS,
         BLOCK_DELETING_SERVICE_CORE_POOL_SIZE, serviceTimeout);
         BLOCK_DELETING_SERVICE_CORE_POOL_SIZE, serviceTimeout);
     this.deletedBlockLog = deletedBlockLog;
     this.deletedBlockLog = deletedBlockLog;
-    this.mappingService = mapper;
+    this.containerManager = containerManager;
     this.nodeManager = nodeManager;
     this.nodeManager = nodeManager;
     this.eventPublisher = eventPublisher;
     this.eventPublisher = eventPublisher;
 
 
@@ -139,7 +140,7 @@ public class SCMBlockDeletingService extends BackgroundService {
       List<DatanodeDetails> datanodes = nodeManager.getNodes(NodeState.HEALTHY);
       List<DatanodeDetails> datanodes = nodeManager.getNodes(NodeState.HEALTHY);
       Map<Long, Long> transactionMap = null;
       Map<Long, Long> transactionMap = null;
       if (datanodes != null) {
       if (datanodes != null) {
-        transactions = new DatanodeDeletedBlockTransactions(mappingService,
+        transactions = new DatanodeDeletedBlockTransactions(containerManager,
             blockDeleteLimitSize, datanodes.size());
             blockDeleteLimitSize, datanodes.size());
         try {
         try {
           transactionMap = deletedBlockLog.getTransactions(transactions);
           transactionMap = deletedBlockLog.getTransactions(transactions);
@@ -174,7 +175,7 @@ public class SCMBlockDeletingService extends BackgroundService {
                     transactions.getTransactionIDList(dnId)));
                     transactions.getTransactionIDList(dnId)));
           }
           }
         }
         }
-        mappingService.updateDeleteTransactionId(transactionMap);
+        containerManager.updateDeleteTransactionId(transactionMap);
       }
       }
 
 
       if (dnTxCount > 0) {
       if (dnTxCount > 0) {

+ 2 - 2
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/CloseContainerEventHandler.java

@@ -46,9 +46,9 @@ public class CloseContainerEventHandler implements EventHandler<ContainerID> {
       LoggerFactory.getLogger(CloseContainerEventHandler.class);
       LoggerFactory.getLogger(CloseContainerEventHandler.class);
 
 
 
 
-  private final Mapping containerManager;
+  private final ContainerManager containerManager;
 
 
-  public CloseContainerEventHandler(Mapping containerManager) {
+  public CloseContainerEventHandler(ContainerManager containerManager) {
     this.containerManager = containerManager;
     this.containerManager = containerManager;
   }
   }
 
 

+ 2 - 2
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/CloseContainerWatcher.java

@@ -44,11 +44,11 @@ public class CloseContainerWatcher extends
 
 
   public static final Logger LOG =
   public static final Logger LOG =
       LoggerFactory.getLogger(CloseContainerWatcher.class);
       LoggerFactory.getLogger(CloseContainerWatcher.class);
-  private final Mapping containerManager;
+  private final ContainerManager containerManager;
 
 
   public CloseContainerWatcher(Event<CloseContainerRetryableReq> startEvent,
   public CloseContainerWatcher(Event<CloseContainerRetryableReq> startEvent,
       Event<CloseContainerStatus> completionEvent,
       Event<CloseContainerStatus> completionEvent,
-      LeaseManager<Long> leaseManager, Mapping containerManager) {
+      LeaseManager<Long> leaseManager, ContainerManager containerManager) {
     super(startEvent, completionEvent, leaseManager);
     super(startEvent, completionEvent, leaseManager);
     this.containerManager = containerManager;
     this.containerManager = containerManager;
   }
   }

+ 4 - 3
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/Mapping.java → hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerManager.java

@@ -33,10 +33,11 @@ import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
 /**
 /**
- * Mapping class contains the mapping from a name to a pipeline mapping. This is
- * used by SCM when allocating new locations and when looking up a key.
+ * ContainerManager class contains the mapping from a name to a pipeline
+ * mapping. This is used by SCM when allocating new locations and when
+ * looking up a key.
  */
  */
-public interface Mapping extends Closeable {
+public interface ContainerManager extends Closeable {
   /**
   /**
    * Returns the ContainerInfo from the container ID.
    * Returns the ContainerInfo from the container ID.
    *
    *

+ 6 - 6
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerReportHandler.java

@@ -50,21 +50,21 @@ public class ContainerReportHandler implements
 
 
   private final NodeManager nodeManager;
   private final NodeManager nodeManager;
 
 
-  private final Mapping containerMapping;
+  private final ContainerManager containerManager;
 
 
   private ContainerStateManager containerStateManager;
   private ContainerStateManager containerStateManager;
 
 
   private ReplicationActivityStatus replicationStatus;
   private ReplicationActivityStatus replicationStatus;
 
 
-  public ContainerReportHandler(Mapping containerMapping,
+  public ContainerReportHandler(ContainerManager containerManager,
       NodeManager nodeManager,
       NodeManager nodeManager,
       ReplicationActivityStatus replicationActivityStatus) {
       ReplicationActivityStatus replicationActivityStatus) {
-    Preconditions.checkNotNull(containerMapping);
+    Preconditions.checkNotNull(containerManager);
     Preconditions.checkNotNull(nodeManager);
     Preconditions.checkNotNull(nodeManager);
     Preconditions.checkNotNull(replicationActivityStatus);
     Preconditions.checkNotNull(replicationActivityStatus);
-    this.containerStateManager = containerMapping.getStateManager();
+    this.containerStateManager = containerManager.getStateManager();
     this.nodeManager = nodeManager;
     this.nodeManager = nodeManager;
-    this.containerMapping = containerMapping;
+    this.containerManager = containerManager;
     this.replicationStatus = replicationActivityStatus;
     this.replicationStatus = replicationActivityStatus;
   }
   }
 
 
@@ -80,7 +80,7 @@ public class ContainerReportHandler implements
     try {
     try {
 
 
       //update state in container db and trigger close container events
       //update state in container db and trigger close container events
-      containerMapping
+      containerManager
           .processContainerReports(datanodeOrigin, containerReport, false);
           .processContainerReports(datanodeOrigin, containerReport, false);
 
 
       Set<ContainerID> containerIds = containerReport.getReportsList().stream()
       Set<ContainerID> containerIds = containerReport.getReportsList().stream()

+ 4 - 4
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerStateManager.java

@@ -136,7 +136,7 @@ public class ContainerStateManager implements Closeable {
    */
    */
   @SuppressWarnings("unchecked")
   @SuppressWarnings("unchecked")
   public ContainerStateManager(Configuration configuration,
   public ContainerStateManager(Configuration configuration,
-      Mapping containerMapping, PipelineSelector pipelineSelector) {
+      ContainerManager containerManager, PipelineSelector pipelineSelector) {
 
 
     // Initialize the container state machine.
     // Initialize the container state machine.
     Set<HddsProtos.LifeCycleState> finalStates = new HashSet();
     Set<HddsProtos.LifeCycleState> finalStates = new HashSet();
@@ -158,15 +158,15 @@ public class ContainerStateManager implements Closeable {
     lastUsedMap = new ConcurrentHashMap<>();
     lastUsedMap = new ConcurrentHashMap<>();
     containerCount = new AtomicLong(0);
     containerCount = new AtomicLong(0);
     containers = new ContainerStateMap();
     containers = new ContainerStateMap();
-    loadExistingContainers(containerMapping, pipelineSelector);
+    loadExistingContainers(containerManager, pipelineSelector);
   }
   }
 
 
-  private void loadExistingContainers(Mapping containerMapping,
+  private void loadExistingContainers(ContainerManager containerManager,
                                       PipelineSelector pipelineSelector) {
                                       PipelineSelector pipelineSelector) {
 
 
     List<ContainerInfo> containerList;
     List<ContainerInfo> containerList;
     try {
     try {
-      containerList = containerMapping.listContainer(0, Integer.MAX_VALUE);
+      containerList = containerManager.listContainer(0, Integer.MAX_VALUE);
 
 
       // if there are no container to load, let us return.
       // if there are no container to load, let us return.
       if (containerList == null || containerList.size() == 0) {
       if (containerList == null || containerList.size() == 0) {

+ 7 - 7
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/ContainerMapping.java → hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/container/SCMContainerManager.java

@@ -74,12 +74,12 @@ import static org.apache.hadoop.hdds.server.ServerUtils.getOzoneMetaDirPath;
 import static org.apache.hadoop.ozone.OzoneConsts.SCM_CONTAINER_DB;
 import static org.apache.hadoop.ozone.OzoneConsts.SCM_CONTAINER_DB;
 
 
 /**
 /**
- * Mapping class contains the mapping from a name to a pipeline mapping. This
- * is used by SCM when
- * allocating new locations and when looking up a key.
+ * ContainerManager class contains the mapping from a name to a pipeline
+ * mapping. This is used by SCM when allocating new locations and when
+ * looking up a key.
  */
  */
-public class ContainerMapping implements Mapping {
-  private static final Logger LOG = LoggerFactory.getLogger(ContainerMapping
+public class SCMContainerManager implements ContainerManager {
+  private static final Logger LOG = LoggerFactory.getLogger(SCMContainerManager
       .class);
       .class);
 
 
   private final NodeManager nodeManager;
   private final NodeManager nodeManager;
@@ -108,7 +108,7 @@ public class ContainerMapping implements Mapping {
    * @throws IOException on Failure.
    * @throws IOException on Failure.
    */
    */
   @SuppressWarnings("unchecked")
   @SuppressWarnings("unchecked")
-  public ContainerMapping(
+  public SCMContainerManager(
       final Configuration conf, final NodeManager nodeManager, final int
       final Configuration conf, final NodeManager nodeManager, final int
       cacheSizeMB, EventPublisher eventPublisher) throws IOException {
       cacheSizeMB, EventPublisher eventPublisher) throws IOException {
     this.nodeManager = nodeManager;
     this.nodeManager = nodeManager;
@@ -653,7 +653,7 @@ public class ContainerMapping implements Mapping {
 
 
   /**
   /**
    * Since allocatedBytes of a container is only in memory, stored in
    * Since allocatedBytes of a container is only in memory, stored in
-   * containerStateManager, when closing ContainerMapping, we need to update
+   * containerStateManager, when closing SCMContainerManager, we need to update
    * this in the container store.
    * this in the container store.
    *
    *
    * @throws IOException on failure.
    * @throws IOException on failure.

+ 11 - 11
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java

@@ -160,7 +160,7 @@ public class SCMClientProtocolServer implements
     String remoteUser = getRpcRemoteUsername();
     String remoteUser = getRpcRemoteUsername();
     getScm().checkAdminAccess(remoteUser);
     getScm().checkAdminAccess(remoteUser);
 
 
-    return scm.getScmContainerManager()
+    return scm.getContainerManager()
         .allocateContainer(replicationType, factor, owner);
         .allocateContainer(replicationType, factor, owner);
   }
   }
 
 
@@ -168,7 +168,7 @@ public class SCMClientProtocolServer implements
   public ContainerInfo getContainer(long containerID) throws IOException {
   public ContainerInfo getContainer(long containerID) throws IOException {
     String remoteUser = getRpcRemoteUsername();
     String remoteUser = getRpcRemoteUsername();
     getScm().checkAdminAccess(remoteUser);
     getScm().checkAdminAccess(remoteUser);
-    return scm.getScmContainerManager()
+    return scm.getContainerManager()
         .getContainer(containerID);
         .getContainer(containerID);
   }
   }
 
 
@@ -176,7 +176,7 @@ public class SCMClientProtocolServer implements
   public ContainerWithPipeline getContainerWithPipeline(long containerID)
   public ContainerWithPipeline getContainerWithPipeline(long containerID)
       throws IOException {
       throws IOException {
     if (chillModePrecheck.isInChillMode()) {
     if (chillModePrecheck.isInChillMode()) {
-      ContainerInfo contInfo = scm.getScmContainerManager()
+      ContainerInfo contInfo = scm.getContainerManager()
           .getContainer(containerID);
           .getContainer(containerID);
       if (contInfo.isContainerOpen()) {
       if (contInfo.isContainerOpen()) {
         if (!hasRequiredReplicas(contInfo)) {
         if (!hasRequiredReplicas(contInfo)) {
@@ -188,7 +188,7 @@ public class SCMClientProtocolServer implements
     }
     }
     String remoteUser = getRpcRemoteUsername();
     String remoteUser = getRpcRemoteUsername();
     getScm().checkAdminAccess(remoteUser);
     getScm().checkAdminAccess(remoteUser);
-    return scm.getScmContainerManager()
+    return scm.getContainerManager()
         .getContainerWithPipeline(containerID);
         .getContainerWithPipeline(containerID);
   }
   }
 
 
@@ -198,7 +198,7 @@ public class SCMClientProtocolServer implements
    */
    */
   private boolean hasRequiredReplicas(ContainerInfo contInfo) {
   private boolean hasRequiredReplicas(ContainerInfo contInfo) {
     try{
     try{
-      return getScm().getScmContainerManager().getStateManager()
+      return getScm().getContainerManager().getStateManager()
           .getContainerReplicas(contInfo.containerID())
           .getContainerReplicas(contInfo.containerID())
           .size() >= contInfo.getReplicationFactor().getNumber();
           .size() >= contInfo.getReplicationFactor().getNumber();
     } catch (SCMException ex) {
     } catch (SCMException ex) {
@@ -211,7 +211,7 @@ public class SCMClientProtocolServer implements
   @Override
   @Override
   public List<ContainerInfo> listContainer(long startContainerID,
   public List<ContainerInfo> listContainer(long startContainerID,
       int count) throws IOException {
       int count) throws IOException {
-    return scm.getScmContainerManager().
+    return scm.getContainerManager().
         listContainer(startContainerID, count);
         listContainer(startContainerID, count);
   }
   }
 
 
@@ -219,7 +219,7 @@ public class SCMClientProtocolServer implements
   public void deleteContainer(long containerID) throws IOException {
   public void deleteContainer(long containerID) throws IOException {
     String remoteUser = getRpcRemoteUsername();
     String remoteUser = getRpcRemoteUsername();
     getScm().checkAdminAccess(remoteUser);
     getScm().checkAdminAccess(remoteUser);
-    scm.getScmContainerManager().deleteContainer(containerID);
+    scm.getContainerManager().deleteContainer(containerID);
 
 
   }
   }
 
 
@@ -257,10 +257,10 @@ public class SCMClientProtocolServer implements
           .ObjectStageChangeRequestProto.Op.create) {
           .ObjectStageChangeRequestProto.Op.create) {
         if (stage == StorageContainerLocationProtocolProtos
         if (stage == StorageContainerLocationProtocolProtos
             .ObjectStageChangeRequestProto.Stage.begin) {
             .ObjectStageChangeRequestProto.Stage.begin) {
-          scm.getScmContainerManager().updateContainerState(id, HddsProtos
+          scm.getContainerManager().updateContainerState(id, HddsProtos
               .LifeCycleEvent.CREATE);
               .LifeCycleEvent.CREATE);
         } else {
         } else {
-          scm.getScmContainerManager().updateContainerState(id, HddsProtos
+          scm.getContainerManager().updateContainerState(id, HddsProtos
               .LifeCycleEvent.CREATED);
               .LifeCycleEvent.CREATED);
         }
         }
       } else {
       } else {
@@ -268,10 +268,10 @@ public class SCMClientProtocolServer implements
             .ObjectStageChangeRequestProto.Op.close) {
             .ObjectStageChangeRequestProto.Op.close) {
           if (stage == StorageContainerLocationProtocolProtos
           if (stage == StorageContainerLocationProtocolProtos
               .ObjectStageChangeRequestProto.Stage.begin) {
               .ObjectStageChangeRequestProto.Stage.begin) {
-            scm.getScmContainerManager().updateContainerState(id, HddsProtos
+            scm.getContainerManager().updateContainerState(id, HddsProtos
                 .LifeCycleEvent.FINALIZE);
                 .LifeCycleEvent.FINALIZE);
           } else {
           } else {
-            scm.getScmContainerManager().updateContainerState(id, HddsProtos
+            scm.getContainerManager().updateContainerState(id, HddsProtos
                 .LifeCycleEvent.CLOSE);
                 .LifeCycleEvent.CLOSE);
           }
           }
         }
         }

+ 1 - 1
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMDatanodeProtocolServer.java

@@ -196,7 +196,7 @@ public class SCMDatanodeProtocolServer implements
         .register(datanodeDetails, nodeReport, pipelineReportsProto);
         .register(datanodeDetails, nodeReport, pipelineReportsProto);
     if (registeredCommand.getError()
     if (registeredCommand.getError()
         == SCMRegisteredResponseProto.ErrorCode.success) {
         == SCMRegisteredResponseProto.ErrorCode.success) {
-      scm.getScmContainerManager().processContainerReports(datanodeDetails,
+      scm.getContainerManager().processContainerReports(datanodeDetails,
           containerReportsProto, true);
           containerReportsProto, true);
       eventPublisher.fireEvent(SCMEvents.NODE_REGISTRATION_CONT_REPORT,
       eventPublisher.fireEvent(SCMEvents.NODE_REGISTRATION_CONT_REPORT,
           new NodeRegistrationContainerReport(datanodeDetails,
           new NodeRegistrationContainerReport(datanodeDetails,

+ 18 - 18
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/StorageContainerManager.java

@@ -40,9 +40,9 @@ import org.apache.hadoop.hdds.scm.command.CommandStatusReportHandler;
 import org.apache.hadoop.hdds.scm.container.CloseContainerEventHandler;
 import org.apache.hadoop.hdds.scm.container.CloseContainerEventHandler;
 import org.apache.hadoop.hdds.scm.container.CloseContainerWatcher;
 import org.apache.hadoop.hdds.scm.container.CloseContainerWatcher;
 import org.apache.hadoop.hdds.scm.container.ContainerActionsHandler;
 import org.apache.hadoop.hdds.scm.container.ContainerActionsHandler;
-import org.apache.hadoop.hdds.scm.container.ContainerMapping;
+import org.apache.hadoop.hdds.scm.container.ContainerManager;
+import org.apache.hadoop.hdds.scm.container.SCMContainerManager;
 import org.apache.hadoop.hdds.scm.container.ContainerReportHandler;
 import org.apache.hadoop.hdds.scm.container.ContainerReportHandler;
-import org.apache.hadoop.hdds.scm.container.Mapping;
 import org.apache.hadoop.hdds.scm.container.replication
 import org.apache.hadoop.hdds.scm.container.replication
     .ReplicationActivityStatus;
     .ReplicationActivityStatus;
 import org.apache.hadoop.hdds.scm.container.replication.ReplicationManager;
 import org.apache.hadoop.hdds.scm.container.replication.ReplicationManager;
@@ -151,7 +151,7 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
    * State Managers of SCM.
    * State Managers of SCM.
    */
    */
   private final NodeManager scmNodeManager;
   private final NodeManager scmNodeManager;
-  private final Mapping scmContainerManager;
+  private final ContainerManager containerManager;
   private final BlockManager scmBlockManager;
   private final BlockManager scmBlockManager;
   private final SCMStorage scmStorage;
   private final SCMStorage scmStorage;
 
 
@@ -206,43 +206,43 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
 
 
     scmNodeManager = new SCMNodeManager(
     scmNodeManager = new SCMNodeManager(
         conf, scmStorage.getClusterID(), this, eventQueue);
         conf, scmStorage.getClusterID(), this, eventQueue);
-    scmContainerManager = new ContainerMapping(
+    containerManager = new SCMContainerManager(
         conf, getScmNodeManager(), cacheSize, eventQueue);
         conf, getScmNodeManager(), cacheSize, eventQueue);
     scmBlockManager = new BlockManagerImpl(
     scmBlockManager = new BlockManagerImpl(
-        conf, getScmNodeManager(), scmContainerManager, eventQueue);
+        conf, getScmNodeManager(), containerManager, eventQueue);
 
 
     replicationStatus = new ReplicationActivityStatus();
     replicationStatus = new ReplicationActivityStatus();
 
 
     CloseContainerEventHandler closeContainerHandler =
     CloseContainerEventHandler closeContainerHandler =
-        new CloseContainerEventHandler(scmContainerManager);
+        new CloseContainerEventHandler(containerManager);
     NodeReportHandler nodeReportHandler =
     NodeReportHandler nodeReportHandler =
         new NodeReportHandler(scmNodeManager);
         new NodeReportHandler(scmNodeManager);
     PipelineReportHandler pipelineReportHandler =
     PipelineReportHandler pipelineReportHandler =
             new PipelineReportHandler(
             new PipelineReportHandler(
-                    scmContainerManager.getPipelineSelector());
+                    containerManager.getPipelineSelector());
     CommandStatusReportHandler cmdStatusReportHandler =
     CommandStatusReportHandler cmdStatusReportHandler =
         new CommandStatusReportHandler();
         new CommandStatusReportHandler();
 
 
     NewNodeHandler newNodeHandler = new NewNodeHandler(scmNodeManager);
     NewNodeHandler newNodeHandler = new NewNodeHandler(scmNodeManager);
     StaleNodeHandler staleNodeHandler =
     StaleNodeHandler staleNodeHandler =
-        new StaleNodeHandler(scmContainerManager.getPipelineSelector());
+        new StaleNodeHandler(containerManager.getPipelineSelector());
     DeadNodeHandler deadNodeHandler = new DeadNodeHandler(scmNodeManager,
     DeadNodeHandler deadNodeHandler = new DeadNodeHandler(scmNodeManager,
-        getScmContainerManager().getStateManager());
+        getContainerManager().getStateManager());
     ContainerActionsHandler actionsHandler = new ContainerActionsHandler();
     ContainerActionsHandler actionsHandler = new ContainerActionsHandler();
     PendingDeleteHandler pendingDeleteHandler =
     PendingDeleteHandler pendingDeleteHandler =
         new PendingDeleteHandler(scmBlockManager.getSCMBlockDeletingService());
         new PendingDeleteHandler(scmBlockManager.getSCMBlockDeletingService());
 
 
     ContainerReportHandler containerReportHandler =
     ContainerReportHandler containerReportHandler =
-        new ContainerReportHandler(scmContainerManager, scmNodeManager,
+        new ContainerReportHandler(containerManager, scmNodeManager,
             replicationStatus);
             replicationStatus);
     scmChillModeManager = new SCMChillModeManager(conf,
     scmChillModeManager = new SCMChillModeManager(conf,
-        getScmContainerManager().getStateManager().getAllContainers(),
+        getContainerManager().getStateManager().getAllContainers(),
         eventQueue);
         eventQueue);
     PipelineActionEventHandler pipelineActionEventHandler =
     PipelineActionEventHandler pipelineActionEventHandler =
         new PipelineActionEventHandler();
         new PipelineActionEventHandler();
 
 
     PipelineCloseHandler pipelineCloseHandler =
     PipelineCloseHandler pipelineCloseHandler =
-        new PipelineCloseHandler(scmContainerManager.getPipelineSelector());
+        new PipelineCloseHandler(containerManager.getPipelineSelector());
 
 
     long watcherTimeout =
     long watcherTimeout =
         conf.getTimeDuration(ScmConfigKeys.HDDS_SCM_WATCHER_TIMEOUT,
         conf.getTimeDuration(ScmConfigKeys.HDDS_SCM_WATCHER_TIMEOUT,
@@ -263,14 +263,14 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
         new SCMContainerPlacementCapacity(scmNodeManager, conf);
         new SCMContainerPlacementCapacity(scmNodeManager, conf);
 
 
     replicationManager = new ReplicationManager(containerPlacementPolicy,
     replicationManager = new ReplicationManager(containerPlacementPolicy,
-        scmContainerManager.getStateManager(), eventQueue,
+        containerManager.getStateManager(), eventQueue,
         commandWatcherLeaseManager);
         commandWatcherLeaseManager);
 
 
     // setup CloseContainer watcher
     // setup CloseContainer watcher
     CloseContainerWatcher closeContainerWatcher =
     CloseContainerWatcher closeContainerWatcher =
         new CloseContainerWatcher(SCMEvents.CLOSE_CONTAINER_RETRYABLE_REQ,
         new CloseContainerWatcher(SCMEvents.CLOSE_CONTAINER_RETRYABLE_REQ,
             SCMEvents.CLOSE_CONTAINER_STATUS, commandWatcherLeaseManager,
             SCMEvents.CLOSE_CONTAINER_STATUS, commandWatcherLeaseManager,
-            scmContainerManager);
+            containerManager);
     closeContainerWatcher.start(eventQueue);
     closeContainerWatcher.start(eventQueue);
 
 
     scmAdminUsernames = conf.getTrimmedStringCollection(OzoneConfigKeys
     scmAdminUsernames = conf.getTrimmedStringCollection(OzoneConfigKeys
@@ -632,7 +632,7 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
   @VisibleForTesting
   @VisibleForTesting
   public ContainerInfo getContainerInfo(long containerID) throws
   public ContainerInfo getContainerInfo(long containerID) throws
       IOException {
       IOException {
-    return scmContainerManager.getContainer(containerID);
+    return containerManager.getContainer(containerID);
   }
   }
 
 
   /**
   /**
@@ -774,7 +774,7 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
     } catch (Exception ex) {
     } catch (Exception ex) {
       LOG.error("SCM Event Queue stop failed", ex);
       LOG.error("SCM Event Queue stop failed", ex);
     }
     }
-    IOUtils.cleanupWithLogger(LOG, scmContainerManager);
+    IOUtils.cleanupWithLogger(LOG, containerManager);
   }
   }
 
 
   /**
   /**
@@ -805,8 +805,8 @@ public final class StorageContainerManager extends ServiceRuntimeInfoImpl
    * Returns SCM container manager.
    * Returns SCM container manager.
    */
    */
   @VisibleForTesting
   @VisibleForTesting
-  public Mapping getScmContainerManager() {
-    return scmContainerManager;
+  public ContainerManager getContainerManager() {
+    return containerManager;
   }
   }
 
 
   /**
   /**

+ 3 - 3
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/block/TestBlockManager.java

@@ -22,7 +22,7 @@ import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.fs.FileUtil;
 import org.apache.hadoop.fs.FileUtil;
 import org.apache.hadoop.hdds.conf.OzoneConfiguration;
 import org.apache.hadoop.hdds.conf.OzoneConfiguration;
 import org.apache.hadoop.hdds.scm.ScmConfigKeys;
 import org.apache.hadoop.hdds.scm.ScmConfigKeys;
-import org.apache.hadoop.hdds.scm.container.ContainerMapping;
+import org.apache.hadoop.hdds.scm.container.SCMContainerManager;
 import org.apache.hadoop.hdds.scm.container.MockNodeManager;
 import org.apache.hadoop.hdds.scm.container.MockNodeManager;
 import org.apache.hadoop.hdds.scm.container.common.helpers.AllocatedBlock;
 import org.apache.hadoop.hdds.scm.container.common.helpers.AllocatedBlock;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
@@ -56,7 +56,7 @@ import static org.apache.hadoop.ozone.OzoneConsts.MB;
  * Tests for SCM Block Manager.
  * Tests for SCM Block Manager.
  */
  */
 public class TestBlockManager implements EventHandler<Boolean> {
 public class TestBlockManager implements EventHandler<Boolean> {
-  private static ContainerMapping mapping;
+  private static SCMContainerManager mapping;
   private static MockNodeManager nodeManager;
   private static MockNodeManager nodeManager;
   private static BlockManagerImpl blockManager;
   private static BlockManagerImpl blockManager;
   private static File testDir;
   private static File testDir;
@@ -83,7 +83,7 @@ public class TestBlockManager implements EventHandler<Boolean> {
       throw new IOException("Unable to create test directory path");
       throw new IOException("Unable to create test directory path");
     }
     }
     nodeManager = new MockNodeManager(true, 10);
     nodeManager = new MockNodeManager(true, 10);
-    mapping = new ContainerMapping(conf, nodeManager, 128, eventQueue);
+    mapping = new SCMContainerManager(conf, nodeManager, 128, eventQueue);
     blockManager = new BlockManagerImpl(conf,
     blockManager = new BlockManagerImpl(conf,
         nodeManager, mapping, eventQueue);
         nodeManager, mapping, eventQueue);
     eventQueue.addHandler(SCMEvents.CHILL_MODE_STATUS, blockManager);
     eventQueue.addHandler(SCMEvents.CHILL_MODE_STATUS, blockManager);

+ 4 - 4
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/block/TestDeletedBlockLog.java

@@ -19,8 +19,8 @@ package org.apache.hadoop.hdds.scm.block;
 
 
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.FileUtils;
 import org.apache.commons.lang3.RandomUtils;
 import org.apache.commons.lang3.RandomUtils;
-import org.apache.hadoop.hdds.scm.container.ContainerMapping;
-import org.apache.hadoop.hdds.scm.container.Mapping;
+import org.apache.hadoop.hdds.scm.container.SCMContainerManager;
+import org.apache.hadoop.hdds.scm.container.ContainerManager;
 import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerInfo;
 import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerInfo;
 import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline;
 import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline;
 import org.apache.hadoop.hdds.scm.container.common.helpers.Pipeline;
 import org.apache.hadoop.hdds.scm.container.common.helpers.Pipeline;
@@ -72,7 +72,7 @@ public class TestDeletedBlockLog {
   private static DeletedBlockLogImpl deletedBlockLog;
   private static DeletedBlockLogImpl deletedBlockLog;
   private OzoneConfiguration conf;
   private OzoneConfiguration conf;
   private File testDir;
   private File testDir;
-  private Mapping containerManager;
+  private ContainerManager containerManager;
   private List<DatanodeDetails> dnList;
   private List<DatanodeDetails> dnList;
 
 
   @Before
   @Before
@@ -82,7 +82,7 @@ public class TestDeletedBlockLog {
     conf = new OzoneConfiguration();
     conf = new OzoneConfiguration();
     conf.setInt(OZONE_SCM_BLOCK_DELETION_MAX_RETRY, 20);
     conf.setInt(OZONE_SCM_BLOCK_DELETION_MAX_RETRY, 20);
     conf.set(OZONE_METADATA_DIRS, testDir.getAbsolutePath());
     conf.set(OZONE_METADATA_DIRS, testDir.getAbsolutePath());
-    containerManager = Mockito.mock(ContainerMapping.class);
+    containerManager = Mockito.mock(SCMContainerManager.class);
     deletedBlockLog = new DeletedBlockLogImpl(conf, containerManager);
     deletedBlockLog = new DeletedBlockLogImpl(conf, containerManager);
     dnList = new ArrayList<>(3);
     dnList = new ArrayList<>(3);
     setupContainerManager();
     setupContainerManager();

+ 2 - 2
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/TestCloseContainerEventHandler.java

@@ -50,7 +50,7 @@ public class TestCloseContainerEventHandler {
 
 
   private static Configuration configuration;
   private static Configuration configuration;
   private static MockNodeManager nodeManager;
   private static MockNodeManager nodeManager;
-  private static ContainerMapping mapping;
+  private static SCMContainerManager mapping;
   private static long size;
   private static long size;
   private static File testDir;
   private static File testDir;
   private static EventQueue eventQueue;
   private static EventQueue eventQueue;
@@ -65,7 +65,7 @@ public class TestCloseContainerEventHandler {
     configuration
     configuration
         .set(OzoneConfigKeys.OZONE_METADATA_DIRS, testDir.getAbsolutePath());
         .set(OzoneConfigKeys.OZONE_METADATA_DIRS, testDir.getAbsolutePath());
     nodeManager = new MockNodeManager(true, 10);
     nodeManager = new MockNodeManager(true, 10);
-    mapping = new ContainerMapping(configuration, nodeManager, 128,
+    mapping = new SCMContainerManager(configuration, nodeManager, 128,
         new EventQueue());
         new EventQueue());
     eventQueue = new EventQueue();
     eventQueue = new EventQueue();
     eventQueue.addHandler(CLOSE_CONTAINER,
     eventQueue.addHandler(CLOSE_CONTAINER,

+ 5 - 5
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/TestContainerReportHandler.java

@@ -74,10 +74,10 @@ public class TestContainerReportHandler implements EventPublisher {
   public void test() throws IOException {
   public void test() throws IOException {
     //GIVEN
     //GIVEN
     OzoneConfiguration conf = new OzoneConfiguration();
     OzoneConfiguration conf = new OzoneConfiguration();
-    Mapping mapping = Mockito.mock(Mapping.class);
+    ContainerManager containerManager = Mockito.mock(ContainerManager.class);
     PipelineSelector selector = Mockito.mock(PipelineSelector.class);
     PipelineSelector selector = Mockito.mock(PipelineSelector.class);
 
 
-    when(mapping.getContainer(anyLong()))
+    when(containerManager.getContainer(anyLong()))
         .thenAnswer(
         .thenAnswer(
             (Answer<ContainerInfo>) invocation ->
             (Answer<ContainerInfo>) invocation ->
                 new Builder()
                 new Builder()
@@ -88,15 +88,15 @@ public class TestContainerReportHandler implements EventPublisher {
       );
       );
 
 
     ContainerStateManager containerStateManager =
     ContainerStateManager containerStateManager =
-        new ContainerStateManager(conf, mapping, selector);
+        new ContainerStateManager(conf, containerManager, selector);
 
 
-    when(mapping.getStateManager()).thenReturn(containerStateManager);
+    when(containerManager.getStateManager()).thenReturn(containerStateManager);
 
 
     ReplicationActivityStatus replicationActivityStatus =
     ReplicationActivityStatus replicationActivityStatus =
         new ReplicationActivityStatus();
         new ReplicationActivityStatus();
 
 
     ContainerReportHandler reportHandler =
     ContainerReportHandler reportHandler =
-        new ContainerReportHandler(mapping, nodeManager,
+        new ContainerReportHandler(containerManager, nodeManager,
             replicationActivityStatus);
             replicationActivityStatus);
 
 
     DatanodeDetails dn1 = TestUtils.randomDatanodeDetails();
     DatanodeDetails dn1 = TestUtils.randomDatanodeDetails();

+ 1 - 1
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/TestContainerStateManager.java

@@ -41,7 +41,7 @@ public class TestContainerStateManager {
   @Before
   @Before
   public void init() throws IOException {
   public void init() throws IOException {
     OzoneConfiguration conf = new OzoneConfiguration();
     OzoneConfiguration conf = new OzoneConfiguration();
-    Mapping mapping = Mockito.mock(Mapping.class);
+    ContainerManager mapping = Mockito.mock(ContainerManager.class);
     PipelineSelector selector =  Mockito.mock(PipelineSelector.class);
     PipelineSelector selector =  Mockito.mock(PipelineSelector.class);
     containerStateManager = new ContainerStateManager(conf, mapping, selector);
     containerStateManager = new ContainerStateManager(conf, mapping, selector);
 
 

+ 53 - 55
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/TestContainerMapping.java → hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/container/TestSCMContainerManager.java

@@ -58,10 +58,10 @@ import java.util.UUID;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeUnit;
 
 
 /**
 /**
- * Tests for Container Mapping.
+ * Tests for Container ContainerManager.
  */
  */
-public class TestContainerMapping {
-  private static ContainerMapping mapping;
+public class TestSCMContainerManager {
+  private static SCMContainerManager containerManager;
   private static MockNodeManager nodeManager;
   private static MockNodeManager nodeManager;
   private static File testDir;
   private static File testDir;
   private static XceiverClientManager xceiverClientManager;
   private static XceiverClientManager xceiverClientManager;
@@ -77,7 +77,7 @@ public class TestContainerMapping {
     Configuration conf = SCMTestUtils.getConf();
     Configuration conf = SCMTestUtils.getConf();
 
 
     testDir = GenericTestUtils
     testDir = GenericTestUtils
-        .getTestDir(TestContainerMapping.class.getSimpleName());
+        .getTestDir(TestSCMContainerManager.class.getSimpleName());
     conf.set(OzoneConfigKeys.OZONE_METADATA_DIRS,
     conf.set(OzoneConfigKeys.OZONE_METADATA_DIRS,
         testDir.getAbsolutePath());
         testDir.getAbsolutePath());
     conf.setTimeDuration(
     conf.setTimeDuration(
@@ -89,7 +89,7 @@ public class TestContainerMapping {
       throw new IOException("Unable to create test directory path");
       throw new IOException("Unable to create test directory path");
     }
     }
     nodeManager = new MockNodeManager(true, 10);
     nodeManager = new MockNodeManager(true, 10);
-    mapping = new ContainerMapping(conf, nodeManager, 128,
+    containerManager = new SCMContainerManager(conf, nodeManager, 128,
         new EventQueue());
         new EventQueue());
     xceiverClientManager = new XceiverClientManager(conf);
     xceiverClientManager = new XceiverClientManager(conf);
     random = new Random();
     random = new Random();
@@ -97,8 +97,8 @@ public class TestContainerMapping {
 
 
   @AfterClass
   @AfterClass
   public static void cleanup() throws IOException {
   public static void cleanup() throws IOException {
-    if(mapping != null) {
-      mapping.close();
+    if(containerManager != null) {
+      containerManager.close();
     }
     }
     FileUtil.fullyDelete(testDir);
     FileUtil.fullyDelete(testDir);
   }
   }
@@ -110,7 +110,7 @@ public class TestContainerMapping {
 
 
   @Test
   @Test
   public void testallocateContainer() throws Exception {
   public void testallocateContainer() throws Exception {
-    ContainerWithPipeline containerInfo = mapping.allocateContainer(
+    ContainerWithPipeline containerInfo = containerManager.allocateContainer(
         xceiverClientManager.getType(),
         xceiverClientManager.getType(),
         xceiverClientManager.getFactor(),
         xceiverClientManager.getFactor(),
         containerOwner);
         containerOwner);
@@ -127,7 +127,7 @@ public class TestContainerMapping {
      */
      */
     Set<UUID> pipelineList = new TreeSet<>();
     Set<UUID> pipelineList = new TreeSet<>();
     for (int x = 0; x < 30; x++) {
     for (int x = 0; x < 30; x++) {
-      ContainerWithPipeline containerInfo = mapping.allocateContainer(
+      ContainerWithPipeline containerInfo = containerManager.allocateContainer(
           xceiverClientManager.getType(),
           xceiverClientManager.getType(),
           xceiverClientManager.getFactor(),
           xceiverClientManager.getFactor(),
           containerOwner);
           containerOwner);
@@ -142,7 +142,7 @@ public class TestContainerMapping {
 
 
   @Test
   @Test
   public void testGetContainer() throws IOException {
   public void testGetContainer() throws IOException {
-    ContainerWithPipeline containerInfo = mapping.allocateContainer(
+    ContainerWithPipeline containerInfo = containerManager.allocateContainer(
         xceiverClientManager.getType(),
         xceiverClientManager.getType(),
         xceiverClientManager.getFactor(),
         xceiverClientManager.getFactor(),
         containerOwner);
         containerOwner);
@@ -155,10 +155,9 @@ public class TestContainerMapping {
 
 
   @Test
   @Test
   public void testGetContainerWithPipeline() throws Exception {
   public void testGetContainerWithPipeline() throws Exception {
-    ContainerWithPipeline containerWithPipeline = mapping.allocateContainer(
-        xceiverClientManager.getType(),
-        xceiverClientManager.getFactor(),
-        containerOwner);
+    ContainerWithPipeline containerWithPipeline = containerManager
+        .allocateContainer(xceiverClientManager.getType(),
+            xceiverClientManager.getFactor(), containerOwner);
     ContainerInfo contInfo = containerWithPipeline.getContainerInfo();
     ContainerInfo contInfo = containerWithPipeline.getContainerInfo();
     // Add dummy replicas for container.
     // Add dummy replicas for container.
     DatanodeDetails dn1 = DatanodeDetails.newBuilder()
     DatanodeDetails dn1 = DatanodeDetails.newBuilder()
@@ -169,28 +168,28 @@ public class TestContainerMapping {
         .setHostName("host2")
         .setHostName("host2")
         .setIpAddress("2.2.2.2")
         .setIpAddress("2.2.2.2")
         .setUuid(UUID.randomUUID().toString()).build();
         .setUuid(UUID.randomUUID().toString()).build();
-    mapping
+    containerManager
         .updateContainerState(contInfo.getContainerID(), LifeCycleEvent.CREATE);
         .updateContainerState(contInfo.getContainerID(), LifeCycleEvent.CREATE);
-    mapping.updateContainerState(contInfo.getContainerID(),
+    containerManager.updateContainerState(contInfo.getContainerID(),
         LifeCycleEvent.CREATED);
         LifeCycleEvent.CREATED);
-    mapping.updateContainerState(contInfo.getContainerID(),
+    containerManager.updateContainerState(contInfo.getContainerID(),
         LifeCycleEvent.FINALIZE);
         LifeCycleEvent.FINALIZE);
-    mapping
+    containerManager
         .updateContainerState(contInfo.getContainerID(), LifeCycleEvent.CLOSE);
         .updateContainerState(contInfo.getContainerID(), LifeCycleEvent.CLOSE);
     ContainerInfo finalContInfo = contInfo;
     ContainerInfo finalContInfo = contInfo;
     LambdaTestUtils.intercept(SCMException.class, "No entry exist for "
     LambdaTestUtils.intercept(SCMException.class, "No entry exist for "
-        + "containerId:", () -> mapping.getContainerWithPipeline(
+        + "containerId:", () -> containerManager.getContainerWithPipeline(
         finalContInfo.getContainerID()));
         finalContInfo.getContainerID()));
 
 
-    mapping.getStateManager().getContainerStateMap()
+    containerManager.getStateManager().getContainerStateMap()
         .addContainerReplica(contInfo.containerID(), dn1, dn2);
         .addContainerReplica(contInfo.containerID(), dn1, dn2);
 
 
-    contInfo = mapping.getContainer(contInfo.getContainerID());
+    contInfo = containerManager.getContainer(contInfo.getContainerID());
     Assert.assertEquals(contInfo.getState(), LifeCycleState.CLOSED);
     Assert.assertEquals(contInfo.getState(), LifeCycleState.CLOSED);
     Pipeline pipeline = containerWithPipeline.getPipeline();
     Pipeline pipeline = containerWithPipeline.getPipeline();
-    mapping.getPipelineSelector().finalizePipeline(pipeline);
+    containerManager.getPipelineSelector().finalizePipeline(pipeline);
 
 
-    ContainerWithPipeline containerWithPipeline2 = mapping
+    ContainerWithPipeline containerWithPipeline2 = containerManager
         .getContainerWithPipeline(contInfo.getContainerID());
         .getContainerWithPipeline(contInfo.getContainerID());
     pipeline = containerWithPipeline2.getPipeline();
     pipeline = containerWithPipeline2.getPipeline();
     Assert.assertNotEquals(containerWithPipeline, containerWithPipeline2);
     Assert.assertNotEquals(containerWithPipeline, containerWithPipeline2);
@@ -202,24 +201,23 @@ public class TestContainerMapping {
   @Test
   @Test
   public void testgetNoneExistentContainer() throws IOException {
   public void testgetNoneExistentContainer() throws IOException {
     thrown.expectMessage("Specified key does not exist.");
     thrown.expectMessage("Specified key does not exist.");
-    mapping.getContainer(random.nextLong());
+    containerManager.getContainer(random.nextLong());
   }
   }
 
 
   @Test
   @Test
   public void testContainerCreationLeaseTimeout() throws IOException,
   public void testContainerCreationLeaseTimeout() throws IOException,
       InterruptedException {
       InterruptedException {
     nodeManager.setChillmode(false);
     nodeManager.setChillmode(false);
-    ContainerWithPipeline containerInfo = mapping.allocateContainer(
+    ContainerWithPipeline containerInfo = containerManager.allocateContainer(
         xceiverClientManager.getType(),
         xceiverClientManager.getType(),
         xceiverClientManager.getFactor(),
         xceiverClientManager.getFactor(),
         containerOwner);
         containerOwner);
-    mapping.updateContainerState(containerInfo.getContainerInfo()
+    containerManager.updateContainerState(containerInfo.getContainerInfo()
             .getContainerID(), HddsProtos.LifeCycleEvent.CREATE);
             .getContainerID(), HddsProtos.LifeCycleEvent.CREATE);
     Thread.sleep(TIMEOUT + 1000);
     Thread.sleep(TIMEOUT + 1000);
 
 
-    NavigableSet<ContainerID> deleteContainers = mapping.getStateManager()
-        .getMatchingContainerIDs(
-            "OZONE",
+    NavigableSet<ContainerID> deleteContainers = containerManager
+        .getStateManager().getMatchingContainerIDs("OZONE",
             xceiverClientManager.getType(),
             xceiverClientManager.getType(),
             xceiverClientManager.getFactor(),
             xceiverClientManager.getFactor(),
             HddsProtos.LifeCycleState.DELETING);
             HddsProtos.LifeCycleState.DELETING);
@@ -228,7 +226,7 @@ public class TestContainerMapping {
 
 
     thrown.expect(IOException.class);
     thrown.expect(IOException.class);
     thrown.expectMessage("Lease Exception");
     thrown.expectMessage("Lease Exception");
-    mapping
+    containerManager
         .updateContainerState(containerInfo.getContainerInfo().getContainerID(),
         .updateContainerState(containerInfo.getContainerInfo().getContainerID(),
             HddsProtos.LifeCycleEvent.CREATED);
             HddsProtos.LifeCycleEvent.CREATED);
   }
   }
@@ -258,25 +256,27 @@ public class TestContainerMapping {
         .newBuilder();
         .newBuilder();
     crBuilder.addAllReports(reports);
     crBuilder.addAllReports(reports);
 
 
-    mapping.processContainerReports(datanodeDetails, crBuilder.build(), false);
+    containerManager.processContainerReports(
+        datanodeDetails, crBuilder.build(), false);
 
 
     ContainerInfo updatedContainer =
     ContainerInfo updatedContainer =
-        mapping.getContainer(info.getContainerID());
+        containerManager.getContainer(info.getContainerID());
     Assert.assertEquals(100000000L,
     Assert.assertEquals(100000000L,
         updatedContainer.getNumberOfKeys());
         updatedContainer.getNumberOfKeys());
     Assert.assertEquals(2000000000L, updatedContainer.getUsedBytes());
     Assert.assertEquals(2000000000L, updatedContainer.getUsedBytes());
 
 
     for (StorageContainerDatanodeProtocolProtos.ContainerInfo c : reports) {
     for (StorageContainerDatanodeProtocolProtos.ContainerInfo c : reports) {
       LambdaTestUtils.intercept(SCMException.class, "No entry "
       LambdaTestUtils.intercept(SCMException.class, "No entry "
-          + "exist for containerId:", () -> mapping.getStateManager()
+          + "exist for containerId:", () -> containerManager.getStateManager()
           .getContainerReplicas(ContainerID.valueof(c.getContainerID())));
           .getContainerReplicas(ContainerID.valueof(c.getContainerID())));
     }
     }
 
 
-    mapping.processContainerReports(TestUtils.randomDatanodeDetails(),
+    containerManager.processContainerReports(TestUtils.randomDatanodeDetails(),
         crBuilder.build(), true);
         crBuilder.build(), true);
     for (StorageContainerDatanodeProtocolProtos.ContainerInfo c : reports) {
     for (StorageContainerDatanodeProtocolProtos.ContainerInfo c : reports) {
-      Assert.assertTrue(mapping.getStateManager().getContainerReplicas(
-          ContainerID.valueof(c.getContainerID())).size() > 0);
+      Assert.assertTrue(containerManager.getStateManager()
+          .getContainerReplicas(
+              ContainerID.valueof(c.getContainerID())).size() > 0);
     }
     }
   }
   }
 
 
@@ -313,9 +313,10 @@ public class TestContainerMapping {
         .newBuilder();
         .newBuilder();
     crBuilder.addAllReports(reports);
     crBuilder.addAllReports(reports);
 
 
-    mapping.processContainerReports(datanodeDetails, crBuilder.build(), false);
+    containerManager.processContainerReports(
+        datanodeDetails, crBuilder.build(), false);
 
 
-    List<ContainerInfo> list = mapping.listContainer(0, 50);
+    List<ContainerInfo> list = containerManager.listContainer(0, 50);
     Assert.assertEquals(2, list.stream().filter(
     Assert.assertEquals(2, list.stream().filter(
         x -> x.getContainerID() == cID1 || x.getContainerID() == cID2).count());
         x -> x.getContainerID() == cID1 || x.getContainerID() == cID2).count());
     Assert.assertEquals(300000000L, list.stream().filter(
     Assert.assertEquals(300000000L, list.stream().filter(
@@ -329,20 +330,18 @@ public class TestContainerMapping {
   @Test
   @Test
   public void testCloseContainer() throws IOException {
   public void testCloseContainer() throws IOException {
     ContainerInfo info = createContainer();
     ContainerInfo info = createContainer();
-    mapping.updateContainerState(info.getContainerID(),
+    containerManager.updateContainerState(info.getContainerID(),
         HddsProtos.LifeCycleEvent.FINALIZE);
         HddsProtos.LifeCycleEvent.FINALIZE);
-    NavigableSet<ContainerID> pendingCloseContainers = mapping.getStateManager()
-        .getMatchingContainerIDs(
-            containerOwner,
+    NavigableSet<ContainerID> pendingCloseContainers = containerManager
+        .getStateManager().getMatchingContainerIDs(containerOwner,
             xceiverClientManager.getType(),
             xceiverClientManager.getType(),
             xceiverClientManager.getFactor(),
             xceiverClientManager.getFactor(),
             HddsProtos.LifeCycleState.CLOSING);
             HddsProtos.LifeCycleState.CLOSING);
     Assert.assertTrue(pendingCloseContainers.contains(info.containerID()));
     Assert.assertTrue(pendingCloseContainers.contains(info.containerID()));
-    mapping.updateContainerState(info.getContainerID(),
+    containerManager.updateContainerState(info.getContainerID(),
         HddsProtos.LifeCycleEvent.CLOSE);
         HddsProtos.LifeCycleEvent.CLOSE);
-    NavigableSet<ContainerID> closeContainers = mapping.getStateManager()
-        .getMatchingContainerIDs(
-            containerOwner,
+    NavigableSet<ContainerID> closeContainers = containerManager
+        .getStateManager().getMatchingContainerIDs(containerOwner,
             xceiverClientManager.getType(),
             xceiverClientManager.getType(),
             xceiverClientManager.getFactor(),
             xceiverClientManager.getFactor(),
             HddsProtos.LifeCycleState.CLOSED);
             HddsProtos.LifeCycleState.CLOSED);
@@ -350,20 +349,19 @@ public class TestContainerMapping {
   }
   }
 
 
   /**
   /**
-   * Creates a container with the given name in ContainerMapping.
+   * Creates a container with the given name in SCMContainerManager.
    * @throws IOException
    * @throws IOException
    */
    */
   private ContainerInfo createContainer()
   private ContainerInfo createContainer()
       throws IOException {
       throws IOException {
     nodeManager.setChillmode(false);
     nodeManager.setChillmode(false);
-    ContainerWithPipeline containerWithPipeline = mapping.allocateContainer(
-        xceiverClientManager.getType(),
-        xceiverClientManager.getFactor(),
-        containerOwner);
+    ContainerWithPipeline containerWithPipeline = containerManager
+        .allocateContainer(xceiverClientManager.getType(),
+            xceiverClientManager.getFactor(), containerOwner);
     ContainerInfo containerInfo = containerWithPipeline.getContainerInfo();
     ContainerInfo containerInfo = containerWithPipeline.getContainerInfo();
-    mapping.updateContainerState(containerInfo.getContainerID(),
+    containerManager.updateContainerState(containerInfo.getContainerID(),
         HddsProtos.LifeCycleEvent.CREATE);
         HddsProtos.LifeCycleEvent.CREATE);
-    mapping.updateContainerState(containerInfo.getContainerID(),
+    containerManager.updateContainerState(containerInfo.getContainerID(),
         HddsProtos.LifeCycleEvent.CREATED);
         HddsProtos.LifeCycleEvent.CREATED);
     return containerInfo;
     return containerInfo;
   }
   }
@@ -371,10 +369,10 @@ public class TestContainerMapping {
   @Test
   @Test
   public void testFlushAllContainers() throws IOException {
   public void testFlushAllContainers() throws IOException {
     ContainerInfo info = createContainer();
     ContainerInfo info = createContainer();
-    List<ContainerInfo> containers = mapping.getStateManager()
+    List<ContainerInfo> containers = containerManager.getStateManager()
         .getAllContainers();
         .getAllContainers();
     Assert.assertTrue(containers.size() > 0);
     Assert.assertTrue(containers.size() > 0);
-    mapping.flushContainerInfo();
+    containerManager.flushContainerInfo();
   }
   }
 
 
 }
 }

+ 5 - 4
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestContainerPlacement.java

@@ -24,7 +24,7 @@ import org.apache.hadoop.fs.FileUtil;
 import org.apache.hadoop.hdds.scm.ScmConfigKeys;
 import org.apache.hadoop.hdds.scm.ScmConfigKeys;
 import org.apache.hadoop.hdds.scm.TestUtils;
 import org.apache.hadoop.hdds.scm.TestUtils;
 import org.apache.hadoop.hdds.scm.XceiverClientManager;
 import org.apache.hadoop.hdds.scm.XceiverClientManager;
-import org.apache.hadoop.hdds.scm.container.ContainerMapping;
+import org.apache.hadoop.hdds.scm.container.SCMContainerManager;
 import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline;
 import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerWithPipeline;
 import org.apache.hadoop.hdds.scm.container.placement.algorithms
 import org.apache.hadoop.hdds.scm.container.placement.algorithms
     .ContainerPlacementPolicy;
     .ContainerPlacementPolicy;
@@ -97,12 +97,13 @@ public class TestContainerPlacement {
     return nodeManager;
     return nodeManager;
   }
   }
 
 
-  ContainerMapping createContainerManager(Configuration config,
+  SCMContainerManager createContainerManager(Configuration config,
       NodeManager scmNodeManager) throws IOException {
       NodeManager scmNodeManager) throws IOException {
     EventQueue eventQueue = new EventQueue();
     EventQueue eventQueue = new EventQueue();
     final int cacheSize = config.getInt(OZONE_SCM_DB_CACHE_SIZE_MB,
     final int cacheSize = config.getInt(OZONE_SCM_DB_CACHE_SIZE_MB,
         OZONE_SCM_DB_CACHE_SIZE_DEFAULT);
         OZONE_SCM_DB_CACHE_SIZE_DEFAULT);
-    return new ContainerMapping(config, scmNodeManager, cacheSize, eventQueue);
+    return new SCMContainerManager(config, scmNodeManager, cacheSize,
+        eventQueue);
 
 
   }
   }
 
 
@@ -131,7 +132,7 @@ public class TestContainerPlacement {
         SCMContainerPlacementCapacity.class, ContainerPlacementPolicy.class);
         SCMContainerPlacementCapacity.class, ContainerPlacementPolicy.class);
 
 
     SCMNodeManager nodeManager = createNodeManager(conf);
     SCMNodeManager nodeManager = createNodeManager(conf);
-    ContainerMapping containerManager =
+    SCMContainerManager containerManager =
         createContainerManager(conf, nodeManager);
         createContainerManager(conf, nodeManager);
     List<DatanodeDetails> datanodes =
     List<DatanodeDetails> datanodes =
         TestUtils.getListOfRegisteredDatanodeDetails(nodeManager, nodeCount);
         TestUtils.getListOfRegisteredDatanodeDetails(nodeManager, nodeCount);

+ 2 - 2
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/node/TestDeadNodeHandler.java

@@ -31,8 +31,8 @@ import org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolPro
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.StorageReportProto;
 import org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.StorageReportProto;
 import org.apache.hadoop.hdds.scm.TestUtils;
 import org.apache.hadoop.hdds.scm.TestUtils;
 import org.apache.hadoop.hdds.scm.container.ContainerID;
 import org.apache.hadoop.hdds.scm.container.ContainerID;
+import org.apache.hadoop.hdds.scm.container.ContainerManager;
 import org.apache.hadoop.hdds.scm.container.ContainerStateManager;
 import org.apache.hadoop.hdds.scm.container.ContainerStateManager;
-import org.apache.hadoop.hdds.scm.container.Mapping;
 import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerInfo;
 import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerInfo;
 import org.apache.hadoop.hdds.scm.container.placement.metrics.SCMNodeMetric;
 import org.apache.hadoop.hdds.scm.container.placement.metrics.SCMNodeMetric;
 import org.apache.hadoop.hdds.scm.container.replication.ReplicationRequest;
 import org.apache.hadoop.hdds.scm.container.replication.ReplicationRequest;
@@ -69,7 +69,7 @@ public class TestDeadNodeHandler {
   public void setup() throws IOException {
   public void setup() throws IOException {
     OzoneConfiguration conf = new OzoneConfiguration();
     OzoneConfiguration conf = new OzoneConfiguration();
     containerStateManager = new ContainerStateManager(conf,
     containerStateManager = new ContainerStateManager(conf,
-        Mockito.mock(Mapping.class),
+        Mockito.mock(ContainerManager.class),
         Mockito.mock(PipelineSelector.class));
         Mockito.mock(PipelineSelector.class));
     eventQueue = new EventQueue();
     eventQueue = new EventQueue();
     nodeManager = new SCMNodeManager(conf, "cluster1", null, eventQueue);
     nodeManager = new SCMNodeManager(conf, "cluster1", null, eventQueue);

+ 6 - 6
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/ozone/container/TestCloseContainerWatcher.java

@@ -27,7 +27,7 @@ import org.apache.hadoop.hdds.scm.container.CloseContainerEventHandler
     .CloseContainerRetryableReq;
     .CloseContainerRetryableReq;
 import org.apache.hadoop.hdds.scm.container.CloseContainerWatcher;
 import org.apache.hadoop.hdds.scm.container.CloseContainerWatcher;
 import org.apache.hadoop.hdds.scm.container.ContainerID;
 import org.apache.hadoop.hdds.scm.container.ContainerID;
-import org.apache.hadoop.hdds.scm.container.ContainerMapping;
+import org.apache.hadoop.hdds.scm.container.SCMContainerManager;
 import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerInfo;
 import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerInfo;
 import org.apache.hadoop.hdds.scm.events.SCMEvents;
 import org.apache.hadoop.hdds.scm.events.SCMEvents;
 import org.apache.hadoop.hdds.server.events.EventHandler;
 import org.apache.hadoop.hdds.server.events.EventHandler;
@@ -61,8 +61,8 @@ public class TestCloseContainerWatcher implements EventHandler<ContainerID> {
   private static EventWatcher<CloseContainerRetryableReq, CloseContainerStatus>
   private static EventWatcher<CloseContainerRetryableReq, CloseContainerStatus>
       watcher;
       watcher;
   private static LeaseManager<Long> leaseManager;
   private static LeaseManager<Long> leaseManager;
-  private static ContainerMapping containerMapping = Mockito
-      .mock(ContainerMapping.class);
+  private static SCMContainerManager containerManager = Mockito
+      .mock(SCMContainerManager.class);
   private static EventQueue queue;
   private static EventQueue queue;
   @Rule
   @Rule
   public Timeout timeout = new Timeout(1000*15);
   public Timeout timeout = new Timeout(1000*15);
@@ -230,7 +230,7 @@ public class TestCloseContainerWatcher implements EventHandler<ContainerID> {
         time);
         time);
     leaseManager.start();
     leaseManager.start();
     watcher = new CloseContainerWatcher(SCMEvents.CLOSE_CONTAINER_RETRYABLE_REQ,
     watcher = new CloseContainerWatcher(SCMEvents.CLOSE_CONTAINER_RETRYABLE_REQ,
-        SCMEvents.CLOSE_CONTAINER_STATUS, leaseManager, containerMapping);
+        SCMEvents.CLOSE_CONTAINER_STATUS, leaseManager, containerManager);
     queue = new EventQueue();
     queue = new EventQueue();
     watcher.start(queue);
     watcher.start(queue);
   }
   }
@@ -274,8 +274,8 @@ public class TestCloseContainerWatcher implements EventHandler<ContainerID> {
       throws IOException {
       throws IOException {
     ContainerInfo containerInfo = Mockito.mock(ContainerInfo.class);
     ContainerInfo containerInfo = Mockito.mock(ContainerInfo.class);
     ContainerInfo containerInfo2 = Mockito.mock(ContainerInfo.class);
     ContainerInfo containerInfo2 = Mockito.mock(ContainerInfo.class);
-    when(containerMapping.getContainer(id1)).thenReturn(containerInfo);
-    when(containerMapping.getContainer(id2)).thenReturn(containerInfo2);
+    when(containerManager.getContainer(id1)).thenReturn(containerInfo);
+    when(containerManager.getContainer(id2)).thenReturn(containerInfo2);
     when(containerInfo.isContainerOpen()).thenReturn(true);
     when(containerInfo.isContainerOpen()).thenReturn(true);
     when(containerInfo2.isContainerOpen()).thenReturn(isOpen);
     when(containerInfo2.isContainerOpen()).thenReturn(isOpen);
   }
   }

+ 26 - 26
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/container/TestContainerStateManagerIntegration.java

@@ -55,7 +55,7 @@ public class TestContainerStateManagerIntegration {
   private MiniOzoneCluster cluster;
   private MiniOzoneCluster cluster;
   private XceiverClientManager xceiverClientManager;
   private XceiverClientManager xceiverClientManager;
   private StorageContainerManager scm;
   private StorageContainerManager scm;
-  private ContainerMapping scmContainerMapping;
+  private ContainerManager containerManager;
   private ContainerStateManager containerStateManager;
   private ContainerStateManager containerStateManager;
   private PipelineSelector selector;
   private PipelineSelector selector;
   private String containerOwner = "OZONE";
   private String containerOwner = "OZONE";
@@ -69,9 +69,9 @@ public class TestContainerStateManagerIntegration {
     cluster.waitTobeOutOfChillMode();
     cluster.waitTobeOutOfChillMode();
     xceiverClientManager = new XceiverClientManager(conf);
     xceiverClientManager = new XceiverClientManager(conf);
     scm = cluster.getStorageContainerManager();
     scm = cluster.getStorageContainerManager();
-    scmContainerMapping = (ContainerMapping) scm.getScmContainerManager();
-    containerStateManager = scmContainerMapping.getStateManager();
-    selector = scmContainerMapping.getPipelineSelector();
+    containerManager = scm.getContainerManager();
+    containerStateManager = containerManager.getStateManager();
+    selector = containerManager.getPipelineSelector();
   }
   }
 
 
   @After
   @After
@@ -128,7 +128,7 @@ public class TestContainerStateManagerIntegration {
               xceiverClientManager.getFactor(), containerOwner);
               xceiverClientManager.getFactor(), containerOwner);
       containers.add(container.getContainerInfo());
       containers.add(container.getContainerInfo());
       if (i >= 5) {
       if (i >= 5) {
-        scm.getScmContainerManager().updateContainerState(container
+        scm.getContainerManager().updateContainerState(container
                 .getContainerInfo().getContainerID(),
                 .getContainerInfo().getContainerID(),
             HddsProtos.LifeCycleEvent.CREATE);
             HddsProtos.LifeCycleEvent.CREATE);
       }
       }
@@ -137,7 +137,7 @@ public class TestContainerStateManagerIntegration {
     // New instance of ContainerStateManager should load all the containers in
     // New instance of ContainerStateManager should load all the containers in
     // container store.
     // container store.
     ContainerStateManager stateManager =
     ContainerStateManager stateManager =
-        new ContainerStateManager(conf, scmContainerMapping, selector);
+        new ContainerStateManager(conf, containerManager, selector);
     int matchCount = stateManager
     int matchCount = stateManager
         .getMatchingContainerIDs(containerOwner,
         .getMatchingContainerIDs(containerOwner,
             xceiverClientManager.getType(), xceiverClientManager.getFactor(),
             xceiverClientManager.getType(), xceiverClientManager.getFactor(),
@@ -154,10 +154,10 @@ public class TestContainerStateManagerIntegration {
     ContainerWithPipeline container1 = scm.getClientProtocolServer().
     ContainerWithPipeline container1 = scm.getClientProtocolServer().
         allocateContainer(xceiverClientManager.getType(),
         allocateContainer(xceiverClientManager.getType(),
             xceiverClientManager.getFactor(), containerOwner);
             xceiverClientManager.getFactor(), containerOwner);
-    scmContainerMapping
+    containerManager
         .updateContainerState(container1.getContainerInfo().getContainerID(),
         .updateContainerState(container1.getContainerInfo().getContainerID(),
             HddsProtos.LifeCycleEvent.CREATE);
             HddsProtos.LifeCycleEvent.CREATE);
-    scmContainerMapping
+    containerManager
         .updateContainerState(container1.getContainerInfo().getContainerID(),
         .updateContainerState(container1.getContainerInfo().getContainerID(),
             HddsProtos.LifeCycleEvent.CREATED);
             HddsProtos.LifeCycleEvent.CREATED);
 
 
@@ -179,10 +179,10 @@ public class TestContainerStateManagerIntegration {
     Assert.assertEquals(container2.getContainerInfo().getContainerID(),
     Assert.assertEquals(container2.getContainerInfo().getContainerID(),
         info.getContainerID());
         info.getContainerID());
 
 
-    scmContainerMapping
+    containerManager
         .updateContainerState(container2.getContainerInfo().getContainerID(),
         .updateContainerState(container2.getContainerInfo().getContainerID(),
             HddsProtos.LifeCycleEvent.CREATE);
             HddsProtos.LifeCycleEvent.CREATE);
-    scmContainerMapping
+    containerManager
         .updateContainerState(container2.getContainerInfo().getContainerID(),
         .updateContainerState(container2.getContainerInfo().getContainerID(),
             HddsProtos.LifeCycleEvent.CREATED);
             HddsProtos.LifeCycleEvent.CREATED);
 
 
@@ -216,7 +216,7 @@ public class TestContainerStateManagerIntegration {
         HddsProtos.LifeCycleState.ALLOCATED).size();
         HddsProtos.LifeCycleState.ALLOCATED).size();
     Assert.assertEquals(1, containers);
     Assert.assertEquals(1, containers);
 
 
-    scmContainerMapping
+    containerManager
         .updateContainerState(container1.getContainerInfo().getContainerID(),
         .updateContainerState(container1.getContainerInfo().getContainerID(),
             HddsProtos.LifeCycleEvent.CREATE);
             HddsProtos.LifeCycleEvent.CREATE);
     containers = containerStateManager.getMatchingContainerIDs(containerOwner,
     containers = containerStateManager.getMatchingContainerIDs(containerOwner,
@@ -224,7 +224,7 @@ public class TestContainerStateManagerIntegration {
         HddsProtos.LifeCycleState.CREATING).size();
         HddsProtos.LifeCycleState.CREATING).size();
     Assert.assertEquals(1, containers);
     Assert.assertEquals(1, containers);
 
 
-    scmContainerMapping
+    containerManager
         .updateContainerState(container1.getContainerInfo().getContainerID(),
         .updateContainerState(container1.getContainerInfo().getContainerID(),
             HddsProtos.LifeCycleEvent.CREATED);
             HddsProtos.LifeCycleEvent.CREATED);
     containers = containerStateManager.getMatchingContainerIDs(containerOwner,
     containers = containerStateManager.getMatchingContainerIDs(containerOwner,
@@ -232,7 +232,7 @@ public class TestContainerStateManagerIntegration {
         HddsProtos.LifeCycleState.OPEN).size();
         HddsProtos.LifeCycleState.OPEN).size();
     Assert.assertEquals(1, containers);
     Assert.assertEquals(1, containers);
 
 
-    scmContainerMapping
+    containerManager
         .updateContainerState(container1.getContainerInfo().getContainerID(),
         .updateContainerState(container1.getContainerInfo().getContainerID(),
             HddsProtos.LifeCycleEvent.FINALIZE);
             HddsProtos.LifeCycleEvent.FINALIZE);
     containers = containerStateManager.getMatchingContainerIDs(containerOwner,
     containers = containerStateManager.getMatchingContainerIDs(containerOwner,
@@ -240,7 +240,7 @@ public class TestContainerStateManagerIntegration {
         HddsProtos.LifeCycleState.CLOSING).size();
         HddsProtos.LifeCycleState.CLOSING).size();
     Assert.assertEquals(1, containers);
     Assert.assertEquals(1, containers);
 
 
-    scmContainerMapping
+    containerManager
         .updateContainerState(container1.getContainerInfo().getContainerID(),
         .updateContainerState(container1.getContainerInfo().getContainerID(),
             HddsProtos.LifeCycleEvent.CLOSE);
             HddsProtos.LifeCycleEvent.CLOSE);
     containers = containerStateManager.getMatchingContainerIDs(containerOwner,
     containers = containerStateManager.getMatchingContainerIDs(containerOwner,
@@ -248,7 +248,7 @@ public class TestContainerStateManagerIntegration {
         HddsProtos.LifeCycleState.CLOSED).size();
         HddsProtos.LifeCycleState.CLOSED).size();
     Assert.assertEquals(1, containers);
     Assert.assertEquals(1, containers);
 
 
-    scmContainerMapping
+    containerManager
         .updateContainerState(container1.getContainerInfo().getContainerID(),
         .updateContainerState(container1.getContainerInfo().getContainerID(),
             HddsProtos.LifeCycleEvent.DELETE);
             HddsProtos.LifeCycleEvent.DELETE);
     containers = containerStateManager.getMatchingContainerIDs(containerOwner,
     containers = containerStateManager.getMatchingContainerIDs(containerOwner,
@@ -256,7 +256,7 @@ public class TestContainerStateManagerIntegration {
         HddsProtos.LifeCycleState.DELETING).size();
         HddsProtos.LifeCycleState.DELETING).size();
     Assert.assertEquals(1, containers);
     Assert.assertEquals(1, containers);
 
 
-    scmContainerMapping
+    containerManager
         .updateContainerState(container1.getContainerInfo().getContainerID(),
         .updateContainerState(container1.getContainerInfo().getContainerID(),
             HddsProtos.LifeCycleEvent.CLEANUP);
             HddsProtos.LifeCycleEvent.CLEANUP);
     containers = containerStateManager.getMatchingContainerIDs(containerOwner,
     containers = containerStateManager.getMatchingContainerIDs(containerOwner,
@@ -270,10 +270,10 @@ public class TestContainerStateManagerIntegration {
         .allocateContainer(
         .allocateContainer(
             xceiverClientManager.getType(),
             xceiverClientManager.getType(),
             xceiverClientManager.getFactor(), containerOwner);
             xceiverClientManager.getFactor(), containerOwner);
-    scmContainerMapping
+    containerManager
         .updateContainerState(container2.getContainerInfo().getContainerID(),
         .updateContainerState(container2.getContainerInfo().getContainerID(),
             HddsProtos.LifeCycleEvent.CREATE);
             HddsProtos.LifeCycleEvent.CREATE);
-    scmContainerMapping
+    containerManager
         .updateContainerState(container2.getContainerInfo().getContainerID(),
         .updateContainerState(container2.getContainerInfo().getContainerID(),
             HddsProtos.LifeCycleEvent.TIMEOUT);
             HddsProtos.LifeCycleEvent.TIMEOUT);
     containers = containerStateManager.getMatchingContainerIDs(containerOwner,
     containers = containerStateManager.getMatchingContainerIDs(containerOwner,
@@ -287,16 +287,16 @@ public class TestContainerStateManagerIntegration {
         .allocateContainer(
         .allocateContainer(
             xceiverClientManager.getType(),
             xceiverClientManager.getType(),
             xceiverClientManager.getFactor(), containerOwner);
             xceiverClientManager.getFactor(), containerOwner);
-    scmContainerMapping
+    containerManager
         .updateContainerState(container3.getContainerInfo().getContainerID(),
         .updateContainerState(container3.getContainerInfo().getContainerID(),
             HddsProtos.LifeCycleEvent.CREATE);
             HddsProtos.LifeCycleEvent.CREATE);
-    scmContainerMapping
+    containerManager
         .updateContainerState(container3.getContainerInfo().getContainerID(),
         .updateContainerState(container3.getContainerInfo().getContainerID(),
             HddsProtos.LifeCycleEvent.CREATED);
             HddsProtos.LifeCycleEvent.CREATED);
-    scmContainerMapping
+    containerManager
         .updateContainerState(container3.getContainerInfo().getContainerID(),
         .updateContainerState(container3.getContainerInfo().getContainerID(),
             HddsProtos.LifeCycleEvent.FINALIZE);
             HddsProtos.LifeCycleEvent.FINALIZE);
-    scmContainerMapping
+    containerManager
         .updateContainerState(container3.getContainerInfo().getContainerID(),
         .updateContainerState(container3.getContainerInfo().getContainerID(),
             HddsProtos.LifeCycleEvent.CLOSE);
             HddsProtos.LifeCycleEvent.CLOSE);
     containers = containerStateManager.getMatchingContainerIDs(containerOwner,
     containers = containerStateManager.getMatchingContainerIDs(containerOwner,
@@ -310,10 +310,10 @@ public class TestContainerStateManagerIntegration {
     ContainerWithPipeline container1 = scm.getClientProtocolServer()
     ContainerWithPipeline container1 = scm.getClientProtocolServer()
         .allocateContainer(xceiverClientManager.getType(),
         .allocateContainer(xceiverClientManager.getType(),
         xceiverClientManager.getFactor(), containerOwner);
         xceiverClientManager.getFactor(), containerOwner);
-    scmContainerMapping.updateContainerState(container1
+    containerManager.updateContainerState(container1
             .getContainerInfo().getContainerID(),
             .getContainerInfo().getContainerID(),
         HddsProtos.LifeCycleEvent.CREATE);
         HddsProtos.LifeCycleEvent.CREATE);
-    scmContainerMapping.updateContainerState(container1
+    containerManager.updateContainerState(container1
             .getContainerInfo().getContainerID(),
             .getContainerInfo().getContainerID(),
         HddsProtos.LifeCycleEvent.CREATED);
         HddsProtos.LifeCycleEvent.CREATED);
 
 
@@ -330,8 +330,8 @@ public class TestContainerStateManagerIntegration {
       Assert.assertEquals(container1.getContainerInfo().getContainerID(),
       Assert.assertEquals(container1.getContainerInfo().getContainerID(),
           info.getContainerID());
           info.getContainerID());
 
 
-      ContainerMapping containerMapping =
-          (ContainerMapping) scmContainerMapping;
+      SCMContainerManager containerMapping =
+          (SCMContainerManager) containerManager;
       // manually trigger a flush, this will persist the allocated bytes value
       // manually trigger a flush, this will persist the allocated bytes value
       // to disk
       // to disk
       containerMapping.flushContainerInfo();
       containerMapping.flushContainerInfo();

+ 11 - 10
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestNode2PipelineMap.java

@@ -21,7 +21,7 @@ import org.apache.hadoop.hdds.conf.OzoneConfiguration;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import org.apache.hadoop.hdds.scm.container.ContainerID;
 import org.apache.hadoop.hdds.scm.container.ContainerID;
-import org.apache.hadoop.hdds.scm.container.ContainerMapping;
+import org.apache.hadoop.hdds.scm.container.ContainerManager;
 import org.apache.hadoop.hdds.scm.container.common.helpers
 import org.apache.hadoop.hdds.scm.container.common.helpers
     .ContainerWithPipeline;
     .ContainerWithPipeline;
 import org.apache.hadoop.hdds.scm.container.common.helpers.PipelineID;
 import org.apache.hadoop.hdds.scm.container.common.helpers.PipelineID;
@@ -51,7 +51,7 @@ public class TestNode2PipelineMap {
   private static StorageContainerManager scm;
   private static StorageContainerManager scm;
   private static ContainerWithPipeline ratisContainer;
   private static ContainerWithPipeline ratisContainer;
   private static ContainerStateMap stateMap;
   private static ContainerStateMap stateMap;
-  private static ContainerMapping mapping;
+  private static ContainerManager containerManager;
   private static PipelineSelector pipelineSelector;
   private static PipelineSelector pipelineSelector;
 
 
   /**
   /**
@@ -65,10 +65,11 @@ public class TestNode2PipelineMap {
     cluster = MiniOzoneCluster.newBuilder(conf).setNumDatanodes(5).build();
     cluster = MiniOzoneCluster.newBuilder(conf).setNumDatanodes(5).build();
     cluster.waitForClusterToBeReady();
     cluster.waitForClusterToBeReady();
     scm = cluster.getStorageContainerManager();
     scm = cluster.getStorageContainerManager();
-    mapping = (ContainerMapping)scm.getScmContainerManager();
-    stateMap = mapping.getStateManager().getContainerStateMap();
-    ratisContainer = mapping.allocateContainer(RATIS, THREE, "testOwner");
-    pipelineSelector = mapping.getPipelineSelector();
+    containerManager = scm.getContainerManager();
+    stateMap = containerManager.getStateManager().getContainerStateMap();
+    ratisContainer = containerManager.allocateContainer(
+        RATIS, THREE, "testOwner");
+    pipelineSelector = containerManager.getPipelineSelector();
   }
   }
 
 
   /**
   /**
@@ -106,13 +107,13 @@ public class TestNode2PipelineMap {
 
 
     // Now close the container and it should not show up while fetching
     // Now close the container and it should not show up while fetching
     // containers by pipeline
     // containers by pipeline
-    mapping
+    containerManager
         .updateContainerState(cId, HddsProtos.LifeCycleEvent.CREATE);
         .updateContainerState(cId, HddsProtos.LifeCycleEvent.CREATE);
-    mapping
+    containerManager
         .updateContainerState(cId, HddsProtos.LifeCycleEvent.CREATED);
         .updateContainerState(cId, HddsProtos.LifeCycleEvent.CREATED);
-    mapping
+    containerManager
         .updateContainerState(cId, HddsProtos.LifeCycleEvent.FINALIZE);
         .updateContainerState(cId, HddsProtos.LifeCycleEvent.FINALIZE);
-    mapping
+    containerManager
         .updateContainerState(cId, HddsProtos.LifeCycleEvent.CLOSE);
         .updateContainerState(cId, HddsProtos.LifeCycleEvent.CLOSE);
     Set<ContainerID> set2 = pipelineSelector.getOpenContainerIDsByPipeline(
     Set<ContainerID> set2 = pipelineSelector.getOpenContainerIDsByPipeline(
         ratisContainer.getPipeline().getId());
         ratisContainer.getPipeline().getId());

+ 10 - 8
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestNodeFailure.java

@@ -22,7 +22,7 @@ import org.apache.hadoop.hdds.conf.OzoneConfiguration;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import org.apache.hadoop.hdds.scm.ScmConfigKeys;
 import org.apache.hadoop.hdds.scm.ScmConfigKeys;
-import org.apache.hadoop.hdds.scm.container.ContainerMapping;
+import org.apache.hadoop.hdds.scm.container.ContainerManager;
 import org.apache.hadoop.hdds.scm.container.common.helpers
 import org.apache.hadoop.hdds.scm.container.common.helpers
     .ContainerWithPipeline;
     .ContainerWithPipeline;
 import org.apache.hadoop.hdds.scm.container.common.helpers.Pipeline;
 import org.apache.hadoop.hdds.scm.container.common.helpers.Pipeline;
@@ -52,7 +52,7 @@ public class TestNodeFailure {
   private static OzoneConfiguration conf;
   private static OzoneConfiguration conf;
   private static ContainerWithPipeline ratisContainer1;
   private static ContainerWithPipeline ratisContainer1;
   private static ContainerWithPipeline ratisContainer2;
   private static ContainerWithPipeline ratisContainer2;
-  private static ContainerMapping mapping;
+  private static ContainerManager containerManager;
   private static long timeForFailure;
   private static long timeForFailure;
 
 
   /**
   /**
@@ -75,9 +75,11 @@ public class TestNodeFailure {
         .build();
         .build();
     cluster.waitForClusterToBeReady();
     cluster.waitForClusterToBeReady();
     StorageContainerManager scm = cluster.getStorageContainerManager();
     StorageContainerManager scm = cluster.getStorageContainerManager();
-    mapping = (ContainerMapping)scm.getScmContainerManager();
-    ratisContainer1 = mapping.allocateContainer(RATIS, THREE, "testOwner");
-    ratisContainer2 = mapping.allocateContainer(RATIS, THREE, "testOwner");
+    containerManager = scm.getContainerManager();
+    ratisContainer1 = containerManager.allocateContainer(
+        RATIS, THREE, "testOwner");
+    ratisContainer2 = containerManager.allocateContainer(
+        RATIS, THREE, "testOwner");
     // At this stage, there should be 2 pipeline one with 1 open container each.
     // At this stage, there should be 2 pipeline one with 1 open container each.
     // Try closing the both the pipelines, one with a closed container and
     // Try closing the both the pipelines, one with a closed container and
     // the other with an open container.
     // the other with an open container.
@@ -113,12 +115,12 @@ public class TestNodeFailure {
         ratisContainer1.getPipeline().getLifeCycleState());
         ratisContainer1.getPipeline().getLifeCycleState());
     Assert.assertEquals(HddsProtos.LifeCycleState.OPEN,
     Assert.assertEquals(HddsProtos.LifeCycleState.OPEN,
         ratisContainer2.getPipeline().getLifeCycleState());
         ratisContainer2.getPipeline().getLifeCycleState());
-    Assert.assertNull(
-        mapping.getPipelineSelector().getPipeline(pipelineToFail.getId()));
+    Assert.assertNull(containerManager.getPipelineSelector()
+        .getPipeline(pipelineToFail.getId()));
     // Now restart the datanode and make sure that a new pipeline is created.
     // Now restart the datanode and make sure that a new pipeline is created.
     cluster.restartHddsDatanode(dnToFail);
     cluster.restartHddsDatanode(dnToFail);
     ContainerWithPipeline ratisContainer3 =
     ContainerWithPipeline ratisContainer3 =
-        mapping.allocateContainer(RATIS, THREE, "testOwner");
+        containerManager.allocateContainer(RATIS, THREE, "testOwner");
     //Assert that new container is not created from the ratis 2 pipeline
     //Assert that new container is not created from the ratis 2 pipeline
     Assert.assertNotEquals(ratisContainer3.getPipeline().getId(),
     Assert.assertNotEquals(ratisContainer3.getPipeline().getId(),
         ratisContainer2.getPipeline().getId());
         ratisContainer2.getPipeline().getId());

+ 15 - 13
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestPipelineClose.java

@@ -21,7 +21,7 @@ import org.apache.hadoop.hdds.conf.OzoneConfiguration;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import org.apache.hadoop.hdds.scm.container.ContainerID;
 import org.apache.hadoop.hdds.scm.container.ContainerID;
-import org.apache.hadoop.hdds.scm.container.ContainerMapping;
+import org.apache.hadoop.hdds.scm.container.ContainerManager;
 import org.apache.hadoop.hdds.scm.container.common.helpers
 import org.apache.hadoop.hdds.scm.container.common.helpers
     .ContainerWithPipeline;
     .ContainerWithPipeline;
 import org.apache.hadoop.hdds.scm.container.common.helpers.Pipeline;
 import org.apache.hadoop.hdds.scm.container.common.helpers.Pipeline;
@@ -51,7 +51,7 @@ public class TestPipelineClose {
   private static ContainerWithPipeline ratisContainer1;
   private static ContainerWithPipeline ratisContainer1;
   private static ContainerWithPipeline ratisContainer2;
   private static ContainerWithPipeline ratisContainer2;
   private static ContainerStateMap stateMap;
   private static ContainerStateMap stateMap;
-  private static ContainerMapping mapping;
+  private static ContainerManager containerManager;
   private static PipelineSelector pipelineSelector;
   private static PipelineSelector pipelineSelector;
 
 
   /**
   /**
@@ -65,11 +65,13 @@ public class TestPipelineClose {
     cluster = MiniOzoneCluster.newBuilder(conf).setNumDatanodes(6).build();
     cluster = MiniOzoneCluster.newBuilder(conf).setNumDatanodes(6).build();
     cluster.waitForClusterToBeReady();
     cluster.waitForClusterToBeReady();
     scm = cluster.getStorageContainerManager();
     scm = cluster.getStorageContainerManager();
-    mapping = (ContainerMapping)scm.getScmContainerManager();
-    stateMap = mapping.getStateManager().getContainerStateMap();
-    ratisContainer1 = mapping.allocateContainer(RATIS, THREE, "testOwner");
-    ratisContainer2 = mapping.allocateContainer(RATIS, THREE, "testOwner");
-    pipelineSelector = mapping.getPipelineSelector();
+    containerManager = scm.getContainerManager();
+    stateMap = containerManager.getStateManager().getContainerStateMap();
+    ratisContainer1 = containerManager
+        .allocateContainer(RATIS, THREE, "testOwner");
+    ratisContainer2 = containerManager
+        .allocateContainer(RATIS, THREE, "testOwner");
+    pipelineSelector = containerManager.getPipelineSelector();
     // At this stage, there should be 2 pipeline one with 1 open container each.
     // At this stage, there should be 2 pipeline one with 1 open container each.
     // Try closing the both the pipelines, one with a closed container and
     // Try closing the both the pipelines, one with a closed container and
     // the other with an open container.
     // the other with an open container.
@@ -98,13 +100,13 @@ public class TestPipelineClose {
 
 
     // Now close the container and it should not show up while fetching
     // Now close the container and it should not show up while fetching
     // containers by pipeline
     // containers by pipeline
-    mapping
+    containerManager
         .updateContainerState(cId, HddsProtos.LifeCycleEvent.CREATE);
         .updateContainerState(cId, HddsProtos.LifeCycleEvent.CREATE);
-    mapping
+    containerManager
         .updateContainerState(cId, HddsProtos.LifeCycleEvent.CREATED);
         .updateContainerState(cId, HddsProtos.LifeCycleEvent.CREATED);
-    mapping
+    containerManager
         .updateContainerState(cId, HddsProtos.LifeCycleEvent.FINALIZE);
         .updateContainerState(cId, HddsProtos.LifeCycleEvent.FINALIZE);
-    mapping
+    containerManager
         .updateContainerState(cId, HddsProtos.LifeCycleEvent.CLOSE);
         .updateContainerState(cId, HddsProtos.LifeCycleEvent.CLOSE);
 
 
     Set<ContainerID> setClosed = pipelineSelector.getOpenContainerIDsByPipeline(
     Set<ContainerID> setClosed = pipelineSelector.getOpenContainerIDsByPipeline(
@@ -132,9 +134,9 @@ public class TestPipelineClose {
     Assert.assertEquals(1, setOpen.size());
     Assert.assertEquals(1, setOpen.size());
 
 
     long cId2 = ratisContainer2.getContainerInfo().getContainerID();
     long cId2 = ratisContainer2.getContainerInfo().getContainerID();
-    mapping
+    containerManager
         .updateContainerState(cId2, HddsProtos.LifeCycleEvent.CREATE);
         .updateContainerState(cId2, HddsProtos.LifeCycleEvent.CREATE);
-    mapping
+    containerManager
         .updateContainerState(cId2, HddsProtos.LifeCycleEvent.CREATED);
         .updateContainerState(cId2, HddsProtos.LifeCycleEvent.CREATED);
     pipelineSelector.finalizePipeline(ratisContainer2.getPipeline());
     pipelineSelector.finalizePipeline(ratisContainer2.getPipeline());
     Assert.assertEquals(ratisContainer2.getPipeline().getLifeCycleState(),
     Assert.assertEquals(ratisContainer2.getPipeline().getLifeCycleState(),

+ 16 - 17
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestSCMRestart.java

@@ -20,7 +20,7 @@ package org.apache.hadoop.hdds.scm.pipeline;
 
 
 import org.apache.hadoop.hdds.conf.OzoneConfiguration;
 import org.apache.hadoop.hdds.conf.OzoneConfiguration;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
 import org.apache.hadoop.hdds.protocol.DatanodeDetails;
-import org.apache.hadoop.hdds.scm.container.ContainerMapping;
+import org.apache.hadoop.hdds.scm.container.ContainerManager;
 import org.apache.hadoop.hdds.scm.container.common.helpers.Pipeline;
 import org.apache.hadoop.hdds.scm.container.common.helpers.Pipeline;
 import org.apache.hadoop.hdds.scm.server.StorageContainerManager;
 import org.apache.hadoop.hdds.scm.server.StorageContainerManager;
 import org.apache.hadoop.ozone.MiniOzoneCluster;
 import org.apache.hadoop.ozone.MiniOzoneCluster;
@@ -46,8 +46,8 @@ public class TestSCMRestart {
   private static OzoneConfiguration conf;
   private static OzoneConfiguration conf;
   private static Pipeline ratisPipeline1;
   private static Pipeline ratisPipeline1;
   private static Pipeline ratisPipeline2;
   private static Pipeline ratisPipeline2;
-  private static ContainerMapping mapping;
-  private static ContainerMapping newMapping;
+  private static ContainerManager containerManager;
+  private static ContainerManager newContainerManager;
 
 
   /**
   /**
    * Create a MiniDFSCluster for testing.
    * Create a MiniDFSCluster for testing.
@@ -64,17 +64,17 @@ public class TestSCMRestart {
         .build();
         .build();
     cluster.waitForClusterToBeReady();
     cluster.waitForClusterToBeReady();
     StorageContainerManager scm = cluster.getStorageContainerManager();
     StorageContainerManager scm = cluster.getStorageContainerManager();
-    mapping = (ContainerMapping)scm.getScmContainerManager();
-    ratisPipeline1 =
-            mapping.allocateContainer(RATIS, THREE, "Owner1").getPipeline();
-    ratisPipeline2 =
-            mapping.allocateContainer(RATIS, ONE, "Owner2").getPipeline();
+    containerManager = scm.getContainerManager();
+    ratisPipeline1 = containerManager.allocateContainer(
+        RATIS, THREE, "Owner1").getPipeline();
+    ratisPipeline2 = containerManager.allocateContainer(
+        RATIS, ONE, "Owner2").getPipeline();
     // At this stage, there should be 2 pipeline one with 1 open container
     // At this stage, there should be 2 pipeline one with 1 open container
     // each. Try restarting the SCM and then discover that pipeline are in
     // each. Try restarting the SCM and then discover that pipeline are in
     // correct state.
     // correct state.
     cluster.restartStorageContainerManager();
     cluster.restartStorageContainerManager();
-    newMapping = (ContainerMapping)(cluster.getStorageContainerManager()
-            .getScmContainerManager());
+    newContainerManager = cluster.getStorageContainerManager()
+        .getContainerManager();
   }
   }
 
 
   /**
   /**
@@ -90,10 +90,10 @@ public class TestSCMRestart {
   @Test
   @Test
   public void testPipelineWithScmRestart() throws IOException {
   public void testPipelineWithScmRestart() throws IOException {
     // After restart make sure that the pipeline are still present
     // After restart make sure that the pipeline are still present
-    Pipeline ratisPipeline1AfterRestart = newMapping.getPipelineSelector()
-            .getPipeline(ratisPipeline1.getId());
-    Pipeline ratisPipeline2AfterRestart = newMapping.getPipelineSelector()
-            .getPipeline(ratisPipeline2.getId());
+    Pipeline ratisPipeline1AfterRestart = newContainerManager
+        .getPipelineSelector().getPipeline(ratisPipeline1.getId());
+    Pipeline ratisPipeline2AfterRestart = newContainerManager
+        .getPipelineSelector().getPipeline(ratisPipeline2.getId());
     Assert.assertNotSame(ratisPipeline1AfterRestart, ratisPipeline1);
     Assert.assertNotSame(ratisPipeline1AfterRestart, ratisPipeline1);
     Assert.assertNotSame(ratisPipeline2AfterRestart, ratisPipeline2);
     Assert.assertNotSame(ratisPipeline2AfterRestart, ratisPipeline2);
     Assert.assertEquals(ratisPipeline1AfterRestart, ratisPipeline1);
     Assert.assertEquals(ratisPipeline1AfterRestart, ratisPipeline1);
@@ -111,9 +111,8 @@ public class TestSCMRestart {
 
 
     // Try creating a new ratis pipeline, it should be from the same pipeline
     // Try creating a new ratis pipeline, it should be from the same pipeline
     // as was before restart
     // as was before restart
-    Pipeline newRatisPipeline =
-            newMapping.allocateContainer(RATIS, THREE, "Owner1")
-                    .getPipeline();
+    Pipeline newRatisPipeline = newContainerManager
+        .allocateContainer(RATIS, THREE, "Owner1").getPipeline();
     Assert.assertEquals(newRatisPipeline.getId(), ratisPipeline1.getId());
     Assert.assertEquals(newRatisPipeline.getId(), ratisPipeline1.getId());
   }
   }
 }
 }

+ 3 - 3
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/OzoneTestUtils.java

@@ -44,13 +44,13 @@ public class OzoneTestUtils {
       StorageContainerManager scm) throws IOException {
       StorageContainerManager scm) throws IOException {
     return performOperationOnKeyContainers((blockID) -> {
     return performOperationOnKeyContainers((blockID) -> {
       try {
       try {
-        scm.getScmContainerManager()
+        scm.getContainerManager()
             .updateContainerState(blockID.getContainerID(),
             .updateContainerState(blockID.getContainerID(),
                 HddsProtos.LifeCycleEvent.FINALIZE);
                 HddsProtos.LifeCycleEvent.FINALIZE);
-        scm.getScmContainerManager()
+        scm.getContainerManager()
             .updateContainerState(blockID.getContainerID(),
             .updateContainerState(blockID.getContainerID(),
                 HddsProtos.LifeCycleEvent.CLOSE);
                 HddsProtos.LifeCycleEvent.CLOSE);
-        Assert.assertFalse(scm.getScmContainerManager()
+        Assert.assertFalse(scm.getContainerManager()
             .getContainerWithPipeline(blockID.getContainerID())
             .getContainerWithPipeline(blockID.getContainerID())
             .getContainerInfo().isContainerOpen());
             .getContainerInfo().isContainerOpen());
       } catch (IOException e) {
       } catch (IOException e) {

+ 1 - 1
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rest/TestOzoneRestClient.java

@@ -445,7 +445,7 @@ public class TestOzoneRestClient {
     // Sum the data size from chunks in Container via containerID
     // Sum the data size from chunks in Container via containerID
     // and localID, make sure the size equals to the actually value size.
     // and localID, make sure the size equals to the actually value size.
     Pipeline pipeline = cluster.getStorageContainerManager()
     Pipeline pipeline = cluster.getStorageContainerManager()
-        .getScmContainerManager().getContainerWithPipeline(containerID)
+        .getContainerManager().getContainerWithPipeline(containerID)
         .getPipeline();
         .getPipeline();
     List<DatanodeDetails> datanodes = pipeline.getMachines();
     List<DatanodeDetails> datanodes = pipeline.getMachines();
     Assert.assertEquals(datanodes.size(), 1);
     Assert.assertEquals(datanodes.size(), 1);

+ 3 - 3
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestCloseContainerHandlingByClient.java

@@ -301,7 +301,7 @@ public class TestCloseContainerHandlingByClient {
     Assert.assertTrue(!containerIdList.isEmpty());
     Assert.assertTrue(!containerIdList.isEmpty());
     for (long containerID : containerIdList) {
     for (long containerID : containerIdList) {
       Pipeline pipeline =
       Pipeline pipeline =
-          cluster.getStorageContainerManager().getScmContainerManager()
+          cluster.getStorageContainerManager().getContainerManager()
               .getContainerWithPipeline(containerID).getPipeline();
               .getContainerWithPipeline(containerID).getPipeline();
       pipelineList.add(pipeline);
       pipelineList.add(pipeline);
       List<DatanodeDetails> datanodes = pipeline.getMachines();
       List<DatanodeDetails> datanodes = pipeline.getMachines();
@@ -349,7 +349,7 @@ public class TestCloseContainerHandlingByClient {
         new ArrayList<>(groupOutputStream.getLocationInfoList());
         new ArrayList<>(groupOutputStream.getLocationInfoList());
     long containerID = locationInfos.get(0).getContainerID();
     long containerID = locationInfos.get(0).getContainerID();
     List<DatanodeDetails> datanodes =
     List<DatanodeDetails> datanodes =
-        cluster.getStorageContainerManager().getScmContainerManager()
+        cluster.getStorageContainerManager().getContainerManager()
             .getContainerWithPipeline(containerID).getPipeline().getMachines();
             .getContainerWithPipeline(containerID).getPipeline().getMachines();
     Assert.assertEquals(1, datanodes.size());
     Assert.assertEquals(1, datanodes.size());
     waitForContainerClose(keyName, key, HddsProtos.ReplicationType.STAND_ALONE);
     waitForContainerClose(keyName, key, HddsProtos.ReplicationType.STAND_ALONE);
@@ -451,7 +451,7 @@ public class TestCloseContainerHandlingByClient {
         groupOutputStream.getLocationInfoList();
         groupOutputStream.getLocationInfoList();
     long containerID = locationInfos.get(0).getContainerID();
     long containerID = locationInfos.get(0).getContainerID();
     List<DatanodeDetails> datanodes =
     List<DatanodeDetails> datanodes =
-        cluster.getStorageContainerManager().getScmContainerManager()
+        cluster.getStorageContainerManager().getContainerManager()
             .getContainerWithPipeline(containerID).getPipeline().getMachines();
             .getContainerWithPipeline(containerID).getPipeline().getMachines();
     Assert.assertEquals(1, datanodes.size());
     Assert.assertEquals(1, datanodes.size());
     // move the container on the datanode to Closing state, this will ensure
     // move the container on the datanode to Closing state, this will ensure

+ 1 - 1
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneRpcClient.java

@@ -580,7 +580,7 @@ public class TestOzoneRpcClient {
     // Second, sum the data size from chunks in Container via containerID
     // Second, sum the data size from chunks in Container via containerID
     // and localID, make sure the size equals to the size from keyDetails.
     // and localID, make sure the size equals to the size from keyDetails.
     Pipeline pipeline = cluster.getStorageContainerManager()
     Pipeline pipeline = cluster.getStorageContainerManager()
-        .getScmContainerManager().getContainerWithPipeline(containerID)
+        .getContainerManager().getContainerWithPipeline(containerID)
         .getPipeline();
         .getPipeline();
     List<DatanodeDetails> datanodes = pipeline.getMachines();
     List<DatanodeDetails> datanodes = pipeline.getMachines();
     Assert.assertEquals(datanodes.size(), 1);
     Assert.assertEquals(datanodes.size(), 1);

+ 1 - 2
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestBlockDeletion.java

@@ -72,7 +72,6 @@ import static org.apache.hadoop.hdds
     .HddsConfigKeys.HDDS_CONTAINER_REPORT_INTERVAL;
     .HddsConfigKeys.HDDS_CONTAINER_REPORT_INTERVAL;
 import static org.apache.hadoop.hdds.scm.ScmConfigKeys.HDDS_SCM_WATCHER_TIMEOUT;
 import static org.apache.hadoop.hdds.scm.ScmConfigKeys.HDDS_SCM_WATCHER_TIMEOUT;
 import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_STALENODE_INTERVAL;
 import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_STALENODE_INTERVAL;
-import static org.apache.hadoop.hdds.scm.ScmConfigKeys.OZONE_SCM_STALENODE_INTERVAL_DEFAULT;
 import static org.apache.hadoop.ozone
 import static org.apache.hadoop.ozone
     .OzoneConfigKeys.OZONE_BLOCK_DELETING_SERVICE_INTERVAL;
     .OzoneConfigKeys.OZONE_BLOCK_DELETING_SERVICE_INTERVAL;
 
 
@@ -239,7 +238,7 @@ public class TestBlockDeletion {
     ContainerReportsProto dummyReport = dummyReportsBuilder.build();
     ContainerReportsProto dummyReport = dummyReportsBuilder.build();
 
 
     logCapturer.clearOutput();
     logCapturer.clearOutput();
-    scm.getScmContainerManager().processContainerReports(
+    scm.getContainerManager().processContainerReports(
         cluster.getHddsDatanodes().get(0).getDatanodeDetails(), dummyReport,
         cluster.getHddsDatanodes().get(0).getDatanodeDetails(), dummyReport,
         false);
         false);
     // wait for event to be handled by event handler
     // wait for event to be handled by event handler

+ 3 - 3
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestCloseContainerByPipeline.java

@@ -102,7 +102,7 @@ public class TestCloseContainerByPipeline {
 
 
     long containerID = omKeyLocationInfo.getContainerID();
     long containerID = omKeyLocationInfo.getContainerID();
     Pipeline pipeline = cluster.getStorageContainerManager()
     Pipeline pipeline = cluster.getStorageContainerManager()
-        .getScmContainerManager().getContainerWithPipeline(containerID)
+        .getContainerManager().getContainerWithPipeline(containerID)
         .getPipeline();
         .getPipeline();
     List<DatanodeDetails> datanodes = pipeline.getMachines();
     List<DatanodeDetails> datanodes = pipeline.getMachines();
     Assert.assertEquals(datanodes.size(), 1);
     Assert.assertEquals(datanodes.size(), 1);
@@ -157,7 +157,7 @@ public class TestCloseContainerByPipeline {
 
 
     long containerID = omKeyLocationInfo.getContainerID();
     long containerID = omKeyLocationInfo.getContainerID();
     Pipeline pipeline = cluster.getStorageContainerManager()
     Pipeline pipeline = cluster.getStorageContainerManager()
-        .getScmContainerManager().getContainerWithPipeline(containerID)
+        .getContainerManager().getContainerWithPipeline(containerID)
         .getPipeline();
         .getPipeline();
     List<DatanodeDetails> datanodes = pipeline.getMachines();
     List<DatanodeDetails> datanodes = pipeline.getMachines();
     Assert.assertEquals(datanodes.size(), 1);
     Assert.assertEquals(datanodes.size(), 1);
@@ -214,7 +214,7 @@ public class TestCloseContainerByPipeline {
 
 
     long containerID = omKeyLocationInfo.getContainerID();
     long containerID = omKeyLocationInfo.getContainerID();
     Pipeline pipeline = cluster.getStorageContainerManager()
     Pipeline pipeline = cluster.getStorageContainerManager()
-        .getScmContainerManager().getContainerWithPipeline(containerID)
+        .getContainerManager().getContainerWithPipeline(containerID)
         .getPipeline();
         .getPipeline();
     List<DatanodeDetails> datanodes = pipeline.getMachines();
     List<DatanodeDetails> datanodes = pipeline.getMachines();
     Assert.assertEquals(3, datanodes.size());
     Assert.assertEquals(3, datanodes.size());

+ 1 - 1
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/container/common/statemachine/commandhandler/TestCloseContainerHandler.java

@@ -81,7 +81,7 @@ public class TestCloseContainerHandler {
 
 
     long containerID = omKeyLocationInfo.getContainerID();
     long containerID = omKeyLocationInfo.getContainerID();
     Pipeline pipeline = cluster.getStorageContainerManager()
     Pipeline pipeline = cluster.getStorageContainerManager()
-        .getScmContainerManager().getContainerWithPipeline(containerID)
+        .getContainerManager().getContainerWithPipeline(containerID)
         .getPipeline();
         .getPipeline();
 
 
     Assert.assertFalse(isContainerClosed(cluster, containerID));
     Assert.assertFalse(isContainerClosed(cluster, containerID));

+ 6 - 6
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestScmChillMode.java

@@ -29,7 +29,7 @@ import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos.LifeCycleEvent;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos.LifeCycleEvent;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationFactor;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationFactor;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationType;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos.ReplicationType;
-import org.apache.hadoop.hdds.scm.container.ContainerMapping;
+import org.apache.hadoop.hdds.scm.container.SCMContainerManager;
 import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerInfo;
 import org.apache.hadoop.hdds.scm.container.common.helpers.ContainerInfo;
 import org.apache.hadoop.hdds.scm.events.SCMEvents;
 import org.apache.hadoop.hdds.scm.events.SCMEvents;
 import org.apache.hadoop.hdds.scm.exceptions.SCMException;
 import org.apache.hadoop.hdds.scm.exceptions.SCMException;
@@ -128,7 +128,7 @@ public class TestScmChillMode {
     Map<String, OmKeyInfo> keyLocations = helper.createKeys(100, 4096);
     Map<String, OmKeyInfo> keyLocations = helper.createKeys(100, 4096);
     final List<ContainerInfo> containers = cluster
     final List<ContainerInfo> containers = cluster
         .getStorageContainerManager()
         .getStorageContainerManager()
-        .getScmContainerManager().getStateManager().getAllContainers();
+        .getContainerManager().getStateManager().getAllContainers();
     GenericTestUtils.waitFor(() -> {
     GenericTestUtils.waitFor(() -> {
       return containers.size() > 10;
       return containers.size() > 10;
     }, 100, 1000);
     }, 100, 1000);
@@ -251,7 +251,7 @@ public class TestScmChillMode {
         new TestStorageContainerManagerHelper(miniCluster, conf);
         new TestStorageContainerManagerHelper(miniCluster, conf);
     Map<String, OmKeyInfo> keyLocations = helper.createKeys(100 * 2, 4096);
     Map<String, OmKeyInfo> keyLocations = helper.createKeys(100 * 2, 4096);
     final List<ContainerInfo> containers = miniCluster
     final List<ContainerInfo> containers = miniCluster
-        .getStorageContainerManager().getScmContainerManager()
+        .getStorageContainerManager().getContainerManager()
         .getStateManager().getAllContainers();
         .getStateManager().getAllContainers();
     GenericTestUtils.waitFor(() -> {
     GenericTestUtils.waitFor(() -> {
       return containers.size() > 10;
       return containers.size() > 10;
@@ -264,8 +264,8 @@ public class TestScmChillMode {
     containers.remove(3);
     containers.remove(3);
 
 
     // Close remaining containers
     // Close remaining containers
-    ContainerMapping mapping = (ContainerMapping) miniCluster
-        .getStorageContainerManager().getScmContainerManager();
+    SCMContainerManager mapping = (SCMContainerManager) miniCluster
+        .getStorageContainerManager().getContainerManager();
     containers.forEach(c -> {
     containers.forEach(c -> {
       try {
       try {
         mapping.updateContainerState(c.getContainerID(),
         mapping.updateContainerState(c.getContainerID(),
@@ -347,7 +347,7 @@ public class TestScmChillMode {
     SCMClientProtocolServer clientProtocolServer = cluster
     SCMClientProtocolServer clientProtocolServer = cluster
         .getStorageContainerManager().getClientProtocolServer();
         .getStorageContainerManager().getClientProtocolServer();
     assertFalse((scm.getClientProtocolServer()).getChillModeStatus());
     assertFalse((scm.getClientProtocolServer()).getChillModeStatus());
-    final List<ContainerInfo> containers = scm.getScmContainerManager()
+    final List<ContainerInfo> containers = scm.getContainerManager()
         .getStateManager().getAllContainers();
         .getStateManager().getAllContainers();
     scm.getEventQueue().fireEvent(SCMEvents.CHILL_MODE_STATUS, true);
     scm.getEventQueue().fireEvent(SCMEvents.CHILL_MODE_STATUS, true);
     GenericTestUtils.waitFor(() -> {
     GenericTestUtils.waitFor(() -> {

+ 7 - 5
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/scm/TestContainerSQLCli.java

@@ -17,6 +17,8 @@
  */
  */
 package org.apache.hadoop.ozone.scm;
 package org.apache.hadoop.ozone.scm;
 
 
+import org.apache.hadoop.hdds.scm.container.ContainerManager;
+import org.apache.hadoop.hdds.scm.container.SCMContainerManager;
 import org.apache.hadoop.hdds.scm.events.SCMEvents;
 import org.apache.hadoop.hdds.scm.events.SCMEvents;
 import org.apache.hadoop.hdds.scm.node.NodeManager;
 import org.apache.hadoop.hdds.scm.node.NodeManager;
 import org.apache.hadoop.hdds.server.events.EventQueue;
 import org.apache.hadoop.hdds.server.events.EventQueue;
@@ -25,7 +27,6 @@ import org.apache.hadoop.ozone.OzoneConfigKeys;
 import org.apache.hadoop.hdds.conf.OzoneConfiguration;
 import org.apache.hadoop.hdds.conf.OzoneConfiguration;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import org.apache.hadoop.hdds.protocol.proto.HddsProtos;
 import org.apache.hadoop.hdds.scm.block.BlockManagerImpl;
 import org.apache.hadoop.hdds.scm.block.BlockManagerImpl;
-import org.apache.hadoop.hdds.scm.container.ContainerMapping;
 import org.apache.hadoop.hdds.scm.container.placement.algorithms.ContainerPlacementPolicy;
 import org.apache.hadoop.hdds.scm.container.placement.algorithms.ContainerPlacementPolicy;
 import org.apache.hadoop.hdds.scm.container.placement.algorithms.SCMContainerPlacementCapacity;
 import org.apache.hadoop.hdds.scm.container.placement.algorithms.SCMContainerPlacementCapacity;
 import org.apache.hadoop.hdds.scm.ScmConfigKeys;
 import org.apache.hadoop.hdds.scm.ScmConfigKeys;
@@ -83,7 +84,7 @@ public class TestContainerSQLCli {
   private OzoneConfiguration conf;
   private OzoneConfiguration conf;
   private String datanodeIpAddress;
   private String datanodeIpAddress;
 
 
-  private ContainerMapping mapping;
+  private ContainerManager containerManager;
   private NodeManager nodeManager;
   private NodeManager nodeManager;
   private BlockManagerImpl blockManager;
   private BlockManagerImpl blockManager;
 
 
@@ -119,9 +120,10 @@ public class TestContainerSQLCli {
     cluster.getStorageContainerManager().stop();
     cluster.getStorageContainerManager().stop();
     eventQueue = new EventQueue();
     eventQueue = new EventQueue();
     nodeManager = cluster.getStorageContainerManager().getScmNodeManager();
     nodeManager = cluster.getStorageContainerManager().getScmNodeManager();
-    mapping = new ContainerMapping(conf, nodeManager, 128,
+    containerManager = new SCMContainerManager(conf, nodeManager, 128,
         eventQueue);
         eventQueue);
-    blockManager = new BlockManagerImpl(conf, nodeManager, mapping, eventQueue);
+    blockManager = new BlockManagerImpl(
+        conf, nodeManager, containerManager, eventQueue);
     eventQueue.addHandler(SCMEvents.CHILL_MODE_STATUS, blockManager);
     eventQueue.addHandler(SCMEvents.CHILL_MODE_STATUS, blockManager);
     eventQueue.fireEvent(SCMEvents.CHILL_MODE_STATUS, false);
     eventQueue.fireEvent(SCMEvents.CHILL_MODE_STATUS, false);
     GenericTestUtils.waitFor(() -> {
     GenericTestUtils.waitFor(() -> {
@@ -165,7 +167,7 @@ public class TestContainerSQLCli {
     }
     }
 
 
     blockManager.close();
     blockManager.close();
-    mapping.close();
+    containerManager.close();
     nodeManager.close();
     nodeManager.close();
 
 
     conf.set(OzoneConfigKeys.OZONE_METADATA_STORE_IMPL, metaStoreType);
     conf.set(OzoneConfigKeys.OZONE_METADATA_STORE_IMPL, metaStoreType);