Skip to content
Snippets Groups Projects
Commit 253eb1e3 authored by Michael Eischer's avatar Michael Eischer
Browse files

Move replica config assertions to static block

This ensures that a local configuration test will trigger these checks.
parent 12b14fbd
No related branches found
No related tags found
No related merge requests found
...@@ -213,7 +213,7 @@ public class REFITConfig { ...@@ -213,7 +213,7 @@ public class REFITConfig {
public static final Class<? extends REFITBenchmarkRunnable> APPLICATION_CLIENT = config.getClass("application.client", REFITBenchmarkRunnable.class); public static final Class<? extends REFITBenchmarkRunnable> APPLICATION_CLIENT = config.getClass("application.client", REFITBenchmarkRunnable.class);
public static final Class<? extends REFITClientLibrary> APPLICATION_CLIENT_LIBRARY = config.getClass("application.library", REFITClientLibrary.class); public static final Class<? extends REFITClientLibrary> APPLICATION_CLIENT_LIBRARY = config.getClass("application.library", REFITClientLibrary.class);
public static final Class<? extends REFITClientPolicy> APPLICATION_CLIENT_POLICY = config.getClass("application.policy", REFITClientPolicy.class); public static final Class<? extends REFITClientPolicy> APPLICATION_CLIENT_POLICY = config.getClass("application.policy", REFITClientPolicy.class);
public static final Class<? extends REFITBaseReplica> APPLICATION_REPLICA = config.getClass("application.replica", REFITBaseReplica.class); public static final Class<? extends REFITBaseReplica> APPLICATION_REPLICA;
// Communication // Communication
public static final int REPLICA_NETWORK_SEND_BUFFER_SIZE = 1024 * config.getInt("replica.network.buffer.send.kb"); public static final int REPLICA_NETWORK_SEND_BUFFER_SIZE = 1024 * config.getInt("replica.network.buffer.send.kb");
...@@ -375,6 +375,8 @@ public class REFITConfig { ...@@ -375,6 +375,8 @@ public class REFITConfig {
REFITAssert.assertTrue(!REFITConfig.AUTHENTICATE_MESSAGES || REFITConfig.WAIT_FOR_FULL_REPLY, REFITAssert.assertTrue(!REFITConfig.AUTHENTICATE_MESSAGES || REFITConfig.WAIT_FOR_FULL_REPLY,
"ack replies are not yet implemented in the BFT protocol"); "ack replies are not yet implemented in the BFT protocol");
APPLICATION_REPLICA = config.getClass("application.replica", REFITBaseReplica.class);
} }
......
...@@ -17,14 +17,15 @@ public class REFITMicroIRMCReplica extends REFITBaseReplica { ...@@ -17,14 +17,15 @@ public class REFITMicroIRMCReplica extends REFITBaseReplica {
private final REFITAbstractChannelSender orderedChannelSenderStage; private final REFITAbstractChannelSender orderedChannelSenderStage;
private final REFITAbstractChannelReceiver orderedChannelReceiverStage; private final REFITAbstractChannelReceiver orderedChannelReceiverStage;
static {
public REFITMicroIRMCReplica(short id, boolean isSingleThreaded) {
super(id, isSingleThreaded, false);
// partial configuration sanity check // partial configuration sanity check
REFITAssert.assertTrue(REFITConfig.AUTONOMOUS_PANICS && REFITConfig.SEPARATE_EXECUTION_REPLICAS REFITAssert.assertTrue(REFITConfig.AUTONOMOUS_PANICS && REFITConfig.SEPARATE_EXECUTION_REPLICAS
&& REFITConfig.BATCH_ALWAYS && REFITOrderGroups.COUNT == 1 && REFITConfig.SIGNED_REQUESTS, && REFITConfig.BATCH_ALWAYS && REFITOrderGroups.COUNT == 1 && REFITConfig.SIGNED_REQUESTS,
"Incompatible configuration"); "Incompatible configuration");
}
public REFITMicroIRMCReplica(short id, boolean isSingleThreaded) {
super(id, isSingleThreaded, false);
boolean isExecutor = (id >= REFITConfig.ORDER_GROUP_SIZE); boolean isExecutor = (id >= REFITConfig.ORDER_GROUP_SIZE);
......
...@@ -27,13 +27,14 @@ public class REFITReplica extends REFITBaseReplica { ...@@ -27,13 +27,14 @@ public class REFITReplica extends REFITBaseReplica {
private final REFITExecutionStageBase executionStage; private final REFITExecutionStageBase executionStage;
private final REFITFuzzyCheckpointStage fuzzyCheckpointStage; private final REFITFuzzyCheckpointStage fuzzyCheckpointStage;
static {
public REFITReplica(short id, boolean isSingleThreaded) {
super(id, isSingleThreaded, true);
if (REFITOrderGroups.COUNT > 1) { if (REFITOrderGroups.COUNT > 1) {
throw new AssertionError("The base configuration only supports a single order group!"); throw new AssertionError("The base configuration only supports a single order group!");
} }
}
public REFITReplica(short id, boolean isSingleThreaded) {
super(id, isSingleThreaded, true);
// Create global stages // Create global stages
if (id < REFITConfig.EXEC_GROUP_SIZE) { if (id < REFITConfig.EXEC_GROUP_SIZE) {
......
...@@ -38,14 +38,15 @@ public class REFITSpiderReplica extends REFITBaseReplica { ...@@ -38,14 +38,15 @@ public class REFITSpiderReplica extends REFITBaseReplica {
private final REFITAbstractChannelSender orderedChannelSenderStage; private final REFITAbstractChannelSender orderedChannelSenderStage;
private final REFITAbstractChannelReceiver orderedChannelReceiverStage; private final REFITAbstractChannelReceiver orderedChannelReceiverStage;
static {
public REFITSpiderReplica(short id, boolean isSingleThreaded) {
super(id, isSingleThreaded, (id >= REFITConfig.ORDER_GROUP_SIZE));
// partial configuration sanity check // partial configuration sanity check
REFITAssert.assertTrue(REFITConfig.AUTONOMOUS_PANICS && REFITConfig.SEPARATE_EXECUTION_REPLICAS REFITAssert.assertTrue(REFITConfig.AUTONOMOUS_PANICS && REFITConfig.SEPARATE_EXECUTION_REPLICAS
&& REFITConfig.BATCH_ALWAYS && REFITOrderGroups.COUNT == 1 && REFITConfig.SIGNED_REQUESTS, && REFITConfig.BATCH_ALWAYS && REFITOrderGroups.COUNT == 1 && REFITConfig.SIGNED_REQUESTS,
"Incompatible configuration"); "Incompatible configuration");
}
public REFITSpiderReplica(short id, boolean isSingleThreaded) {
super(id, isSingleThreaded, (id >= REFITConfig.ORDER_GROUP_SIZE));
boolean isExecutor = (id >= REFITConfig.ORDER_GROUP_SIZE); boolean isExecutor = (id >= REFITConfig.ORDER_GROUP_SIZE);
int executorID = REFITReplicaGroups.getExecutionGroupId(id); int executorID = REFITReplicaGroups.getExecutionGroupId(id);
......
...@@ -31,14 +31,15 @@ public class REFITWeaveReplica extends REFITBaseReplica { ...@@ -31,14 +31,15 @@ public class REFITWeaveReplica extends REFITBaseReplica {
private final REFITGroupMessageRouter msgRouter; private final REFITGroupMessageRouter msgRouter;
static {
public REFITWeaveReplica(short id, boolean isSingleThreaded) {
super(id, isSingleThreaded, true);
// minimal sanity check // minimal sanity check
REFITAssert.assertTrue(REFITConfig.LOCATION_BASED_ORDER_GROUPS REFITAssert.assertTrue(REFITConfig.LOCATION_BASED_ORDER_GROUPS
&& REFITConfig.TOTAL_NR_OF_REPLICAS == REFITConfig.ORDER_GROUP_SIZE && REFITConfig.TOTAL_NR_OF_REPLICAS == REFITConfig.ORDER_GROUP_SIZE
&& REFITConfig.TOTAL_NR_OF_REPLICAS == REFITConfig.EXEC_GROUP_SIZE, "Incompatible configuration"); && REFITConfig.TOTAL_NR_OF_REPLICAS == REFITConfig.EXEC_GROUP_SIZE, "Incompatible configuration");
}
public REFITWeaveReplica(short id, boolean isSingleThreaded) {
super(id, isSingleThreaded, true);
for (int i = 0; i < REFITOrderGroups.COUNT; i++) { for (int i = 0; i < REFITOrderGroups.COUNT; i++) {
REFITLogger.logDebug(this, "Order group " + i + ": " + Arrays.toString(REFITConfig.ORDER_GROUPS[i])); REFITLogger.logDebug(this, "Order group " + i + ": " + Arrays.toString(REFITConfig.ORDER_GROUPS[i]));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment