Package org.voltdb.catalog

Examples of org.voltdb.catalog.Host


        // XXX This is all very similar to the splitting code in
        // LoadMultipartitionTable. Consider ways to consolidate later
        Map<Integer, Integer> sites_to_partitions = new HashMap<Integer, Integer>();

        // CHANGE : Up Sites
        Host catalog_host = context.getHost();
        Collection<Site> catalog_sites = CatalogUtil.getSitesForHost(catalog_host);
        // Collection<Site> catalog_sites =
        // CatalogUtil.getAllSites(HStore.instance().getCatalog());

        LOG.trace("Table :" + tableName);
View Full Code Here


        Cluster cluster = catalog.getClusters().get("cluster");
        cluster.setNum_partitions(partitionCount);
        // set the address of the coordinator
        cluster.setLeaderaddress(clusterConfig.getLeaderAddress().trim());
        for (int i = 0; i < hostCount; i++) {
            Host host = cluster.getHosts().add(String.valueOf(i));
            host.setIpaddr("localhost"); // DEFAULT
        }

        // add all the partitions.
        for (int i = 0; i < partitionCount; ++i) {
            //cluster.getPartitions().add(String.valueOf(i));
        }

        // add all the sites
        int initiatorsPerHost = 1;
        int partitionCounter = -1;
        int nextInitiatorId = 1;
        int siteId = -1;
        for (int i = 0, cnt = (sitesPerHost * hostCount); i < cnt; i++) {

            int hostForSite = i / cnt;
            Host host = cluster.getHosts().get(String.valueOf(hostForSite));
            int hostId = Integer.parseInt(host.getTypeName());

//            int withinHostId = i % (sitesPerHost + initiatorsPerHost);

            //int siteId = hostId * VoltDB.SITES_TO_HOST_DIVISOR;// + withinHostId;

View Full Code Here

    private DependencySet saveTest(String file_path, String file_nonce, SystemProcedureExecutionContext context, String hostname) {
        {
            VoltTable result = constructNodeResultsTable();
            // Choose the lowest site ID on this host to do the file scan
            // All other sites should just return empty results tables.
            Host catalog_host = context.getHost();
            Site site = context.getSite();

            CatalogMap<Partition> partition_map = site.getPartitions();
            Integer lowest_partition_id = Integer.MAX_VALUE, p_id;
            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);
            }
           
            for(Partition pt : partition_map){
                p_id = pt.getId();
                lowest_partition_id = Math.min(p_id, lowest_partition_id);
            }
           
            assert(lowest_partition_id != Integer.MAX_VALUE);
           
            //LOG.trace("Partition id :" + context.getPartitionExecutor().getPartitionId());
            //LOG.trace("Lowest Partition id :" + lowest_partition_id);

            // Do it at partition with lowest partition id on site with lowest site id
            // as we can have multiple partitions per site in HStore
            if (context.getSite().getId() == lowest_site_id && context.getPartitionExecutor().getPartitionId() == lowest_partition_id) {

               LOG.trace("Checking feasibility of save with path and nonce: " + file_path + ", " + file_nonce);
               LOG.trace("ExecutionSitesCurrentlySnapshotting check : " + SnapshotSiteProcessor.ExecutionSitesCurrentlySnapshotting.get());

                // CHANGE : Only 1 Site doing this
                if (SnapshotSiteProcessor.ExecutionSitesCurrentlySnapshotting.get() != -1) {
                    result.addRow(Integer.parseInt(context.getSite().getHost().getTypeName().replaceAll("[\\D]", "")), hostname, "", "FAILURE", "SNAPSHOT IN PROGRESS");
                    return new DependencySet(DEP_saveTest, result);
                }

                for (Table table : SnapshotUtil.getTablesToSave(context.getDatabase())) {
                    File saveFilePath = SnapshotUtil.constructFileForTable(table, file_path, file_nonce,
                            String.valueOf(context.getHost().getId()),                                
                            String.valueOf(context.getHStoreSite().getSiteId()),
                            String.valueOf(context.getPartitionExecutor().getPartitionId())
                            );
                    LOG.trace("Host ID " + context.getSite().getHost().getTypeName() + " table: " + table.getTypeName() + " to path: " + saveFilePath);
                    String file_valid = "SUCCESS";
                    String err_msg = "";
                    if (saveFilePath.exists()) {
                        file_valid = "FAILURE";
                        err_msg = "SAVE FILE ALREADY EXISTS: " + saveFilePath;
                    } else if (!saveFilePath.getParentFile().canWrite()) {
                        file_valid = "FAILURE";
                        err_msg = "FILE LOCATION UNWRITABLE: " + saveFilePath;
                    } else {
                        try {
                            saveFilePath.createNewFile();
                        } catch (IOException ex) {
                            file_valid = "FAILURE";
                            err_msg = "FILE CREATION OF " + saveFilePath + "RESULTED IN IOException: " + ex.getMessage();
                        }
                    }
                    result.addRow(catalog_host.getId(), hostname, context.getHStoreSite().getSiteId(), context.getPartitionExecutor().getPartitionId(),  table.getTypeName(), file_valid, err_msg);
                }
            }
            //LOG.trace("Host ID " + context.getSite().getHost().getTypeName() + "\n" + new DependencySet(DEP_saveTest, result));
            return new DependencySet(DEP_saveTest, result);
        }
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.