Committed by
Yuta Higuchi
DatabaseManager: larger raft log size limit
Change-Id: Ib93b11ce55d9c038fad8e4fabfa8efc089899656
Showing
1 changed file
with
8 additions
and
1 deletions
... | @@ -17,6 +17,7 @@ import java.util.concurrent.ScheduledExecutorService; | ... | @@ -17,6 +17,7 @@ import java.util.concurrent.ScheduledExecutorService; |
17 | import java.util.concurrent.TimeUnit; | 17 | import java.util.concurrent.TimeUnit; |
18 | 18 | ||
19 | import net.kuujo.copycat.Copycat; | 19 | import net.kuujo.copycat.Copycat; |
20 | +import net.kuujo.copycat.CopycatConfig; | ||
20 | import net.kuujo.copycat.cluster.ClusterConfig; | 21 | import net.kuujo.copycat.cluster.ClusterConfig; |
21 | import net.kuujo.copycat.cluster.Member; | 22 | import net.kuujo.copycat.cluster.Member; |
22 | import net.kuujo.copycat.cluster.TcpCluster; | 23 | import net.kuujo.copycat.cluster.TcpCluster; |
... | @@ -116,6 +117,9 @@ public class DatabaseManager implements DatabaseService, DatabaseAdminService { | ... | @@ -116,6 +117,9 @@ public class DatabaseManager implements DatabaseService, DatabaseAdminService { |
116 | 117 | ||
117 | private volatile LeaderElectEvent myLeaderEvent = null; | 118 | private volatile LeaderElectEvent myLeaderEvent = null; |
118 | 119 | ||
120 | + // TODO make this configuratble | ||
121 | + private int maxLogSizeBytes = 128 * (1024 ^ 2); | ||
122 | + | ||
119 | @Activate | 123 | @Activate |
120 | public void activate() throws InterruptedException, ExecutionException { | 124 | public void activate() throws InterruptedException, ExecutionException { |
121 | 125 | ||
... | @@ -175,7 +179,10 @@ public class DatabaseManager implements DatabaseService, DatabaseAdminService { | ... | @@ -175,7 +179,10 @@ public class DatabaseManager implements DatabaseService, DatabaseAdminService { |
175 | Log consensusLog = new MapDBLog(LOG_FILE_PREFIX + localNode.id(), | 179 | Log consensusLog = new MapDBLog(LOG_FILE_PREFIX + localNode.id(), |
176 | ClusterMessagingProtocol.DB_SERIALIZER); | 180 | ClusterMessagingProtocol.DB_SERIALIZER); |
177 | 181 | ||
178 | - copycat = new Copycat(stateMachine, consensusLog, cluster, copycatMessagingProtocol); | 182 | + CopycatConfig ccConfig = new CopycatConfig(); |
183 | + ccConfig.setMaxLogSize(maxLogSizeBytes); | ||
184 | + | ||
185 | + copycat = new Copycat(stateMachine, consensusLog, cluster, copycatMessagingProtocol, ccConfig); | ||
179 | copycat.event(LeaderElectEvent.class).registerHandler(new RaftLeaderElectionMonitor()); | 186 | copycat.event(LeaderElectEvent.class).registerHandler(new RaftLeaderElectionMonitor()); |
180 | copycat.event(LeaderElectEvent.class).registerHandler(expirationTracker); | 187 | copycat.event(LeaderElectEvent.class).registerHandler(expirationTracker); |
181 | } | 188 | } | ... | ... |
-
Please register or login to post a comment