Search in sources :

Example 11 with LocalCluster

use of org.voltdb.regressionsuites.LocalCluster in project voltdb by VoltDB.

the class LatencyManualTest method main.

/**
     * @param args
     * @throws IOException
     */
public static void main(String[] args) throws Exception {
    try {
        String simpleSchema = "create stream blah partition on column ival (" + "ival bigint default 0 not null, " + "PRIMARY KEY(ival));";
        VoltProjectBuilder builder = new VoltProjectBuilder();
        builder.addLiteralSchema(simpleSchema);
        builder.addStmtProcedure("Insert", "insert into blah values (?);", null);
        LocalCluster cluster = new LocalCluster("latencycheck.jar", 2, 1, 0, BackendTarget.NATIVE_EE_JNI);
        cluster.setHasLocalServer(true);
        boolean success = cluster.compile(builder);
        assert (success);
        cluster.startUp(true);
        final String listener = cluster.getListenerAddresses().get(0);
        final Client client = ClientFactory.createClient();
        client.createConnection(listener);
        long iterations = 10000;
        long start = System.nanoTime();
        for (int i = 0; i < iterations; i++) {
            client.callProcedure("Insert", i);
        }
        long end = System.nanoTime();
        double ms = (end - start) / 1000000.0;
        client.close();
        cluster.shutDown();
        System.out.printf("Avg latency was %.3f ms.\n", ms / iterations);
    } catch (Exception e) {
        e.printStackTrace();
    } finally {
        File jar = new File("latencycheck.jar");
        jar.delete();
    }
}
Also used : LocalCluster(org.voltdb.regressionsuites.LocalCluster) VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder) Client(org.voltdb.client.Client) File(java.io.File) IOException(java.io.IOException)

Example 12 with LocalCluster

use of org.voltdb.regressionsuites.LocalCluster in project voltdb by VoltDB.

the class ScanPerfTest method testHaltLiveRejoinOnOverflow.

@Test
public void testHaltLiveRejoinOnOverflow() throws Exception {
    LocalCluster cluster = null;
    Client client = null;
    VoltTable pTable = TableHelper.quickTable("P (ID:BIGINT-N, VALUE:BIGINT-N) PK(ID)");
    // build and compile a catalog
    System.out.println("Compiling catalog.");
    VoltProjectBuilder builder = new VoltProjectBuilder();
    builder.addLiteralSchema(TableHelper.ddlForTable(pTable, false));
    builder.addLiteralSchema("PARTITION TABLE P ON COLUMN ID;\n" + "CREATE PROCEDURE FROM CLASS org.voltdb.planner.ScanPerfTest$ScanTable;\n" + "PARTITION PROCEDURE ScanPerfTest$ScanTable ON TABLE P COLUMN ID;\n");
    cluster = new LocalCluster("scanperf.jar", 8, 1, 0, BackendTarget.NATIVE_EE_JNI);
    //cluster.setMaxHeap(10);
    boolean success = cluster.compile(builder);
    assertTrue(success);
    //fail();
    System.out.println("Starting cluster.");
    cluster.setHasLocalServer(false);
    cluster.overrideAnyRequestForValgrind();
    cluster.startUp(true);
    System.out.println("Getting client connected.");
    ClientConfig clientConfig = new ClientConfig();
    client = ClientFactory.createClient(clientConfig);
    for (String address : cluster.getListenerAddresses()) {
        client.createConnection(address);
    }
    System.out.println("Loading");
    Random r = new Random();
    // load up > 1gb data
    fillTable(6000, client, r);
    System.out.println("100% loaded.");
    client.drain();
    client.close();
    System.out.println("Getting client re-connected.");
    clientConfig = new ClientConfig();
    clientConfig.setProcedureCallTimeout(Long.MAX_VALUE);
    clientConfig.setMaxOutstandingTxns(50);
    client = ClientFactory.createClient(clientConfig);
    for (String address : cluster.getListenerAddresses()) {
        client.createConnection(address);
    }
    long start = System.currentTimeMillis();
    for (int i = 0; i < 12; i++) {
        while ((System.currentTimeMillis() - start) < ((i + 1) * 5000)) {
            client.callProcedure(new ScanCallback(), "ScanPerfTest$ScanTable", r.nextLong());
        }
        System.out.printf("Scanned at %.2f rows/sec when %.0f%% done.\n", rows.get() / (nanos.get() / 1000000000.0), ((i + 1) / 12.0) * 100);
        System.out.printf("%d scans on an average of %d rows/partition\n", scans.get(), rows.get() / scans.get());
        System.out.printf("%.2f scans per second\n", scans.get() / (nanos.get() / 1000000000.0));
    }
    System.out.println("Draining.");
    client.drain();
    client.close();
    System.out.printf("Scanned at %f rows/sec after drain.\n", rows.get() / (nanos.get() / 1000000000.0));
    cluster.shutDown();
}
Also used : LocalCluster(org.voltdb.regressionsuites.LocalCluster) Random(java.util.Random) VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder) Client(org.voltdb.client.Client) ClientConfig(org.voltdb.client.ClientConfig) VoltTable(org.voltdb.VoltTable) Test(org.junit.Test) JUnit4LocalClusterTest(org.voltdb.regressionsuites.JUnit4LocalClusterTest)

