| 1680 | |
| 1681 | |
| 1682 | Future<Nothing> Master::_recover(const Registry& registry) |
| 1683 | { |
| 1684 | hashset<string> missingCapabilities = |
| 1685 | missingMinimumCapabilities(info_, registry); |
| 1686 | |
| 1687 | if (!missingCapabilities.empty()) { |
| 1688 | LOG(ERROR) << "Master is missing the following minimum capabilities: " |
| 1689 | << strings::join<hashset<string>>(", ", missingCapabilities) |
| 1690 | << ". See the following documentation for steps to safely " |
| 1691 | << "recover from this state: " |
| 1692 | << "http://mesos.apache.org/documentation/latest/downgrades"; |
| 1693 | EXIT(EXIT_FAILURE); |
| 1694 | } |
| 1695 | |
| 1696 | foreach (const Registry::Slave& slave, registry.slaves().slaves()) { |
| 1697 | SlaveInfo slaveInfo = slave.info(); |
| 1698 | |
| 1699 | // We store the `SlaveInfo`'s resources in the `pre-reservation-refinement` |
| 1700 | // in order to support downgrades. We convert them back to `post-` format |
| 1701 | // here so that we can keep our invariant of working with `post-` format |
| 1702 | // resources within master memory. |
| 1703 | upgradeResources(&slaveInfo); |
| 1704 | |
| 1705 | slaves.recovered.put(slaveInfo.id(), slaveInfo); |
| 1706 | |
| 1707 | // Recover the draining and deactivation states. |
| 1708 | if (slave.has_drain_info()) { |
| 1709 | slaves.draining[slaveInfo.id()] = slave.drain_info(); |
| 1710 | } |
| 1711 | |
| 1712 | if (slave.has_deactivated() && slave.deactivated()) { |
| 1713 | slaves.deactivated.insert(slaveInfo.id()); |
| 1714 | } |
| 1715 | } |
| 1716 | |
| 1717 | foreach (const Registry::UnreachableSlave& unreachable, |
| 1718 | registry.unreachable().slaves()) { |
| 1719 | CHECK(!slaves.unreachable.contains(unreachable.id())); |
| 1720 | slaves.unreachable[unreachable.id()] = unreachable.timestamp(); |
| 1721 | |
| 1722 | // Recover the draining and deactivation states. |
| 1723 | if (unreachable.has_drain_info()) { |
| 1724 | slaves.draining[unreachable.id()] = unreachable.drain_info(); |
| 1725 | } |
| 1726 | |
| 1727 | if (unreachable.has_deactivated() && unreachable.deactivated()) { |
| 1728 | slaves.deactivated.insert(unreachable.id()); |
| 1729 | } |
| 1730 | } |
| 1731 | |
| 1732 | foreach (const Registry::GoneSlave& gone, |
| 1733 | registry.gone().slaves()) { |
| 1734 | slaves.gone[gone.id()] = gone.timestamp(); |
| 1735 | } |
| 1736 | |
| 1737 | // Set up a timer for age-based registry GC. |
| 1738 | scheduleRegistryGc(); |
| 1739 | |