=sha #20315 make sharding snapshotting based on seqNr, not counter (#20319)

This commit is contained in:
Konrad Malawski 2016-05-05 16:21:24 +02:00
parent 1f8225087f
commit d24c1e0ede
3 changed files with 9 additions and 9 deletions

View file

@ -321,8 +321,6 @@ private[akka] class PersistentShard(
override def snapshotPluginId: String = settings.snapshotPluginId
var persistCount = 0
// would be initialized after recovery completed
override def initialized(): Unit = {}
@ -334,8 +332,7 @@ private[akka] class PersistentShard(
}
def saveSnapshotWhenNeeded(): Unit = {
persistCount += 1
if (persistCount % snapshotAfter == 0) {
if (lastSequenceNr % snapshotAfter == 0 && lastSequenceNr != 0) {
log.debug("Saving snapshot, sequence number [{}]", snapshotSequenceNr)
saveSnapshot(state)
}

View file

@ -729,8 +729,6 @@ class PersistentShardCoordinator(typeName: String, settings: ClusterShardingSett
override def snapshotPluginId: String = settings.snapshotPluginId
var persistCount = 0
override def receiveRecover: Receive = {
case evt: DomainEvent
log.debug("receiveRecover {}", evt)
@ -793,8 +791,7 @@ class PersistentShardCoordinator(typeName: String, settings: ClusterShardingSett
}
def saveSnapshotWhenNeeded(): Unit = {
persistCount += 1
if (persistCount % snapshotAfter == 0) {
if (lastSequenceNr % snapshotAfter == 0 && lastSequenceNr != 0) {
log.debug("Saving snapshot, sequence number [{}]", snapshotSequenceNr)
saveSnapshot(state)
}

View file

@ -767,7 +767,13 @@ object MiMa extends AutoPlugin {
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.http.impl.util.package.printEvent"),
// #20362 - parser private
ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.impl.model.parser.CommonRules.expires-date")
ProblemFilters.exclude[ReversedMissingMethodProblem]("akka.http.impl.model.parser.CommonRules.expires-date"),
// #20319 - remove not needed "no. of persists" counter in sharding
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.cluster.sharding.PersistentShard.persistCount"),
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.cluster.sharding.PersistentShard.persistCount_="),
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.cluster.sharding.PersistentShardCoordinator.persistCount"),
ProblemFilters.exclude[DirectMissingMethodProblem]("akka.cluster.sharding.PersistentShardCoordinator.persistCount_=")
)
)
}