Package edu.brown.hstore.txns

Examples of edu.brown.hstore.txns.LocalTransaction


        } // FOR
       
        int windowSize = this.work_queue.size();
        this.scheduler.setPolicyType(SpecExecSchedulerPolicyType.SHORTEST);
        this.scheduler.setWindowSize(windowSize);
        LocalTransaction next = this.scheduler.next(this.dtxn, SpeculationType.SP2_REMOTE_BEFORE);
        assertNotNull(next);
        assertEquals(shortest, next);
        // System.err.println(profiler.num_comparisons.toString());
        assertEquals(1, profiler.num_comparisons.get(windowSize));
    }
View Full Code Here


   
    /**
     * testLongestPolicy
     */
    public void testLongestPolicy() throws Exception {
        LocalTransaction tsWithoutEstimatorState = this.populateQueue(this.addedTxns, 3);
        LocalTransaction next = this.scheduler.next(this.dtxn, SpeculationType.IDLE);
        // System.err.println(this.dtxn.debug());
        assertNotNull(next);
        assertEquals(tsWithoutEstimatorState, next);
        assertFalse(this.work_queue.toString(), this.work_queue.contains(next));
  }
View Full Code Here

                break;
            }
        } // FOR
        assertNotNull(proc);
       
        LocalTransaction ts = new LocalTransaction(this.hstore_site);
        ts.testInit(this.idManager.getNextUniqueTransactionId(), BASE_PARTITION, null, catalogContext.getPartitionSetSingleton(BASE_PARTITION), proc);
        assertTrue(ts.isPredictSinglePartition());
        this.addToQueue(ts);
       
        LocalTransaction next = this.scheduler.next(this.dtxn, SpeculationType.IDLE);
        //System.err.println(this.dtxn.debug());
        assertNotNull(next);
        assertEquals(ts, next);
        assertFalse(this.work_queue.contains(next));
    }
View Full Code Here

        assertNotNull(cs);
        Collection<Table> conflictTables = ConflictSetUtil.getAllTables(cs.getWritewriteconflicts());
        assertFalse(conflictTables.isEmpty());
       
        // First time we should be able to get through
        LocalTransaction ts = new LocalTransaction(this.hstore_site);
        ts.testInit(this.idManager.getNextUniqueTransactionId(), BASE_PARTITION, null, catalogContext.getPartitionSetSingleton(BASE_PARTITION), proc);
        assertTrue(ts.isPredictSinglePartition());
        this.addToQueue(ts);
        LocalTransaction next = this.scheduler.next(this.dtxn, SpeculationType.SP2_REMOTE_AFTER);
        assertNotNull(next);
        assertEquals(ts, next);
        assertFalse(this.work_queue.contains(next));
        ts.finish();
       
View Full Code Here

        ConflictSet cs = proc.getConflicts().get(dtxnProc.getName());
        assertNotNull(cs);
        Collection<Table> conflictTables = ConflictSetUtil.getAllTables(cs.getReadwriteconflicts());
        assertFalse(conflictTables.isEmpty());
       
        LocalTransaction ts = new LocalTransaction(this.hstore_site);
        ts.testInit(this.idManager.getNextUniqueTransactionId(), BASE_PARTITION, null, catalogContext.getPartitionSetSingleton(BASE_PARTITION), proc);
        assertTrue(ts.isPredictSinglePartition());
        this.addToQueue(ts);
       
        LocalTransaction next = this.scheduler.next(this.dtxn, SpeculationType.SP2_REMOTE_BEFORE);
        assertNotNull(next);
        assertEquals(ts, next);
        assertFalse(this.work_queue.contains(next));
        ts.finish();
       
View Full Code Here

        boolean predict_canAbort = true;
        Procedure catalog_proc = catalogContext.procedures.getIgnoreCase("@NoOp");
        ParameterSet params = new ParameterSet();
        RpcCallback<ClientResponseImpl> client_callback = null;
       
        LocalTransaction ts = new LocalTransaction(hstore_site);
        ts.init(txnId, EstTime.currentTimeMillis(), clientHandle, base_partition,
                predict_touchedPartitions, predict_readOnly, predict_canAbort,
                catalog_proc, params, client_callback);
        EstTimeUpdater.update(System.currentTimeMillis());
        return (ts);
    }
