public static Set<Host> getHostsForDomainPartition(Ring ring, Domain domain, int partition) throws IOException { Set<Host> results = new HashSet<Host>(); for (Host host : ring.getHosts()) { HostDomain domainById = host.getHostDomain(domain); for (HostDomainPartition hdpc : domainById.getPartitions()) { if (hdpc.getPartitionNumber() == partition) { results.add(host); break; } } } return results; }
private void doDeleteOrUndeletePartition(HttpServletRequest req, HttpServletResponse resp, boolean deletable) throws IOException { RingGroup rg = coordinator.getRingGroup(req.getParameter("g")); Ring r = rg.getRing(Integer.parseInt(req.getParameter("n"))); Host h = r.getHostByAddress(PartitionServerAddress.parse(URLEnc.decode(req.getParameter("h")))); HostDomain hd = h.getHostDomain(coordinator.getDomain(req.getParameter("d"))); HostDomainPartition hdp = hd.getPartitionByNumber(Integer.parseInt(req.getParameter("p"))); hdp.setDeletable(deletable); redirectBack(resp, rg, r, h); }
HostDomain hostDomain = host.getHostDomain(domain);
HostDomain hostDomain = host.getHostDomain(domain);
public static UpdateProgressAggregator computeUpdateProgress(Host host, DomainGroup domainGroup) throws IOException { UpdateProgressAggregator result = new UpdateProgressAggregator(); for (DomainAndVersion dgvdv : domainGroup.getDomainVersions()) { Domain domain = dgvdv.getDomain(); HostDomain hostDomain = host.getHostDomain(domain); if (hostDomain != null) { for (HostDomainPartition partition : hostDomain.getPartitions()) { // Ignore deletable partitions if (!partition.isDeletable()) { if (partition.getCurrentDomainVersion() != null && partition.getCurrentDomainVersion().equals(dgvdv.getVersionNumber())) { result.add(domain, true); } else { result.add(domain, false); } } } } } return result; }
HostDomain hostDomain = host.getHostDomain(dgdv.getDomain()); if (hostDomain != null) { Set<HostDomainPartition> partitions = hostDomain.getPartitions(); HostDomain hostDomain = host.getHostDomain(domain); if (hostDomain == null) { LOG.error(String.format("Could not get HostDomain of Domain %s on Host %s. Skipping.", domain, host));
private static boolean allPartitionsUpToDate(Host host, Collection<DomainAndVersion> domainVersions, boolean allowMoreRecentDomainVersions) throws IOException { // Check that each domain of the given domain group version is up to date on this host for (DomainAndVersion domainAndVersion : domainVersions) { Domain domain = domainAndVersion.getDomain(); HostDomain hostDomain = host.getHostDomain(domain); if (hostDomain != null) { for (HostDomainPartition partition : hostDomain.getPartitions()) { // Ignore deletable partitions if (!partition.isDeletable()) { // If the partition is not currently at the given domain group version, the host is not up-to-date if (partition.getCurrentDomainVersion() == null || (!allowMoreRecentDomainVersions && partition.getCurrentDomainVersion() != domainAndVersion.getVersionNumber()) || (allowMoreRecentDomainVersions && (partition.getCurrentDomainVersion() < domainAndVersion.getVersionNumber()))) { LOG.info("Host " + host.getAddress().getHostName() + " is not up to date for domain " + domain.getName() + " and version " + domainAndVersion.getVersionNumber()); LOG.info("Host " + host.getAddress().getHostName() + " has a partition on domain " + domain.getName() + " at version " + partition.getCurrentDomainVersion()); return false; } } } } } return true; }