Search in sources :

Example 26 with ColumnInfo

use of org.voltdb.VoltTable.ColumnInfo in project voltdb by VoltDB.

the class TestStatisticsSuiteDRStats method testDRRole.

public void testDRRole() throws IOException, ProcCallException {
    if (!VoltDB.instance().getConfig().m_isEnterprise) {
        System.out.println("SKIPPING DRNODE STATS TESTS FOR COMMUNITY VERSION");
        return;
    }
    System.out.println("\n\nTESTING DRROLE STATS\n\n\n");
    Client client = getFullyConnectedClient();
    ColumnInfo[] expectedSchema2 = new ColumnInfo[3];
    assertEquals("Expected DRRoleStatistics schema length is 3", 3, expectedSchema2.length);
    expectedSchema2[0] = new ColumnInfo("ROLE", VoltType.STRING);
    expectedSchema2[1] = new ColumnInfo("STATE", VoltType.STRING);
    expectedSchema2[2] = new ColumnInfo("REMOTE_CLUSTER_ID", VoltType.INTEGER);
    VoltTable expectedTable2 = new VoltTable(expectedSchema2);
    VoltTable[] results = null;
    //
    // DRNODE
    //
    results = client.callProcedure("@Statistics", "DRROLE", 0).getResults();
    // one aggregate tables returned
    assertEquals(1, results.length);
    System.out.println("Test DRROLE table: " + results[0].toString());
    validateSchema(results[0], expectedTable2);
    // Only one row for DRROLE stats
    assertEquals(1, results[0].getRowCount());
}
Also used : ColumnInfo(org.voltdb.VoltTable.ColumnInfo) Client(org.voltdb.client.Client) VoltTable(org.voltdb.VoltTable)

Example 27 with ColumnInfo

use of org.voltdb.VoltTable.ColumnInfo in project voltdb by VoltDB.

the class TestStatisticsSuite method testStarvationStatistics.

public void testStarvationStatistics() throws Exception {
    System.out.println("\n\nTESTING STARVATION STATS\n\n\n");
    Client client = getFullyConnectedClient();
    ColumnInfo[] expectedSchema = new ColumnInfo[10];
    expectedSchema[0] = new ColumnInfo("TIMESTAMP", VoltType.BIGINT);
    expectedSchema[1] = new ColumnInfo("HOST_ID", VoltType.INTEGER);
    expectedSchema[2] = new ColumnInfo("HOSTNAME", VoltType.STRING);
    expectedSchema[3] = new ColumnInfo("SITE_ID", VoltType.INTEGER);
    expectedSchema[4] = new ColumnInfo("COUNT", VoltType.BIGINT);
    expectedSchema[5] = new ColumnInfo("PERCENT", VoltType.FLOAT);
    expectedSchema[6] = new ColumnInfo("AVG", VoltType.BIGINT);
    expectedSchema[7] = new ColumnInfo("MIN", VoltType.BIGINT);
    expectedSchema[8] = new ColumnInfo("MAX", VoltType.BIGINT);
    expectedSchema[9] = new ColumnInfo("STDDEV", VoltType.BIGINT);
    VoltTable expectedTable = new VoltTable(expectedSchema);
    VoltTable[] results = null;
    //
    // STARVATION
    //
    results = client.callProcedure("@Statistics", "STARVATION", 0).getResults();
    // one aggregate table returned
    assertEquals(1, results.length);
    System.out.println("Test STARVATION table: " + results[0].toString());
    validateSchema(results[0], expectedTable);
    // One row per site, we don't use HSID though, so hard to do straightforward
    // per-site unique check.  Finesse it.
    // We also get starvation stats for the MPI, so we need to add a site per host.
    assertEquals(HOSTS * (SITES + 1), results[0].getRowCount());
    results[0].advanceRow();
    Map<String, String> columnTargets = new HashMap<String, String>();
    columnTargets.put("HOSTNAME", results[0].getString("HOSTNAME"));
    validateRowSeenAtAllHosts(results[0], columnTargets, false);
}
Also used : HashMap(java.util.HashMap) ColumnInfo(org.voltdb.VoltTable.ColumnInfo) Client(org.voltdb.client.Client) VoltTable(org.voltdb.VoltTable)

Example 28 with ColumnInfo

use of org.voltdb.VoltTable.ColumnInfo in project voltdb by VoltDB.

the class TestStatisticsSuite method testMemoryStatistics.

