use of org.apache.hadoop.ozone.container.replication.ReplicationServer.ReplicationConfig in project ozone by apache.
the class TestReplicationConfig method isCreatedWitDefaultValues.
@Test
public void isCreatedWitDefaultValues() {
// GIVEN
OzoneConfiguration conf = new OzoneConfiguration();
// WHEN
ReplicationConfig subject = conf.getObject(ReplicationConfig.class);
// THEN
assertEquals(REPLICATION_MAX_STREAMS_DEFAULT, subject.getReplicationMaxStreams());
}
use of org.apache.hadoop.ozone.container.replication.ReplicationServer.ReplicationConfig in project ozone by apache.
the class TestReplicationConfig method acceptsValidValues.
@Test
public void acceptsValidValues() {
// GIVEN
int validReplicationLimit = 123;
OzoneConfiguration conf = new OzoneConfiguration();
conf.setInt(REPLICATION_STREAMS_LIMIT_KEY, validReplicationLimit);
// WHEN
ReplicationConfig subject = conf.getObject(ReplicationConfig.class);
// THEN
assertEquals(validReplicationLimit, subject.getReplicationMaxStreams());
}
use of org.apache.hadoop.ozone.container.replication.ReplicationServer.ReplicationConfig in project ozone by apache.
the class TestEndPoint method testCheckVersionResponse.
@Test
public void testCheckVersionResponse() throws Exception {
OzoneConfiguration conf = SCMTestUtils.getConf();
conf.setBoolean(OzoneConfigKeys.DFS_CONTAINER_IPC_RANDOM_PORT, true);
conf.setBoolean(OzoneConfigKeys.DFS_CONTAINER_RATIS_IPC_RANDOM_PORT, true);
conf.setFromObject(new ReplicationConfig().setPort(0));
try (EndpointStateMachine rpcEndPoint = createEndpoint(conf, serverAddress, 1000)) {
GenericTestUtils.LogCapturer logCapturer = GenericTestUtils.LogCapturer.captureLogs(VersionEndpointTask.LOG);
DatanodeDetails datanodeDetails = randomDatanodeDetails();
OzoneContainer ozoneContainer = new OzoneContainer(datanodeDetails, conf, getContext(datanodeDetails), null);
rpcEndPoint.setState(EndpointStateMachine.EndPointStates.GETVERSION);
VersionEndpointTask versionTask = new VersionEndpointTask(rpcEndPoint, conf, ozoneContainer);
EndpointStateMachine.EndPointStates newState = versionTask.call();
// if version call worked the endpoint should automatically move to the
// next state.
Assert.assertEquals(EndpointStateMachine.EndPointStates.REGISTER, newState);
// Now rpcEndpoint should remember the version it got from SCM
Assert.assertNotNull(rpcEndPoint.getVersion());
// Now change server cluster ID, so datanode cluster ID will be
// different from SCM server response cluster ID.
String newClusterId = UUID.randomUUID().toString();
scmServerImpl.setClusterId(newClusterId);
rpcEndPoint.setState(EndpointStateMachine.EndPointStates.GETVERSION);
newState = versionTask.call();
Assert.assertEquals(EndpointStateMachine.EndPointStates.SHUTDOWN, newState);
List<HddsVolume> volumesList = StorageVolumeUtil.getHddsVolumesList(ozoneContainer.getVolumeSet().getFailedVolumesList());
Assert.assertTrue(volumesList.size() == 1);
Assert.assertTrue(logCapturer.getOutput().contains("org.apache.hadoop.ozone.common" + ".InconsistentStorageStateException: Mismatched ClusterIDs"));
Assert.assertTrue(ozoneContainer.getVolumeSet().getVolumesList().size() == 0);
Assert.assertTrue(ozoneContainer.getVolumeSet().getFailedVolumesList().size() == 1);
}
}
use of org.apache.hadoop.ozone.container.replication.ReplicationServer.ReplicationConfig in project ozone by apache.
the class TestEndPoint method testGetVersionTask.
@Test
public /**
* We make getVersion RPC call, but via the VersionEndpointTask which is
* how the state machine would make the call.
*/
void testGetVersionTask() throws Exception {
OzoneConfiguration conf = SCMTestUtils.getConf();
conf.setFromObject(new ReplicationConfig().setPort(0));
try (EndpointStateMachine rpcEndPoint = createEndpoint(conf, serverAddress, 1000)) {
DatanodeDetails datanodeDetails = randomDatanodeDetails();
OzoneContainer ozoneContainer = new OzoneContainer(datanodeDetails, conf, getContext(datanodeDetails), null);
rpcEndPoint.setState(EndpointStateMachine.EndPointStates.GETVERSION);
VersionEndpointTask versionTask = new VersionEndpointTask(rpcEndPoint, conf, ozoneContainer);
EndpointStateMachine.EndPointStates newState = versionTask.call();
// if version call worked the endpoint should automatically move to the
// next state.
Assert.assertEquals(EndpointStateMachine.EndPointStates.REGISTER, newState);
// Now rpcEndpoint should remember the version it got from SCM
Assert.assertNotNull(rpcEndPoint.getVersion());
}
}
use of org.apache.hadoop.ozone.container.replication.ReplicationServer.ReplicationConfig in project ozone by apache.
the class TestReplicationConfig method overridesInvalidValues.
@Test
public void overridesInvalidValues() {
// GIVEN
int invalidReplicationLimit = -5;
OzoneConfiguration conf = new OzoneConfiguration();
conf.setInt(REPLICATION_STREAMS_LIMIT_KEY, invalidReplicationLimit);
// WHEN
ReplicationConfig subject = conf.getObject(ReplicationConfig.class);
// THEN
assertEquals(REPLICATION_MAX_STREAMS_DEFAULT, subject.getReplicationMaxStreams());
}
Aggregations