Example 13 with LocalCluster

use of org.voltdb.regressionsuites.LocalCluster in project voltdb by VoltDB.

the class TestCollector method setUp.

@Before
public void setUp() throws Exception {
    String simpleSchema = "create table blah (" + "ival bigint default 0 not null, " + "PRIMARY KEY(ival));";
    builder = new VoltProjectBuilder();
    builder.addLiteralSchema(simpleSchema);
    builder.addProcedures(CrashJVM.class);
    builder.addProcedures(CrashVoltDBProc.class);
    cluster = new LocalCluster("collect.jar", 2, 1, 0, BackendTarget.NATIVE_EE_JNI);
    cluster.setHasLocalServer(false);
    boolean success = cluster.compile(builder);
    assert (success);
    File voltDbRoot;
    cluster.startUp(true);
    //Get server specific root after startup.
    if (cluster.isNewCli()) {
        voltDbRoot = new File(cluster.getServerSpecificRoot("0"));
    } else {
        String voltDbFilePrefix = cluster.getSubRoots().get(0).getPath();
        voltDbRoot = new File(voltDbFilePrefix, builder.getPathToVoltRoot().getPath());
    }
    m_voltDbRootPath = voltDbRoot.getPath();
    listener = cluster.getListenerAddresses().get(0);
    client = ClientFactory.createClient();
    client.createConnection(listener);
    m_outputFileName = "";
    m_pid = getpid(m_voltDbRootPath);
    m_prefix = "";
    System.setProperty("VOLT_JUSTATEST", "true");
}
Also used : LocalCluster(org.voltdb.regressionsuites.LocalCluster) VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder) ZipFile(java.util.zip.ZipFile) File(java.io.File) Before(org.junit.Before)

Example 14 with LocalCluster

use of org.voltdb.regressionsuites.LocalCluster in project voltdb by VoltDB.

the class TestCSVFormatterSuite method buildEnv.

public static MultiConfigSuiteBuilder buildEnv() throws Exception {
    final MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder(TestCSVFormatterSuite.class);
    Map<String, String> additionalEnv = new HashMap<>();
    //Specify bundle location
    String bundleLocation = System.getProperty("user.dir") + "/bundles";
    System.out.println("Bundle location is: " + bundleLocation);
    additionalEnv.put("voltdbbundlelocation", bundleLocation);
    VoltProjectBuilder project = new VoltProjectBuilder();
    project.setUseDDLSchema(true);
    project.addSchema(TestSQLTypesSuite.class.getResource("sqltypessuite-import-ddl.sql"));
    project.addPartitionInfo("importCSVTable", "clm_integer");
    // configure socket importer 1
    Properties props = buildProperties("port", "7001", "decode", "true", "procedure", "importCSVTable.insert");
    Properties formatConfig = buildProperties("nullstring", "test", "separator", ",", "blank", "empty", "escape", "\\", "quotechar", "\"", "nowhitespace", "true");
    project.addImport(true, "custom", "csv", "socketstream.jar", props, formatConfig);
    // configure socket importer 2
    props = buildProperties("port", "7002", "decode", "true", "procedure", "importCSVTable.insert");
    formatConfig = buildProperties("nullstring", "test", "separator", ",", "blank", "error", "escape", "\\", "quotechar", "\"", "strictquotes", "true", "trimunquoted", "false");
    project.addImport(true, "custom", "csv", "socketstream.jar", props, formatConfig);
    project.addPartitionInfo("importCSVTable", "clm_integer");
    /*
         * compile the catalog all tests start with
         */
    LocalCluster config = new LocalCluster("import-ddl-cluster-rep.jar", 4, 1, 0, BackendTarget.NATIVE_EE_JNI, LocalCluster.FailureState.ALL_RUNNING, true, false, additionalEnv);
    config.setHasLocalServer(false);
    boolean compile = config.compile(project);
    assertTrue(compile);
    builder.addServerConfig(config);
    return builder;
}
Also used : LocalCluster(org.voltdb.regressionsuites.LocalCluster) TestSQLTypesSuite(org.voltdb.regressionsuites.TestSQLTypesSuite) HashMap(java.util.HashMap) VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder) MultiConfigSuiteBuilder(org.voltdb.regressionsuites.MultiConfigSuiteBuilder) Properties(java.util.Properties)

