Code Review
/
controller.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Bug-2590: Clustering : Minimize usage of in-memory journal
[controller.git]
/
opendaylight
/
md-sal
/
sal-akka-raft
/
src
/
main
/
java
/
org
/
opendaylight
/
controller
/
cluster
/
raft
/
RaftActor.java
diff --git
a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActor.java
b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActor.java
index aa7b4533b7758f7a3f457ea48b1ae72cc6d94162..766b80e73dd12c890df3ed493e397a7cd144aab4 100644
(file)
--- a/
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActor.java
+++ b/
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActor.java
@@
-107,14
+107,10
@@
public abstract class RaftActor extends AbstractUntypedPersistentActor {
private CaptureSnapshot captureSnapshot = null;
private CaptureSnapshot captureSnapshot = null;
- private volatile boolean hasSnapshotCaptureInitiated = false;
-
private Stopwatch recoveryTimer;
private int currentRecoveryBatchCount;
private Stopwatch recoveryTimer;
private int currentRecoveryBatchCount;
-
-
public RaftActor(String id, Map<String, String> peerAddresses) {
this(id, peerAddresses, Optional.<ConfigParams>absent());
}
public RaftActor(String id, Map<String, String> peerAddresses) {
this(id, peerAddresses, Optional.<ConfigParams>absent());
}
@@
-436,7
+432,7
@@
public abstract class RaftActor extends AbstractUntypedPersistentActor {
self().tell(new ApplyLogEntries((int) replicatedLogEntry.getIndex()), self());
// Check if the "real" snapshot capture has been initiated. If no then do the fake snapshot
self().tell(new ApplyLogEntries((int) replicatedLogEntry.getIndex()), self());
// Check if the "real" snapshot capture has been initiated. If no then do the fake snapshot
- if(!
hasSnapshotCaptureInitiated
){
+ if(!
context.isSnapshotCaptureInitiated()
){
raftContext.getReplicatedLog().snapshotPreCommit(raftContext.getLastApplied(),
raftContext.getTermInformation().getCurrentTerm());
raftContext.getReplicatedLog().snapshotCommit();
raftContext.getReplicatedLog().snapshotPreCommit(raftContext.getLastApplied(),
raftContext.getTermInformation().getCurrentTerm());
raftContext.getReplicatedLog().snapshotCommit();
@@
-693,7
+689,7
@@
public abstract class RaftActor extends AbstractUntypedPersistentActor {
}
captureSnapshot = null;
}
captureSnapshot = null;
-
hasSnapshotCaptureInitiated = false
;
+
context.setSnapshotCaptureInitiated(false)
;
}
protected boolean hasFollowers(){
}
protected boolean hasFollowers(){
@@
-794,7
+790,7
@@
public abstract class RaftActor extends AbstractUntypedPersistentActor {
getRaftActorContext().getConfigParams().getSnapshotDataThresholdPercentage() / 100;
// when a snaphsot is being taken, captureSnapshot != null
getRaftActorContext().getConfigParams().getSnapshotDataThresholdPercentage() / 100;
// when a snaphsot is being taken, captureSnapshot != null
- if (
hasSnapshotCaptureInitiated == false
&&
+ if (
!context.isSnapshotCaptureInitiated()
&&
( journalSize % context.getConfigParams().getSnapshotBatchCount() == 0 ||
dataSizeForCheck > dataThreshold)) {
( journalSize % context.getConfigParams().getSnapshotBatchCount() == 0 ||
dataSizeForCheck > dataThreshold)) {
@@
-827,7
+823,7
@@
public abstract class RaftActor extends AbstractUntypedPersistentActor {
getSelf().tell(new CaptureSnapshot(
lastIndex(), lastTerm(), lastAppliedIndex, lastAppliedTerm),
null);
getSelf().tell(new CaptureSnapshot(
lastIndex(), lastTerm(), lastAppliedIndex, lastAppliedTerm),
null);
-
hasSnapshotCaptureInitiated = true
;
+
context.setSnapshotCaptureInitiated(true)
;
}
if(callback != null){
callback.apply(replicatedLogEntry);
}
if(callback != null){
callback.apply(replicatedLogEntry);