Monitor::preinit

int Monitor::preinit()
|---r = sanitize_options()
    |---g_conf->mon_lease_renew_interval_factor  //必须小于1.0
    |---g_conf->mon_lease_ack_timeout_factor // 必须大于1.0
|---PerfCountersBuilder pcb(g_ceph_context, "mon", l_mon_first, l_mon_last);
    |---构造时 m_perf_counters(new PerfCounters(cct, name, first, last)) // PerfCounters 私有构造 ??
        // typedef std::vector<perf_counter_data_any_d> perf_counter_data_vec_t
        |--- m_data.resize(upper_bound - lower_bound - 1) // vector重置元素个数
|---logger = pcb.create_perf_counters();
    |---PerfCounters *ret = m_perf_counters  // logger指向 m_perf_counters, 通过外部指针访问类的私有变量
|---cct->get_perfcounters_collection()->add(logger)
    |---插入 m_loggers
|---PerfCountersBuilder pcb(g_ceph_context, "cluster", l_cluster_first, l_cluster_last);
|---cluster_logger = pcb.create_perf_counters();
|---paxos->init_logger()
    |---pcb.set_prio_default(PerfCountersBuilder::PRIO_USEFUL)
    |---pcb.add_u64_counter
    |---logger = pcb.create_perf_counters()
    |---g_ceph_context->get_perfcounters_collection()->add(logger)
|---r = check_fsid()
|---read_features();
    |---read_features_off_disk(store, &features)
        |---store->get(MONITOR_NAME, COMPAT_SET_LOC, featuresbl)
        // 读取不到
        |---features->encode(featuresbl)
        |---store->apply_transaction(t)
        // 读取到了
        |---features->decode(it)
    |---calc_quorum_requirements()
|---has_ever_joined = (store->get(MONITOR_NAME, "joined") != 0)
|---if (!has_ever_joined) 
// 没有加入过 quorum
    |---get_str_list(g_conf->mon_initial_members, initial_members) 
        // initial_members 不为空。
        |---monmap->set_initial_members(g_ceph_context, initial_members, name, messenger->get_myaddr(), &extra_probe_peers)
            |---mon不在initial_members,则将其插入extra_probe_peers
            |----initial_members中的mon不存在于mon_info中,则将其加入mon_info
// 本节点没有在monmap中
    |---
|---if (store->exists("mon_sync", "in_sync"))
|---if (store->get("mon_sync", "force_sync") > 0) 
|---if (clear_store) 
|---sync_last_committed_floor = store->get("mon_sync", "last_committed_floor")
|---init_paxos()
    |---paxos->init()
        |---上次当选leader时产生的PN,下次当选继续产生
        |---接受的最后一个PN(来源未知)
        |---最后一次commit的paxos id
        |---日志中最早commit的paxos id(并不一定是第一个)
    |---for (int i = 0; i < PAXOS_NUM; ++i) 
        |---调用paxos_service中的各个init
    |---refresh_from_paxos(NULL)
|---health_monitor->init();
|---if (is_keyring_required())
    |---if (authmon()->get_last_committed() == 0)
        |---
        |---
    |---r = keyring.load(cct, keyring_loc)
    |---
    |---
|---admin_hook = new AdminHook(this);
|---AdminSocket* admin_socket = cct->get_admin_socket();
|---r = admin_socket->register_command("mon_status", "mon_status", admin_hook, "show current monitor status");
|---g_conf->add_observer(this);
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值