Package org.voltdb.catalog

Examples of org.voltdb.catalog.Procedure


   
    /**
     * testEqualParameters
     */
    public void testEqualParameters() throws Exception {
        Procedure catalog_proc = this.getProcedure(neworder.class);
        Statement catalog_stmt = CollectionUtil.first(catalog_proc.getStatements());
        assertNotNull(catalog_stmt);
        StmtParameter catalog_stmt_param = CollectionUtil.first(catalog_stmt.getParameters());
        assertNotNull(catalog_stmt_param);
       
        TransactionTrace txn_trace = CollectionUtil.first(workload.getTraces(catalog_proc));
        assertNotNull(txn_trace);
       
        ParameterSet params = new ParameterSet(txn_trace.getParams());
        for (ProcParameter catalog_param : catalog_proc.getParameters()) {
            if (catalog_param.getIsarray()) {
                Object inner[] = (Object[])params.toArray()[catalog_param.getIndex()];
                for (int i = 0; i < inner.length; i++) {
                    ParameterMapping pm = new ParameterMapping(catalog_stmt, 0, catalog_stmt_param, catalog_param, i, 1.0d);
                    assertTrue(this.checker.equalParameters(params, pm, params, pm));
View Full Code Here


   
    /**
     * testMultiProcParameter
     */
    public void testMultiProcParameter() throws Exception {
        Procedure catalog_proc = this.getProcedure(UpdateSubscriberData.class);
        ProcParameter params[] = {
            catalog_proc.getParameters().get(0),
            catalog_proc.getParameters().get(1),
        };
        int num_params = catalog_proc.getParameters().size();
        MultiProcParameter item0 = MultiProcParameter.get(params);
        assertNotNull(item0);
        assertEquals(catalog_proc, item0.getParent());
        assertEquals(num_params, item0.getIndex());
        for (int i = 0; i < params.length; i++) {
View Full Code Here

    /**
     * testReadWriteConflicts
     */
    @Test
    public void testReadWriteConflicts() throws Exception {
        Procedure proc = this.getProcedure(neworder.class);
        Collection<Table> tables = CatalogUtil.getReferencedTables(proc);
       
        LocalTransaction ts0 = new LocalTransaction(this.hstore_site);
        ts0.testInit(NEXT_TXN_ID++,
                     BASE_PARTITION,
View Full Code Here

    /**
     * testWriteWriteConflicts
     */
    @Test
    public void testWriteWriteConflicts() throws Exception {
        Procedure proc = this.getProcedure(neworder.class);
        Collection<Table> tables = CatalogUtil.getReferencedTables(proc);
       
        LocalTransaction ts0 = new LocalTransaction(this.hstore_site);
        ts0.testInit(NEXT_TXN_ID++,
                     BASE_PARTITION,
View Full Code Here

     * testSinglePartitionTxn
     */
    @Test
    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

    public void testMultiPartitionTxn() throws Exception {
        this.loadData(this.getTable(TM1Constants.TABLENAME_SUBSCRIBER));
        this.loadData(this.getTable(TM1Constants.TABLENAME_CALL_FORWARDING));
       
        // 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

        // Submit our first dtxn that will block until we tell it to go
        DtxnTester.NOTIFY_BEFORE.drainPermits();
        DtxnTester.LOCK_BEFORE.drainPermits();
        DtxnTester.NOTIFY_AFTER.drainPermits();
        DtxnTester.LOCK_AFTER.drainPermits();
        Procedure catalog_proc = this.getProcedure(DtxnTester.class);
        Object params[] = new Object[]{ BASE_PARTITION };
        this.client.callProcedure(callback, catalog_proc.getName(), params);
       
        // Block until we know that the txn has started running
        boolean result = DtxnTester.NOTIFY_BEFORE.tryAcquire(NOTIFY_TIMEOUT, TimeUnit.MILLISECONDS);
        assertTrue(result);

        // Now fire off all of our other dtxns. They should not
        // get executed until our first guy is finished.
        catalog_proc = this.getProcedure(DeleteCallForwarding.class);
        for (int i = 0; i < NUM_TXNS; i++) {
            params = new Object[]{ Integer.toString(i), 1l, 1l };
            this.client.callProcedure(callback, catalog_proc.getName(), params);
        } // FOR
       
        // Sleep for a bit. We still should not have gotten back any responses
        ThreadUtil.sleep(NOTIFY_TIMEOUT);
        assertEquals(0, callback.responses.size());
View Full Code Here

        HStoreSiteTestUtil.LatchableProcedureCallback blockedCallback = new HStoreSiteTestUtil.LatchableProcedureCallback(1);
        DtxnTester.NOTIFY_BEFORE.drainPermits();
        DtxnTester.LOCK_BEFORE.drainPermits();
        DtxnTester.NOTIFY_AFTER.drainPermits();
        DtxnTester.LOCK_AFTER.drainPermits();
        Procedure catalog_proc = this.getProcedure(DtxnTester.class);
        Object params[] = new Object[]{ BASE_PARTITION };
        this.client.callProcedure(blockedCallback, catalog_proc.getName(), params);
        // Block until we know that the txn has started running
        boolean result = DtxnTester.NOTIFY_BEFORE.tryAcquire(NOTIFY_TIMEOUT, TimeUnit.MILLISECONDS);
        assertTrue(result);

        // Fire off a mix of single-partition txns and distributed txns
        // Since we will delay each invocation, we know that the txn ids
        // will be farther enough apart that we should expect them to be
        // returned in the proper order
        Procedure spProc = this.getProcedure(GetSubscriberData.class);
        HStoreSiteTestUtil.LatchableProcedureCallback spCallback = new HStoreSiteTestUtil.LatchableProcedureCallback(NUM_TXNS);
        // spCallback.setDebug(true);
        Procedure mpProc = this.getProcedure(DeleteCallForwarding.class);
        HStoreSiteTestUtil.LatchableProcedureCallback mpCallback = new HStoreSiteTestUtil.LatchableProcedureCallback(NUM_TXNS);
        // mpCallback.setDebug(true);
       
        for (int i = 0; i < NUM_TXNS; i++) {
            // SINGLE-PARTITION
            params = new Object[]{ new Long(i) };
            this.client.callProcedure(spCallback, spProc.getName(), params);
            ThreadUtil.sleep(100);
           
            // MULTI-PARTITION
            params = new Object[]{ Integer.toString(i), 1l, 1l };
            this.client.callProcedure(mpCallback, mpProc.getName(), params);
            ThreadUtil.sleep(100);
        } // FOR
       
        // Sleep for a bit. We still should have gotten back any responses
        ThreadUtil.sleep(NOTIFY_TIMEOUT);
View Full Code Here

                copiedHandles.put(ts.getTransactionId(), copy);
            }
        };
        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());
View Full Code Here

    @Test
    public void testTransactionCounters() throws Exception {
        hstore_conf.site.txn_counters = true;
        hstore_site.updateConf(hstore_conf, null);
       
        Procedure catalog_proc = this.getProcedure(UpdateLocation.class);
        ClientResponse cr = null;
        int num_txns = 500;
       
        Object params[] = { 1234l, "XXXX" };
        for (int i = 0; i < num_txns; i++) {
            this.client.callProcedure(catalog_proc.getName(), params);
        } // FOR
        ThreadUtil.sleep(1000);
        assertEquals(num_txns, TransactionCounter.RECEIVED.get());
       
        // Now try invoking @Statistics to get back more information
        params = new Object[]{ SysProcSelector.TXNCOUNTER.name(), 0 };
        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++) {
                    String counterName = results[0].getColumnName(i);
                    TransactionCounter tc = TransactionCounter.get(counterName);
                    assertNotNull(counterName, tc);
                   
View Full Code Here

TOP

Related Classes of org.voltdb.catalog.Procedure

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.