Search in sources :

Example 1 with PipelineActionsProto

use of org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.PipelineActionsProto in project ozone by apache.

the class HeartbeatEndpointTask method addPipelineActions.

/**
 * Adds all the pending PipelineActions to the heartbeat.
 *
 * @param requestBuilder builder to which the report has to be added.
 */
private void addPipelineActions(SCMHeartbeatRequestProto.Builder requestBuilder) {
    List<PipelineAction> actions = context.getPendingPipelineAction(rpcEndpoint.getAddress(), maxPipelineActionsPerHB);
    if (!actions.isEmpty()) {
        PipelineActionsProto pap = PipelineActionsProto.newBuilder().addAllPipelineActions(actions).build();
        requestBuilder.setPipelineActions(pap);
    }
}
Also used : PipelineActionsProto(org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.PipelineActionsProto) PipelineAction(org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.PipelineAction)

Example 2 with PipelineActionsProto

use of org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.PipelineActionsProto in project ozone by apache.

the class TestPipelineActionHandler method testCloseActionForMissingPipeline.

@Test
public void testCloseActionForMissingPipeline() throws PipelineNotFoundException, NotLeaderException {
    final PipelineManager manager = Mockito.mock(PipelineManager.class);
    final EventQueue queue = Mockito.mock(EventQueue.class);
    Mockito.when(manager.getPipeline(Mockito.any(PipelineID.class))).thenThrow(new PipelineNotFoundException());
    final PipelineActionHandler actionHandler = new PipelineActionHandler(manager, SCMContext.emptyContext(), null);
    final PipelineActionsProto actionsProto = PipelineActionsProto.newBuilder().addPipelineActions(PipelineAction.newBuilder().setClosePipeline(ClosePipelineInfo.newBuilder().setPipelineID(HddsProtos.PipelineID.newBuilder().setId(UUID.randomUUID().toString()).build()).setReason(ClosePipelineInfo.Reason.PIPELINE_FAILED)).setAction(PipelineAction.Action.CLOSE).build()).build();
    final PipelineActionsFromDatanode pipelineActions = new PipelineActionsFromDatanode(MockDatanodeDetails.randomDatanodeDetails(), actionsProto);
    actionHandler.onMessage(pipelineActions, queue);
    Mockito.verify(queue, Mockito.times(1)).fireEvent(Mockito.any(), Mockito.any(CommandForDatanode.class));
}
Also used : CommandForDatanode(org.apache.hadoop.ozone.protocol.commands.CommandForDatanode) PipelineActionsFromDatanode(org.apache.hadoop.hdds.scm.server.SCMDatanodeHeartbeatDispatcher.PipelineActionsFromDatanode) PipelineActionsProto(org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.PipelineActionsProto) EventQueue(org.apache.hadoop.hdds.server.events.EventQueue) Test(org.junit.Test)

Aggregations

PipelineActionsProto (org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.PipelineActionsProto)2 PipelineAction (org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.PipelineAction)1 PipelineActionsFromDatanode (org.apache.hadoop.hdds.scm.server.SCMDatanodeHeartbeatDispatcher.PipelineActionsFromDatanode)1 EventQueue (org.apache.hadoop.hdds.server.events.EventQueue)1 CommandForDatanode (org.apache.hadoop.ozone.protocol.commands.CommandForDatanode)1 Test (org.junit.Test)1