Search in sources :

Example 21 with ColumnInfo

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

the class TestVoltTable method testStupidAdvanceRowUse.

public void testStupidAdvanceRowUse() {
    VoltTable table = new VoltTable(new ColumnInfo("foo", VoltType.BIGINT));
    table.addRow(5);
    // try to access value without calling advanceRow
    try {
        table.getLong(0);
        fail();
    } catch (RuntimeException e) {
        assertTrue(e.getMessage().startsWith("VoltTableRow.advanceRow"));
    }
}
Also used : ColumnInfo(org.voltdb.VoltTable.ColumnInfo)

Example 22 with ColumnInfo

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

the class MemoryStats method populateColumnSchema.

@Override
protected void populateColumnSchema(ArrayList<ColumnInfo> columns) {
    super.populateColumnSchema(columns);
    columns.add(new VoltTable.ColumnInfo("RSS", VoltType.INTEGER));
    columns.add(new VoltTable.ColumnInfo("JAVAUSED", VoltType.INTEGER));
    columns.add(new VoltTable.ColumnInfo("JAVAUNUSED", VoltType.INTEGER));
    columns.add(new VoltTable.ColumnInfo("TUPLEDATA", VoltType.BIGINT));
    columns.add(new VoltTable.ColumnInfo("TUPLEALLOCATED", VoltType.BIGINT));
    columns.add(new VoltTable.ColumnInfo("INDEXMEMORY", VoltType.BIGINT));
    columns.add(new VoltTable.ColumnInfo("STRINGMEMORY", VoltType.BIGINT));
    columns.add(new VoltTable.ColumnInfo("TUPLECOUNT", VoltType.BIGINT));
    columns.add(new VoltTable.ColumnInfo("POOLEDMEMORY", VoltType.BIGINT));
    columns.add(new VoltTable.ColumnInfo("PHYSICALMEMORY", VoltType.BIGINT));
    columns.add(new VoltTable.ColumnInfo("JAVAMAXHEAP", VoltType.INTEGER));
}
Also used : ColumnInfo(org.voltdb.VoltTable.ColumnInfo)

Example 23 with ColumnInfo

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

the class Cartographer method populateColumnSchema.

@Override
protected void populateColumnSchema(ArrayList<ColumnInfo> columns) {
    columns.add(new ColumnInfo("Partition", VoltType.INTEGER));
    columns.add(new ColumnInfo("Sites", VoltType.STRING));
    columns.add(new ColumnInfo("Leader", VoltType.STRING));
}
Also used : ColumnInfo(org.voltdb.VoltTable.ColumnInfo)

Example 24 with ColumnInfo

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

the class BalancePartitionsStatistics method populateColumnSchema.

@Override
protected void populateColumnSchema(ArrayList<ColumnInfo> columns) {
    columns.add(new ColumnInfo(Constants.TIMESTAMP, VoltType.BIGINT));
    columns.add(new ColumnInfo(Constants.PERCENTAGE_MOVED, VoltType.FLOAT));
    columns.add(new ColumnInfo(Constants.MOVED_ROWS, VoltType.BIGINT));
    columns.add(new ColumnInfo(Constants.ROWS_PER_SECOND, VoltType.FLOAT));
    columns.add(new ColumnInfo(Constants.ESTIMATED_REMAINING, VoltType.BIGINT));
    columns.add(new ColumnInfo(Constants.MEGABYTES_PER_SECOND, VoltType.FLOAT));
    columns.add(new ColumnInfo(Constants.CALLS_PER_SECOND, VoltType.FLOAT));
    columns.add(new ColumnInfo(Constants.CALLS_LATENCY, VoltType.FLOAT));
    columns.add(new ColumnInfo(Constants.CALLS_TIME, VoltType.FLOAT));
    columns.add(new ColumnInfo(Constants.CALLS_TRANSFER_TIME, VoltType.FLOAT));
}
Also used : ColumnInfo(org.voltdb.VoltTable.ColumnInfo)

Example 25 with ColumnInfo

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

the class TestStatisticsSuite method testLatencyValidity.

