Search in sources :

Example 6 with StatusResponse

use of org.apache.cassandra.repair.messages.StatusResponse in project cassandra by apache.

the class LocalSessions method handleStatusRequest.

public void handleStatusRequest(InetAddressAndPort from, StatusRequest request) {
    logger.trace("received {} from {}", request, from);
    UUID sessionID = request.sessionID;
    LocalSession session = getSession(sessionID);
    if (session == null) {
        logger.warn("Received status request message for unknown session {}", sessionID);
        sendMessage(from, Message.out(STATUS_RSP, new StatusResponse(sessionID, FAILED)));
    } else {
        sendMessage(from, Message.out(STATUS_RSP, new StatusResponse(sessionID, session.getState())));
        logger.info("Responding to status response message for incremental repair session {} with local state {}", sessionID, session.getState());
    }
}
Also used : StatusResponse(org.apache.cassandra.repair.messages.StatusResponse) UUID(java.util.UUID)

Example 7 with StatusResponse

use of org.apache.cassandra.repair.messages.StatusResponse in project cassandra by apache.

the class LocalSessionTest method handleStatusResponseFailed.

@Test
public void handleStatusResponseFailed() throws Exception {
    UUID sessionID = registerSession();
    InstrumentedLocalSessions sessions = new InstrumentedLocalSessions();
    sessions.start();
    LocalSession session = sessions.prepareForTest(sessionID);
    session.setState(FINALIZE_PROMISED);
    sessions.handleStatusResponse(PARTICIPANT1, new StatusResponse(sessionID, FAILED));
    Assert.assertEquals(FAILED, session.getState());
}
Also used : StatusResponse(org.apache.cassandra.repair.messages.StatusResponse) UUID(java.util.UUID) AbstractRepairTest(org.apache.cassandra.repair.AbstractRepairTest) Test(org.junit.Test)

Example 8 with StatusResponse

use of org.apache.cassandra.repair.messages.StatusResponse in project cassandra by apache.

the class LocalSessionTest method handleStatusResponseFailedRedundant.

@Test
public void handleStatusResponseFailedRedundant() throws Exception {
    UUID sessionID = registerSession();
    InstrumentedLocalSessions sessions = new InstrumentedLocalSessions();
    sessions.start();
    LocalSession session = sessions.prepareForTest(sessionID);
    session.setState(FAILED);
    sessions.handleStatusResponse(PARTICIPANT1, new StatusResponse(sessionID, FAILED));
    Assert.assertEquals(FAILED, session.getState());
}
Also used : StatusResponse(org.apache.cassandra.repair.messages.StatusResponse) UUID(java.util.UUID) AbstractRepairTest(org.apache.cassandra.repair.AbstractRepairTest) Test(org.junit.Test)

Example 9 with StatusResponse

use of org.apache.cassandra.repair.messages.StatusResponse in project cassandra by apache.

the class LocalSessionTest method handleStatusRequest.

@Test
public void handleStatusRequest() throws Exception {
    UUID sessionID = registerSession();
    InstrumentedLocalSessions sessions = new InstrumentedLocalSessions();
    sessions.start();
    LocalSession session = sessions.prepareForTest(sessionID);
    Assert.assertEquals(PREPARED, session.getState());
    sessions.sentMessages.clear();
    sessions.handleStatusRequest(PARTICIPANT2, new StatusRequest(sessionID));
    assertNoMessagesSent(sessions, PARTICIPANT1);
    assertMessagesSent(sessions, PARTICIPANT2, new StatusResponse(sessionID, PREPARED));
    assertNoMessagesSent(sessions, PARTICIPANT3);
}
Also used : StatusRequest(org.apache.cassandra.repair.messages.StatusRequest) StatusResponse(org.apache.cassandra.repair.messages.StatusResponse) UUID(java.util.UUID) AbstractRepairTest(org.apache.cassandra.repair.AbstractRepairTest) Test(org.junit.Test)

Example 10 with StatusResponse

use of org.apache.cassandra.repair.messages.StatusResponse in project cassandra by apache.

the class LocalSessionTest method handleStatusResponseNoop.

@Test
public void handleStatusResponseNoop() throws Exception {
    UUID sessionID = registerSession();
    InstrumentedLocalSessions sessions = new InstrumentedLocalSessions();
    sessions.start();
    LocalSession session = sessions.prepareForTest(sessionID);
    session.setState(REPAIRING);
    sessions.handleStatusResponse(PARTICIPANT1, new StatusResponse(sessionID, FINALIZE_PROMISED));
    Assert.assertEquals(REPAIRING, session.getState());
}
Also used : StatusResponse(org.apache.cassandra.repair.messages.StatusResponse) UUID(java.util.UUID) AbstractRepairTest(org.apache.cassandra.repair.AbstractRepairTest) Test(org.junit.Test)

Aggregations

UUID (java.util.UUID)10 StatusResponse (org.apache.cassandra.repair.messages.StatusResponse)10 AbstractRepairTest (org.apache.cassandra.repair.AbstractRepairTest)8 Test (org.junit.Test)8 StatusRequest (org.apache.cassandra.repair.messages.StatusRequest)2