use of org.apache.hadoop.hdds.scm.pipeline.PipelineID in project ozone by apache.
the class TestSCMRatisRequest method testEncodeAndDecodeSuccess.
@Test
public void testEncodeAndDecodeSuccess() throws Exception {
PipelineID pipelineID = PipelineID.randomId();
Object[] args = new Object[] { pipelineID.getProtobuf() };
String operation = "test";
SCMRatisRequest request = SCMRatisRequest.of(PIPELINE, operation, new Class[] { pipelineID.getProtobuf().getClass() }, args);
Assert.assertEquals(operation, SCMRatisRequest.decode(request.encode()).getOperation());
Assert.assertEquals(args[0], SCMRatisRequest.decode(request.encode()).getArguments()[0]);
}
use of org.apache.hadoop.hdds.scm.pipeline.PipelineID in project ozone by apache.
the class TestPipelineIDCodec method testConvertAndReadBackFFAsUUID.
@Test
public void testConvertAndReadBackFFAsUUID() throws Exception {
long mostSigBits = 0xFFFF_FFFF_FFFF_FFFFL;
long leastSigBits = 0xFFFF_FFFF_FFFF_FFFFL;
UUID uuid = new UUID(mostSigBits, leastSigBits);
PipelineID pid = PipelineID.valueOf(uuid);
byte[] encoded = new PipelineIDCodec().toPersistedFormat(pid);
PipelineID decoded = new PipelineIDCodec().fromPersistedFormat(encoded);
assertEquals(pid, decoded);
}
use of org.apache.hadoop.hdds.scm.pipeline.PipelineID in project ozone by apache.
the class TestPipelineIDCodec method testConvertAndReadBackZeroAsUUID.
@Test
public void testConvertAndReadBackZeroAsUUID() throws Exception {
long mostSigBits = 0x0000_0000_0000_0000L;
long leastSigBits = 0x0000_0000_0000_0000L;
UUID uuid = new UUID(mostSigBits, leastSigBits);
PipelineID pid = PipelineID.valueOf(uuid);
byte[] encoded = new PipelineIDCodec().toPersistedFormat(pid);
PipelineID decoded = new PipelineIDCodec().fromPersistedFormat(encoded);
assertEquals(pid, decoded);
}
use of org.apache.hadoop.hdds.scm.pipeline.PipelineID in project ozone by apache.
the class TestPipelineIDCodec method testConvertAndReadBackRandomUUID.
@Test
public void testConvertAndReadBackRandomUUID() throws Exception {
UUID uuid = UUID.randomUUID();
PipelineID pid = PipelineID.valueOf(uuid);
byte[] encoded = new PipelineIDCodec().toPersistedFormat(pid);
PipelineID decoded = new PipelineIDCodec().fromPersistedFormat(encoded);
assertEquals(pid, decoded);
}
use of org.apache.hadoop.hdds.scm.pipeline.PipelineID in project ozone by apache.
the class ReconPipelineManager method removeInvalidPipelines.
public void removeInvalidPipelines(List<Pipeline> pipelinesFromScm) {
acquireWriteLock();
try {
List<Pipeline> pipelinesInHouse = getPipelines();
// Removing pipelines in Recon that are no longer in SCM.
// TODO Recon may need to track inactive pipelines as well. So this can be
// removed in a followup JIRA.
List<Pipeline> invalidPipelines = pipelinesInHouse.stream().filter(p -> !pipelinesFromScm.contains(p)).collect(Collectors.toList());
invalidPipelines.forEach(p -> {
PipelineID pipelineID = p.getId();
if (!p.getPipelineState().equals(CLOSED)) {
try {
getStateManager().updatePipelineState(pipelineID.getProtobuf(), HddsProtos.PipelineState.PIPELINE_CLOSED);
} catch (IOException e) {
LOG.warn("Pipeline {} not found while updating state. ", p.getId(), e);
}
}
try {
LOG.info("Removing invalid pipeline {} from Recon.", pipelineID);
closePipeline(p, false);
} catch (IOException e) {
LOG.warn("Unable to remove pipeline {}", pipelineID, e);
}
});
} finally {
releaseWriteLock();
}
}
Aggregations