// Make sure @Statistics LATENCY returns sane data in the expected formats.
//
public void testLatencyValidity() throws Exception {
    System.out.println("\n\nTESTING LATENCY STATS VALIDITY\n\n\n");
    Client client = getFullyConnectedClient();
    // Validate column names, types and ordering.
    ColumnInfo[] expectedSchema = new ColumnInfo[13];
    // milliseconds
    expectedSchema[0] = new ColumnInfo("TIMESTAMP", VoltType.BIGINT);
    expectedSchema[1] = new ColumnInfo("HOST_ID", VoltType.INTEGER);
    expectedSchema[2] = new ColumnInfo("HOSTNAME", VoltType.STRING);
    // milliseconds
    expectedSchema[3] = new ColumnInfo("INTERVAL", VoltType.INTEGER);
    // samples
    expectedSchema[4] = new ColumnInfo("COUNT", VoltType.INTEGER);
    // samples per second
    expectedSchema[5] = new ColumnInfo("TPS", VoltType.INTEGER);
    // microseconds
    expectedSchema[6] = new ColumnInfo("P50", VoltType.BIGINT);
    // microseconds
    expectedSchema[7] = new ColumnInfo("P95", VoltType.BIGINT);
    // microseconds
    expectedSchema[8] = new ColumnInfo("P99", VoltType.BIGINT);
    // microseconds
    expectedSchema[9] = new ColumnInfo("P99.9", VoltType.BIGINT);
    // microseconds
    expectedSchema[10] = new ColumnInfo("P99.99", VoltType.BIGINT);
    // microseconds
    expectedSchema[11] = new ColumnInfo("P99.999", VoltType.BIGINT);
    // microseconds
    expectedSchema[12] = new ColumnInfo("MAX", VoltType.BIGINT);
    VoltTable expectedTable = new VoltTable(expectedSchema);
    VoltTable[] results = null;
    // Do some work that will generate latency stats
    for (int i = 0; i < SITES * HOSTS; i++) {
        results = client.callProcedure("NEW_ORDER.insert", i).getResults();
    }
    // Statistics roll over every 5 seconds.
    // Retry until we've seen the window with our data.
    // We retry more often than that so that we don't miss the window;
    // this also speeds up tests when the data comes in towards the end of a window.
    long samplesFound;
    int numInvocations = 0;
    final int delayMsec = (int) TimeUnit.SECONDS.toMillis(1);
    final int invocationLimit = 2 * LatencyStats.INTERVAL_MS / delayMsec;
    // prevent misleading test failures if INTERVAL_MS changes
    assertTrue(delayMsec < LatencyStats.INTERVAL_MS);
    do {
        Thread.sleep(delayMsec);
        results = client.callProcedure("@Statistics", "LATENCY", 0).getResults();
        // one aggregate table returned
        assertEquals(1, results.length);
        System.out.println("Test latency table: " + results[0].toString());
        validateSchema(results[0], expectedTable);
        // should have at least one row from each host
        results[0].advanceRow();
        Map<String, String> columnTargets = new HashMap<String, String>();
        columnTargets.put("HOSTNAME", results[0].getString("HOSTNAME"));
        validateRowSeenAtAllHosts(results[0], columnTargets, false);
        assertEquals(HOSTS, results[0].getRowCount());
        // Search all nodes for the one that has our data
        results[0].resetRowPosition();
        samplesFound = 0;
        while (results[0].advanceRow()) {
            // milliseconds
            final long interval = results[0].getLong("INTERVAL");
            // samples
            final long count = results[0].getLong("COUNT");
            // samples per second
            final long tps = results[0].getLong("TPS");
            // microseconds
            final long p50 = results[0].getLong("P50");
            // microseconds
            final long p95 = results[0].getLong("P95");
            // microseconds
            final long p99 = results[0].getLong("P99");
            // microseconds
            final long p39 = results[0].getLong("P99.9");
            // microseconds
            final long p49 = results[0].getLong("P99.99");
            // microseconds
            final long p59 = results[0].getLong("P99.999");
            // microseconds
            final long max = results[0].getLong("MAX");
            // Run sanity checks on the data
            assertEquals(interval, LatencyStats.INTERVAL_MS);
            // Test needs to do this calculation the exact same way as the code due to fixed point rounding
            assertEquals(tps, (int) (TimeUnit.SECONDS.toMillis(count) / interval));
            assertTrue(count == 0 || p50 > 0);
            assertTrue(p50 <= p95);
            assertTrue(p95 <= p99);
            assertTrue(p99 <= p39);
            assertTrue(p39 <= p49);
            assertTrue(p49 <= p59);
            assertTrue(p59 <= max);
            samplesFound += count;
        }
        numInvocations++;
    } while (samplesFound == 0 && numInvocations < invocationLimit);
    assertTrue(samplesFound > 0);
}
Also used : HashMap(java.util.HashMap) 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