HDDS-2103. TestContainerReplication fails due to unhealthy container (#1421)
This commit is contained in:
parent
c255333e20
commit
5a381f73e9
@ -18,7 +18,6 @@
|
||||
|
||||
package org.apache.hadoop.ozone.container;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -42,11 +41,9 @@
|
||||
import org.apache.hadoop.ozone.container.common.helpers.BlockData;
|
||||
import org.apache.hadoop.ozone.container.common.interfaces.Container;
|
||||
import org.apache.hadoop.ozone.container.common.statemachine.DatanodeStateMachine;
|
||||
import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainerData;
|
||||
import org.apache.hadoop.ozone.container.keyvalue.KeyValueHandler;
|
||||
import org.apache.hadoop.ozone.container.ozoneimpl.OzoneContainer;
|
||||
import org.apache.hadoop.ozone.container.ozoneimpl.TestOzoneContainer;
|
||||
import org.apache.hadoop.ozone.protocol.commands.CloseContainerCommand;
|
||||
import org.apache.hadoop.ozone.protocol.commands.ReplicateContainerCommand;
|
||||
import org.apache.hadoop.test.GenericTestUtils;
|
||||
|
||||
@ -74,9 +71,6 @@ public void testContainerReplication() throws Exception {
|
||||
|
||||
long containerId = 1L;
|
||||
|
||||
conf.setSocketAddr("hdls.datanode.http-address",
|
||||
new InetSocketAddress("0.0.0.0", 0));
|
||||
|
||||
MiniOzoneCluster cluster =
|
||||
MiniOzoneCluster.newBuilder(conf).setNumDatanodes(2)
|
||||
.setRandomContainerPort(true).build();
|
||||
@ -107,9 +101,6 @@ public void testContainerReplication() throws Exception {
|
||||
ContainerCommandRequestProto putBlockRequest = ContainerTestHelper
|
||||
.getPutBlockRequest(sourcePipelines, requestProto.getWriteChunk());
|
||||
|
||||
ContainerProtos.BlockData blockData =
|
||||
putBlockRequest.getPutBlock().getBlockData();
|
||||
|
||||
ContainerCommandResponseProto response =
|
||||
client.sendCommand(putBlockRequest);
|
||||
|
||||
@ -121,11 +112,11 @@ public void testContainerReplication() throws Exception {
|
||||
cluster.getHddsDatanodes());
|
||||
|
||||
// Close the container
|
||||
cluster.getStorageContainerManager().getScmNodeManager()
|
||||
.addDatanodeCommand(
|
||||
sourceDatanodes.get(0).getUuid(),
|
||||
new CloseContainerCommand(containerId,
|
||||
sourcePipelines.getId(), true));
|
||||
ContainerCommandRequestProto closeContainerRequest = ContainerTestHelper
|
||||
.getCloseContainer(sourcePipelines, containerId);
|
||||
response = client.sendCommand(closeContainerRequest);
|
||||
Assert.assertNotNull(response);
|
||||
Assert.assertEquals(ContainerProtos.Result.SUCCESS, response.getResult());
|
||||
|
||||
//WHEN: send the order to replicate the container
|
||||
cluster.getStorageContainerManager().getScmNodeManager()
|
||||
@ -144,8 +135,6 @@ public void testContainerReplication() throws Exception {
|
||||
OzoneContainer ozoneContainer =
|
||||
destinationDatanodeDatanodeStateMachine.getContainer();
|
||||
|
||||
|
||||
|
||||
Container container =
|
||||
ozoneContainer
|
||||
.getContainerSet().getContainer(containerId);
|
||||
@ -158,9 +147,6 @@ public void testContainerReplication() throws Exception {
|
||||
"ContainerData of the replicated container is null",
|
||||
container.getContainerData());
|
||||
|
||||
long keyCount = ((KeyValueContainerData) container.getContainerData())
|
||||
.getKeyCount();
|
||||
|
||||
KeyValueHandler handler = (KeyValueHandler) ozoneContainer.getDispatcher()
|
||||
.getHandler(ContainerType.KeyValueContainer);
|
||||
|
||||
@ -171,7 +157,6 @@ public void testContainerReplication() throws Exception {
|
||||
Assert.assertEquals(1, key.getChunks().size());
|
||||
Assert.assertEquals(requestProto.getWriteChunk().getChunkData(),
|
||||
key.getChunks().get(0));
|
||||
|
||||
}
|
||||
|
||||
private HddsDatanodeService chooseDatanodeWithoutContainer(Pipeline pipeline,
|
||||
@ -185,9 +170,8 @@ private HddsDatanodeService chooseDatanodeWithoutContainer(Pipeline pipeline,
|
||||
"No datanode outside of the pipeline");
|
||||
}
|
||||
|
||||
static OzoneConfiguration newOzoneConfiguration() {
|
||||
final OzoneConfiguration conf = new OzoneConfiguration();
|
||||
return conf;
|
||||
private static OzoneConfiguration newOzoneConfiguration() {
|
||||
return new OzoneConfiguration();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user