Package org.voltdb.catalog

Examples of org.voltdb.catalog.Catalog


     *            - [0] host [1] port# [2] site#
     * @return
     */
    @SuppressWarnings("unchecked")
    public static Catalog cloneCatalog(Catalog orig_catalog, ClusterConfiguration cc) {
        Catalog catalog = CatalogCloner.cloneBaseCatalog(orig_catalog, Site.class, Host.class, Partition.class);
        return FixCatalog.updateCatalog(catalog, cc);
    }
View Full Code Here


            if (best_cost == overall_best_cost)
                candidate_sets.add(new HashSet<Table>());
            for (Set<Table> replication_set : candidate_sets) {
                cost_model.invalidateCache(candidates);

                Catalog new_catalog = CatalogCloner.cloneBaseCatalog(info.catalogContext.database.getCatalog());
                for (Table catalog_tbl : proc_tables) {
                    DesignerVertex vertex = ptree.getVertex(catalog_tbl);
                    assert (vertex != null) : "PartitionTree is missing a vertex for " + catalog_tbl + " " + ptree.getVertices();
                    Table new_catalog_tbl = CatalogCloner.clone(catalog_tbl, new_catalog);
View Full Code Here

        // Fix the catalog!
        // populateCatalog(args.catalog_db, type);

        // Populate host information
        Catalog new_catalog = args.catalog;
        if (args.hasIntParam(ArgumentsParser.PARAM_CATALOG_NUM_HOSTS)) {
            String host_format = args.getParam(ArgumentsParser.PARAM_CATALOG_HOSTS);

            int num_hosts = args.getIntParam(ArgumentsParser.PARAM_CATALOG_NUM_HOSTS);
            int num_sites_per_host = (args.hasIntParam(ArgumentsParser.PARAM_CATALOG_SITES_PER_HOST) ? args.getIntParam(ArgumentsParser.PARAM_CATALOG_SITES_PER_HOST) : 2);
            int num_partitions_per_site = (args.hasIntParam(ArgumentsParser.PARAM_CATALOG_PARTITIONS_PER_SITE) ? args.getIntParam(ArgumentsParser.PARAM_CATALOG_PARTITIONS_PER_SITE) : 2);

            if (host_format == null) {
                FixCatalog.updateCatalog(new_catalog, num_hosts, num_sites_per_host, num_partitions_per_site);
            } else {
                FixCatalog.updateCatalog(new_catalog, host_format, num_hosts, num_sites_per_host, num_partitions_per_site);
            }

        // Use host list
        } else {
            String hostsInfo = args.getParam(ArgumentsParser.PARAM_CATALOG_HOSTS);
            ClusterConfiguration cc = new ClusterConfiguration(hostsInfo);
            FixCatalog.updateCatalog(new_catalog, cc);
        }

        // Now construct the new Dtxn.Coordinator configuration
        // String new_dtxn = HStoreDtxnConf.toHStoreDtxnConf(new_catalog);

        // We need to write this things somewhere now...
        FileUtil.writeStringToFile(new File(catalogOutputPath), new_catalog.serialize());
        LOG.debug("Wrote updated catalog specification to '" + catalogOutputPath + "'");

        // FileUtil.writeStringToFile(new File(dtxnOutputPath), new_dtxn);
        // LOG.info("Wrote updated Dtxn.Coordinator configuration to '" +
        // dtxnOutputPath + "'");
View Full Code Here

    public static AbstractPlanNode compileSQL(final Procedure catalog_proc, String name, String sql) throws Exception {
        VoltCompiler compiler = new VoltCompiler();
        HSQLInterface hsql = HSQLInterface.loadHsqldb();

        Database catalog_db = (Database) catalog_proc.getParent();
        Catalog catalog = catalog_db.getCatalog();
        Statement catalog_stmt = catalog_proc.getStatements().add(name);

        StatementCompiler.compile(compiler, hsql, catalog, catalog_db, new DatabaseEstimates(), catalog_stmt, sql, true);

        // HACK: For now just return the PlanNodeList from the first fragment
View Full Code Here

        //
        // Setup fake database connection. Pass stuff to database to get catalog
        // objects
        //
        Catalog catalog = new Catalog();
        catalog.execute("add / clusters " + CatalogUtil.DEFAULT_CLUSTER_NAME);
        catalog.execute("add /clusters[" + CatalogUtil.DEFAULT_CLUSTER_NAME + "] databases " + CatalogUtil.DEFAULT_DATABASE_NAME);
        Database catalog_db = catalog.getClusters().get(CatalogUtil.DEFAULT_CLUSTER_NAME).getDatabases().get(CatalogUtil.DEFAULT_DATABASE_NAME);

        VoltCompiler compiler = new VoltCompiler();
        DDLCompiler ddl_compiler = new DDLCompiler(compiler, hzsql);
        ddl_compiler.fillCatalogFromXML(catalog, catalog_db, xmlSchema);
        return (catalog);
View Full Code Here

     */
    public static void main(String[] vargs) throws Exception {
        ArgumentsParser args = ArgumentsParser.load(vargs);
        args.require(ArgumentsParser.PARAM_CATALOG, ArgumentsParser.PARAM_CATALOG_OUTPUT);

        Catalog catalog = args.catalog;
        File output = args.getFileParam(ArgumentsParser.PARAM_CATALOG_OUTPUT);
        new CatalogExporter(catalog).save(output);
    }
View Full Code Here

        assert (catalog_db != null);
        // Catalog clone_catalog = new Catalog();
        // clone_catalog.execute(catalog_db.getCatalog().serialize());
        // return (CatalogUtil.getDatabase(clone_catalog));

        final Catalog clone_catalog = CatalogCloner.cloneBaseCatalog(catalog_db.getCatalog(), new ArrayList<Class<? extends CatalogType>>());
        Database clone_db = CatalogUtil.getDatabase(clone_catalog);
        assert (!catalog_db.equals(clone_db));

        // Need to also clone the MultiColumn guys too!
        for (Table catalog_tbl : catalog_db.getTables()) {
View Full Code Here

     * @param catalog
     * @param skip_types
     * @return
     */
    public static Catalog cloneBaseCatalog(Catalog catalog, final Collection<Class<? extends CatalogType>> skip_types) {
        final Catalog new_catalog = new Catalog();

        new AbstractTreeWalker<CatalogType>() {
            protected void populate_children(AbstractTreeWalker.Children<CatalogType> children, CatalogType element) {
                if (element instanceof Catalog) {
                    children.addAfter(((Catalog) element).getClusters().values());
View Full Code Here

    /**
     * @param src_db
     * @param dest_db
     */
    public static void cloneConstraints(Database src_db, Database dest_db) {
        Catalog dest_catalog = dest_db.getCatalog();
        for (Table src_tbl : src_db.getTables()) {
            Table dest_tbl = dest_db.getTables().get(src_tbl.getName());
            if (dest_tbl != null) {
                for (Constraint src_cons : src_tbl.getConstraints()) {
                    // Only clone FKEY constraint if the other table is in the catalog
View Full Code Here

                    temp += String.format("\n%s: %s", procName, this.getStmtProcedureSQL(procName));
                LOG.debug(String.format("Generating new query plans for %d rewritten Statements%s", this.rewritten_queries.size(), temp));
            }

            // Build the catalog
            Catalog catalog = null;
            try {
                catalog = this.createCatalog();
            } catch (Throwable ex) {
                LOG.error("Failed to build compile vertical partitioning catalog");
                LOG.error("Busted DDL:\n" + VerticalPartitionPlanner.this.ddl);
View Full Code Here

TOP

Related Classes of org.voltdb.catalog.Catalog

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.