From: Vishal Thapar Date: Wed, 7 Dec 2016 06:41:45 +0000 (+0530) Subject: BUG 7310: Add configurable option to skip columns X-Git-Tag: release/carbon~51 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=5f8ca82c15d75d6c703cef2ded1072c4a588c93b;p=ovsdb.git BUG 7310: Add configurable option to skip columns Adds a new cfg file to configure table columns to be skipped when monitoring updates from OVS switch. Currently following tables and columns are configurable: 1. Manager: status Change-Id: I6d869ca559cb69374dcdf75b60282c105af85806 Signed-off-by: Vishal Thapar --- diff --git a/southbound/southbound-features/pom.xml b/southbound/southbound-features/pom.xml index e3491540d..946828a6a 100644 --- a/southbound/southbound-features/pom.xml +++ b/southbound/southbound-features/pom.xml @@ -106,6 +106,13 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL southbound-impl ${project.version} + + ${project.groupId} + southbound-impl + ${project.version} + cfg + config + ${project.groupId} southbound-api diff --git a/southbound/southbound-features/src/main/features/features.xml b/southbound/southbound-features/src/main/features/features.xml index 11d953dbf..123f2ac68 100644 --- a/southbound/southbound-features/src/main/features/features.xml +++ b/southbound/southbound-features/src/main/features/features.xml @@ -50,5 +50,6 @@ and is available at http://www.eclipse.org/legal/epl-v10.html odl-ovsdb-southbound-impl mvn:org.opendaylight.ovsdb/utils.mdsal-utils/{{VERSION}} mvn:org.opendaylight.ovsdb/utils.southbound-utils/{{VERSION}} + mvn:org.opendaylight.ovsdb/southbound-impl/{{VERSION}}/cfg/config diff --git a/southbound/southbound-impl/pom.xml b/southbound/southbound-impl/pom.xml index c4bece1dd..a451ca2ee 100644 --- a/southbound/southbound-impl/pom.xml +++ b/southbound/southbound-impl/pom.xml @@ -145,6 +145,28 @@ and is available at http://www.eclipse.org/legal/epl-v10.html + + org.codehaus.mojo + build-helper-maven-plugin + + + attach-artifacts + + attach-artifact + + package + + + + ${project.build.directory}/classes/initial/southbound.cfg + cfg + config + + + + + + diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionInstance.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionInstance.java index fdf6d2a1d..6e9665004 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionInstance.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionInstance.java @@ -70,9 +70,9 @@ import org.slf4j.LoggerFactory; public class OvsdbConnectionInstance { private static final Logger LOG = LoggerFactory.getLogger(OvsdbConnectionInstance.class); - private OvsdbClient client; + private final OvsdbClient client; private ConnectionInfo connectionInfo; - private TransactionInvoker txInvoker; + private final TransactionInvoker txInvoker; private Map transactInvokers; private MonitorCallBack callback; private InstanceIdentifier instanceIdentifier; diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundConstants.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundConstants.java index b6a6713f6..7e4db86d4 100755 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundConstants.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundConstants.java @@ -11,6 +11,7 @@ import com.google.common.collect.ImmutableBiMap; import com.google.common.collect.ImmutableCollection; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; +import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; import java.util.List; @@ -153,11 +154,12 @@ public class SouthboundConstants { //Note: _version is an internal column of ovsdb schema, that gets updated //with every change in the row of the table. + // The "Manager" entry needs to be a modifiable list, SouthboundProvider::setSkipManagerStatus() modifies it static final ImmutableMap> SKIP_COLUMN_FROM_TABLE = new ImmutableMap.Builder>() .put("Open_vSwitch", Arrays.asList("statistics","_version")) .put("Port", Arrays.asList("statistics","_version")) - .put("Manager", Collections.singletonList("_version")) + .put("Manager", new ArrayList<>(Collections.singletonList("_version"))) .put("SSL", Collections.singletonList("_version")) .put("QoS", Collections.singletonList("_version")) .put("Queue", Collections.singletonList("_version")) diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundProvider.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundProvider.java index 0756378e0..4fff92754 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundProvider.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundProvider.java @@ -9,6 +9,7 @@ package org.opendaylight.ovsdb.southbound; import com.google.common.base.Optional; import com.google.common.util.concurrent.CheckedFuture; +import java.util.Map; import java.util.concurrent.ExecutionException; import org.opendaylight.controller.md.sal.binding.api.DataBroker; import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; @@ -48,11 +49,12 @@ public class SouthboundProvider implements AutoCloseable { private OvsdbConnectionManager cm; private TransactionInvoker txInvoker; private OvsdbDataTreeChangeListener ovsdbDataTreeChangeListener; - private EntityOwnershipService entityOwnershipService; + private final EntityOwnershipService entityOwnershipService; private EntityOwnershipCandidateRegistration registration; private SouthboundPluginInstanceEntityOwnershipListener providerOwnershipChangeListener; - private OvsdbConnection ovsdbConnection; + private final OvsdbConnection ovsdbConnection; private final InstanceIdentifierCodec instanceIdentifierCodec; + private static final String SKIP_MONITORING_MANAGER_STATUS_PARAM = "skip-monitoring-manager-status"; public SouthboundProvider(final DataBroker dataBroker, final EntityOwnershipService entityOwnershipServiceDependency, @@ -145,8 +147,8 @@ public class SouthboundProvider implements AutoCloseable { } private class SouthboundPluginInstanceEntityOwnershipListener implements EntityOwnershipListener { - private SouthboundProvider sp; - private EntityOwnershipListenerRegistration listenerRegistration; + private final SouthboundProvider sp; + private final EntityOwnershipListenerRegistration listenerRegistration; SouthboundPluginInstanceEntityOwnershipListener(SouthboundProvider sp, EntityOwnershipService entityOwnershipService) { @@ -164,4 +166,24 @@ public class SouthboundProvider implements AutoCloseable { } } + public void updateConfigParameter(Map configParameters) { + if (configParameters != null && !configParameters.isEmpty()) { + LOG.debug("Config parameters received : {}", configParameters.entrySet()); + for (Map.Entry paramEntry : configParameters.entrySet()) { + if (paramEntry.getKey().equalsIgnoreCase(SKIP_MONITORING_MANAGER_STATUS_PARAM)) { + setSkipMonitoringManagerStatus(Boolean.parseBoolean((String)paramEntry.getValue())); + break; + } + } + } + } + + public void setSkipMonitoringManagerStatus(boolean flag) { + LOG.debug("skipManagerStatus set to {}", flag); + if (flag) { + SouthboundConstants.SKIP_COLUMN_FROM_TABLE.get("Manager").add("status"); + } else { + SouthboundConstants.SKIP_COLUMN_FROM_TABLE.get("Manager").remove("status"); + } + } } diff --git a/southbound/southbound-impl/src/main/resources/initial/southbound.cfg b/southbound/southbound-impl/src/main/resources/initial/southbound.cfg new file mode 100644 index 000000000..1299870ae --- /dev/null +++ b/southbound/southbound-impl/src/main/resources/initial/southbound.cfg @@ -0,0 +1,14 @@ +###################################################### +# Performance Tuning Configuration Parameters # +###################################################### +# Setting "skip-monitoring-manager-status" value to "true" will skip +# monitoring of "status" column of OVSDB database "Manager" +# table of OVS switch. By default monitoring of the column is #enabled (default value "false"). +# NOTE: Setting it to true will reduce the number of updates +# received by OVSDB plugin from OVS, that eventually help in +# improving the performance of OVSDB southbound plugin. +# However, it will impact functionality in a clustered HA +# setup. So please use this option when you are running OVSDB +# southbound plugin in single node and want to achieve better +# performance. +#skip-monitoring-manager-status = false diff --git a/southbound/southbound-impl/src/main/resources/org/opendaylight/blueprint/southbound.xml b/southbound/southbound-impl/src/main/resources/org/opendaylight/blueprint/southbound.xml index e8fe07d76..824570c96 100644 --- a/southbound/southbound-impl/src/main/resources/org/opendaylight/blueprint/southbound.xml +++ b/southbound/southbound-impl/src/main/resources/org/opendaylight/blueprint/southbound.xml @@ -1,6 +1,7 @@ + + + + + + + +