Package edu.brown.utils

Examples of edu.brown.utils.PartitionSet


        assertEquals(dtxnVoltProc.getTransactionId(), dtxn.getTransactionId());
//        EstimatorState t_state = dtxn.getEstimatorState();
//        if (t_state instanceof MarkovEstimatorState) {
//            LOG.warn("WROTE MARKOVGRAPH: " + ((MarkovEstimatorState)t_state).dumpMarkovGraph());
//        }
        PartitionSet donePartitions = dtxn.getDonePartitions();
        assertEquals(donePartitions.toString(), 1, donePartitions.size());
        assertEquals(this.remoteExecutor.getPartitionId(), donePartitions.get());
       
        // ThreadUtil.sleep(10000000);
       
        // We're looking good!
        // Check to make sure that the dtxn succeeded
View Full Code Here


        // We have to call comparePathsFast first to setup some sets
        // We don't care what the outcome is here...
        this.costmodel.comparePathsFast(this.estimated_path, this.txn_state.getActualPath());
       
        // Remove all of the estimated read partitions except for one
        PartitionSet e_read_partitions = this.costmodel.getLastEstimatedReadPartitions();
        assertNotNull(e_read_partitions);
        Set<Integer> retain = (Set<Integer>)CollectionUtil.addAll(new HashSet<Integer>(), CollectionUtil.first(e_read_partitions));
        e_read_partitions.retainAll(retain);
       
        // Then add all of our partitions to the actual read partitions
        PartitionSet a_read_partitions = this.costmodel.getLastActualReadPartitions();
        a_read_partitions.addAll(catalogContext.getAllPartitionIds());
       
        double cost = this.costmodel.comparePathsFull(this.txn_state);
       
        List<Penalty> penalties = this.costmodel.getLastPenalties();
        assertNotNull(penalties);
View Full Code Here

            // If we are at a remote site, then we have to be careful here.
            // We don't actually have the real callback that the RemotePrepareCallback needs.
            // So that we have to use a null callback that doesn't actually do anything. The
            // RemotePrepareCallback will make sure that we mark the partition as prepared.
            if (ts instanceof RemoteTransaction) {
                PartitionSet partitions = catalogContext.getPartitionSetSingleton(this.partitionId);
                RpcCallback<TransactionPrepareResponse> origCallback = NullCallback.getInstance();
                ((RemotePrepareCallback)callback).init((RemoteTransaction)ts, partitions, origCallback);
            }
            this.queuePrepare(ts, callback);
        }
