Package org.voltdb.client

Examples of org.voltdb.client.ClientResponse


       
        String sql = String.format("SELECT * FROM %s WHERE custid = 1",
                                   SmallBankConstants.TABLENAME_ACCOUNTS);
       
        String procName = VoltSystemProcedure.procCallName(AdHoc.class);
        ClientResponse cresponse = client.callProcedure(procName, sql);
        assert(cresponse.getStatus() == Status.OK) : cresponse.toString();

        // XXX: We currently have no way of checking the read/write set
        //      for adhoc queries, so I just have this for checking manually.
    }
View Full Code Here


        assertTrue("No tuples were evicted!\n"+evictResult, evicted > 0);
        // System.err.println(VoltTableUtil.format(evictResult));
       
        // Now execute a query that needs to access data from this block
        Procedure proc = this.getProcedure(procName); // Special Single-Stmt Proc
        ClientResponse cresponse = null;
        if (useLimit) {
            cresponse = this.client.callProcedure(proc.getName(), expected);
        } else {
            cresponse = this.client.callProcedure(proc.getName());
        }
        assertEquals(Status.OK, cresponse.getStatus());

        // Make sure that we tracked that we tried to touch evicted data
        assertEquals(1, this.profiler.evictedaccess_history.size());

        // And then check to make sure that we get the correct number of rows back
        VoltTable results[] = cresponse.getResults();
        System.err.println(VoltTableUtil.format(results[0]));
        assertEquals(1, results.length);
        assertEquals(expected, results[0].getRowCount());
    }
View Full Code Here

                                                            vt, parameters[i].getClass()));
        } // FOR
       
        LOG.info(String.format("Invoking %s [params=%s]",
                               catalog_proc.getName(), Arrays.toString(parameters)));
        ClientResponse cresponse = client.callProcedure(catalog_proc.getName(), parameters);
       
        return (cresponse);
    }
View Full Code Here

        Integer port = CollectionUtil.random(CatalogUtil.getExecutionSitePorts(catalog_site));
        assert(port != null);
        client.createConnection(null, catalog_host.getIpaddr(), port, "user", "password");
        LOG.info(String.format("Connected to H-Store cluster at %s:%d", catalog_host.getIpaddr(), port));
       
        ClientResponse cresponse = VoltProcedureInvoker.invoke(args.catalog,
                                                               client,
                                                               procName,
                                                               parameters);
        if (cresponse == null) System.exit(-1);
       
//        m.put("Status", cresponse.getStatus());
//        m.put("Length", String.format("%d [bytes=%d]", cresponse.getResults().length, cresponse.getResultsSize()));
//        m.put("Results", StringUtil.join("\n", ));
        Map<String, Object> m = new LinkedHashMap<String, Object>();
        for (int i = 0; i < cresponse.getResults().length; i++) {
            VoltTable vt = cresponse.getResults()[i];
            m.put(String.format("  [%02d]", i), vt);
        } // FOR
       
        LOG.info(StringUtil.repeat("-", 50));
        LOG.info(String.format("%s Txn #%d - Status %s\n%s",
                               procName,
                               cresponse.getTransactionId(),
                               cresponse.getStatus(),
                               cresponse.toString()));
    }
View Full Code Here

        // System.err.println(VoltTableUtil.format(evictResult));
       
        // Now execute a query that needs to access data from this block
        Procedure proc = this.getProcedure(procName); // Special Single-Stmt Proc
        Object params[] = { 1, 1, 1, expected };
        ClientResponse cresponse = this.client.callProcedure(proc.getName(), params);
        assertEquals(Status.OK, cresponse.getStatus());

        // Make sure that we tracked that we tried to touch evicted data
        assertEquals(1, this.profiler.evictedaccess_history.size());

        // And then check to make sure that we get the correct number of rows back
        VoltTable results[] = cresponse.getResults();
        System.err.println(VoltTableUtil.format(results[0]));
        assertEquals(1, results.length);
        assertEquals(expected, results[0].getRowCount());
    }
