Search in sources :

Example 1 with LayoutMsg

use of org.corfudb.protocols.wireprotocol.LayoutMsg in project CorfuDB by CorfuDB.

the class LayoutServerTest method commitReturnsAck.

private void commitReturnsAck(LayoutServer s1, Integer reboot, long baseEpoch) {
    long newEpoch = baseEpoch + reboot;
    sendMessage(new CorfuPayloadMsg<>(CorfuMsgType.SET_EPOCH, newEpoch));
    Layout layout = TestLayoutBuilder.single(SERVERS.PORT_0);
    layout.setEpoch(newEpoch);
    sendPrepare(newEpoch, HIGH_RANK);
    Assertions.assertThat(getLastMessage().getMsgType()).isEqualTo(CorfuMsgType.LAYOUT_PREPARE_ACK);
    sendPropose(newEpoch, HIGH_RANK, layout);
    Assertions.assertThat(getLastMessage().getMsgType()).isEqualTo(CorfuMsgType.ACK);
    sendCommitted(newEpoch, layout);
    Assertions.assertThat(getLastMessage().getMsgType()).isEqualTo(CorfuMsgType.ACK);
    sendCommitted(newEpoch, layout);
    Assertions.assertThat(getLastMessage().getMsgType()).isEqualTo(CorfuMsgType.ACK);
    requestLayout(newEpoch);
    Assertions.assertThat(getLastMessage().getMsgType()).isEqualTo(CorfuMsgType.LAYOUT_RESPONSE);
    Assertions.assertThat(((LayoutMsg) getLastMessage()).getLayout()).isEqualTo(layout);
}
Also used : LayoutMsg(org.corfudb.protocols.wireprotocol.LayoutMsg) Layout(org.corfudb.runtime.view.Layout)

Example 2 with LayoutMsg

use of org.corfudb.protocols.wireprotocol.LayoutMsg in project CorfuDB by CorfuDB.

the class LayoutServerTest method bootstrapServerInstallsNewLayout.

/**
     * Verifies that a server responds with a layout that the server was bootstrapped with.
     * There are no layout changes between bootstrap and layout request.
     */
@Test
public void bootstrapServerInstallsNewLayout() {
    Layout layout = TestLayoutBuilder.single(SERVERS.PORT_0);
    bootstrapServer(layout);
    requestLayout(layout.getEpoch());
    Assertions.assertThat(getLastMessage().getMsgType()).isEqualTo(CorfuMsgType.LAYOUT_RESPONSE);
    Assertions.assertThat(((LayoutMsg) getLastMessage()).getLayout()).isEqualTo(layout);
}
Also used : LayoutMsg(org.corfudb.protocols.wireprotocol.LayoutMsg) Layout(org.corfudb.runtime.view.Layout) Test(org.junit.Test)

Aggregations

LayoutMsg (org.corfudb.protocols.wireprotocol.LayoutMsg)2 Layout (org.corfudb.runtime.view.Layout)2 Test (org.junit.Test)1