Examples of PartitionPlan


Examples of edu.brown.designer.partitioners.plan.PartitionPlan

            File path = new File(this.params.get(PARAM_PARTITION_PLAN));
            boolean ignoreMissing = this.getBooleanParam(ArgumentsParser.PARAM_PARTITION_PLAN_IGNORE_MISSING, false);
            if (path.exists() || (path.exists() == false && ignoreMissing == false)) {
                if (debug)
                    LOG.debug("Loading in partition plan from '" + path + "'");
                this.pplan = new PartitionPlan();
                this.pplan.load(path, this.catalog_db);

                // Apply!
                if (this.params.containsKey(PARAM_PARTITION_PLAN_APPLY) && this.getBooleanParam(PARAM_PARTITION_PLAN_APPLY)) {
                    boolean secondaryIndexes = this.getBooleanParam(PARAM_PARTITION_PLAN_NO_SECONDARY, false) == false;
View Full Code Here

Examples of edu.brown.designer.partitioners.plan.PartitionPlan

    }
   
    private void init() {
        this.setLayout(new BorderLayout());
       
        final PartitionPlan plan = this.designer.getPartitionPlan();
        final ArrayList<Table> tables = new ArrayList<Table>();
        tables.addAll(plan.getTableEntries().keySet());
       
        final JTable partitonTable = new JTable(new AbstractTableModel() {
            private static final long serialVersionUID = 1L;
            protected final String columns[] = { "Table", "Method", "Partition Attribute", "Parent", "Parent Attribute" };
           
            public String getColumnName(int col) { return (this.columns[col]); }
            public int getColumnCount() { return (this.columns.length); }
            public int getRowCount() { return (tables.size()); }
            public Object getValueAt(int row, int col) {
                String ret = null;
               
                Table catalog_tbl = tables.get(row);
                TableEntry entry = plan.getTableEntries().get(catalog_tbl);
                switch (col) {
                    case 0:
                        ret = catalog_tbl.getName();
                        break;
                    case 1:
View Full Code Here

Examples of edu.brown.designer.partitioners.plan.PartitionPlan

        // Step 2: Table Partitioner
        //
        if (this.pplan == null) {
            if (this.hints.start_random) {
                LOG.debug("Randomizing the catalog partitioning attributes");
                PartitionPlan random_pplan = new RandomPartitioner(this, this.info, false).generate(this.hints);
                random_pplan.apply(this.info.catalogContext.database);
                LOG.debug("Randomized Catalog:\n" + random_pplan);
            }

            LOG.debug("Creating partition plan using " + this.partitioner.getClass().getSimpleName());
            this.pplan = this.partitioner.generate(this.hints);
View Full Code Here

Examples of edu.brown.designer.partitioners.plan.PartitionPlan

        // If given a PartitionPlan, then update the catalog
        if (args.hasParam(ArgumentsParser.PARAM_PARTITION_PLAN)) {
            File pplan_path = new File(args.getParam(ArgumentsParser.PARAM_PARTITION_PLAN));
            if (pplan_path.exists()) {
                PartitionPlan pplan = new PartitionPlan();
                pplan.load(pplan_path, args.catalog_db);
                pplan.apply(args.catalog_db);
                LOG.info("Applied PartitionPlan '" + pplan_path + "'");
            }
        }

        // Create the container object that will hold all the information that
        // the designer will need to use
        DesignerInfo info = new DesignerInfo(args);

        // Upper Bounds
        Designer designer = new Designer(info, args.designer_hints, args);
        PartitionPlan initial_solution = new MostPopularPartitioner(designer, info).generate(args.designer_hints);
        initial_solution.apply(args.catalog_db);

        // Calculate the actual cost too while we're at it...
        TimeIntervalCostModel<SingleSitedCostModel> cm = new TimeIntervalCostModel<SingleSitedCostModel>(args.catalogContext, SingleSitedCostModel.class, args.num_intervals);
        cm.applyDesignerHints(args.designer_hints);
        double upper_bound = cm.estimateWorkloadCost(args.catalogContext, args.workload);
View Full Code Here

Examples of edu.brown.designer.partitioners.plan.PartitionPlan

        if (globalPartitionPlan != null) return;
        globalPartitionPlanLock.lock();
        try {
            if (globalPartitionPlan != null) return;
            if (debug.val) LOG.debug("Loading PartitionPlan '" + partitionPlanPath + "' and applying it to the catalog");
            globalPartitionPlan = new PartitionPlan();
            try {
                globalPartitionPlan.load(partitionPlanPath, catalog_db);
                globalPartitionPlan.apply(catalog_db);
            } catch (Exception ex) {
                throw new RuntimeException("Failed to load PartitionPlan '" + partitionPlanPath + "' and apply it to the catalog", ex);
View Full Code Here

Examples of edu.brown.designer.partitioners.plan.PartitionPlan

                } else if (useCatalog) {
                    pplan_map.put(catalog_proc, CatalogUtil.getPartitioningProcParameter(catalog_proc));
                }
            } // FOR
        }
        PartitionPlan pplan = PartitionPlan.createFromMap(pplan_map);
        return (pplan);
    }
View Full Code Here

Examples of edu.brown.designer.partitioners.plan.PartitionPlan

        // Pure genius! Then use the PrimaryKeyPartitioner to calculate an
        // upper-bounds
        if (this.upper_bounds_pplan == null) {
            if (debug.val)
                LOG.debug("Calculating upper bounds...");
            PartitionPlan pplan = new MostPopularPartitioner(this.designer, this.info).generate(hints);

            // Cost Estimate
            AbstractCostModel cost_model = info.getCostModel();
            assert (cost_model != null);
            cost_model.applyDesignerHints(hints);
View Full Code Here

Examples of edu.brown.designer.partitioners.plan.PartitionPlan

        this.thread = new TraverseThread(info, hints, this.best_vertex, this.agraph, this.table_visit_order, this.proc_visit_order);
        thread.run(); // BLOCK
        this.halt_reason = this.thread.halt_reason;

        PartitionPlan pplan = null;

        // If the best solution is still the start vertex, then we know that it
        // was the upper bound
        // limit was the best solution, so we can just use that. What a waste of
        // a search!
        if (this.best_vertex.isStartVertex()) {
            if (debug.val)
                LOG.debug("No new solution was found. Using upper bounds");
            assert (this.upper_bounds_vertex.isUpperBoundVertex());
            assert (this.upper_bounds_pplan != null);
            assert (this.best_vertex.getCost().equals(this.upper_bounds_vertex.getCost())) : this.best_vertex.getCost() + " == " + this.upper_bounds_vertex.getCost();
            pplan = this.upper_bounds_pplan;

            // Otherwise reconstruct the PartitionPlan from the StateVertex
        } else {
            pplan = this.createPartitionPlan(hints, this.best_vertex, true, true);
            this.setProcedureSinglePartitionFlags(pplan, hints);
        }
        // Make sure that we actually completed the search and didn't just abort
        if (!thread.completed_search) {
            LOG.error("Failed to complete search successfully:\n" + pplan);
            assert (false);
        }
        pplan.apply(info.catalogContext.database); // Why?
        return (pplan);
    }
View Full Code Here

Examples of edu.brown.designer.partitioners.plan.PartitionPlan

                    // different parameters for those ones where the parameter
                    // actually doesn't make a difference
                    if (hints.target_plan != null) {
                        if (debug.val)
                            LOG.info("Comparing new best solution with target PartitionPlan");
                        PartitionPlan new_plan = createPartitionPlan(hints, best_vertex, false, false);
                        if (hints.target_plan.getTableEntries().equals(new_plan.getTableEntries())) {
                            this.halt_search = true;
                            this.halt_reason = HaltReason.FOUND_TARGET;
                        }
                    }
View Full Code Here

Examples of edu.brown.designer.partitioners.plan.PartitionPlan

        super(designer, info);
    }

    @Override
    public PartitionPlan generate(DesignerHints hints) throws Exception {
        PartitionPlan pplan = new PartitionPlan();

        if (debug.val)
            LOG.debug("Selecting partitioning Column for " + this.info.catalogContext.database.getTables().size() + " Tables");
        double total_memory_used = 0.0;
        boolean calculate_memory = (hints.force_replication_size_limit != null && hints.max_memory_per_partition != 0);
        for (Table catalog_tbl : CatalogUtil.getDataTables(info.catalogContext.database)) {
            String table_key = CatalogKey.createKey(catalog_tbl);
            TableEntry pentry = null;
            Column col = null;
            Collection<Column> pkey_columns = CatalogUtil.getPrimaryKeyColumns(catalog_tbl);

            TableStatistics ts = info.stats.getTableStatistics(catalog_tbl);
            assert (ts != null) : "Null TableStatistics for " + catalog_tbl;
            double size_ratio = (calculate_memory ? (ts.tuple_size_total / (double) hints.max_memory_per_partition) : 0);

            // Replication
            if (hints.force_replication.contains(table_key) || (calculate_memory && ts.readonly && size_ratio <= hints.force_replication_size_limit) || pkey_columns.isEmpty()) {
                total_memory_used += size_ratio;
                if (debug.val)
                    LOG.debug("Choosing " + catalog_tbl.getName() + " for replication");
                col = ReplicatedColumn.get(catalog_tbl);
                pentry = new TableEntry(PartitionMethodType.REPLICATION, col, null, null);

                // Hash Primary Key
            } else {
                total_memory_used += (size_ratio / (double) info.getNumPartitions());

                if (hints.enable_multi_partitioning == false || pkey_columns.size() == 1) {
                    col = CollectionUtil.first(pkey_columns);
                    pentry = new TableEntry(PartitionMethodType.HASH, col, null, null);
                } else {
                    col = MultiColumn.get(pkey_columns.toArray(new Column[0]));
                    pentry = new TableEntry(PartitionMethodType.HASH, col, null, null);
                }
                assert (pentry.attribute != null) : catalog_tbl;
            }
            if (debug.val)
                LOG.debug(String.format("[%02d] %s", pplan.getTableCount(), col.fullName()));
            pplan.getTableEntries().put(catalog_tbl, pentry);
        } // FOR
        assert (total_memory_used <= 100) : "Too much memory per partition: " + total_memory_used;

        if (hints.enable_procparameter_search) {
            if (debug.val)
                LOG.debug("Selecting partitioning ProcParameter for " + this.info.catalogContext.database.getProcedures().size() + " Procedures");
            pplan.apply(info.catalogContext.database);
            for (Procedure catalog_proc : this.info.catalogContext.database.getProcedures()) {
                if (catalog_proc.getSystemproc() || catalog_proc.getParameters().size() == 0)
                    continue;
                Set<String> param_order = PartitionerUtil.generateProcParameterOrder(info, info.catalogContext.database, catalog_proc, hints);
                ProcedureEntry pentry = new ProcedureEntry(PartitionMethodType.HASH, CatalogKey.getFromKey(info.catalogContext.database, CollectionUtil.first(param_order), ProcParameter.class), null);
                pplan.getProcedureEntries().put(catalog_proc, pentry);
            } // FOR
        }
        this.setProcedureSinglePartitionFlags(pplan, hints);

        return (pplan);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.