Search in sources :

Example 1 with ContainerActionsProto

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

the class HeartbeatEndpointTask method addContainerActions.

/**
 * Adds all the pending ContainerActions to the heartbeat.
 *
 * @param requestBuilder builder to which the report has to be added.
 */
private void addContainerActions(SCMHeartbeatRequestProto.Builder requestBuilder) {
    List<ContainerAction> actions = context.getPendingContainerAction(rpcEndpoint.getAddress(), maxContainerActionsPerHB);
    if (!actions.isEmpty()) {
        ContainerActionsProto cap = ContainerActionsProto.newBuilder().addAllContainerActions(actions).build();
        requestBuilder.setContainerActions(cap);
    }
}
Also used : ContainerAction(org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.ContainerAction) ContainerActionsProto(org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.ContainerActionsProto)

Example 2 with ContainerActionsProto

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

the class TestContainerActionsHandler method testCloseContainerAction.

@Test
public void testCloseContainerAction() {
    EventQueue queue = new EventQueue();
    ContainerActionsHandler actionsHandler = new ContainerActionsHandler();
    CloseContainerEventHandler closeContainerEventHandler = Mockito.mock(CloseContainerEventHandler.class);
    queue.addHandler(SCMEvents.CLOSE_CONTAINER, closeContainerEventHandler);
    queue.addHandler(SCMEvents.CONTAINER_ACTIONS, actionsHandler);
    ContainerAction action = ContainerAction.newBuilder().setContainerID(1L).setAction(ContainerAction.Action.CLOSE).setReason(ContainerAction.Reason.CONTAINER_FULL).build();
    ContainerActionsProto cap = ContainerActionsProto.newBuilder().addContainerActions(action).build();
    ContainerActionsFromDatanode containerActions = new ContainerActionsFromDatanode(MockDatanodeDetails.randomDatanodeDetails(), cap);
    queue.fireEvent(SCMEvents.CONTAINER_ACTIONS, containerActions);
    queue.processAll(1000L);
    verify(closeContainerEventHandler, times(1)).onMessage(ContainerID.valueOf(1L), queue);
}
Also used : ContainerAction(org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.ContainerAction) ContainerActionsFromDatanode(org.apache.hadoop.hdds.scm.server.SCMDatanodeHeartbeatDispatcher.ContainerActionsFromDatanode) ContainerActionsProto(org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.ContainerActionsProto) EventQueue(org.apache.hadoop.hdds.server.events.EventQueue) Test(org.junit.Test)

Aggregations

ContainerAction (org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.ContainerAction)2 ContainerActionsProto (org.apache.hadoop.hdds.protocol.proto.StorageContainerDatanodeProtocolProtos.ContainerActionsProto)2 ContainerActionsFromDatanode (org.apache.hadoop.hdds.scm.server.SCMDatanodeHeartbeatDispatcher.ContainerActionsFromDatanode)1 EventQueue (org.apache.hadoop.hdds.server.events.EventQueue)1 Test (org.junit.Test)1