Yuta HIGUCHI

DatabaseManager: extended election Timeout 2s -> 5s

Change-Id: I192113f634cd27c21b7d987b784bc81b1c6bde44
...@@ -117,9 +117,12 @@ public class DatabaseManager implements DatabaseService, DatabaseAdminService { ...@@ -117,9 +117,12 @@ public class DatabaseManager implements DatabaseService, DatabaseAdminService {
117 117
118 private volatile LeaderElectEvent myLeaderEvent = null; 118 private volatile LeaderElectEvent myLeaderEvent = null;
119 119
120 - // TODO make this configuratble 120 + // TODO make this configurable
121 private int maxLogSizeBytes = 128 * (1024 ^ 2); 121 private int maxLogSizeBytes = 128 * (1024 ^ 2);
122 122
123 + // TODO make this configurable
124 + private long electionTimeoutMs = 5000; // CopyCat default: 2000
125 +
123 @Activate 126 @Activate
124 public void activate() throws InterruptedException, ExecutionException { 127 public void activate() throws InterruptedException, ExecutionException {
125 128
...@@ -181,6 +184,7 @@ public class DatabaseManager implements DatabaseService, DatabaseAdminService { ...@@ -181,6 +184,7 @@ public class DatabaseManager implements DatabaseService, DatabaseAdminService {
181 184
182 CopycatConfig ccConfig = new CopycatConfig(); 185 CopycatConfig ccConfig = new CopycatConfig();
183 ccConfig.setMaxLogSize(maxLogSizeBytes); 186 ccConfig.setMaxLogSize(maxLogSizeBytes);
187 + ccConfig.setElectionTimeout(electionTimeoutMs);
184 188
185 copycat = new Copycat(stateMachine, consensusLog, cluster, copycatMessagingProtocol, ccConfig); 189 copycat = new Copycat(stateMachine, consensusLog, cluster, copycatMessagingProtocol, ccConfig);
186 copycat.event(LeaderElectEvent.class).registerHandler(new RaftLeaderElectionMonitor()); 190 copycat.event(LeaderElectEvent.class).registerHandler(new RaftLeaderElectionMonitor());
......