Add documentation about per-shard settings 31/89931/2
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 25 May 2020 17:44:44 +0000 (19:44 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 25 May 2020 17:55:41 +0000 (19:55 +0200)
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 6a684ff32bca4e50cb72146671804f1aa22f0635..2d6e4ebcbcaa02736c43f339a8fcb3a0f651c7e0 100644 (file)
@@ -217,6 +217,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);
 
@@ -237,6 +238,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");
@@ -253,5 +255,6 @@ public class DatastoreContextIntrospectorTest {
 
         shardContext = configIntrospector.newContextFactory().getShardDatastoreContext("default");
         assertEquals(44, shardContext.getShardTransactionIdleTimeout().toMinutes());
+        assertTrue(shardContext.isPersistent());
     }
 }