public void testMemoryStatistics() throws Exception {
    System.out.println("\n\nTESTING MEMORY STATS\n\n\n");
    Client client = getFullyConnectedClient();
    ColumnInfo[] expectedSchema = new ColumnInfo[14];
    expectedSchema[0] = new ColumnInfo("TIMESTAMP", VoltType.BIGINT);
    expectedSchema[1] = new ColumnInfo("HOST_ID", VoltType.INTEGER);
    expectedSchema[2] = new ColumnInfo("HOSTNAME", VoltType.STRING);
    expectedSchema[3] = new ColumnInfo("RSS", VoltType.INTEGER);
    expectedSchema[4] = new ColumnInfo("JAVAUSED", VoltType.INTEGER);
    expectedSchema[5] = new ColumnInfo("JAVAUNUSED", VoltType.INTEGER);
    expectedSchema[6] = new ColumnInfo("TUPLEDATA", VoltType.BIGINT);
    expectedSchema[7] = new ColumnInfo("TUPLEALLOCATED", VoltType.BIGINT);
    expectedSchema[8] = new ColumnInfo("INDEXMEMORY", VoltType.BIGINT);
    expectedSchema[9] = new ColumnInfo("STRINGMEMORY", VoltType.BIGINT);
    expectedSchema[10] = new ColumnInfo("TUPLECOUNT", VoltType.BIGINT);
    expectedSchema[11] = new ColumnInfo("POOLEDMEMORY", VoltType.BIGINT);
    expectedSchema[12] = new ColumnInfo("PHYSICALMEMORY", VoltType.BIGINT);
    expectedSchema[13] = new ColumnInfo("JAVAMAXHEAP", VoltType.INTEGER);
    VoltTable expectedTable = new VoltTable(expectedSchema);
    VoltTable[] results = null;
    //
    // memory
    //
    // give time to seed the stats cache?
    Thread.sleep(1000);
    results = client.callProcedure("@Statistics", "memory", 0).getResults();
    System.out.println("Node memory statistics table: " + results[0].toString());
    // one aggregate table returned
    assertEquals(1, results.length);
    validateSchema(results[0], expectedTable);
    results[0].advanceRow();
    // Hacky, on a single local cluster make sure that all 'nodes' are present.
    // MEMORY stats lacks a common string across nodes, but we can hijack the hostname in this case.
    Map<String, String> columnTargets = new HashMap<String, String>();
    columnTargets.put("HOSTNAME", results[0].getString("HOSTNAME"));
    validateRowSeenAtAllHosts(results[0], columnTargets, true);
}
Also used : HashMap(java.util.HashMap) ColumnInfo(org.voltdb.VoltTable.ColumnInfo) Client(org.voltdb.client.Client) VoltTable(org.voltdb.VoltTable)

Example 29 with ColumnInfo

use of org.voltdb.VoltTable.ColumnInfo in project voltdb by VoltDB.

the class TestStatisticsSuite method testLiveClientsStatistics.

public void testLiveClientsStatistics() throws Exception {
    System.out.println("\n\nTESTING LIVECLIENTS STATS\n\n\n");
    Client client = getFullyConnectedClient();
    ColumnInfo[] expectedSchema = new ColumnInfo[9];
    expectedSchema[0] = new ColumnInfo("TIMESTAMP", VoltType.BIGINT);
    expectedSchema[1] = new ColumnInfo("HOST_ID", VoltType.INTEGER);
    expectedSchema[2] = new ColumnInfo("HOSTNAME", VoltType.STRING);
    expectedSchema[3] = new ColumnInfo("CONNECTION_ID", VoltType.BIGINT);
    expectedSchema[4] = new ColumnInfo("CLIENT_HOSTNAME", VoltType.STRING);
    expectedSchema[5] = new ColumnInfo("ADMIN", VoltType.TINYINT);
    expectedSchema[6] = new ColumnInfo("OUTSTANDING_REQUEST_BYTES", VoltType.BIGINT);
    expectedSchema[7] = new ColumnInfo("OUTSTANDING_RESPONSE_MESSAGES", VoltType.BIGINT);
    expectedSchema[8] = new ColumnInfo("OUTSTANDING_TRANSACTIONS", VoltType.BIGINT);
    VoltTable expectedTable = new VoltTable(expectedSchema);
    int patientRetries = 2;
    int hostsHeardFrom = 0;
    //
    do {
        // loop until we get the desired answer or lose patience waiting out possible races.
        VoltTable[] results = client.callProcedure("@Statistics", "LIVECLIENTS", 0).getResults();
        // one aggregate table returned
        assertEquals(1, results.length);
        System.out.println("Test LIVECLIENTS table: " + results[0].toString());
        validateSchema(results[0], expectedTable);
        // Hacky, on a single local cluster make sure that all 'nodes' are present.
        // LiveClients stats lacks a common string across nodes, but we can hijack the hostname in this case.
        results[0].advanceRow();
        Map<String, String> columnTargets = new HashMap<String, String>();
        columnTargets.put("HOSTNAME", results[0].getString("HOSTNAME"));
        hostsHeardFrom = countHostsProvidingRows(results[0], columnTargets, true);
    } while ((hostsHeardFrom < HOSTS) && (--patientRetries) > 0);
    assertEquals(claimRecentAnalysis(), HOSTS, hostsHeardFrom);
}
Also used : HashMap(java.util.HashMap) ColumnInfo(org.voltdb.VoltTable.ColumnInfo) Client(org.voltdb.client.Client) VoltTable(org.voltdb.VoltTable)