View Full Code Here

        boolean predict_canAbort = true;
        Procedure catalog_proc = catalogContext.procedures.getIgnoreCase("@NoOp");
        ParameterSet params = new ParameterSet();
        RpcCallback<ClientResponseImpl> client_callback = null;
       
        LocalTransaction ts = new LocalTransaction(base_hstore_site);
        ts.init(txnId, EstTime.currentTimeMillis(), clientHandle, base_partition,
                predict_touchedPartitions, predict_readOnly, predict_canAbort,
                catalog_proc, params, client_callback);
       
        base_hstore_site.getTransactionInitializer().registerTransaction(ts, base_partition);
        PartitionSet partitions = remote_hstore_site.getLocalPartitionIds();
View Full Code Here

        // Let's try one!
        if (site_id == 0) {
            // Sleep for a few seconds give the other guys time to prepare themselves
            ThreadUtil.sleep(2500);
           
            final LocalTransaction ts = makeLocalTransaction(hstore_site);
            RpcCallback<TransactionInitResponse> callback = new RpcCallback<TransactionInitResponse>() {
                @Override
                public void run(TransactionInitResponse parameter) {
                    LOG.info("GOT CALLBACK FOR " + ts);
                    latch.countDown();
View Full Code Here

        }
        else if (table.getRowCount() == 0) {
            throw new VoltAbortException("The VoltTable for table '" + tableName + "' is empty");
        }

        LocalTransaction ts = this.getTransactionState();
       
        // if tableName is replicated, just send table everywhere.
        if (catalog_tbl.getIsreplicated()) {
            // If they haven't locked all of the partitions in the cluster, then we'll
            // stop them right here and force them to get those
            if (ts.getPredictTouchedPartitions().size() != this.allPartitionsHistogram.getValueCount()) {
                throw new MispredictionException(this.getTransactionId(), this.allPartitionsHistogram);
            }
            pfs = this.createReplicatedPlan(ts, catalog_tbl, table);
        }
        // Otherwise, create a VoltTable for each partition and split up the incoming table
View Full Code Here

     * @param pfs an array of synthesized plan fragments
     * @param aggregatorOutputDependencyId dependency id produced by the aggregation pf
     *        The id of the table returned as the result of this procedure.
     */
    protected final VoltTable[] executeSysProcPlanFragmentsAsync(SynthesizedPlanFragment pfs[]) {
        LocalTransaction ts = this.getTransactionState();
        if (debug.val) LOG.debug(ts + " - Preparing to execute " + pfs.length + " sysproc fragments");
       
        this.fragments.clear();
        ParameterSet parameters[] = new ParameterSet[pfs.length];
        for (int i = 0; i < pfs.length; i++) {
            SynthesizedPlanFragment pf = pfs[i];
            // check mutually exclusive flags
            assert(!(pf.multipartition && pf.nonExecSites));
            assert(pf.parameters != null);

            // We'll let the PartitionExecutor decide how to serialize our ParameterSets
            parameters[i] = pf.parameters;

            // If the multipartition flag is set to true and we don't have a destPartitionId,
            // then we'll just make it go to all partitions. This is so that we can support
            // old-school VoltDB's sysprocs
            int partitions[] = null;
            if (pf.destPartitionId < 0) {
                if (pf.multipartition) {
                    partitions = CollectionUtil.toIntArray(catalogContext.getAllPartitionIds());
                }
                // If it's not multipartitioned and they still don't have a destPartitionId,
                // then we'll make it just go to this PartitionExecutor's local partition
                else {
                    partitions = new int[]{ this.executor.getPartitionId() };
                }
                if (debug.val) LOG.debug(this.getClass() + " => " + Arrays.toString(partitions));
            }
            else {
                partitions = new int[]{ pf.destPartitionId };
            }
           
            // Create a WorkFragment for each target partition
            for (int destPartitionId : partitions) {
                if (debug.val)
                    LOG.debug(String.format("%s - Creating %s for partition %s [fragmentId=%d]",
                              ts, WorkFragment.class.getSimpleName(),
                              destPartitionId, pf.fragmentId));
                WorkFragment.Builder builder = WorkFragment.newBuilder()
                                                        .setPartitionId(destPartitionId)
                                                        .setReadOnly(false)
                                                        .setLastFragment(pf.last_task)
                                                        .addFragmentId(pf.fragmentId)
                                                        .addStmtCounter(0)
                                                        .addStmtIndex(0)
                                                        .addStmtIgnore(false)
                                                        .addParamIndex(i);
                ts.getTouchedPartitions().put(destPartitionId);
               
                boolean needs_input = false;
                for (int ii = 0; ii < pf.outputDependencyIds.length; ii++) {
                    // Input Dependencies
                    if (pf.inputDependencyIds != null && ii < pf.inputDependencyIds.length) {
View Full Code Here

TOP

Related Classes of edu.brown.hstore.txns.LocalTransaction

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.