Package org.voltdb.catalog

Examples of org.voltdb.catalog.Host


    /**
     * Take snapshots
     */
    private void takeSnapshot(){
        // Do this only on site lowest id
        Host catalog_host = this.getHost();
        Integer lowest_site_id = Integer.MAX_VALUE, s_id;

        for (Site st : CatalogUtil.getAllSites(catalog_host)) {
            s_id = st.getId();
            lowest_site_id = Math.min(s_id, lowest_site_id);
View Full Code Here


       
        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);
        client.createConnection(null, catalog_host.getIpaddr(), port, "user", "password");
        LOG.info(String.format("Connected to H-Store cluster at %s:%d", catalog_host.getIpaddr(), port));
       
        ClientResponse cresponse = VoltProcedureInvoker.invoke(args.catalog,
                                                               client,
                                                               procName,
                                                               parameters);
View Full Code Here

    }

    public Set<Host> getHosts(Database catalog_db) {
        Set<Host> hosts = new HashSet<Host>();
        for (String host_key : this.getHosts()) {
            Host catalog_host = CatalogKey.getFromKey(catalog_db, host_key, Host.class);
            assert (catalog_host != null);
            hosts.add(catalog_host);
        } // FOR
        return (hosts);
    }
View Full Code Here

                } // 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;
View Full Code Here

           
            // Construct a xref mapping between host->sites and site->partitions
            Map<Host, Set<Site>> host_site_xref = new HashMap<Host, Set<Site>>();
            Map<Site, Collection<Partition>> site_partition_xref = new HashMap<Site, Collection<Partition>>();
            for (Site site_cat : cluster_cat.getSites()) {
                Host host_cat = site_cat.getHost();
                if (!host_site_xref.containsKey(host_cat)) {
                    host_site_xref.put(host_cat, new HashSet<Site>());
                }
                host_site_xref.get(host_cat).add(site_cat);
               
                Collection<Partition> partitions = CollectionUtil.addAll(new HashSet<Partition>(), site_cat.getPartitions());
                site_partition_xref.put(site_cat, partitions);
            } // FOR
           
            // Hosts
            DefaultMutableTreeNode hosts_node = new CatalogMapTreeNode(Host.class, "Hosts", cluster_cat.getHosts());
            cluster_node.add(hosts_node);
            for (Host host_cat : cluster_cat.getHosts()) {
                DefaultMutableTreeNode host_node = new DefaultMutableTreeNode(new WrapperNode(host_cat, host_cat.getIpaddr()));
                hosts_node.add(host_node);
                buildSearchIndex(host_cat, host_node);
               
                // Sites
                if (host_site_xref.containsKey(host_cat)) {
View Full Code Here

                }
            };

            Cluster catalog_clus = CatalogUtil.getCluster(catalog_item);
            for (Site catalog_site : catalog_clus.getSites()) {
                Host catalog_host = catalog_site.getHost();
                if (!sites.containsKey(catalog_host)) {
                    sites.put(catalog_host, new TreeSet<Site>(comparator));
                }
                sites.get(catalog_host).add(catalog_site);
                if (debug.val)
View Full Code Here

        final Map<Integer, Set<Pair<String, Integer>>> sites = cache.EXECUTION_SITES;

        if (sites.isEmpty()) {
            Cluster catalog_clus = CatalogUtil.getCluster(catalog_item);
            for (Site catalog_site : CatalogUtil.getSortedCatalogItems(catalog_clus.getSites(), "id")) {
                Host catalog_host = catalog_site.getHost();
                assert (catalog_host != null);
                Set<Pair<String, Integer>> s = new HashSet<Pair<String, Integer>>();
                for (Integer port : CatalogUtil.getExecutionSitePorts(catalog_site)) {
                    s.add(Pair.of(catalog_host.getIpaddr(), port));
                    // break;
                } // FOR
                sites.put(catalog_site.getId(), s);
            } // FOR
        }
View Full Code Here

        assert (catalog_clus != null);
        Partition catalog_part = CatalogUtil.getPartitionById(catalog_clus, base_partition);
        assert (catalog_part != null);
        Site catalog_site = catalog_part.getParent();
        assert (catalog_site != null);
        Host catalog_host = catalog_site.getHost();
        assert (catalog_host != null);

        // Now look at what other partitions are on the same host that we are
        for (Site other_site : catalog_clus.getSites()) {
            if (other_site.getHost().equals(catalog_host) == false)
View Full Code Here

        int host = 0;
        while (cluster_it.hasNext()) {
            Cluster c = cluster_it.next();
            Iterator<Host> host_it = c.getHosts().iterator();
            while (host_it.hasNext()) {
                Host h = host_it.next();
                Iterator<Site> site_it = CatalogUtil.getSitesForHost(h).iterator();
                while (site_it.hasNext()) {
                    site_host.put(site_it.next().getId(), host);
                    total_sites++;
                }
View Full Code Here

    protected final Client createClient() throws Exception {
        // Connect to random site and using a random port that it's listening on
        Site catalog_site = CollectionUtil.random(catalogContext.sites);
        assertNotNull(catalog_site);
       
        Host catalog_host = catalog_site.getHost();
        assertNotNull(catalog_host);
       
        String hostName = catalog_host.getIpaddr();
        int port = catalog_site.getProc_port();
       
        LOG.debug(String.format("Creating new client connection to HStoreSite %s at %s:%d",
                                HStoreThreadManager.formatSiteName(catalog_site.getId()),
                                hostName, port));
View Full Code Here

TOP

Related Classes of org.voltdb.catalog.Host

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.