On Mon, 24 Oct 2016, xxhdx1985126 wrote: > Hi, everyone. > > > I'm trying to read the source code that boots an OSD instance, and I find something really overwhelms me. > In the OSD::init() method, it read the OSDSuperblock by calling OSD::read_superblock(), and the it tried to get the "current" map : "osdmap = get_map(superblock.current_epoch)". Then OSD uses this osdmap to calculate the acting and up set of each pg. > I really don't understand this! Since the OSDSuperblock is read from the disk, the content of the superblock.current_epoch must be an old epoch which is recorded by the last OSD instance that run on the ceph osd's directory. Why use an old "current_epoch" to calculate the acting and up set of each pg? Yes. load_pgs() instantiates all of the PGs, populates the current (== current_epoch) up and acting vectors, and triggers a loaded event to help get everything in-memory initialized. Then, during the 'booting' sequence, we request the latest map from the monitor, and respond to any changes in the OSDMap--everything that happened while the OSD was down, and eventually the OSDmap that indicates the OSD is now up. At that point it can start doing useful work. Look for the AdvMap and ActMap state events. This process of responding to changes to the OSDMap and synchronizing with other OSDs in collectively called "peering" and is one of the more difficult areas of the code to understand. :/ sage