]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
crimson/osd: add facilities for sending notify
authorKefu Chai <kchai@redhat.com>
Mon, 4 Mar 2019 02:47:21 +0000 (10:47 +0800)
committerKefu Chai <kchai@redhat.com>
Fri, 22 Mar 2019 05:21:32 +0000 (13:21 +0800)
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>
src/crimson/osd/pg.cc
src/crimson/osd/pg.h

index 8b59d3e16e263ade1f64b289ba8c9627112bdf9e..7310b49314b49b78241e952cc642db882e7f699d 100644 (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
index a630c4417d8bf6d64f12365ba051de4a1e7b8ac2..f39e806e0c36c805df1bb1678d048f85bdf98bc3 100644 (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)