Example 30 with ColumnInfo

use of org.voltdb.VoltTable.ColumnInfo in project voltdb by VoltDB.

the class TestStatisticsSuite method testTopoStatistics.

public void testTopoStatistics() throws Exception {
    System.out.println("\n\nTESTING TOPO STATS\n\n\n");
    Client client = getFullyConnectedClient();
    ColumnInfo[] expectedSchema1 = new ColumnInfo[3];
    expectedSchema1[0] = new ColumnInfo("Partition", VoltType.INTEGER);
    expectedSchema1[1] = new ColumnInfo("Sites", VoltType.STRING);
    expectedSchema1[2] = new ColumnInfo("Leader", VoltType.STRING);
    VoltTable expectedTable1 = new VoltTable(expectedSchema1);
    ColumnInfo[] expectedSchema2 = new ColumnInfo[2];
    expectedSchema2[0] = new ColumnInfo("HASHTYPE", VoltType.STRING);
    expectedSchema2[1] = new ColumnInfo("HASHCONFIG", VoltType.VARBINARY);
    VoltTable expectedTable2 = new VoltTable(expectedSchema2);
    VoltTable[] results = null;
    //
    // TOPO with interval set to 0, retrieving binary hash config
    //
    results = client.callProcedure("@Statistics", "TOPO", 0).getResults();
    // two aggregate tables returned
    assertEquals(2, results.length);
    System.out.println("Test TOPO table: " + results[0].toString());
    System.out.println("Test TOPO table: " + results[1].toString());
    validateSchema(results[0], expectedTable1);
    validateSchema(results[1], expectedTable2);
    VoltTable topo = results[0];
    // Should have partitions + 1 rows in the first table
    assertEquals(PARTITIONS + 1, results[0].getRowCount());
    // Make sure we can find the MPI, at least
    boolean found = false;
    while (topo.advanceRow()) {
        if ((int) topo.getLong("Partition") == MpInitiator.MP_INIT_PID) {
            found = true;
        }
    }
    assertTrue(found);
    // and only one row in the second table
    assertEquals(1, results[1].getRowCount());
    //
    // TOPO with interval set to 1, for retrieving compressed json hash config
    //
    results = client.callProcedure("@Statistics", "TOPO", 1).getResults();
    // two aggregate tables returned
    assertEquals(2, results.length);
    System.out.println("Test TOPO table: " + results[0].toString());
    System.out.println("Test TOPO table: " + results[1].toString());
    validateSchema(results[0], expectedTable1);
    validateSchema(results[1], expectedTable2);
    topo = results[0];
    // Should have partitions + 1 rows in the first table
    assertEquals(PARTITIONS + 1, results[0].getRowCount());
    // Make sure we can find the MPI, at least
    found = false;
    while (topo.advanceRow()) {
        if ((int) topo.getLong("Partition") == MpInitiator.MP_INIT_PID) {
            found = true;
        }
    }
    assertTrue(found);
    // and only one row in the second table
    assertEquals(1, results[1].getRowCount());
}
Also used : ColumnInfo(org.voltdb.VoltTable.ColumnInfo) Client(org.voltdb.client.Client) VoltTable(org.voltdb.VoltTable)

Aggregations

ColumnInfo (org.voltdb.VoltTable.ColumnInfo)84 VoltTable (org.voltdb.VoltTable)40 Client (org.voltdb.client.Client)17 HashMap (java.util.HashMap)10 ByteBuffer (java.nio.ByteBuffer)6 DependencyPair (org.voltdb.DependencyPair)6 BigDecimal (java.math.BigDecimal)5 ArrayList (java.util.ArrayList)5 TimestampType (org.voltdb.types.TimestampType)5 Test (org.junit.Test)4 CSVWriter (au.com.bytecode.opencsv_voltpatches.CSVWriter)2 Map (java.util.Map)2 JSONObject (org.json_voltpatches.JSONObject)2 CatalogContext (org.voltdb.CatalogContext)2 CatalogSpecificPlanner (org.voltdb.CatalogSpecificPlanner)2 GeographyPointValue (org.voltdb.types.GeographyPointValue)2 GeographyValue (org.voltdb.types.GeographyValue)2 ByteArrayInputStream (java.io.ByteArrayInputStream)1 File (java.io.File)1 IOException (java.io.IOException)1