Package org.voltdb.catalog

Examples of org.voltdb.catalog.Cluster


        for (int i = 0; i < parameters.length; i++) {
            parameters[i] = args.getOptParam(i+1);
        } // FOR
       
        Client client = ClientFactory.createClient(128, null, false, null);
        Cluster catalog_clus = args.catalog_db.getParent();
        Site catalog_site = CollectionUtil.first(catalog_clus.getSites());
        assert(catalog_site != null);
        Host catalog_host = catalog_site.getHost();
        assert(catalog_host != null);
        Integer port = CollectionUtil.random(CatalogUtil.getExecutionSitePorts(catalog_site));
        assert(port != null);
View Full Code Here


        // Instead of something exhaustive, let's just make sure that we get
        // the number of result rows corresponding to the number of
        // ExecutionSites
        // that did save work
        Cluster cluster = CatalogUtil.getCluster(this.getCatalog());
        Database database = cluster.getDatabases().get("database");
        CatalogMap<Table> tables = database.getTables();

        CatalogMap<Site> sites = cluster.getSites();
        int num_hosts = cluster.getHosts().size();
        int replicated = 0;
        int total_tables = 0;
        int expected_entries = 0;

        for (Table table : tables) {
View Full Code Here

        ClusterConfig config = new ClusterConfig(3, 1, 2, "localhost");
        Catalog catalog = new Catalog();
        catalog.execute("add / clusters cluster");
        ClusterCompiler.compile(catalog, config);
        System.out.println(catalog.serialize());
        Cluster cluster = catalog.getClusters().get("cluster");
        Collection<Partition> partitions = CatalogUtil.getAllPartitions(cluster);
        // despite 3 hosts, should only have 1 partition with k-safety of 2
//        assertEquals(1, partitions.size());
//        // All the execution sites should have the same relative index
//        int part_guid = CatalogUtil.getPartitionById(cluster, 0).getRelativeIndex();
View Full Code Here

    @Override
    protected void setUp() throws Exception {
        aide = new PlannerTestAideDeCamp(TestPlansGroupBy.class.getResource("testplans-orderby-ddl.sql"), "testplansorderby");

        // Set all tables to non-replicated.
        Cluster cluster = aide.getCatalog().getClusters().get("cluster");
        CatalogMap<Table> tmap = cluster.getDatabases().get("database").getTables();
        for (Table t : tmap) {
            t.setIsreplicated(true);
        }
    }
View Full Code Here

    @Override
    protected void setUp() throws Exception {
        aide = new PlannerTestAideDeCamp(TestPlansGroupBy.class.getResource("testplans-groupby-ddl.sql"), "testplansgroupby");

        // Set all tables to non-replicated.
        Cluster cluster = aide.getCatalog().getClusters().get("cluster");
        CatalogMap<Table> tmap = cluster.getDatabases().get("database").getTables();
        for (Table t : tmap) {
            t.setIsreplicated(false);
        }
    }
View Full Code Here

        PartitionMapping pmap = new PartitionMapping();

        //
        // Sites
        //
        Cluster catalog_cluster = (Cluster) info.catalogContext.database.getParent();
        int site_id = 0;
        for (Host catalog_host : catalog_cluster.getHosts()) {
            int num_sites = catalog_host.getCorespercpu() * catalog_host.getThreadspercore();
            for (int ctr = 0; ctr < num_sites; ctr++) {
                SiteEntry site = new SiteEntry(site_id);
                pmap.assign(catalog_host, site);
                site_id++;
View Full Code Here

        PartitionMapping pmap = new PartitionMapping();

        //
        // Sites
        //
        Cluster catalog_cluster = (Cluster) info.catalogContext.database.getParent();
        int site_id = 0;
        for (Host catalog_host : catalog_cluster.getHosts()) {
            int num_sites = catalog_host.getCorespercpu() * catalog_host.getThreadspercore();
            for (int ctr = 0; ctr < num_sites; ctr++) {
                SiteEntry site = new SiteEntry(site_id);
                pmap.assign(catalog_host, site);
                site_id++;
View Full Code Here

    /**
     * Initialize the graph structure for the catalog elements
     */
    private void init() {
        Cluster catalog_cluster = (Cluster) this.getDatabase().getParent();

//        // Hosts
//        for (Host catalog_host : catalog_cluster.getHosts()) {
//            Solution.Vertex v_host = new Solution.Vertex(catalog_host);
//            // CPUS
View Full Code Here

         *
         * @param cache
         * @param catalog_item
         */
        private synchronized void buildPartitionCache(CatalogType catalog_item) {
            Cluster catalog_clus = CatalogUtil.getCluster(catalog_item);
            for (Site catalog_site : catalog_clus.getSites()) {
                for (Partition catalog_part : catalog_site.getPartitions()) {
                    this.PARTITION_XREF.put(catalog_part.getId(), catalog_part);
                } // FOR
            } // FOR
        }
View Full Code Here

     * @param catalog
     * @param cc
     * @return
     */
    public static Catalog updateCatalog(Catalog catalog, ClusterConfiguration cc) {
        Cluster catalog_clus = CatalogUtil.getCluster(catalog);

        // Add a bunch of hosts and partitions to this mofo
        assert (catalog_clus != null);
        int host_id = HStoreConstants.FIRST_PARTITION_ID;

        int partition_ctr = 0;
        catalog_clus.getHosts().clear();
        catalog_clus.getSites().clear();
        for (String host : cc.getHosts()) {
            if (LOCALHOST_TYPOS.contains(host)) {
                String msg = String.format("POSSIBLE TYPO IN HOSTNAME '%s'. " +
                                           "DID YOU MEAN 'localhost'?", host);
                msg = StringBoxUtil.box(msg);
                LOG.warn("");
                for (String line : StringUtil.splitLines(msg)) {
                    LOG.warn(StringUtil.bold(line));
                } // FOR
                LOG.warn("");
            }
           
            String host_name = String.format("host%02d", host_id);
            Host catalog_host = catalog_clus.getHosts().add(host_name);
            assert (catalog_host != null);
            catalog_host.setId(host_id);
            catalog_host.setIpaddr(host);
            LOG.debug("Created new host " + catalog_host + " on node '" + host + "'");

            int proc_port = HStoreConstants.DEFAULT_PORT;
            int messenger_port = proc_port + HStoreConstants.MESSENGER_PORT_OFFSET;

            // Now create the sites for this host
            for (Integer siteid : cc.getSites(host)) {
                LOG.debug("Adding Site #" + siteid + " on " + host);

                Site catalog_site = catalog_clus.getSites().add(siteid.toString());
                assert (catalog_site != null);
                catalog_site.setId(siteid);
                catalog_site.setHost(catalog_host);
                catalog_site.setProc_port(proc_port++);
                catalog_site.setMessenger_port(messenger_port++);

                // Add all the partitions
                for (Integer partition_id : cc.getPartitionIds(host, siteid)) {
                    Partition catalog_part = catalog_site.getPartitions().add(partition_id.toString());
                    assert (catalog_part != null);
                    catalog_part.setId(partition_id);
                    partition_ctr++;
                } // FOR

            } // FOR
            host_id++;
              // LOG.debug("Added " + ctr + " partitions for " + catalog_host);
        } // FOR
        catalog_clus.setNum_partitions(partition_ctr);
        LOG.info(String.format("Updated host information in catalog with %d host%s and %d partitions",
                               catalog_clus.getHosts().size(),
                               (catalog_clus.getHosts().size() > 1 ? "s" : ""),
                               partition_ctr));
        return (catalog);
    }
View Full Code Here

TOP

Related Classes of org.voltdb.catalog.Cluster

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.