Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ void addContainerToPipeline(PipelineID pipelineID, ContainerID containerID)

Pipeline pipeline = getPipeline(pipelineID);
if (pipeline.isClosed()) {
throw new IOException(String
.format("Cannot add container to pipeline=%s in closed state",
pipelineID));
LOG.warn("Adding container {} to pipeline={} in CLOSED state." +
" This happens only for some exceptional cases." +
" Check for the previous exceptions.", containerID, pipelineID);
}
pipeline2container.get(pipelineID).add(containerID);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -762,7 +762,7 @@ public void testSafeModeUpdatedOnSafemodeExit() throws Exception {
}

@Test
public void testAddContainerWithClosedPipeline() throws Exception {
public void testAddContainerWithClosedPipelineScmStart() throws Exception {
GenericTestUtils.LogCapturer logCapturer = GenericTestUtils.LogCapturer.
captureLogs(LoggerFactory.getLogger(PipelineStateMap.class));
SCMHADBTransactionBuffer buffer = new SCMHADBTransactionBufferStub(dbStore);
Expand All @@ -786,6 +786,30 @@ public void testAddContainerWithClosedPipeline() throws Exception {
pipelineID + " in closed state"));
}

@Test
public void testAddContainerWithClosedPipeline() throws Exception {
GenericTestUtils.LogCapturer logCapturer = GenericTestUtils.LogCapturer.
captureLogs(LoggerFactory.getLogger(PipelineStateMap.class));
SCMHADBTransactionBuffer buffer = new SCMHADBTransactionBufferStub(dbStore);
PipelineManagerImpl pipelineManager =
createPipelineManager(true, buffer);
Table<PipelineID, Pipeline> pipelineStore =
SCMDBDefinition.PIPELINES.getTable(dbStore);
Pipeline pipeline = pipelineManager.createPipeline(
RatisReplicationConfig
.getInstance(HddsProtos.ReplicationFactor.THREE));
PipelineID pipelineID = pipeline.getId();
pipelineManager.addContainerToPipeline(pipelineID, ContainerID.valueOf(1));
pipelineManager.getStateManager().updatePipelineState(
pipelineID.getProtobuf(), HddsProtos.PipelineState.PIPELINE_CLOSED);
buffer.flush();
Assertions.assertTrue(pipelineStore.get(pipelineID).isClosed());
pipelineManager.addContainerToPipeline(pipelineID,
ContainerID.valueOf(2));
assertTrue(logCapturer.getOutput().contains(
"Adding container #2 to pipeline=" + pipelineID + " in CLOSED state."));
}

@Test
public void testPipelineCloseFlow() throws IOException, TimeoutException {
GenericTestUtils.LogCapturer logCapturer = GenericTestUtils.LogCapturer
Expand Down