Package edu.brown.utils

Examples of edu.brown.utils.PartitionSet


        return (this.done_partitionset);
    }
   
    public PartitionSet getMostTouchedPartitions(EstimationThresholds t) {
        assert(t != null);
        if (this.touched_partitionset == null) this.touched_partitionset = new PartitionSet();
        this.getPartitions(this.touched_partitionset, this.done, t.getDoneThreshold(), true);
       
        if (this.most_touched_partitionset == null) {
            this.most_touched_partitionset = new PartitionSet();
        }
        int max_ctr = 0;
        for (int p : this.touched_partitionset.values()) {
            int numTouched = (int)this.touched.get(p, 0);
            if (numTouched > 0 && max_ctr <= numTouched) {
View Full Code Here


            if (actual_path.equals(predicted_path)) correct_path_txns.get(catalog_proc).incrementAndGet();
           
            LOG.info("MarkovEstimate:\n" + est);
           
            // Check whether we predict the same partitions
            PartitionSet actual_partitions = MarkovUtil.getTouchedPartitions(actual_path);
            PartitionSet predicted_partitions = MarkovUtil.getTouchedPartitions(predicted_path);
            if (actual_partitions.equals(predicted_partitions)) correct_partitions_txns.get(catalog_proc).incrementAndGet();
            if (actual_partitions.size() > 1) multip_txns.get(catalog_proc).incrementAndGet();
           
               
//                System.err.println(xact.debug(args.catalog_db));
View Full Code Here

        String procName = neworder.class.getSimpleName();
        Object params[] = RegressionSuiteUtil.generateNewOrder(catalogContext.numberOfPartitions, true, WAREHOUSE_ID, DISTRICT_ID);
        ClientResponse cr = client.callProcedure(procName, params);
        assertTrue(cr.hasDebug());
       
        PartitionSet touched = new PartitionSet(cr.getDebug().getExecTouchedPartitions());
        assertEquals(cr.toString(), 2, touched.size());
        int basePartition = cr.getBasePartition();
        assertTrue(cr.toString(), touched.contains(basePartition));
        PartitionSet early = cr.getDebug().getEarlyPreparePartitions();
        assertFalse(cr.toString(), early.isEmpty());
        touched.remove(basePartition);
        int remotePartition = touched.get();
        assertNotSame(HStoreConstants.NULL_PARTITION_ID, remotePartition);
       
        // System.err.println(cr);
        assertFalse(cr.toString(), early.contains(basePartition));
        assertTrue(cr.toString(), early.contains(remotePartition));
    }
View Full Code Here

        Integer base_partition = new Random().nextInt(NUM_PARTITIONS);
       
        // Double check that this is always a distributed query
        AbstractPlanNode orig = PlanNodeUtil.getRootPlanNodeForStatement(catalog_stmt, false);
        assertNotNull(orig);
        PartitionSet orig_partitions = new PartitionSet();
        p_estimator.getAllPartitions(orig_partitions, catalog_stmt, params, base_partition);
        assertNotNull(orig_partitions);
        assertEquals(NUM_PARTITIONS, orig_partitions.size());
       
        // Now create the optimized query plan that uses the vertical partition
        boolean ret = vp_planner.optimizeStatement(catalog_stmt);
        assert(ret);
        p_estimator.clear();
        PartitionSet new_partitions = new PartitionSet();
        p_estimator.getAllPartitions(new_partitions, catalog_stmt, params, base_partition);
        assertNotNull(new_partitions);
//        System.err.println("NEW PARTITIONS: " + new_partitions);
        assertEquals(1, new_partitions.size());
        assertEquals(base_partition, CollectionUtil.first(new_partitions));
    }
View Full Code Here

        // We just care that it got optimized properly with the ORDER BY
        VerticalPartitionPlanner vp_planner = new VerticalPartitionPlanner(catalog_db, true);
        boolean ret = vp_planner.optimizeStatement(catalog_stmt);
        assert(ret);
        p_estimator.clear();
        PartitionSet new_partitions = new PartitionSet();
        p_estimator.getAllPartitions(new_partitions, catalog_stmt, params, base_partition);
        assertNotNull(new_partitions);
//        System.err.println("NEW PARTITIONS: " + new_partitions);
        assertEquals(1, new_partitions.size());
        assertEquals(base_partition, CollectionUtil.first(new_partitions));
       
        // Make sure the ORDER BY column references the vertical partition table
        CatalogUtil.clearCache(catalog_db);
        PlanNodeUtil.clearCache();
View Full Code Here

            // Ok so where's what going on here. We need to send back
            // an abort message, so we're going use the builder that we've been
            // working on and send out the bomb back to the base partition tells it that this
            // transaction is kaput at this HStoreSite.
            this.builder.clearPartitions();
            PartitionSet partitions = this.getPartitions();
            for (int partition : partitions.values()) {
                assert(this.hstore_site.isLocalPartition(partition));
                this.builder.addPartitions(partition);
            } // FOR

            assert(this.builder.getPartitionsList() != null) :
View Full Code Here

        FilterResult result = FilterResult.ALLOW;
        if (element instanceof TransactionTrace) {
            TransactionTrace xact = (TransactionTrace)element;
            Procedure catalog_proc = xact.getCatalogItem(this.catalog_db);
           
            PartitionSet partitions = new PartitionSet();
            try {
                int base_partition = this.p_estimator.getBasePartition(catalog_proc, xact.getParams(), true);
                partitions.add(base_partition);
                for (QueryTrace query : xact.getQueries()) {
                    this.p_estimator.getAllPartitions(partitions, query, base_partition);
                } // FOR
               
            } catch (Exception ex) {
                throw new RuntimeException(ex);
            }
            assert(partitions.isEmpty() == false);
            boolean allow = (this.singlepartition ? (partitions.size() == 1) : (partitions.size() > 1));
            result = (allow ? FilterResult.ALLOW : FilterResult.SKIP);
            if (debug.val)
                LOG.debug(String.format("%s :: partitions=%s / allow=%s ==> %s",
                          xact, partitions, allow, result));
        }
View Full Code Here

    @Deprecated
    public static PartitionSet getAllPartitionIds(CatalogType catalog_item) {
        final CatalogUtil.Cache cache = CatalogUtil.getCatalogCache(catalog_item);
        if (cache.PARTITION_XREF.isEmpty())
            cache.buildPartitionCache(catalog_item);
        return (new PartitionSet(cache.PARTITION_XREF.asList()));
    }
View Full Code Here

     *
     * @param catalogContext
     * @return
     */
    public static PartitionSet getLocalPartitionIds(Site catalog_site) {
        PartitionSet partition_ids = new PartitionSet();
        for (Partition catalog_proc : catalog_site.getPartitions()) {
            partition_ids.add(catalog_proc.getId());
        } // FOR
        return (partition_ids);
    }
View Full Code Here

     * @param catalog_db
     * @param base_partition
     * @return
     */
    public static PartitionSet getLocalPartitionIds(Database catalog_db, int base_partition) {
        PartitionSet partition_ids = new PartitionSet();
        for (Partition catalog_proc : CatalogUtil.getLocalPartitions(catalog_db, base_partition)) {
            partition_ids.add(catalog_proc.getId());
        } // FOR
        return (partition_ids);
    }
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.