Package edu.brown.utils

Examples of edu.brown.utils.PartitionSet


                      estimate.getClass().getSimpleName(), vertex.getClass().getSimpleName(),
                      estimate.touched_partitions, estimate.confidence, estimate.hashCode(),
                      (trace.val ? "\n"+vertex.debug() : "")));
       
        Statement catalog_stmt = vertex.getCatalogItem();
        PartitionSet partitions = vertex.getPartitions();
        boolean readQuery = (catalog_stmt.getQuerytype() == QueryType.SELECT.getValue());
        for (int partition : partitions.values()) {
            if (estimate.isDoneProbabilitySet(partition) == false) {
                estimate.setDoneProbability(partition, vertex.getDoneProbability(partition));
            }
            if (estimate.isWriteProbabilitySet(partition) == false) {
                estimate.setWriteProbability(partition, vertex.getWriteProbability(partition));
            }
            (readQuery ? estimate.read_partitions : estimate.write_partitions).add(partition);
            estimate.incrementTouchedCounter(partition);
            estimate.touched_partitions.add(partition);
        } // FOR
        // Make sure that we update our probabilities for any partition that we've touched
        // in the past but are not touching for this query
        for (int partition : vertex.getPastPartitions()) {
            if (partitions.contains(partition) == false) {
                if (estimate.isDoneProbabilitySet(partition) == false) {
                    estimate.setDoneProbability(partition, vertex.getDoneProbability(partition));
                }
                if (estimate.isWriteProbabilitySet(partition) == false) {
                    estimate.setWriteProbability(partition, vertex.getWriteProbability(partition));
View Full Code Here


        public boolean isWritePartition(EstimationThresholds t, int partition) {
            return (this.isReadOnlyPartition(t, partition) == false);
        }
        @Override
        public PartitionSet getWritePartitions(EstimationThresholds t) {
            return new PartitionSet(CollectionUtils.subtract(this.partitions, this.readonly));
        }
View Full Code Here

    @SuppressWarnings("unchecked")
    @Override
    public <T extends EstimatorState> T startTransactionImpl(Long txn_id, int base_partition, Procedure catalog_proc, Object[] args) {
        String procName = catalog_proc.getName();
        FixedEstimatorState ret = new FixedEstimatorState(this.catalogContext, txn_id, base_partition);
        PartitionSet partitions = null;
        PartitionSet readonly = EMPTY_PARTITION_SET;
        if (procName.equalsIgnoreCase("vote")) {
            partitions = this.catalogContext.getPartitionSetSingleton(base_partition);
        } else {
            partitions = this.catalogContext.getAllPartitionIds();
        }
View Full Code Here

        this.batch = new SQLStmt[]{ new SQLStmt(stmt) };
        this.args = new ParameterSet[]{ new ParameterSet(params) };
       
        BatchPlanner planner = new BatchPlanner(batch, catalog_proc, p_estimator);
        this.touched_partitions.clear();
        PartitionSet partitions = catalogContext.getPartitionSetSingleton(BASE_PARTITION);
        BatchPlan plan = planner.plan(TXN_ID,
                                      BASE_PARTITION,
                                      partitions,
                                      this.touched_partitions,
                                      this.args);
View Full Code Here

            LOG.debug(String.format("Notifying partitions %s that %s is preparing to commit",
                      partitions, ts));
       
        // Remove any partitions that we have notified previously *and* we have
        // already gotten a response from.
        PartitionSet receivedPartitions = callback.getReceivedPartitions();
        if (receivedPartitions.isEmpty() == false) {
            if (debug.val)
                LOG.debug(String.format("Removed partitions %s from %s for %s [origPartitions=%s]",
                          receivedPartitions, TransactionPrepareRequest.class.getSimpleName(),
                          ts, partitions));
            partitions = new PartitionSet(partitions);
            partitions.removeAll(receivedPartitions);
        }
       
        // FAST PATH: If all of the partitions that this txn needs are on this
        // HStoreSite, then we don't need to bother with making this request
View Full Code Here

        // Check whether we have already begun the finish process for this txn
        if (ts.shouldInvokeFinish() == false) {
            return;
        }
       
        PartitionSet partitions = ts.getPredictTouchedPartitions();
        if (debug.val)
            LOG.debug(String.format("Notifying partitions %s that %s is finished [status=%s]",
                      partitions, ts, status));
       
        // FAST PATH: If all of the partitions that this txn needs are on this
View Full Code Here

                                                     .setBasePartition(ts.getBasePartition())
                                                     .setProcedureId(ts.getProcedure().getId())
                                                     .setParams(paramBytes)
                                                     .build();
       
        PartitionSet partitions = ts.getPredictTouchedPartitions();
        if (debug.val){
            LOG.debug(String.format("Notifying partitions %s that %s is in Map Phase", partitions, ts));
            if (trace.val) LOG.trace("<HStoreCoordinator.TransactionMap> is executing to sendMessages to all partitions");
        }
        this.transactionMap_handler.sendMessages(ts, request, callback, partitions);
View Full Code Here

        // already have all the information that it needs about this txn
        TransactionReduceRequest request = TransactionReduceRequest.newBuilder()
                                                     .setTransactionId(ts.getTransactionId())
                                                     .build();
       
        PartitionSet partitions = ts.getPredictTouchedPartitions();
        if (debug.val) {
            LOG.debug(String.format("Notifying partitions %s that %s is in Reduce Phase", partitions, ts));
            if (trace.val) LOG.trace("<HStoreCoordinator.TransactionReduce> is executing to sendMessages to all partitions");
        }
        this.transactionReduce_handler.sendMessages(ts, request, callback, partitions);
View Full Code Here

    private Collection<AbstractTransaction> loadQueue(int num_txns) throws InterruptedException {
        Collection<AbstractTransaction> added = new TreeSet<AbstractTransaction>();
        for (long i = 0; i < num_txns; i++) {
            LocalTransaction txn = new LocalTransaction(this.hstore_site);
            Long txnId = this.idManager.getNextUniqueTransactionId();
            txn.testInit(txnId, 0, new PartitionSet(1), this.catalog_proc);
           
            // I think that we need to do this...
            this.queue.noteTransactionRecievedAndReturnLastSafeTxnId(txn.getTransactionId());
           
            boolean ret = this.queue.offer(txn, false);
View Full Code Here

        // We should be able to get them back in the right order
        Collection<AbstractTransaction> added = new TreeSet<AbstractTransaction>();
        for (long i = 0; i < NUM_TXNS; i++) {
            LocalTransaction txn = new LocalTransaction(this.hstore_site);
            Long txnId = this.idManager.getNextUniqueTransactionId();
            txn.testInit(txnId, 0, new PartitionSet(1), this.catalog_proc);
            added.add(txn);
        } // FOR
        List<AbstractTransaction> shuffled = new ArrayList<AbstractTransaction>(added);
        Collections.shuffle(shuffled, random);
       
View Full Code Here

TOP

Related Classes of edu.brown.utils.PartitionSet

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.