[SDFAB-753] Optimize several ONOS components

Leverage the improved ClusterEvent to optimize several ONOS components.
The idea behind is that there is no need to react for these components
when an Atomix goes down. Actually, reacting will put additional
pressure in the Atomix nodes for no reason. Moreover, any operation done
in this period can potentially timeout

Change-Id: I5edeb3c1189e4255cdb1efb712da33d397da27bf
(cherry picked from commit 75ac28406acc3adf639385694ebb458d52ad8c88)
This commit is contained in:
pierventre 2021-11-09 20:06:01 +01:00 committed by Pier Luigi Ventre
parent 55a5f39ae6
commit e73a7270af
4 changed files with 30 additions and 14 deletions

View File

@ -152,6 +152,11 @@ public class RouteMonitor {
@Override
public void event(ClusterEvent event) {
eventExecutor.execute(() -> {
if (event.instanceType() == ClusterEvent.InstanceType.STORAGE) {
log.debug("Skipping cluster event for {}", event.subject().id().id());
return;
}
switch (event.type()) {
case INSTANCE_DEACTIVATED:
NodeId id = event.subject().id();

View File

@ -830,6 +830,11 @@ public class FpmManager implements FpmInfoService {
@Override
public void event(ClusterEvent event) {
clusterEventExecutor.execute(() -> {
if (event.instanceType() == ClusterEvent.InstanceType.STORAGE) {
log.debug("Skipping cluster event for {}", event.subject().id().id());
return;
}
log.info("Receives ClusterEvent {} for {}", event.type(), event.subject().id());
switch (event.type()) {
case INSTANCE_READY:

View File

@ -922,7 +922,11 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase {
private class InternalClusterListener implements ClusterEventListener {
@Override
public void event(ClusterEvent event) {
msgSender.execute(() -> sendMessage(instanceMessage(event, null)));
msgSender.execute(() -> {
if (event.instanceType() == ClusterEvent.InstanceType.ONOS) {
sendMessage(instanceMessage(event, null));
}
});
}
}

View File

@ -380,23 +380,25 @@ public final class UiSharedTopologyModel
}
private void handleEvent(ClusterEvent event) {
ControllerNode cnode = event.subject();
if (event.instanceType() == ClusterEvent.InstanceType.ONOS) {
ControllerNode cnode = event.subject();
switch (event.type()) {
switch (event.type()) {
case INSTANCE_ADDED:
case INSTANCE_ACTIVATED:
case INSTANCE_READY:
case INSTANCE_DEACTIVATED:
cache.addOrUpdateClusterMember(cnode);
break;
case INSTANCE_ADDED:
case INSTANCE_ACTIVATED:
case INSTANCE_READY:
case INSTANCE_DEACTIVATED:
cache.addOrUpdateClusterMember(cnode);
break;
case INSTANCE_REMOVED:
cache.removeClusterMember(cnode);
break;
case INSTANCE_REMOVED:
cache.removeClusterMember(cnode);
break;
default:
break;
default:
break;
}
}
}
}