Package org.voltdb

Examples of org.voltdb.VoltTable$Row


            cr = this.client.callProcedure(procName, params);
            System.err.println(VoltTableUtil.format(cr.getResults()[0]));
            assertNotNull(cr);
            assertEquals(Status.OK, cr.getStatus());
           
            VoltTable results[] = cr.getResults();
            assertEquals(1, results.length);
           
            if (ii != 0) continue;
           
            boolean found = false;
View Full Code Here


    }
   

    private void loadData(int tuples) 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 < tuples; i++) {
            Object row[] = VoltTableUtil.getRandomRow(catalog_tbl);
            row[0] = i;
            vt.addRow(row);
        } // FOR
        this.executor.loadTable(1000l, catalog_tbl, vt, false);
    }
View Full Code Here

        // Our stats should now come back with one eviction executed
        procName = VoltSystemProcedure.procCallName(EvictHistory.class);
        ClientResponse cresponse = client.callProcedure(procName);
        assertEquals(cresponse.toString(), Status.OK, cresponse.getStatus());
        assertEquals(cresponse.toString(), 1, cresponse.getResults().length);
        VoltTable result_table = cresponse.getResults()[0];
        System.err.println(VoltTableUtil.format(result_table));

        return (m);
    }
View Full Code Here

        procName = VoltSystemProcedure.procCallName(Statistics.class);
        Object params2[] = { SysProcSelector.ANTICACHE.name(), 0 };
        cresponse = this.client.callProcedure(procName, params2);
        assertEquals(cresponse.toString(), Status.OK, cresponse.getStatus());
        assertEquals(cresponse.toString(), 1, cresponse.getResults().length);
        VoltTable result = cresponse.getResults()[0];
        assertEquals(1, result.getRowCount());
        System.err.println(VoltTableUtil.format(result));
    }
View Full Code Here

                params[i] = keys[i];
            } // FOR
            ClientResponse cresponse = this.client.callProcedure(proc.getName(), params);
            assertEquals(Status.OK, cresponse.getStatus());
           
            VoltTable results[] = cresponse.getResults();
            assertEquals(1, results.length);
            data[trial] = results[0].asScalarLong() / 1000000d;
            System.err.printf("  TRIAL %d: %.2f ms [# of Reads=%d]\n", trial, data[trial], num_reads);
        } // FOR
        double avg = MathUtil.arithmeticMean(data);
View Full Code Here

        // We want to always insert one SUBSCRIBER record per partition so
        // that we can play with them. Set VLR_LOCATION to zero so that
        // can check whether it has been modified
        Table catalog_tbl = this.getTable(TM1Constants.TABLENAME_SUBSCRIBER);
        Column catalog_col = this.getColumn(catalog_tbl, "VLR_LOCATION");
        VoltTable vt = CatalogUtil.getVoltTable(catalog_tbl);
        for (int i = 0; i < NUM_PARTITIONS; i++) {
            Object row[] = VoltTableUtil.getRandomRow(catalog_tbl);
            row[0] = new Long(i);
            row[catalog_col.getIndex()] = 0l;
            vt.addRow(row);
        } // FOR
        String procName = VoltSystemProcedure.procCallName(LoadMultipartitionTable.class);
        ClientResponse cr = this.client.callProcedure(procName, catalog_tbl.getName(), vt);
        assertEquals(cr.toString(), Status.OK, cr.getStatus());
    }
View Full Code Here

       
        Map<Integer, Long> expectedValues = new HashMap<Integer, Long>();
        for (int i = 0; i < 5; i++) {
            int fragmentId = baseFragmentId + i;
            long expected = baseValue + i;
            VoltTable result = new VoltTable(TARGET_RESULT);
            result.addRow(expected);
            expectedValues.put(fragmentId, expected);
       
            // First store it in the cache
            this.cache.addResult(txnId, fragmentId, partitionId, params, result);
        } // FOR
