Package org.voltdb

Examples of org.voltdb.VoltTable$Row


    @Test
    public void testEvictTuplesMultiple() throws Exception {
        // Just checks whether we can call evictBlock multiple times
        this.loadData();

        VoltTable results[] = this.ee.getStats(SysProcSelector.TABLE, this.locators, false, 0L);
        assertEquals(1, results.length);
        System.err.println(VoltTableUtil.format(results));

    results[0].advanceRow();
        for (String col : statsFields) {
            int idx = results[0].getColumnIndex(col);
            assertEquals(0, results[0].getLong(idx));   
        } // FOR
        System.err.println(StringUtil.repeat("=", 100));
       
        // Now force the EE to evict our boys out in multiple rounds
        VoltTable evictResult = null;
        for (int i = 0; i < 5; i++) {
            if (i > 0) {
                System.err.println(StringUtil.repeat("-", 100));
                ThreadUtil.sleep(1000);
            }
            System.err.println("Eviction #" + i);
            evictResult = this.ee.antiCacheEvictBlock(catalog_tbl, 512, 1);
            System.err.println(VoltTableUtil.format(evictResult));
            assertNotNull(evictResult);
            assertEquals(1, evictResult.getRowCount());
            assertNotSame(results[0].getColumnCount(), evictResult.getColumnCount());
            evictResult.resetRowPosition();
            boolean adv = evictResult.advanceRow();
            assertTrue(adv);
        } // FOR
    }
View Full Code Here


    // UTILITY METHODS
    // --------------------------------------------------------------------------------------------
   
    private void loadData(Table catalog_tbl) throws Exception {
        // Load in a bunch of dummy data for this table
        VoltTable vt = CatalogUtil.getVoltTable(catalog_tbl);
        assertNotNull(vt);
        for (int i = 0; i < NUM_TUPLES; i++) {
            Object row[] = VoltTableUtil.getRandomRow(catalog_tbl);
           
            if (catalog_tbl.getName().equalsIgnoreCase(TPCCConstants.TABLENAME_ORDER_LINE)) {
                row[0] = i; // OL_O_ID
                row[1] = (byte)i; // OL_D_ID
                row[2] = (short)i; // OL_W_ID
            }
            vt.addRow(row);
        } // FOR
        this.executor.loadTable(1000l, catalog_tbl, vt, false);
       
        int statsLocators[] = { catalog_tbl.getRelativeIndex() };
        VoltTable stats[] = this.ee.getStats(SysProcSelector.TABLE, statsLocators, false, 0L);
        assertEquals(1, stats.length);
        // System.err.println(VoltTableUtil.format(stats));
    }
View Full Code Here

        assertEquals(1, stats.length);
        // System.err.println(VoltTableUtil.format(stats));
    }
   
    private VoltTable evictData(Table catalog_tbl) throws Exception {
        VoltTable results[] = this.ee.getStats(SysProcSelector.TABLE, this.locators, false, 0L);
        assertEquals(1, results.length);
        // System.err.println(VoltTableUtil.format(results));
        while (results[0].advanceRow()) {
            if (results[0].getString("TABLE_NAME").equalsIgnoreCase(catalog_tbl.getName()) == false)
                continue;
            for (String col : statsFields) {
                int idx = results[0].getColumnIndex(col);
                assertEquals(0, results[0].getLong(idx));   
            } // FOR
        } // WHILE
       
        // Now force the EE to evict our boys out
        // We'll tell it to remove 1MB, which is guaranteed to include all of our tuples
        VoltTable evictResult = this.ee.antiCacheEvictBlock(catalog_tbl, 1024 * 1024, 1);

//        System.err.println("-------------------------------");
//        System.err.println(VoltTableUtil.format(evictResult));
        assertNotNull(evictResult);
        assertEquals(1, evictResult.getRowCount());
        assertNotSame(results[0].getColumnCount(), evictResult.getColumnCount());
        evictResult.resetRowPosition();
        boolean adv = evictResult.advanceRow();
        assertTrue(adv);
        return (evictResult);
    }
