Fix multiple snapshots present after journal removal 80/82380/8
authorTomas Cere <tomas.cere@pantheon.tech>
Mon, 3 Jun 2019 13:02:08 +0000 (15:02 +0200)
committerRobert Varga <nite@hq.sk>
Thu, 4 Jul 2019 15:02:51 +0000 (15:02 +0000)
commit609076e66a0298d0d3c912ade66e813a464c4c8a
tree1848c40934650ed0ec3a9a0a827691285e4cca0d
parentc7fb53c205eddf3324a686b024e600480410fdb1
Fix multiple snapshots present after journal removal

After journal removal the sequence number starts counting from 0
once again. Therefore we can have multiple snapshots present and
snapshots with higher sequence number always take priority for loading
even when a newer snapshot is present.

Change this up in 2 ways:
1. disregard sequence number while deleting snapshots(delete all
snapshots with an older timestamp)
2. while loading snapshots prioritize timestamp rather than seqNr.

Also simplify LocalSnapshotStore.compare().

Change-Id: I205ea0ddf48d73b0a09297a1ce4e9fd514531993
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/SnapshotManager.java
opendaylight/md-sal/sal-akka-raft/src/test/java/org/opendaylight/controller/cluster/raft/SnapshotManagerTest.java
opendaylight/md-sal/sal-clustering-commons/src/main/java/org/opendaylight/controller/cluster/persistence/LocalSnapshotStore.java