context.getTermInformation().getVotedFor());
}
} else {
- dataRecoveredWithPersistenceDisabled = true;
+ boolean isServerConfigPayload = false;
+ if(message instanceof ReplicatedLogEntry){
+ ReplicatedLogEntry repLogEntry = (ReplicatedLogEntry)message;
+ if(isServerConfigurationPayload(repLogEntry)){
+ isServerConfigPayload = true;
+ context.updatePeerIds((ServerConfigurationPayload)repLogEntry.getData());
+ }
+ }
+
+ if(!isServerConfigPayload){
+ dataRecoveredWithPersistenceDisabled = true;
+ }
}
return recoveryComplete;
logEntry.getIndex(), logEntry.size());
}
+ if(isServerConfigurationPayload(logEntry)){
+ context.updatePeerIds((ServerConfigurationPayload)logEntry.getData());
+ }
replicatedLog().append(logEntry);
}
initRecoveryTimer();
int batchSize = context.getConfigParams().getJournalRecoveryLogBatchSize();
- if(currentRecoveryBatchCount == 0) {
- cohort.startLogRecoveryBatch(batchSize);
- }
+ if(!isServerConfigurationPayload(logEntry)){
+ if(currentRecoveryBatchCount == 0) {
+ cohort.startLogRecoveryBatch(batchSize);
+ }
- cohort.appendRecoveredLogEntry(logEntry.getData());
+ cohort.appendRecoveredLogEntry(logEntry.getData());
- if(++currentRecoveryBatchCount >= batchSize) {
- endCurrentLogRecoveryBatch();
+ if(++currentRecoveryBatchCount >= batchSize) {
+ endCurrentLogRecoveryBatch();
+ }
}
}
"journal-size = {}", replicatedLog().lastIndex(), replicatedLog().getSnapshotIndex(),
replicatedLog().getSnapshotTerm(), replicatedLog().size());
}
+
+ private boolean isServerConfigurationPayload(ReplicatedLogEntry repLogEntry){
+ return (repLogEntry.getData() instanceof ServerConfigurationPayload);
+ }
}