View Full Code Here

        for (int i = 0; i < batchSize; i++) {
            stmtCounters[i] = ts.updateStatementCounter(batchStmts[i].getStatement());
        } // FOR
       
        if (ts.hasPrefetchQueries()) {
            PartitionSet stmtPartitions[] = plan.getStatementPartitions();
            PrefetchState prefetchState = ts.getPrefetchState();
            QueryTracker queryTracker = prefetchState.getExecQueryTracker();
            assert(prefetchState != null);
            for (int i = 0; i < batchSize; i++) {
                // We always have to update the query tracker regardless of whether
                // the query was prefetched or not. This is so that we can ensure
                // that we execute the queries in the right order.
                Statement stmt = batchStmts[i].getStatement();
                stmtCounters[i] = queryTracker.addQuery(stmt, stmtPartitions[i], batchParams[i]);
            } // FOR
            // FIXME PrefetchQueryUtil.checkSQLStmtBatch(this, ts, plan, batchSize, batchStmts, batchParams);
        } // PREFETCH
       
        VoltTable results[] = null;
       
        // FAST-PATH: Single-partition + Local
        // If the BatchPlan only has WorkFragments that are for this partition, then
        // we can use the fast-path executeLocalPlan() method
        if (plan.isSingledPartitionedAndLocal()) {
            if (trace.val)
                LOG.trace(String.format("%s - Sending %s directly to the ExecutionEngine at partition %d",
                          ts, plan.getClass().getSimpleName(), this.partitionId));
           
            // If this the finalTask flag is set to true, and we're only executing queries at this
            // partition, then we need to notify the other partitions that we're done with them.
            if (hstore_conf.site.exec_early_prepare &&
                    finalTask == true &&
                    ts.isPredictSinglePartition() == false &&
                    ts.isSysProc() == false &&
                    ts.allowEarlyPrepare() == true) {
                tmp_fragmentsPerPartition.clearValues();
                tmp_fragmentsPerPartition.put(this.partitionId, batchSize);
                DonePartitionsNotification notify = this.computeDonePartitions(ts, null, tmp_fragmentsPerPartition, finalTask);
                if (notify != null && notify.hasSitesToNotify()) {
                    this.notifyDonePartitions(ts, notify);
                }
            }

            // Execute the queries right away.
            results = this.executeLocalPlan(ts, plan, batchParams);
        }
        // DISTRIBUTED EXECUTION
        // Otherwise, we need to generate WorkFragments and then send the messages out
        // to our remote partitions using the HStoreCoordinator
        else {
            List<WorkFragment.Builder> partitionFragments = new ArrayList<WorkFragment.Builder>();
            plan.getWorkFragmentsBuilders(ts.getTransactionId(), stmtCounters, partitionFragments);
            if (debug.val)
                LOG.debug(String.format("%s - Using dispatchWorkFragments to execute %d %ss",
                          ts, partitionFragments.size(), WorkFragment.class.getSimpleName()));
           
            if (needs_profiling) {
                int remote_cnt = 0;
                PartitionSet stmtPartitions[] = plan.getStatementPartitions();
                for (int i = 0; i < batchSize; i++) {
                    if (stmtPartitions[i].get() != ts.getBasePartition()) remote_cnt++;
                    if (trace.val)
                        LOG.trace(String.format("%s - [%02d] stmt:%s / partitions:%s",
                                 ts, i, batchStmts[i].getStatement().getName(), stmtPartitions[i]));
View Full Code Here

                instance_ctr.put(catalog_stmt, new AtomicInteger(0));
            }
            this.vertices[i] = new MarkovVertex(catalog_stmt,
                                                MarkovVertex.Type.QUERY,
                                                instance_ctr.get(catalog_stmt).getAndIncrement(),
                                                new PartitionSet(this.partitions[i]),
                                                new PartitionSet());
        } // FOR
       
        graph = new MarkovGraph(catalog_proc);
        graph.initialize();
        start = graph.getStartVertex();
View Full Code Here

       
       
        // Test to make sure that Vertex.isEqual() works with and without the PAST_PARTITIONS flag
        for (int i = 0; i <= 1; i++) {
            Statement catalog_stmt = this.vertices[i].getCatalogItem();
            PartitionSet partitions = this.vertices[i].getPartitions();
            PartitionSet past_partitions = this.vertices[i].getPastPartitions();
            int query_index = this.vertices[i].getQueryCounter();
           
            assertNotNull(catalog_stmt);
            assertNotNull(partitions);
            assertFalse(partitions.isEmpty());
            assertNotNull(past_partitions);
            assertFalse(past_partitions.isEmpty());
            assert(query_index >= 0);

            MarkovVertex new_v = new MarkovVertex((Statement)this.vertices[i].getCatalogItem(),
                    this.vertices[i].getType(),
                    this.vertices[i].getQueryCounter(),
                    new PartitionSet(this.vertices[i].getPartitions()),
                    PartitionSet.singleton(1));
            for (boolean past_partitions_flag : new boolean[]{false, true}) {
                // If we're at the first vertex, then isEqual() should always return true regardless
                // of whether we are using the past_partitions_flag or not
                // Otherwise, we should only return true if the past_partitions_flag is false
View Full Code Here

        Statement catalog_stmt = this.getStatement(catalog_proc, "GetData");
        MarkovVertex v = new MarkovVertex(catalog_stmt,
                                          Type.QUERY,
                                          0,
                                          catalogContext.getAllPartitionIds(),
                                          new PartitionSet());
       
       
        // System.err.println(start.debug());
       
        assertNotNull(start);
View Full Code Here

            // Use HStoreConf's site.specexec_enable=false instead
            if (hstore_conf.site.specexec_disable_partitions.trim() == "*") {
                this.setDisabled(true);
            }
            else {
                PartitionSet partitions = PartitionSet.parse(hstore_conf.site.specexec_disable_partitions);
                this.setDisabled(partitions.contains(this.partitionId));
            }
        }
    }
View Full Code Here

        testGraph.initialize();
        MarkovVertex start = testGraph.getStartVertex();
        MarkovVertex stop = testGraph.getCommitVertex();

        Statement catalog_stmt = CollectionUtil.first(this.catalog_proc.getStatements());
        PartitionSet all_previous = new PartitionSet();
        for (int i = 0; i < 10; i++) {
            PartitionSet partitions = new PartitionSet();
            partitions.add(i % NUM_PARTITIONS);
            PartitionSet previous = new PartitionSet(all_previous);
           
            MarkovVertex current = new MarkovVertex(catalog_stmt, MarkovVertex.Type.QUERY, i, partitions, previous);
            testGraph.addVertex(current);
           
            long startcount = start.getInstanceHits();
View Full Code Here

        long txnId = hstore_site.getTransactionIdManager(0).getNextUniqueTransactionId();
        long clientHandle = -1;
       
        CatalogContext catalogContext = hstore_site.getCatalogContext();
        int base_partition = CollectionUtil.random(hstore_site.getLocalPartitionIds());
        PartitionSet predict_touchedPartitions = catalogContext.getAllPartitionIds();
        boolean predict_readOnly = false;
        boolean predict_canAbort = true;
        Procedure catalog_proc = catalogContext.procedures.getIgnoreCase("@NoOp");
        ParameterSet params = new ParameterSet();
        RpcCallback<ClientResponseImpl> client_callback = null;
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.