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