Package edu.brown.HStoreSiteTestUtil

Examples of edu.brown.HStoreSiteTestUtil.LatchableProcedureCallback


    private Map<Integer, VoltTable> evictData(Client client) throws Exception {
//        System.err.printf("Evicting data...");
        String procName = VoltSystemProcedure.procCallName(EvictTuples.class);
        CatalogContext catalogContext = this.getCatalogContext();
        String tableNames[] = { VoterConstants.TABLENAME_VOTES };
        LatchableProcedureCallback callback = new LatchableProcedureCallback(catalogContext.numberOfPartitions);
//        long evictBytes[] = { Integer.MAX_VALUE };
        long evictBytes[] = {10000};
        int numBlocks[] = { 1 };
        for (int partition : catalogContext.getAllPartitionIds()) {
//            System.err.printf("Evicting data at partition %d...\n", partition);
          String children[] = null;
            Object params[] = { partition, tableNames, children, evictBytes, numBlocks };
            boolean result = client.callProcedure(callback, procName, params);
            assertTrue(result);
        } // FOR
       
        // Wait until they all finish
        boolean result = callback.latch.await(NOTIFY_TIMEOUT, TimeUnit.MILLISECONDS);
        assertTrue(callback.toString(), result);
       
        // Construct a mapping BasePartition->VoltTable
        Map<Integer, VoltTable> m = new TreeMap<Integer, VoltTable>();
        for (ClientResponse cr : callback.responses) {
            assertEquals(cr.toString(), Status.OK, cr.getStatus());
View Full Code Here


       
        // Fire off a distributed a txn that will block.
        Object dtxnParams[] = new Object[]{ BASE_PARTITION, BASE_PARTITION+1, 1.0 };
        StoredProcedureInvocationHints dtxnHints = new StoredProcedureInvocationHints();
        dtxnHints.basePartition = BASE_PARTITION;
        LatchableProcedureCallback dtxnCallback = new LatchableProcedureCallback(1);
        this.client.callProcedure(dtxnCallback, this.blockingProc.getName(), dtxnHints, dtxnParams);
       
        // Block until we know that the txn has started running
        BlockingSendPayment dtxnVoltProc = HStoreSiteTestUtil.getCurrentVoltProcedure(this.baseExecutor, BlockingSendPayment.class);
        assertNotNull(dtxnVoltProc);
        boolean result = dtxnVoltProc.NOTIFY_BEFORE.tryAcquire(HStoreSiteTestUtil.NOTIFY_TIMEOUT, TimeUnit.MILLISECONDS);
        assertTrue(result);
        this.checkCurrentDtxn();
       
        // Let the dtxn execute some queries that modify the remote partition
        dtxnVoltProc.LOCK_BEFORE.release();
        result = dtxnVoltProc.NOTIFY_AFTER.tryAcquire(HStoreSiteTestUtil.NOTIFY_TIMEOUT, TimeUnit.MILLISECONDS);
        assertTrue(result);
       
        // Fire off a single-partition txn that will get executed right away but
        // have its ClientResponse held until it learns whether the dtxn
        // will commit successfully
        Procedure spProc = this.getProcedure(DepositChecking.class);
        Object spParams[] = new Object[]{ remotePartition, 1.0 };
        StoredProcedureInvocationHints spHints = new StoredProcedureInvocationHints();
        spHints.basePartition = remotePartition;
        LatchableProcedureCallback spCallback0 = new LatchableProcedureCallback(1);
        this.client.callProcedure(spCallback0, spProc.getName(), spHints, spParams);
        HStoreSiteTestUtil.checkBlockedSpeculativeTxns(remoteExecutor, 1);

        // Now release the dtxn. When it goes to commit with 2PC it will
        // find that there is a conflict with the single-partition txn.
View Full Code Here

       
        // Fire off a distributed a txn that will block.
        Object dtxnParams[] = new Object[]{ BASE_PARTITION, BASE_PARTITION+1, 1.0 };
        StoredProcedureInvocationHints dtxnHints = new StoredProcedureInvocationHints();
        dtxnHints.basePartition = BASE_PARTITION;
        LatchableProcedureCallback dtxnCallback = new LatchableProcedureCallback(1);
        this.client.callProcedure(dtxnCallback, this.blockingProc.getName(), dtxnHints, dtxnParams);
       
        // Block until we know that the txn has started running
        BlockingSendPayment dtxnVoltProc = HStoreSiteTestUtil.getCurrentVoltProcedure(this.baseExecutor, BlockingSendPayment.class);
        assertNotNull(dtxnVoltProc);
        boolean result = dtxnVoltProc.NOTIFY_BEFORE.tryAcquire(HStoreSiteTestUtil.NOTIFY_TIMEOUT, TimeUnit.MILLISECONDS);
        assertTrue(result);
        this.checkCurrentDtxn();
       
        // Fire off a single-partition txn that will not get executed right away
        // We have to use the blocking version because there needs to be data in tables first
        Object spParams[] = new Object[]{ BASE_PARTITION+1, BASE_PARTITION+1, 1.0 };
        StoredProcedureInvocationHints spHints = new StoredProcedureInvocationHints();
        spHints.basePartition = BASE_PARTITION+1;
        LatchableProcedureCallback spCallback0 = new LatchableProcedureCallback(1);
        this.client.callProcedure(spCallback0, this.nonblockingProc.getName(), spHints, spParams);
        HStoreSiteTestUtil.checkQueuedTxns(this.remoteExecutor, 1);
       
        // Ok now we're going to release our txn. It will execute a bunch of stuff.
        // It should be able to identify that it is finished with the remote partition without
View Full Code Here

    public void testProfiling() throws Exception {
        hstore_conf.site.exec_profiling = true;
        hstore_conf.site.exec_force_allpartitions = true;
       
        int num_txns = 10;
        LatchableProcedureCallback callback = new LatchableProcedureCallback(num_txns);
        Procedure catalog_proc = this.getProcedure(UpdateLocation.class);
        for (int i = 0; i < num_txns; i++) {
            Object params[] = { i, Integer.toString(i) };
            boolean queued = this.client.callProcedure(callback, catalog_proc.getName(), params);
            assertTrue(queued);
View Full Code Here

        };
        this.clientInterface.getOffBackPressureObservable().addObserver(offBackPressureObserver);

        // Submit a bunch of txns that will block and check to make sure that
        // can go on and off on the backpressure status properly
        LatchableProcedureCallback callback = new LatchableProcedureCallback(1);
        String procName = VoltSystemProcedure.procCallName(Sleep.class);
        Object params[] = { WAIT_TIME, data };
        client.callProcedure(callback, procName, params);
        ThreadUtil.sleep(WAIT_TIME);
       
        LatchableProcedureCallback floodCallback = new LatchableProcedureCallback(NUM_TXNS);
        for (int i = 0; i < NUM_TXNS; i++) {
            client.callProcedure(floodCallback, procName, new Object[]{0, data});
        } // FOR
       
        boolean result = callback.latch.await(WAIT_TIME*3, TimeUnit.MILLISECONDS);
View Full Code Here

TOP

Related Classes of edu.brown.HStoreSiteTestUtil.LatchableProcedureCallback

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.