Package org.voltdb.client

Examples of org.voltdb.client.ClientResponse


        Set<String> allTables = new HashSet<String>();
       
        String procName = VoltSystemProcedure.procCallName(AdHoc.class);
        for (String tableName : allTables) {
            String query = "SELECT COUNT(*) FROM " + tableName;
            ClientResponse cresponse = client.callProcedure(procName, query);
            assertEquals(Status.OK, cresponse.getStatus());
            VoltTable results[] = cresponse.getResults();
            assertEquals(1, results.length);
            long count = results[0].asScalarLong();
            assertTrue(tableName + " -> " + count, count > 0);
            // System.err.println(tableName + "\n" + results[0]);
        } // FOR
View Full Code Here


        VoltTable[] is2results = client.callProcedure("InsertStock", 5L, 3L, 45L,
                "INFO", "INFO", "INFO", "INFO", "INFO", "INFO", "INFO", "INFO",
                "INFO", "INFO", 5582L, 152L, 32L, "DATA").getResults();
        assertEquals(1L, is2results[0].asScalarLong());

        ClientResponse cr = client.callProcedure(TPCCConstants.STOCK_LEVEL, (byte)3, (byte)7, 5000);
        assertEquals(Status.OK, cr.getStatus());
        results = cr.getResults();
        // check one table was returned
        assertEquals(1, results.length);
        // check one tuple was modified
        result = results[0];
        assertNotNull(result);
View Full Code Here

                "INFO", "INFO", "INFO", "INFO", "INFO", INITIAL_S_YTD+20, INITIAL_S_ORDER_CNT+20,
                32L, "DATA").getResults()[0];

        final double PRICE = 2341.23;
        // long i_id, long i_im_id, String i_name, double i_price, String i_data
        ClientResponse cr =
        client.callProcedure("InsertItem", 4L, 4L, "ITEM1",
                PRICE, TPCCConstants.ORIGINAL_STRING);
        VoltTable item1 = cr.getResults()[0];
       
        VoltTable item2 = client.callProcedure("InsertItem", 5L, 5L, "ITEM2",
                PRICE, TPCCConstants.ORIGINAL_STRING).getResults()[0];
        VoltTable item3 = client.callProcedure("InsertItem", 6L, 6L, "ITEM3",
                PRICE, TPCCConstants.ORIGINAL_STRING).getResults()[0];
