Package org.voltdb.catalog

Examples of org.voltdb.catalog.Procedure


    public void testTransactionProfilers() throws Exception {
        hstore_conf.site.txn_counters = true;
        hstore_conf.site.txn_profiling = 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
        // Invoke it multiple times to make sure we get something...
        String procName = VoltSystemProcedure.procCallName(Statistics.class);
        params = new Object[]{ SysProcSelector.TXNPROFILER.name(), 0 };
        String fields[] = { "TOTAL", "INIT_TOTAL" };
        for (int ii = 0; ii < 5; ii++) {
            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;
            results[0].resetRowPosition();
            while (results[0].advanceRow()) {
                if (results[0].getString(3).equalsIgnoreCase(catalog_proc.getName())) {
                    for (String f : fields) {
                        int i = results[0].getColumnIndex(f);
                        assertEquals(f, results[0].getColumnName(i));
                        long val = results[0].getLong(i);
                        assertFalse(f, results[0].wasNull());
View Full Code Here


    /**
     * testSendClientResponse
     */
    @Test
    public void testSendClientResponse() throws Exception {
        Procedure catalog_proc = this.getProcedure(TARGET_PROCEDURE);
        PartitionSet predict_touchedPartitions = new PartitionSet(BASE_PARTITION);
        boolean predict_readOnly = true;
        boolean predict_canAbort = true;
       
        MockClientCallback callback = new MockClientCallback();
View Full Code Here

                                                     PartitionSet partitions,
                                                     ParameterSet procParams,
                                                     int base_partition,
                                                     int proc_id) {
        RemoteTransaction ts = null;
        Procedure catalog_proc = this.catalogContext.getProcedureById(proc_id);
        try {
            ts = new RemoteTransaction(this.hstore_site);
            assert(ts.isInitialized() == false);
            ts.init(txn_id, base_partition, procParams, catalog_proc, partitions, true);
            if (debug.val)
View Full Code Here

                                                           long initiateTime,
                                                           long client_handle,
                                                           int base_partition,
                                                           int procId,
                                                           ByteBuffer paramsBuffer) {
        Procedure catalog_proc = this.catalogContext.getProcedureById(procId);
        if (catalog_proc == null) {
            throw new RuntimeException("Unknown procedure id '" + procId + "'");
        }
       
        // Initialize the ParameterSet
View Full Code Here

                      keys[i][j] = zipf.nextInt(NUM_TUPLES);
                    num_reads++;
                } // FOR
            } // FOR
           
            Procedure proc = this.getProcedure(SelectBlaster.class);
            Object params[] = new Object[keys.length];
            for (int i = 0; i < keys.length; i++) {
                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;
View Full Code Here

        SinglePartitionTester.LOCK_BEFORE.put(marker, spLock);
        Semaphore spNotify = new Semaphore(0);
        SinglePartitionTester.NOTIFY_BEFORE.put(marker, spNotify);
        LatchableProcedureCallback spCallback0 = new LatchableProcedureCallback(1);
        Object params[] = new Object[]{ BASE_PARTITION, marker, 0 };
        Procedure spProc = this.getProcedure(SinglePartitionTester.class);
        this.client.callProcedure(spCallback0, spProc.getName(), params);
       
        // Block until we know that the txn has started running
        result = spNotify.tryAcquire(NOTIFY_TIMEOUT, TimeUnit.MILLISECONDS);
        assertTrue(result);
       
        // Then execute a distributed txn. It will get the lock for the
        // other partition that the first partition isn't running on
        Object dtxnParams[] = new Object[]{ BASE_PARTITION+1 };
        this.client.callProcedure(this.dtxnCallback, this.dtxnProc.getName(), dtxnParams);
        ThreadUtil.sleep(NOTIFY_TIMEOUT);
       
        // Now blast out a single-partition txn that will get
        // speculatively executed on the idle partition
        LatchableProcedureCallback spCallback1 = new LatchableProcedureCallback(1);
        params = new Object[]{ BASE_PARTITION+1, marker + 1, 0 };
        this.client.callProcedure(spCallback1, spProc.getName(), params);
        result = spCallback1.latch.await(NOTIFY_TIMEOUT, TimeUnit.MILLISECONDS);
        assertTrue("SINGLE-P1 LATCH: " + spCallback1.latch, result);
        assertEquals(1, spCallback1.responses.size());
        this.checkClientResponses(spCallback1.responses, Status.OK, true, 0);
       
View Full Code Here

        assertTrue(result);
        this.checkCurrentDtxn();
       
        // Now submit our aborting single-partition txn
        // This should be allowed to be speculatively executed right away
        Procedure spProc0 = this.getProcedure(SinglePartitionTester.class);
        Procedure spProc1 = this.getProcedure(CheckSubscriber.class);
        LatchableProcedureCallback spCallback0 = new LatchableProcedureCallback(NUM_SPECEXEC_TXNS);
        LatchableProcedureCallback spCallback1 = new LatchableProcedureCallback(NUM_SPECEXEC_TXNS);
        LatchableProcedureCallback spCallback2 = new LatchableProcedureCallback(NUM_SPECEXEC_TXNS);
        int MARKER = 1000;
        for (int i = 0; i < NUM_SPECEXEC_TXNS; i++) {
            // First txn will not abort
            params = new Object[]{ BASE_PARTITION+1, MARKER, 0 };
            this.client.callProcedure(spCallback0, spProc0.getName(), params);
           
            // Second txn will abort
            params = new Object[]{ BASE_PARTITION+1, MARKER+1, 1 };
            this.client.callProcedure(spCallback1, spProc0.getName(), params);
           
            // Third txn should only see the first txn's marker value
            params = new Object[]{ BASE_PARTITION+1, MARKER, 1 }; // SHOULD BE EQUAL!
            this.client.callProcedure(spCallback2, spProc1.getName(), params);
        } // FOR
        ThreadUtil.sleep(NOTIFY_TIMEOUT);
       
        // We should get back all of the aborting txns' responses, but none from
        // the other txns
View Full Code Here

        assertTrue(result);
        this.checkCurrentDtxn();
       
        // Now submit our aborting single-partition txn
        // This should be allowed to be speculatively executed right away
        Procedure spProc0 = this.getProcedure(SinglePartitionTester.class);
        LatchableProcedureCallback spCallback0 = new LatchableProcedureCallback(1);
        int MARKER = 9999;
        params = new Object[]{ BASE_PARTITION+1, MARKER, 1 };
        this.client.callProcedure(spCallback0, spProc0.getName(), params);

        // Now execute the second batch of single-partition txns
        // These should never see the changes made by our first single-partition txn
        Procedure spProc1 = this.getProcedure(CheckSubscriber.class);
        LatchableProcedureCallback spCallback1 = new LatchableProcedureCallback(NUM_SPECEXEC_TXNS);
        params = new Object[]{ BASE_PARTITION+1, MARKER, 0 }; // Should not be equal!
        for (int i = 0; i < NUM_SPECEXEC_TXNS; i++) {
            this.client.callProcedure(spCallback1, spProc1.getName(), params);
        } // FOR
        HStoreSiteTestUtil.checkBlockedSpeculativeTxns(this.remoteExecutor, NUM_SPECEXEC_TXNS);
       
        // Release all of the dtxn's locks
        this.lockAfter.release();
View Full Code Here

       
        // TODO: Check that the string data has all been evicted.
       
        // Now execute a query that needs to access data from this block
        long expected = 1;
        Procedure proc = this.getProcedure("GetRecord");
        ClientResponse cresponse = this.client.callProcedure(proc.getName(), expected);
        assertEquals(Status.OK, cresponse.getStatus());
       
        // Check to make sure that our stats were updated
        VoltTable newStats[] = this.ee.getStats(SysProcSelector.TABLE, this.locators, false, 0L);
        assertEquals(1, newStats.length);
        System.err.println(VoltTableUtil.format(newStats));
        adv = newStats[0].advanceRow();
        assert(adv);
        for (int i = 0; i < statsFields.length; i++) {
            // ACTIVE
            assertEquals(statsFields[i], 0, newStats[0].getLong(statsFields[i]));
           
            // GLOBAL WRITTEN
            assertEquals(writtenFields[i], origStats[0].getLong(writtenFields[i]), newStats[0].getLong(writtenFields[i]));
           
            // GLOBAL READ
            assertEquals(readFields[i], origStats[0].getLong(writtenFields[i]), newStats[0].getLong(readFields[i]));
        } // FOR
       
        // Check that the global stats for the site matches too
        this.executor.getDebugContext().updateMemory();
        proc = this.getProcedure(VoltSystemProcedure.procCallName(Statistics.class));
        Object params[] = { SysProcSelector.MEMORY.name(), 0 };
        cresponse = this.client.callProcedure(proc.getName(), params);
        assertEquals(Status.OK, cresponse.getStatus());
        VoltTable results = cresponse.getResults()[0];
        adv = results.advanceRow();
        assert(adv);
        for (int i = 0; i < statsFields.length; i++) {
View Full Code Here

        long evicted = evictResult.getLong("ANTICACHE_TUPLES_EVICTED");
        assertTrue("No tuples were evicted!"+evictResult, evicted > 0);
       
        // Now execute a query that needs to access data from this block
        long expected = 1;
        Procedure proc = this.getProcedure("GetRecord"); // Special Single-Stmt Proc
        ClientResponse cresponse = this.client.callProcedure(proc.getName(), expected);
        assertEquals(Status.OK, cresponse.getStatus());
       
        VoltTable results[] = cresponse.getResults();
        assertEquals(1, results.length);
        boolean adv = results[0].advanceRow();
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.