View Full Code Here

        }
       
        // Then make sure that we can evict from each of them
        for (String tableName : TARGET_TABLES) {
            Table catalog_tbl = this.getTable(tableName);
            VoltTable evictResult = this.evictData(catalog_tbl);
            evictResult.advanceRow();

            // Our stats should now come back with at least one block evicted
            VoltTable results[] = this.ee.getStats(SysProcSelector.TABLE, this.locators, false, 0L);
            assertEquals(1, results.length);
            // System.err.println("-------------------------------");
            // System.err.println(VoltTableUtil.format(results));

            while (results[0].advanceRow()) {
View Full Code Here

    // --------------------------------------------------------------------------------------------
   
    private void loadData() throws Exception {
        // Load in a bunch of dummy data for this table
      // site 1
        VoltTable vt1 = CatalogUtil.getVoltTable(catalog_tbl);
        assertNotNull(vt1);
        for (int i = 0; i < NUM_TUPLES/2; i++) {
            Object row[] = VoltTableUtil.getRandomRow(catalog_tbl);
            row[0] = i;
            vt1.addRow(row);
        } // FOR
        this.executors[0].loadTable(1000l, catalog_tbl, vt1, false);
       
        // site 2
        VoltTable vt2 = CatalogUtil.getVoltTable(catalog_tbl);
        for (int i = 0; i < NUM_TUPLES/2; i++) {
            Object row[] = VoltTableUtil.getRandomRow(catalog_tbl);
            row[0] = i;
            vt2.addRow(row);
        } // FOR
        this.executors[1].loadTable(1001l, catalog_tbl, vt2, false);
       
        VoltTable stats[] = this.ee[0].getStats(SysProcSelector.TABLE, this.locators, false, 0L);
        assertEquals(1, stats.length);
        System.err.println(VoltTableUtil.format(stats));
        stats = this.ee[1].getStats(SysProcSelector.TABLE, this.locators, false, 0L);
        assertEquals(1, stats.length);
        System.err.println(VoltTableUtil.format(stats));
View Full Code Here

    }
   
    private VoltTable evictData() throws Exception {
      // evict only from remote site i.e site 1
        VoltTable results[] = this.ee[1].getStats(SysProcSelector.TABLE, this.locators, false, 0L);
        assertEquals(1, results.length);
        // System.err.println(VoltTableUtil.format(results));
        for (String col : statsFields) {
      results[0].advanceRow();
            int idx = results[0].getColumnIndex(col);
            assertEquals(0, results[0].getLong(idx));   
        } // FOR

        // Now force the EE to evict our boys out
        // We'll tell it to remove 1MB, which is guaranteed to include all of our tuples
        VoltTable evictResult = this.ee[1].antiCacheEvictBlock(catalog_tbl, 1024 * 500, 1);

        System.err.println("-------------------------------");
        System.err.println(VoltTableUtil.format(evictResult));
        assertNotNull(evictResult);
        assertEquals(1, evictResult.getRowCount());
        //assertNotSame(results[0].getColumnCount(), evictResult.getColumnCount());
        evictResult.resetRowPosition();
        boolean adv = evictResult.advanceRow();
        assertTrue(adv);
          return (evictResult);
    }
View Full Code Here

    public synchronized VoltTable getDependency(long txnId) {
        return this.dependencies.get(txnId);
    }
   
    public synchronized VoltTable waitForDependency(long txnId) {
        VoltTable vt = this.dependencies.get(txnId);
        if (vt == null) {
            CountDownLatch latch = this.latches.get(txnId);
            if (latch == null) {
                latch = new CountDownLatch(1);
                this.latches.put(txnId, latch);
View Full Code Here

    // --------------------------------------------------------------------------------------------
    // UTILITY METHODS
    // --------------------------------------------------------------------------------------------
   
    private void updateTracking(AbstractTransaction ts, Table catalog_tbl, boolean isRead, int...tupleIds) {
        VoltTable vts[] = this.readWriteSets.get(ts);
        if (vts == null) {
            vts = new VoltTable[]{
                        new VoltTable(TestReadWriteTracking.RESULT_COLS),
                        new VoltTable(TestReadWriteTracking.RESULT_COLS)
            };
            this.readWriteSets.put(ts, vts);
        }

        VoltTable vt = null;
        if (isRead) {
            vt = vts[OptimisticConflictChecker.READ];
            ts.markTableRead(BASE_PARTITION, catalog_tbl);
        }
        else {
            vt = vts[OptimisticConflictChecker.WRITE];
            ts.markTableWritten(BASE_PARTITION, catalog_tbl);
        }
        for (int tupleId : tupleIds) {
            vt.addRow(catalog_tbl.getName(), tupleId);
        } // FOR
    }
View Full Code Here

        assertEquals(Status.OK, cr.getStatus());
    }
   
    private void loadData(Table catalog_tbl) throws Exception {
        // Load some data directly into the EEs without going through transactions
        VoltTable vts[] = {
            CatalogUtil.getVoltTable(catalog_tbl),
            CatalogUtil.getVoltTable(catalog_tbl)
        };
        assertEquals(NUM_PARTITIONS, vts.length);
        AbstractHasher hasher = p_estimator.getHasher();
View Full Code Here

        cr = this.client.callProcedure(VoltSystemProcedure.procCallName(Statistics.class), params);
//        System.err.println(cr);
        assertNotNull(cr);
        assertEquals(Status.OK, cr.getStatus());
       
        VoltTable results[] = cr.getResults();
        assertEquals(1, results.length);
        boolean found = false;
        while (results[0].advanceRow()) {
            if (results[0].getString(3).equalsIgnoreCase(catalog_proc.getName())) {
                for (int i = 4; i < results[0].getColumnCount(); i++) {
View Full Code Here

TOP

Related Classes of org.voltdb.VoltTable$Row

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.