View Full Code Here

        assertEquals(O_ID, r.getLong(1));
    }
   
    public void testTABLECOUNTS() throws IOException, ProcCallException {
        Client client = getClient();
        ClientResponse cr = null;
        CatalogContext catalogContext = this.getCatalogContext();
       
        Random rand = this.getRandom();
        int num_tuples = 11;
        for (Table catalog_tbl : catalogContext.database.getTables()) {
            RegressionSuiteUtil.loadRandomData(client, catalog_tbl, rand, num_tuples);
        } // FOR (table)
       
        // Now get the counts for the tables that we just loaded
        cr = client.callProcedure(GetTableCounts.class.getSimpleName());
        // System.err.println(cr);
        assertEquals(Status.OK, cr.getStatus());
        assertEquals(1, cr.getResults().length);
        VoltTable vt = cr.getResults()[0];
        while (vt.advanceRow()) {
            String tableName = vt.getString(0);
            int count = (int)vt.getLong(1);
            assertEquals(tableName, num_tuples, count);
        } // WHILE
View Full Code Here

        RegressionSuiteUtil.initializeTPCCDatabase(this.getCatalogContext(), client);
       
        String procName = VoltSystemProcedure.procCallName(AdHoc.class);
        for (String tableName : TPCCConstants.TABLENAMES) {
            String query = "SELECT COUNT(*) FROM " + tableName;
            ClientResponse cresponse = client.callProcedure(procName, query);
            assertEquals(Status.OK, cresponse.getStatus());
            VoltTable results[] = cresponse.getResults();
            assertEquals(1, results.length);
            long count = results[0].asScalarLong();
            assertTrue(tableName + " -> " + count, count > 0);
            // System.err.println(tableName + "\n" + VoltTableUtil.format(results[0]));
        } // FOR
View Full Code Here

       
        // Fire off a single-partition txn
        // It should always come back with zero restarts
        String procName = neworder.class.getSimpleName();
        Object params[] = RegressionSuiteUtil.generateNewOrder(catalogContext.numberOfPartitions, false, (short)1);
        ClientResponse cresponse = client.callProcedure(procName, params);
        assertEquals(cresponse.toString(), Status.OK, cresponse.getStatus());
        assertTrue(cresponse.toString(), cresponse.isSinglePartition());
        assertEquals(cresponse.toString(), 0, cresponse.getRestartCounter());
       
        // Sleep a little bit to give them for the txn to get cleaned up
        ThreadUtil.sleep(2500);
       
        // Then execute the same thing again multiple times.
        // It should use the cache estimate from the first txn
        // We are going to execute them asynchronously to check whether we
        // can share the cache properly
        final int num_invocations = 10;
        final CountDownLatch latch = new CountDownLatch(num_invocations);
        final List<ClientResponse> cresponses = new ArrayList<ClientResponse>();
        ProcedureCallback callback = new ProcedureCallback() {
            @Override
            public void clientCallback(ClientResponse clientResponse) {
                cresponses.add(clientResponse);
                latch.countDown();
            }
        };
        for (int i = 0; i < num_invocations; i++) {
            client.callProcedure(callback, procName, params);
        } // FOR
       
        // Now wait for the responses
        boolean result = latch.await(5, TimeUnit.SECONDS);
        assertTrue(result);
       
        for (ClientResponse cr : cresponses) {
            assertEquals(cr.toString(), Status.OK, cr.getStatus());
            assertTrue(cr.toString(), cr.isSinglePartition());
            assertEquals(cr.toString(), 0, cr.getRestartCounter());
        } // FOR
       
        // So we need to grab the MarkovEstimatorProfiler stats and check
        // that the cache counter is greater than one
        cresponse = RegressionSuiteUtil.getStats(client, SysProcSelector.MARKOVPROFILER);
        VoltTable results[] = cresponse.getResults();
        long cached_cnt = 0;
        boolean found = false;
        String targetCol = "CACHED_ESTIMATE_CNT";
        while (results[0].advanceRow()) {
            for (int i = 0; i < results[0].getColumnCount(); i++) {
View Full Code Here

        // Fire off a distributed neworder txn
        // It should always come back with zero restarts
        String procName = neworder.class.getSimpleName();
        Object params[] = RegressionSuiteUtil.generateNewOrder(catalogContext.numberOfPartitions, true, (short)2);
       
        ClientResponse cresponse = client.callProcedure(procName, params);
        assertEquals(cresponse.toString(), Status.OK, cresponse.getStatus());
        assertFalse(cresponse.toString(), cresponse.isSinglePartition());
        assertEquals(cresponse.toString(), 0, cresponse.getRestartCounter());
//        System.err.println(cresponse);
       
        // Get the MarkovEstimatorProfiler stats
        cresponse = RegressionSuiteUtil.getStats(client, SysProcSelector.MARKOVPROFILER);
        System.err.println(VoltTableUtil.format(cresponse.getResults()[0]));
    }
View Full Code Here

            return;
        }

        int ctr = 0;
        Iterator<LogEntry> log_itr = reader.iterator();
        ClientResponse cresponse = null;
        Client client = this.getClient();
        CatalogContext cc = this.getCatalogContext();
        VoltTable results[] = null;

        while (log_itr.hasNext()) {
            LogEntry entry = log_itr.next();

            assert(entry != null);
            //System.err.println("REDO :: TXN ID :" + entry.getTransactionId().longValue());
            //System.err.println("REDO :: PROC ID :" + entry.getProcedureId());

            Object[] entryParams = entry.getProcedureParams().toArray();
       
            String procName = cc.getProcedureById(entry.getProcedureId()).fullName();
            Procedure catalog_proc = cc.procedures.getIgnoreCase(procName);

            if(catalog_proc.getReadonly() == false){
                // System.out.println("Invoking procedure ::" + procName);

                cresponse = client.callProcedure(procName, entryParams);
                assertEquals(cresponse.getStatus(), Status.OK);
               
                // results = cresponse.getResults();
                // assertEquals(results.length, 1);
            }
View Full Code Here


    private void checkYCSBTable(Client client, int numTuples) {
        long key_itr, key;
        String procName;
        ClientResponse cresponse = null;
        VoltTable vt = null;
        boolean adv = true;

        for (key_itr = 0; key_itr < numTuples; key_itr++) {
            procName = ReadRecord.class.getSimpleName();
            Object params[] = { key_itr };

            try {
                cresponse = client.callProcedure(procName, params);
            } catch (Exception e) {
                e.printStackTrace();
            }

            assertNotNull(cresponse);
            assertEquals(Status.OK, cresponse.getStatus());
            assertEquals(1, cresponse.getResults().length);

            vt = cresponse.getResults()[0];
            adv = vt.advanceRow();
            if (adv == false)
                System.err.println("key :" + key_itr + " no result");
            else
                System.err.println("key :" + key_itr + " result:" + vt.getLong(0));
View Full Code Here

    public void testInitialize() throws Exception {
        Client client = this.getClient();
        this.initializeDatabase(client, NUM_TUPLES);
       
        String query = "SELECT COUNT(*) FROM " + UsersConstants.TABLENAME_USERS;
        ClientResponse cresponse = client.callProcedure("@AdHoc", query);
        assertEquals(Status.OK, cresponse.getStatus());
        VoltTable results[] = cresponse.getResults();
        assertEquals(1, results.length);
        assertEquals(NUM_TUPLES, results[0].asScalarLong());
    }
View Full Code Here

TOP

Related Classes of org.voltdb.client.ClientResponse

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.