bharatviswa504 commented on a change in pull request #2745:
URL: https://github.com/apache/ozone/pull/2745#discussion_r733335700
##########
File path:
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineStateManagerImpl.java
##########
@@ -117,6 +117,18 @@ public void addContainerToPipeline(
}
}
+ @Override
+ public void addContainerToPipelineSCMStart(
+ PipelineID pipelineId, ContainerID containerID)
+ throws IOException {
+ lock.writeLock().lock();
Review comment:
If there is no contention here , and it is only called serially and also
if only during start Still do we need it??
##########
File path:
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/pipeline/TestPipelineManagerImpl.java
##########
@@ -624,6 +626,30 @@ public void testSafeModeUpdatedOnSafemodeExit() throws
Exception {
pipelineManager.close();
}
+ @Test
+ public void testAddContainerWithClosedPipeline() throws Exception {
+ GenericTestUtils.LogCapturer logCapturer = GenericTestUtils.LogCapturer.
+ captureLogs(LoggerFactory.getLogger(PipelineStateMap.class));
+ SCMHADBTransactionBuffer buffer = new
MockSCMHADBTransactionBuffer(dbStore);
+ PipelineManagerImpl pipelineManager =
+ createPipelineManager(true, buffer);
+ Table<PipelineID, Pipeline> pipelineStore =
+ SCMDBDefinition.PIPELINES.getTable(dbStore);
+ Pipeline pipeline = pipelineManager.createPipeline(
+ new RatisReplicationConfig(HddsProtos.ReplicationFactor.THREE));
+ PipelineID pipelineID = pipeline.getId();
+ pipelineManager.addContainerToPipeline(pipelineID, ContainerID.valueOf(1));
Review comment:
Test does not test the scenario, but I see it tests newly added code.
##########
File path:
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/pipeline/PipelineStateMap.java
##########
@@ -104,6 +104,33 @@ void addContainerToPipeline(PipelineID pipelineID,
ContainerID containerID)
pipeline2container.get(pipelineID).add(containerID);
}
+ /**
+ * Add container to an existing pipeline during SCM Start.
+ *
+ * @param pipelineID - PipelineID of the pipeline to which container is added
+ * @param containerID - ContainerID of the container to add
+ */
+ void addContainerToPipelineSCMStart(PipelineID pipelineID,
+ ContainerID containerID) throws IOException {
+ Preconditions.checkNotNull(pipelineID,
+ "Pipeline Id cannot be null");
+ Preconditions.checkNotNull(containerID,
+ "Container Id cannot be null");
+
+ Pipeline pipeline = getPipeline(pipelineID);
+ if (pipeline.isClosed()) {
+ /*
+ When SCM restarts it can be an inconsistent state where some
Review comment:
Inconsistent -> SCM DB may not be update to date would be better wording
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]