From: Kefu Chai Date: Mon, 4 Mar 2019 02:47:21 +0000 (+0800) Subject: crimson/osd: add facilities for sending notify X-Git-Tag: v15.0.0~151^2~6 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=afddf28846b2d114421d5a8853a6e2bbd805de9e;p=ceph-ci.git 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 --- diff --git a/src/crimson/osd/pg.cc b/src/crimson/osd/pg.cc index 8b59d3e16e2..7310b49314b 100644 --- a/src/crimson/osd/pg.cc +++ b/src/crimson/osd/pg.cc @@ -510,6 +510,20 @@ std::pair 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 evt) { // todo diff --git a/src/crimson/osd/pg.h b/src/crimson/osd/pg.h index a630c4417d8..f39e806e0c3 100644 --- a/src/crimson/osd/pg.h +++ b/src/crimson/osd/pg.h @@ -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 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)