Replication updates with local identifier shouldn't use the same timestamp, because this allows two different updates which replace each other on different nodes, and don't converge. Extend default TimeProvider precision to nanoseconds, to exclude possibility of 'microsecond overflow' on frequent changes to the same entry

This commit is contained in:
leventov
2015-12-26 17:28:35 +03:00
parent 0ead52335b
commit 1743f1c694
5 changed files with 14 additions and 19 deletions
@@ -128,12 +128,7 @@ public abstract class ReplicatedMapEntryStages<K, V> extends MapEntryStages<K, V
public void updatedReplicationStateOnPresentEntry() {
if (!ru.replicationUpdateInit()) {
s.innerWriteLock.lock();
long timestamp;
if (identifier() != mh.m().identifier()) {
timestamp = Math.max(timestamp() + 1, mh.m().timeProvider.currentTime());
} else {
timestamp = mh.m().timeProvider.currentTime();
}
long timestamp = Math.max(timestamp() + 1, mh.m().timeProvider.currentTime());
updateReplicationState(mh.m().identifier(), timestamp);
}
}