View Full Code Here

    // --------------------------------------------------------------------------------------------
   
    private void statusSnapshot() throws Exception {
        String procName = VoltSystemProcedure.procCallName(ExecutorStatus.class);
        Object params[] = { 0L };
        ClientResponse cr = this.client.callProcedure(procName, params);
        assertEquals(Status.OK, cr.getStatus());
    }
View Full Code Here

    public void testSinglePartitionTxn() throws Exception {
        // Simple test to check whether we can execute single-partition txns serially
        Procedure catalog_proc = this.getProcedure(GetSubscriberData.class);
        for (int i = 0; i < 4; i++) {
            Object params[] = { (long)i };
            ClientResponse cr = this.client.callProcedure(catalog_proc.getName(), params);
            assertEquals(Status.OK, cr.getStatus());
        }
//        System.err.println(cr);
        this.statusSnapshot();
    }
View Full Code Here

       
        // Simple test to check whether we can execute multi-partition txns serially
        Procedure catalog_proc = this.getProcedure(DeleteCallForwarding.class);
        for (int i = 0; i < NUM_TXNS; i++) {
            Object params[] = { Integer.toString(i), 1l, 1l };
            ClientResponse cr = this.client.callProcedure(catalog_proc.getName(), params);
            assertEquals(Status.OK, cr.getStatus());
        }
//        System.err.println(cr);
        this.statusSnapshot();
    }
View Full Code Here

        long lastTxnIds[] = new long[NUM_PARTITIONS];
        int basePartition;
        long txnId;
        Arrays.fill(lastTxnIds, -1l);
        for (int i = 0; i < NUM_TXNS; i++) {
            ClientResponse spResponse = spCallback.responses.get(i);
            assertEquals(spResponse.toString(), Status.OK, spResponse.getStatus());
            txnId = spResponse.getTransactionId();
            basePartition = spResponse.getBasePartition();
            assertTrue(String.format("%02d :: LAST[%d] < SP[%d]", basePartition, lastTxnIds[basePartition], txnId),
                       lastTxnIds[basePartition] < txnId);
            lastTxnIds[basePartition] = txnId;
           
            ClientResponse mpResponse = mpCallback.responses.get(i);
            assertEquals(mpResponse.toString(), Status.OK, mpResponse.getStatus());
            txnId = mpResponse.getTransactionId();
            basePartition = mpResponse.getBasePartition();
            assertTrue(String.format("%02d :: LAST[%d] < SP[%d]", basePartition, lastTxnIds[basePartition], txnId),
                    lastTxnIds[basePartition] < txnId);
            lastTxnIds[basePartition] = txnId;
        } // FOR
       
View Full Code Here

        };
        hstore_site.getTransactionInitializer().getNewTxnObservable().addObserver(newTxnObserver);
       
        Procedure catalog_proc = this.getProcedure(UpdateLocation.class);
        Object params[] = { 1234l, "XXXX" };
        ClientResponse cr = this.client.callProcedure(catalog_proc.getName(), params);
        assertEquals(Status.OK, cr.getStatus());
        // System.err.println(cr);
        // System.err.println(StringUtil.formatMaps(copiedHandles));
       
        assertTrue(cr.hasDebug());
        ClientResponseDebug crDebug = cr.getDebug();
        assertNotNull(crDebug);
       
        LocalTransaction copy = copiedHandles.get(cr.getTransactionId());
        assertNotNull(copiedHandles.toString(), copy);
        assertEquals(copy.getTransactionId().longValue(), cr.getTransactionId());
        assertEquals(copy.getClientHandle(), cr.getClientHandle());
        assertEquals(copy.getBasePartition(), cr.getBasePartition());
        assertEquals(copy.isPredictAbortable(), crDebug.isPredictAbortable());
        assertEquals(copy.isPredictReadOnly(), crDebug.isPredictReadOnly());
        assertEquals(copy.isPredictSinglePartition(), crDebug.isPredictSinglePartition());
        assertEquals(copy.getPredictTouchedPartitions(), crDebug.getPredictTouchedPartitions());
    }
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.