sergeyuttsel commented on code in PR #2957:
URL: https://github.com/apache/ignite-3/pull/2957#discussion_r1434830313
##########
modules/distribution-zones/src/test/java/org/apache/ignite/internal/distributionzones/causalitydatanodes/DistributionZoneCausalityDataNodesTest.java:
##########
@@ -1013,73 +997,116 @@ void simpleTopologyChanges() throws Exception {
* @throws Exception If failed.
*/
@Test
- @Disabled("https://issues.apache.org/jira/browse/IGNITE-20412")
- void checkDataNodesRepeated() throws Exception {
- prepareZonesWithOneDataNodes();
+ void checkDataNodesRepeatedOnNodeAdded() throws Exception {
+ prepareZonesWithTwoDataNodes();
- prepareZonesTimerValuesToTest();
+ Map<Integer, Set<String>> expectedDataNodes = new HashMap<>();
+ expectedDataNodes.put(getZoneId(DEFAULT_ZONE_NAME),
Set.of(NODE_0.name(), NODE_1.name(), NODE_2.name()));
+ expectedDataNodes.put(getZoneId(ZONE_NAME), Set.of(NODE_0.name(),
NODE_1.name(), NODE_2.name()));
+ expectedDataNodes.put(getZoneId(ZONE_NAME_2), Set.of(NODE_0.name(),
NODE_1.name()));
+ expectedDataNodes.put(getZoneId(ZONE_NAME_3), Set.of(NODE_0.name(),
NODE_1.name()));
- CountDownLatch scaleUpLatch = blockScaleUpTaskExecution();
+ Map<Integer, Set<String>> expectedDataNodes1 = new
HashMap<>(expectedDataNodes);
+ expectedDataNodes1.put(getZoneId(ZONE_NAME_4), Set.of(NODE_0.name(),
NODE_1.name()));
- CountDownLatch scaleDownLatch = blockScaleDownTaskExecution();
+ Map<Integer, Set<String>> expectedDataNodes2 = new
HashMap<>(expectedDataNodes);
+ expectedDataNodes2.put(getZoneId(ZONE_NAME_4), Set.of(NODE_0.name(),
NODE_1.name(), NODE_2.name()));
- Set<LogicalNode> topology1 = Set.of(NODE_0, NODE_1, NODE_2);
- Set<LogicalNode> topology2 = Set.of(NODE_0, NODE_2);
+ checkDataNodesRepeated(expectedDataNodes1, expectedDataNodes2, true);
+ }
- // Change logical topology. NODE_2 is added.
- long topologyRevision1 =
putNodeInLogicalTopologyAndGetRevision(NODE_2, topology1);
- waitForCondition(() -> metaStorageManager.appliedRevision() >=
topologyRevision1, TIMEOUT);
+ /**
+ * Check that data nodes calculation is idempotented.
+ * The current data nodes value which was calculated by data nodes from
the meta storage manager and topology augmentation maps equals
+ * to the data nodes value which were calculated by data nodes from the
meta storage manager after topology augmentation maps
+ * were cleared.
+ *
+ * @throws Exception If failed.
+ */
+ @Test
+ void checkDataNodesRepeatedOnNodeRemoved() throws Exception {
+ prepareZonesWithTwoDataNodes();
- // Change logical topology. NODE_1 is removed.
- long topologyRevision2 =
removeNodeInLogicalTopologyAndGetRevision(Set.of(NODE_1), topology2);
- waitForCondition(() -> metaStorageManager.appliedRevision() >=
topologyRevision2, TIMEOUT);
-
- Set<String> expectedDefaultZoneDataNodes = Set.of(NODE_0.name(),
NODE_2.name());
- Set<String> expectedZone1DataNodes = Set.of(NODE_0.name(),
NODE_1.name(), NODE_2.name());
- Set<String> expectedZone2DataNodes = Set.of(NODE_0.name());
- Set<String> expectedZone3DataNodes = Set.of(NODE_0.name(),
NODE_1.name());
-
- // Check that data nodes values are changed according to scale up and
down timers.
- // Data nodes from the meta storage manager and topology augmentation
maps are used to calculate current data nodes.
- checkDataNodes(
- topologyRevision2,
- expectedDefaultZoneDataNodes,
- expectedZone1DataNodes,
- expectedZone2DataNodes,
- expectedZone3DataNodes
- );
+ Map<Integer, Set<String>> expectedDataNodes = new HashMap<>();
+ expectedDataNodes.put(getZoneId(DEFAULT_ZONE_NAME),
Set.of(NODE_0.name()));
+ expectedDataNodes.put(getZoneId(ZONE_NAME), Set.of(NODE_0.name(),
NODE_1.name()));
+ expectedDataNodes.put(getZoneId(ZONE_NAME_2), Set.of(NODE_0.name()));
+ expectedDataNodes.put(getZoneId(ZONE_NAME_3), Set.of(NODE_0.name(),
NODE_1.name()));
+
+ Map<Integer, Set<String>> expectedDataNodes1 = new
HashMap<>(expectedDataNodes);
Review Comment:
Fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]