Package edu.brown.utils

Examples of edu.brown.utils.PartitionSet$Itr


       
        // HACK
        // Use a TransactionPrepareWrapperCallback to ensure that we only send back
        // the prepare response once all of the PartitionExecutors have successfully
        // acknowledged that we're ready to commit
        PartitionSet partitions = new PartitionSet(request.getPartitionsList());
        assert(partitions.isEmpty() == false) :
            "Unexpected empty list of updated partitions for txn #" + txn_id;
        partitions.retainAll(hstore_site.getLocalPartitionIds());
       
        RemoteTransaction ts = this.hstore_site.getTransaction(txn_id);
        assert(ts != null) : "Unexpected null transaction handle for txn #" + txn_id;
       
        // Always create a new prepare callback because we may get multiple messages
View Full Code Here


                LOG.warn(ts + " - No remote partition prefetchable queries were found in the transaction's " +
                     "initial path estimate. Unable to schedule prefetch queries.");
            return (null);
        }

        PartitionSet touched_partitions = ts.getPredictTouchedPartitions();
        boolean touched_sites[] = new boolean[this.catalogContext.numberOfSites];
        Arrays.fill(touched_sites, false);
        for (int partition : touched_partitions.values()) {
            touched_sites[this.partitionSiteXref[partition]] = true;
        } // FOR

        TransactionInitRequest.Builder default_request = null;
        for (int site_id = 0; site_id < this.catalogContext.numberOfSites; ++site_id) {
View Full Code Here

        // until we get back results from all of the partitions
        // TODO: The base information of a set of FragmentTaskMessages should be moved into
        // the message wrapper (e.g., base partition, client handle)
        boolean first = true;
        int fragmentCount = request.getFragmentsCount();
        PartitionSet partitions = null;
        if (fragmentCount == 1) {
            WorkFragment work = CollectionUtil.first(request.getFragmentsList());
            partitions = this.catalogContext.getPartitionSetSingleton(work.getPartitionId());
        }
        else {
            partitions = new PartitionSet();
            for (WorkFragment work : request.getFragmentsList()) {
                partitions.add(work.getPartitionId());
            } // FOR
        }
       
        for (WorkFragment work : request.getFragmentsList()) {
            // Always initialize the TransactionWorkCallback for the first callback
View Full Code Here

   
    /**
     * Constructor
     */
    protected DependencyInfo(CatalogContext catalogContext) {
        this.expectedPartitions = new PartitionSet(); // catalogContext.numberOfPartitions);
        this.resultPartitions = new PartitionSet(); // catalogContext.numberOfPartitions);
    }
View Full Code Here

    public DistributedState init(LocalTransaction ts) {
        this.ts = ts;
       
        // Initialize the prepare callback.
        // We have to do this in order to support early 2PC prepares
        PartitionSet partitions = ts.getPredictTouchedPartitions();
        this.prepare_callback.init(this.ts, partitions);
       
        // Compute whether all of the partitions for this txn are at the same local site
        for (int partition : partitions.values()) {
            if (ts.hstore_site.isLocalPartition(partition) == false) {
                this.is_all_local = false;
                break;
            }
        } // FOR
View Full Code Here

    public void testMispredict() throws Exception {
        BatchPlanner batchPlan = new BatchPlanner(batch[TARGET_BATCH], catalog_proc, p_estimator);
       
        // Ask the planner to plan a multi-partition transaction where we have predicted it
        // as single-partitioned. It should throw a nice MispredictionException
        PartitionSet partitions = new PartitionSet();
        partitions.add(BASE_PARTITION);
        partitions.add(BASE_PARTITION+1);
       
        BatchPlanner.BatchPlan plan = batchPlan.plan(TXN_ID, BASE_PARTITION+1, partitions, this.touched_partitions, args[TARGET_BATCH]);
        assert(plan.hasMisprediction());
        if (plan != null) System.err.println(plan.toString());
    }
View Full Code Here

    public void testMispredictPartitions() throws Exception {
        BatchPlanner batchPlan = new BatchPlanner(batch[TARGET_BATCH], catalog_proc, p_estimator);
       
        // Ask the planner to plan a multi-partition transaction where we have predicted it
        // as single-partitioned. It should throw a nice MispredictionException
        PartitionSet partitions = new PartitionSet();
        partitions.add(BASE_PARTITION);
//        partitions.add(BASE_PARTITION+1);
       
        BatchPlanner.BatchPlan plan = batchPlan.plan(TXN_ID, BASE_PARTITION+1, partitions, this.touched_partitions, args[TARGET_BATCH]);
        assert(plan.hasMisprediction());
        if (plan != null) System.err.println(plan.toString());
View Full Code Here

           
            Statement catalog_stmts[] = batchPlan.getStatements();
            assertNotNull(catalog_stmts);
            assertEquals(query_batch[batch_idx].size(), catalog_stmts.length);
           
            PartitionSet partitions[] = plan.getStatementPartitions();
            assertNotNull(partitions);
           
            for (int i = 0; i < catalog_stmts.length; i++) {
                assertEquals(query_batch[batch_idx].get(i).getCatalogItem(catalogContext.database), catalog_stmts[i]);
                PartitionSet p = partitions[i];
                assertNotNull(p);
                assertFalse(p.isEmpty());
            } // FOR
//            System.err.println(plan);
        }
    }
View Full Code Here

       
        SQLStmt batch[] = { new SQLStmt(catalog_stmt) };
        ParameterSet params[] = new ParameterSet[]{
                VoltProcedure.getCleanParams(batch[0], new Object[]{ new Long(1) })
        };
        PartitionSet partitions = new PartitionSet(0);
       
        // Check to make sure that if we do a SELECT on a replicated table, that
        // it doesn't get added to our touched partitions histogram
        BatchPlanner batchPlan = new BatchPlanner(batch, catalog_proc, p_estimator);
        BatchPlanner.BatchPlan plan = batchPlan.plan(TXN_ID, BASE_PARTITION, partitions, this.touched_partitions, params);
View Full Code Here

                return (estState);
            }
        };

        // Generate the minimum set of partitions that we need to touch
        PartitionSet partitions = new PartitionSet();
        for (int idx : new int[] { 2, 1 }) {
            Object val = this.proc_params[idx];
            int p = p_estimator.getHasher().hash(val);
            System.err.println(val + " -> " + p);
            partitions.add(p);
        } // FOR

        this.ts.testInit(TXN_ID, LOCAL_PARTITION, null, partitions, this.getProcedure(TARGET_PREFETCH_PROCEDURE));
        this.ts.initializePrefetch();
View Full Code Here

TOP

Related Classes of edu.brown.utils.PartitionSet$Itr

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.