Add documentation about per-shard settings 90/89890/2
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 25 May 2020 17:44:44 +0000 (19:44 +0200)
committerRobert Varga <nite@hq.sk>
Mon, 25 May 2020 17:56:30 +0000 (17:56 +0000)
Previous implementation of per-shard datastore properties did not
document this ability. Make sure we document it and properly test it.

JIRA: CONTROLLER-911
Change-Id: I5be13c73e76e612a93620710e6a00b78d9dee216
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
opendaylight/md-sal/sal-clustering-config/src/main/resources/initial/datastore.cfg
opendaylight/md-sal/sal-distributed-datastore/src/test/java/org/opendaylight/controller/cluster/datastore/DatastoreContextIntrospectorTest.java

index d43ed4b01b9d571bb4bb4fbbbf4a2b7fc6d0d85f..afceb37f7ac7ba825e5e4e9381ccad003738cde4 100644 (file)
@@ -4,6 +4,15 @@
 # the "shard-election-timeout-factor" property would be applied to both data stores whereas specifying
 # "operational.shard-election-timeout-factor" would only apply to the "operational" data store. Similarly,
 # specifying "config.shard-election-timeout-factor" would only apply to the "config" data store.
+# Overall flexibility goes even further, as these overrides can also be combined with per-shard specification,
+# so that you can also use:
+#   <shard-name>.<setting>
+#   <datastore-name>.<shard-name>.<setting>
+# for example:
+#   topology.shard-election-timeout-factor=2             # override both config/operational for topology shard
+#   config.topology.shard-election-timeout-factor=5      # override config for topology shard
+#   operational.topology.shard-election-timeout-factor=7 # override operational for topology shard
+#
 
 # The multiplication factor to be used to determine shard election timeout. The shard election timeout
 # is determined by multiplying shardHeartbeatIntervalInMillis with the shardElectionTimeoutFactor.
index cca8eb6198f2453a919ef53e43e04009265ccec2..f98a9b75d44eb66992e757954df4890b12d4981a 100644 (file)
@@ -241,6 +241,7 @@ public class DatastoreContextIntrospectorTest {
         properties.put("operational.shard-transaction-idle-timeout-in-minutes", "33"); // operational override
         properties.put("config.shard-transaction-idle-timeout-in-minutes", "44"); // config override
         properties.put("topology.shard-transaction-idle-timeout-in-minutes", "55"); // global shard override
+        properties.put("config.topology.persistent", "false"); // per-shard config override
 
         final DatastoreContextIntrospector operIntrospector = INTROSPECTOR_FACTORY.newInstance(OPERATIONAL);
 
@@ -261,6 +262,7 @@ public class DatastoreContextIntrospectorTest {
 
         shardContext = configIntrospector.newContextFactory().getShardDatastoreContext("topology");
         assertEquals(55, shardContext.getShardTransactionIdleTimeout().toMinutes());
+        assertFalse(shardContext.isPersistent());
 
         // operational shard override
         properties.put("operational.topology.shard-transaction-idle-timeout-in-minutes", "66");
@@ -277,5 +279,6 @@ public class DatastoreContextIntrospectorTest {
 
         shardContext = configIntrospector.newContextFactory().getShardDatastoreContext("default");
         assertEquals(44, shardContext.getShardTransactionIdleTimeout().toMinutes());
+        assertTrue(shardContext.isPersistent());
     }
 }