Example 15 with LocalCluster

use of org.voltdb.regressionsuites.LocalCluster in project voltdb by VoltDB.

the class TestImportStatistics method suite.

public static junit.framework.Test suite() throws Exception {
    LocalCluster config;
    Map<String, String> additionalEnv = new HashMap<>();
    //Specify bundle location
    String bundleLocation = System.getProperty("user.dir") + "/bundles";
    System.out.println("Bundle location is: " + bundleLocation);
    additionalEnv.put("voltdbbundlelocation", bundleLocation);
    final MultiConfigSuiteBuilder builder = new MultiConfigSuiteBuilder(TestImportStatistics.class);
    VoltProjectBuilder project = new VoltProjectBuilder();
    project.setUseDDLSchema(true);
    project.addSchema(TestSQLTypesSuite.class.getResource("sqltypessuite-import-ddl.sql"));
    project.addProcedures(TestStatsProcedure7.class);
    project.addProcedures(TestStatsProcedure11.class);
    // configure socket importer
    Properties props = buildProperties("port", "7001", "decode", "true", "procedure", "TestImportStatistics$TestStatsProcedure7");
    project.addImport(true, "custom", "csv", "socketstream.jar", props);
    project.addPartitionInfo("importTable", "PKEY");
    // another socket importer
    props = buildProperties("port", "7002", "decode", "true", "procedure", "TestImportStatistics$TestStatsProcedure11");
    project.addImport(true, "custom", "csv", "socketstream.jar", props);
    project.addPartitionInfo("importTable", "PKEY");
    // configure log4j socket handler importer
    props = buildProperties("port", "6060", "procedure", "log_events.insert", "log-event-table", "log_events");
    project.addImport(true, "custom", null, "log4jsocketimporter.jar", props);
    config = new LocalCluster("import-stats-ddl-cluster-rep.jar", 4, 1, 0, BackendTarget.NATIVE_EE_JNI, LocalCluster.FailureState.ALL_RUNNING, true, false, additionalEnv);
    config.setHasLocalServer(false);
    boolean compile = config.compile(project);
    assertTrue(compile);
    builder.addServerConfig(config, false);
    return builder;
}
Also used : LocalCluster(org.voltdb.regressionsuites.LocalCluster) TestSQLTypesSuite(org.voltdb.regressionsuites.TestSQLTypesSuite) HashMap(java.util.HashMap) VoltProjectBuilder(org.voltdb.compiler.VoltProjectBuilder) MultiConfigSuiteBuilder(org.voltdb.regressionsuites.MultiConfigSuiteBuilder) Properties(java.util.Properties)

Aggregations

LocalCluster (org.voltdb.regressionsuites.LocalCluster)19 VoltProjectBuilder (org.voltdb.compiler.VoltProjectBuilder)18 MultiConfigSuiteBuilder (org.voltdb.regressionsuites.MultiConfigSuiteBuilder)7 Client (org.voltdb.client.Client)6 File (java.io.File)5 Test (org.junit.Test)5 HashMap (java.util.HashMap)4 ClientResponse (org.voltdb.client.ClientResponse)4 Properties (java.util.Properties)3 Before (org.junit.Before)3 ClientConfig (org.voltdb.client.ClientConfig)3 TestSQLTypesSuite (org.voltdb.regressionsuites.TestSQLTypesSuite)3 VoltTable (org.voltdb.VoltTable)2 ProcCallException (org.voltdb.client.ProcCallException)2 VoltCompiler (org.voltdb.compiler.VoltCompiler)2 JUnit4LocalClusterTest (org.voltdb.regressionsuites.JUnit4LocalClusterTest)2 InMemoryJarfile (org.voltdb.utils.InMemoryJarfile)2 VoltFile (org.voltdb.utils.VoltFile)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1