JAkutenshi commented on code in PR #6430: URL: https://github.com/apache/ignite-3/pull/6430#discussion_r2293912174
########## modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/api/ItSqlCreateZoneTest.java: ########## @@ -65,12 +78,67 @@ void testCreateZoneSucceedWithCorrectStorageProfileOnSameNode() { assertDoesNotThrow(() -> createZoneQuery(0, "default")); } + Set<Class<? extends NetworkMessage>> allMessages = ConcurrentHashMap.newKeySet(); + @Test void testCreateZoneSucceedWithCorrectStorageProfileOnDifferentNode() { cluster.startNode(1, NODE_BOOTSTRAP_CFG_TEMPLATE_WITH_EXTRA_PROFILE); assertDoesNotThrow(() -> createZoneQuery(0, EXTRA_PROFILE_NAME)); } + @Test + void testCreateZoneSucceedWithCorrectStorageProfileOnDifferentNodeWithDistributedLogicalTopologyUpdate() throws InterruptedException { + // Node 0 is CMG leader and Node 1 is a laggy query executor. + IgniteImpl node0 = unwrapIgniteImpl(node(0)); + IgniteImpl node1 = unwrapIgniteImpl(cluster.startNode(1)); + + assertTrue(waitForCondition( + () -> node1.logicalTopologyService().localLogicalTopology().nodes().size() == 2, + 10_000 + )); + + // Assert that we can't to create zone without a node with extra profilel. Review Comment: Fixed ########## modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/api/ItSqlCreateZoneTest.java: ########## @@ -65,12 +78,67 @@ void testCreateZoneSucceedWithCorrectStorageProfileOnSameNode() { assertDoesNotThrow(() -> createZoneQuery(0, "default")); } + Set<Class<? extends NetworkMessage>> allMessages = ConcurrentHashMap.newKeySet(); + @Test void testCreateZoneSucceedWithCorrectStorageProfileOnDifferentNode() { cluster.startNode(1, NODE_BOOTSTRAP_CFG_TEMPLATE_WITH_EXTRA_PROFILE); assertDoesNotThrow(() -> createZoneQuery(0, EXTRA_PROFILE_NAME)); } + @Test + void testCreateZoneSucceedWithCorrectStorageProfileOnDifferentNodeWithDistributedLogicalTopologyUpdate() throws InterruptedException { + // Node 0 is CMG leader and Node 1 is a laggy query executor. + IgniteImpl node0 = unwrapIgniteImpl(node(0)); + IgniteImpl node1 = unwrapIgniteImpl(cluster.startNode(1)); + + assertTrue(waitForCondition( + () -> node1.logicalTopologyService().localLogicalTopology().nodes().size() == 2, + 10_000 + )); + + // Assert that we can't to create zone without a node with extra profilel. + assertThrowsWithCause( + () -> createZoneQuery(1, EXTRA_PROFILE_NAME), + SqlException.class, + "Some storage profiles don't exist [missedProfileNames=[" + EXTRA_PROFILE_NAME + "]]." + ); + + // Node 1 won't see node 2 joined with extra profile because node 0 is CMG leader and all RAFT-replicated messages to node 1 will be Review Comment: Fixed ########## modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/api/ItSqlCreateZoneTest.java: ########## @@ -65,12 +78,67 @@ void testCreateZoneSucceedWithCorrectStorageProfileOnSameNode() { assertDoesNotThrow(() -> createZoneQuery(0, "default")); } + Set<Class<? extends NetworkMessage>> allMessages = ConcurrentHashMap.newKeySet(); + @Test void testCreateZoneSucceedWithCorrectStorageProfileOnDifferentNode() { cluster.startNode(1, NODE_BOOTSTRAP_CFG_TEMPLATE_WITH_EXTRA_PROFILE); assertDoesNotThrow(() -> createZoneQuery(0, EXTRA_PROFILE_NAME)); } + @Test + void testCreateZoneSucceedWithCorrectStorageProfileOnDifferentNodeWithDistributedLogicalTopologyUpdate() throws InterruptedException { + // Node 0 is CMG leader and Node 1 is a laggy query executor. + IgniteImpl node0 = unwrapIgniteImpl(node(0)); + IgniteImpl node1 = unwrapIgniteImpl(cluster.startNode(1)); + + assertTrue(waitForCondition( + () -> node1.logicalTopologyService().localLogicalTopology().nodes().size() == 2, + 10_000 + )); + + // Assert that we can't to create zone without a node with extra profilel. + assertThrowsWithCause( + () -> createZoneQuery(1, EXTRA_PROFILE_NAME), + SqlException.class, + "Some storage profiles don't exist [missedProfileNames=[" + EXTRA_PROFILE_NAME + "]]." + ); + + // Node 1 won't see node 2 joined with extra profile because node 0 is CMG leader and all RAFT-replicated messages to node 1 will be + // dropped after the code below. + node0.dropMessages((recipient, msg) -> msg instanceof AppendEntriesRequest + && ((AppendEntriesRequest) msg).groupId().equals(CmgGroupId.INSTANCE.toString()) + && node1.name().equals(recipient)); + + // Then start node 2 with the desired extra profile. + cluster.startNode(2, NODE_BOOTSTRAP_CFG_TEMPLATE_WITH_EXTRA_PROFILE); + + // Check that Node 1 and 2 will see all three nodes in local logical topologies. Review Comment: Fixed ########## modules/sql-engine/src/integrationTest/java/org/apache/ignite/internal/sql/api/ItSqlCreateZoneTest.java: ########## @@ -65,12 +78,67 @@ void testCreateZoneSucceedWithCorrectStorageProfileOnSameNode() { assertDoesNotThrow(() -> createZoneQuery(0, "default")); } + Set<Class<? extends NetworkMessage>> allMessages = ConcurrentHashMap.newKeySet(); + @Test void testCreateZoneSucceedWithCorrectStorageProfileOnDifferentNode() { cluster.startNode(1, NODE_BOOTSTRAP_CFG_TEMPLATE_WITH_EXTRA_PROFILE); assertDoesNotThrow(() -> createZoneQuery(0, EXTRA_PROFILE_NAME)); } + @Test + void testCreateZoneSucceedWithCorrectStorageProfileOnDifferentNodeWithDistributedLogicalTopologyUpdate() throws InterruptedException { + // Node 0 is CMG leader and Node 1 is a laggy query executor. + IgniteImpl node0 = unwrapIgniteImpl(node(0)); + IgniteImpl node1 = unwrapIgniteImpl(cluster.startNode(1)); + + assertTrue(waitForCondition( + () -> node1.logicalTopologyService().localLogicalTopology().nodes().size() == 2, + 10_000 + )); + + // Assert that we can't to create zone without a node with extra profilel. + assertThrowsWithCause( + () -> createZoneQuery(1, EXTRA_PROFILE_NAME), + SqlException.class, + "Some storage profiles don't exist [missedProfileNames=[" + EXTRA_PROFILE_NAME + "]]." + ); + + // Node 1 won't see node 2 joined with extra profile because node 0 is CMG leader and all RAFT-replicated messages to node 1 will be + // dropped after the code below. + node0.dropMessages((recipient, msg) -> msg instanceof AppendEntriesRequest + && ((AppendEntriesRequest) msg).groupId().equals(CmgGroupId.INSTANCE.toString()) + && node1.name().equals(recipient)); + + // Then start node 2 with the desired extra profile. + cluster.startNode(2, NODE_BOOTSTRAP_CFG_TEMPLATE_WITH_EXTRA_PROFILE); + + // Check that Node 1 and 2 will see all three nodes in local logical topologies. + assertTrue(waitForCondition( + () -> unwrapIgniteImpl(node(0)).logicalTopologyService().localLogicalTopology().nodes().size() == 3, + 10_000 + )); + + assertTrue(waitForCondition( + () -> unwrapIgniteImpl(node(2)).logicalTopologyService().localLogicalTopology().nodes().size() == 3, + 10_000 + )); + + // And we expect that node 1 won't see node 2 in it's local logical topology. 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: notifications-unsubscr...@ignite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org