This is an automated email from the ASF dual-hosted git repository. domgarguilo pushed a commit to branch 2.1 in repository https://gitbox.apache.org/repos/asf/accumulo.git
The following commit(s) were added to refs/heads/2.1 by this push: new 1831118812 Parallelized CreateTableIT.testCreateLotsOfTables() to speed it up (#5534) 1831118812 is described below commit 1831118812a6e242ccaeee354da4bf608985dad9 Author: Dom G. <domgargu...@apache.org> AuthorDate: Mon May 5 12:59:53 2025 -0400 Parallelized CreateTableIT.testCreateLotsOfTables() to speed it up (#5534) --- .../org/apache/accumulo/test/CreateTableIT.java | 34 +++++++++++++++------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/test/src/main/java/org/apache/accumulo/test/CreateTableIT.java b/test/src/main/java/org/apache/accumulo/test/CreateTableIT.java index 52346a38d1..3c0641365b 100644 --- a/test/src/main/java/org/apache/accumulo/test/CreateTableIT.java +++ b/test/src/main/java/org/apache/accumulo/test/CreateTableIT.java @@ -21,15 +21,25 @@ package org.apache.accumulo.test; import static org.junit.jupiter.api.Assertions.assertEquals; import java.time.Duration; +import java.util.Arrays; +import java.util.concurrent.TimeUnit; import org.apache.accumulo.core.client.Accumulo; import org.apache.accumulo.core.client.AccumuloClient; +import org.apache.accumulo.core.client.AccumuloException; +import org.apache.accumulo.core.client.AccumuloSecurityException; +import org.apache.accumulo.core.client.TableExistsException; +import org.apache.accumulo.core.util.Timer; import org.apache.accumulo.harness.SharedMiniClusterBase; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class CreateTableIT extends SharedMiniClusterBase { + private static final Logger log = LoggerFactory.getLogger(CreateTableIT.class); + public static final int NUM_TABLES = 500; @Override protected Duration defaultTimeout() { @@ -47,20 +57,22 @@ public class CreateTableIT extends SharedMiniClusterBase { } @Test - public void testCreateLotsOfTables() throws Exception { + public void testCreateLotsOfTables() { try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) { + String[] tableNames = getUniqueNames(NUM_TABLES); - String[] tableNames = getUniqueNames(500); + Arrays.stream(tableNames).parallel().forEach(name -> { + Timer timer = Timer.startNew(); + try { + client.tableOperations().create(name); + } catch (AccumuloException | AccumuloSecurityException | TableExistsException e) { + throw new RuntimeException(e); + } + log.info("Table {} creation took: {} ms", name, timer.elapsed(TimeUnit.MILLISECONDS)); + }); - for (int i = 0; i < tableNames.length; i++) { - // Create waits for the Fate operation to complete - long start = System.currentTimeMillis(); - client.tableOperations().create(tableNames[i]); - System.out.println("Table creation took: " + (System.currentTimeMillis() - start) + "ms"); - } - // Confirm all 500 user tables exist in addition to Root, Metadata, - // and ScanRef tables - assertEquals(503, client.tableOperations().list().size()); + final int systemTables = 3; + assertEquals(NUM_TABLES + systemTables, client.tableOperations().list().size()); } }