Repository: ignite Updated Branches: refs/heads/master c00060ba8 -> 752ea17ab
IGNITE-9134 ZookeeperDiscoverySpiTest#testLargeUserAttribute3 fails with OOME. - Fixes #4461. Signed-off-by: Dmitriy Pavlov <[email protected]> Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/752ea17a Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/752ea17a Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/752ea17a Branch: refs/heads/master Commit: 752ea17abcf27dbc371cfd5aa5288cd33d79ba87 Parents: c00060b Author: Vitaliy Biryukov <[email protected]> Authored: Fri Aug 3 18:14:46 2018 +0300 Committer: Dmitriy Pavlov <[email protected]> Committed: Fri Aug 3 18:14:46 2018 +0300 ---------------------------------------------------------------------- .../zk/internal/ZookeeperDiscoverySpiTest.java | 31 +++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/752ea17a/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiTest.java ---------------------------------------------------------------------- diff --git a/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiTest.java b/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiTest.java index 24b61d7..19ca5f2 100644 --- a/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiTest.java +++ b/modules/zookeeper/src/test/java/org/apache/ignite/spi/discovery/zk/internal/ZookeeperDiscoverySpiTest.java @@ -2360,6 +2360,8 @@ public class ZookeeperDiscoverySpiTest extends GridCommonAbstractTest { } /** + * Test with large user attribute on coordinator node. + * * @throws Exception If failed. */ public void testLargeUserAttribute1() throws Exception { @@ -2379,6 +2381,8 @@ public class ZookeeperDiscoverySpiTest extends GridCommonAbstractTest { } /** + * Test with large user attribute on non-coordinator node. + * * @throws Exception If failed. */ public void testLargeUserAttribute2() throws Exception { @@ -2394,19 +2398,23 @@ public class ZookeeperDiscoverySpiTest extends GridCommonAbstractTest { } /** + * Test with large user attributes on random nodes. + * Also tests that big messages (more than 1MB) properly separated and processed by zk. + * * @throws Exception If failed. */ public void testLargeUserAttribute3() throws Exception { - ThreadLocalRandom rnd = ThreadLocalRandom.current(); - - long stopTime = System.currentTimeMillis() + 60_000; - - int nodes = 0; + Set<Integer> idxs = ThreadLocalRandom.current() + .ints(0, 10) + .distinct() + .limit(3) + .boxed() + .collect(Collectors.toSet()); - for (int i = 0; i < 25; i++) { + for (int i = 0; i < 10; i++) { info("Iteration: " + i); - if (rnd.nextBoolean()) + if (idxs.contains(i)) initLargeAttribute(); else userAttrs = null; @@ -2414,14 +2422,9 @@ public class ZookeeperDiscoverySpiTest extends GridCommonAbstractTest { clientMode(i > 5); startGrid(i); - - nodes++; - - if (System.currentTimeMillis() >= stopTime) - break; } - waitForTopology(nodes); + waitForTopology(10); } /** @@ -2430,7 +2433,7 @@ public class ZookeeperDiscoverySpiTest extends GridCommonAbstractTest { private void initLargeAttribute() { userAttrs = new HashMap<>(); - int[] attr = new int[1024 * 1024 + ThreadLocalRandom.current().nextInt(1024)]; + int[] attr = new int[1024 * 1024 + ThreadLocalRandom.current().nextInt(1024 * 512)]; for (int i = 0; i < attr.length; i++) attr[i] = i;
