Package edu.brown.HStoreSiteTestUtil

Examples of edu.brown.HStoreSiteTestUtil.LatchableProcedureCallback


    private BlockingSendPayment startTxn() throws Exception {
        // 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 voltProc = HStoreSiteTestUtil.getCurrentVoltProcedure(this.executor, BlockingSendPayment.class);
        assertNotNull(voltProc);
View Full Code Here


        long start, stop;

        String procName = VoltSystemProcedure.procCallName(EvictTuples.class);
        CatalogContext catalogContext = this.getCatalogContext();
        String tableNames[] = { TARGET_TABLE };
        LatchableProcedureCallback callback = new LatchableProcedureCallback(catalogContext.numberOfPartitions);

        long evictBytes[] = {block_size};
        int numBlocks[] = { 1 };

        start = System.currentTimeMillis()// start timer

        for (int partition : catalogContext.getAllPartitionIds()) {
//            System.err.printf("Evicting data at partition %d...\n", partition);
            Object params[] = { partition, tableNames, null, evictBytes, numBlocks };
            boolean result = this.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);

        stop = System.currentTimeMillis();
        System.err.println("  Eviction time: " + (stop-start) + " ms");

        // Construct a mapping BasePartition->VoltTable
View Full Code Here

        int marker = 1000;
        Semaphore spLock = new Semaphore(0);
        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());
View Full Code Here

        boolean result = this.notifyAfter.tryAcquire(NOTIFY_TIMEOUT, TimeUnit.MILLISECONDS);
        assertTrue(result);
        this.checkCurrentDtxn();
       
        // Now fire off a bunch of single-partition txns
        LatchableProcedureCallback spCallback = new LatchableProcedureCallback(NUM_SPECEXEC_TXNS);
        params = new Object[]{ BASE_PARTITION+1 }; // S_ID
        for (int i = 0; i < NUM_SPECEXEC_TXNS; i++) {
            this.client.callProcedure(spCallback, this.spProc.getName(), params);
        } // FOR
        ThreadUtil.sleep(NOTIFY_TIMEOUT);
View Full Code Here

       
        // 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);
View Full Code Here

        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);
View Full Code Here

        procName = Sleeper.class.getSimpleName();
        params = new Object[]{ WAREHOUSE_ID+1, sleepBefore, sleepAfter };
        client.callProcedure(new NullCallback(), procName, params);
       
        // Now fire off a distributed NewOrder transaction
        final LatchableProcedureCallback dtxnCallback = new LatchableProcedureCallback(1);
        procName = neworder.class.getSimpleName();
        params = RegressionSuiteUtil.generateNewOrder(catalogContext.numberOfPartitions, true, WAREHOUSE_ID, DISTRICT_ID);
        client.callProcedure(dtxnCallback, procName, params);
        long start = System.currentTimeMillis();
       
View Full Code Here

        RegressionSuiteUtil.initializeTM1Database(this.getCatalogContext(), client);
       
        // Submit a distributed txn and make sure that our conflicting
        // txn is not speculatively executed
        final int sleepTime = 5000; // ms
        final LatchableProcedureCallback dtxnCallback = new LatchableProcedureCallback(1);
       
        // We're going to first execute a dtxn that updates all SUBSCRIBER records
        String dtxnProcName = UpdateAll.class.getSimpleName();
        Object dtxnParams[] = { 0, sleepTime };
        client.callProcedure(dtxnCallback, dtxnProcName, dtxnParams);
       
        // Then fire off a proc that updates SUBSCRIBER as well. This should never
        // be allowed to execute speculatively
        String spProcName = UpdateOne.class.getSimpleName();
        Object spParams[] = new Object[]{ 1 };
        LatchableProcedureCallback spCallback = new LatchableProcedureCallback(1);
        ThreadUtil.sleep(100);
        client.callProcedure(spCallback, spProcName, spParams);
       
        // Wait until we have both latches
        dtxnCallback.latch.await(sleepTime*2, TimeUnit.MILLISECONDS);
View Full Code Here

    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[] = { UsersConstants.TABLENAME_USERS };
      LatchableProcedureCallback callback = new LatchableProcedureCallback(1);
//      long evictBytes[] = { Integer.MAX_VALUE };
      long evictBytes[] = {1024 * 10};
      int numBlocks[] = { 1 };
     
      int remote_partition = catalogContext.getAllPartitionIdArray()[1];
      System.out.printf("Evicting data at partition %d...\n", remote_partition);
      String children[] = null;
          Object params[] = { remote_partition, tableNames, children, evictBytes, numBlocks };
          boolean result = client.callProcedure(callback, procName, params);
          assertTrue(result);
     
     
      // Wait until they all finish
      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

   
    private void loadVotes(Client client, int num_txns) throws Exception {
       
//        System.err.println("Loading data...");
       
        LatchableProcedureCallback callback = new LatchableProcedureCallback(num_txns);
        for (int i = 0; i < num_txns; i++) {
            Object params[] = { new Long(i),
                                TestVoterSuite.phoneNumber+i,
                                TestVoterSuite.contestantNumber,
                                num_txns+1 }
            client.callProcedure(callback, Vote.class.getSimpleName(), params);
        } // FOR

        // Wait until they all finish
        boolean result = callback.latch.await(NOTIFY_TIMEOUT, TimeUnit.MILLISECONDS);
        assertTrue(callback.toString(), result);
        for (ClientResponse cr : callback.responses) {
            assertEquals(cr.toString(), Status.OK, cr.getStatus());
        }
       
        // Make sure that our vote is actually in the real table and materialized views
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.