Add a configuration option to vary how heavyweight anti-entropy is.
Change-Id: I57cea61182b3d19deb47608ffb7dd617529ae34c
diff --git a/core/store/dist/src/main/java/org/onosproject/store/ecmap/EventuallyConsistentMapImpl.java b/core/store/dist/src/main/java/org/onosproject/store/ecmap/EventuallyConsistentMapImpl.java
index 1069f63..8de348a 100644
--- a/core/store/dist/src/main/java/org/onosproject/store/ecmap/EventuallyConsistentMapImpl.java
+++ b/core/store/dist/src/main/java/org/onosproject/store/ecmap/EventuallyConsistentMapImpl.java
@@ -98,6 +98,7 @@
// TODO: Make these anti-entropy params configurable
private long initialDelaySec = 5;
private long periodSec = 5;
+ private boolean lightweightAntiEntropy = true;
/**
* Creates a new eventually consistent map shared amongst multiple instances.
@@ -567,35 +568,32 @@
private void handleAntiEntropyAdvertisement(AntiEntropyAdvertisement<K> ad) {
List<EventuallyConsistentMapEvent<K, V>> externalEvents;
- boolean sync = false;
externalEvents = antiEntropyCheckLocalItems(ad);
antiEntropyCheckLocalRemoved(ad);
- externalEvents.addAll(antiEntropyCheckRemoteRemoved(ad));
+ if (!lightweightAntiEntropy) {
+ externalEvents.addAll(antiEntropyCheckRemoteRemoved(ad));
- // if remote ad has something unknown, actively sync
- for (K key : ad.timestamps().keySet()) {
- if (!items.containsKey(key)) {
- sync = true;
- break;
+ // if remote ad has something unknown, actively sync
+ for (K key : ad.timestamps().keySet()) {
+ if (!items.containsKey(key)) {
+ // Send the advertisement back if this peer is out-of-sync
+ final NodeId sender = ad.sender();
+ AntiEntropyAdvertisement<K> myAd = createAdvertisement();
+ try {
+ unicastMessage(sender, antiEntropyAdvertisementSubject, myAd);
+ } catch (IOException e) {
+ log.debug(
+ "Failed to send reactive anti-entropy advertisement to {}",
+ sender);
+ }
+
+ break;
+ }
}
}
-
- // Send the advertisement back if this peer is out-of-sync
- if (sync) {
- final NodeId sender = ad.sender();
- AntiEntropyAdvertisement<K> myAd = createAdvertisement();
- try {
- unicastMessage(sender, antiEntropyAdvertisementSubject, myAd);
- } catch (IOException e) {
- log.debug(
- "Failed to send reactive anti-entropy advertisement to {}",
- sender);
- }
- }
-
externalEvents.forEach(this::notifyListeners);
}