//        System.err.println(StringUtil.formatMaps(expectedValues));
//        System.err.println("---------------");
//        System.err.println(this.cache.toString());
       
        // Then ask for them back in a shuffled order
        List<Integer> fragmentIds = new ArrayList<Integer>(expectedValues.keySet());
        Collections.shuffle(fragmentIds);
        for (Integer fragmentId : fragmentIds) {
            long expected = expectedValues.get(fragmentId);
            VoltTable cacheResult = this.cache.getResult(txnId, fragmentId, partitionId, params);
            assertNotNull(fragmentId.toString(), cacheResult);
            assertEquals(1, cacheResult.getRowCount());
            assertEquals(expected, cacheResult.asScalarLong());
        } // FOR
       
        // If we change the params, we should never get back our results
        params = new ParameterSet("WuTang!", 1981);
        for (Integer fragmentId : fragmentIds) {
            VoltTable cacheResult = this.cache.getResult(txnId, fragmentId, partitionId, params);
            assertNull(fragmentId.toString(), cacheResult);
        } // FOR
       
        // Now create a new ParameteSet with the same values and make
        // sure get back the same results.
        params = new ParameterSet("Squi" + "rrels", 1981);
        for (Integer fragmentId : fragmentIds) {
            long expected = expectedValues.get(fragmentId);
            VoltTable cacheResult = this.cache.getResult(txnId, fragmentId, partitionId, params);
            assertNotNull(fragmentId.toString(), cacheResult);
            assertEquals(1, cacheResult.getRowCount());
            assertEquals(expected, cacheResult.asScalarLong());
        } // FOR
    }
View Full Code Here

            SendDataRequest.Builder builder = SendDataRequest.newBuilder()
                                                .setTransactionId(txn_id.longValue())
                                                .setSenderSite(local_site_id);
            // Loop through and get all the data for this site
            for (Partition catalog_part : remote_site.getPartitions()) {
                VoltTable vt = data.get(catalog_part.getId());
                if (vt == null) {
                    LOG.warn("No data in " + ts + " for partition " + catalog_part.getId());
                    continue;
                }
                ByteString bs = null;
                byte bytes[] = null;
                try {
                    bytes = ByteBuffer.wrap(FastSerializer.serialize(vt)).array();
                    bs = ByteString.copyFrom(bytes);
                    if (debug.val)
                        LOG.debug(String.format("%s - Outbound data for partition #%d " +
                              "[RowCount=%d / MD5=%s / Length=%d]",
                                  ts, catalog_part.getId(),
                                  vt.getRowCount(), StringUtil.md5sum(bytes), bytes.length));
                } catch (Exception ex) {
                    String msg = String.format("Unexpected error when serializing %s data for partition %d",
                                               ts, catalog_part.getId());
                    throw new ServerFaultException(msg, ex, ts.getTransactionId());
                }
                if (trace.val)
                    LOG.trace("Constructing Dependency for " + catalog_part);
                builder.addDepId(catalog_part.getId())
                       .addData(bs);
            } // FOR n partitions in remote_site
           
            if (builder.getDataCount() > 0) {
                if (debug.val)
                    LOG.debug(String.format("%s - Sending data to %d partitions at %s for %s",
                              ts, builder.getDataCount(), remote_site, ts));
                this.channels[dest_site_id].sendData(new ProtoRpcController(), builder.build(), callback);
            }
        } // FOR n sites in this catalog
               
        for (int partition : hstore_site.getLocalPartitionIds().values()) {
            VoltTable vt = data.get(Integer.valueOf(partition));
            if (vt == null) {
                LOG.warn("No data in " + ts + " for partition " + partition);
                continue;
            }
            if (debug.val) LOG.debug(String.format("Storing VoltTable directly at local partition %d for %s", partition, ts));
View Full Code Here

    // UTILITY METHODS
    // --------------------------------------------------------------------------------------------
   
    private void loadData() 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);
            row[0] = i;
            vt.addRow(row);
            if (i == 1) readBackTracker = row[1].toString();
        } // FOR
        this.executor.loadTable(1000l, catalog_tbl, vt, false);
       
        VoltTable stats[] = this.ee.getStats(SysProcSelector.TABLE, this.locators, 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() throws Exception {
        VoltTable results[] = this.ee.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.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

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.