crimson/osd: add facilities for sending notify

we need to notify the primary osd that a PG hosted by it has changed,
and it needs to start peering for it.

Signed-off-by: Kefu Chai <kchai@redhat.com>
This commit is contained in:
Kefu Chai 2019-03-04 10:47:21 +08:00
parent f9b08c8489
commit afddf28846
2 changed files with 17 additions and 0 deletions

View File

@ -510,6 +510,20 @@ std::pair<PG::choose_acting_t, pg_shard_t> PG::choose_acting()
}
}
bool PG::should_send_notify() const
{
return should_notify_primary && primary.osd >= 0;
}
pg_notify_t PG::get_notify(epoch_t query_epoch) const
{
return pg_notify_t{primary.shard,
whoami.shard,
query_epoch,
get_osdmap_epoch(),
info};
}
seastar::future<> PG::do_peering_event(std::unique_ptr<PGPeeringEvent> evt)
{
// todo

View File

@ -78,6 +78,8 @@ public:
seastar::future<> read_state(ceph::os::CyanStore* store);
// peering/recovery
bool should_send_notify() const;
pg_notify_t get_notify(epoch_t query_epoch) const;
seastar::future<> do_peering_event(std::unique_ptr<PGPeeringEvent> evt);
seastar::future<> handle_advance_map(cached_map_t next_map);
seastar::future<> handle_activate_map();
@ -95,6 +97,7 @@ private:
epoch_t last_peering_reset = 0;
epoch_t need_up_thru = 0;
bool should_notify_primary = false;
// peer_info -- projected (updates _before_ replicas ack)
peer_info_t peer_info; //< info from peers (stray or prior)