]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd/pg: Implement context_registry_on_change()
authorMatan Breizman <mbreizma@redhat.com>
Tue, 7 Feb 2023 19:48:42 +0000 (19:48 +0000)
committerMatan Breizman <mbreizma@redhat.com>
Tue, 7 Mar 2023 09:04:04 +0000 (09:04 +0000)
Signed-off-by: Matan Breizman <mbreizma@redhat.com>
src/crimson/osd/pg.cc
src/crimson/osd/pg.h
src/crimson/osd/watch.h

index 352d88285ff293e04e6317542c5aa64d95415796..52aee483560cc7c843105bc04d31dcd43f507435 100644 (file)
@@ -1426,6 +1426,7 @@ seastar::future<> PG::stop()
 
 void PG::on_change(ceph::os::Transaction &t) {
   logger().debug("{} {}:", *this, __func__);
+  context_registry_on_change();
   obc_loader.notify_on_change(is_primary());
   recovery_backend->on_peering_interval_change(t);
   backend->on_actingset_changed(is_primary());
@@ -1439,6 +1440,17 @@ void PG::on_change(ceph::os::Transaction &t) {
   }
 }
 
+void PG::context_registry_on_change() {
+    obc_registry.for_each([](ObjectContextRef obc) {
+      assert(obc);
+      for (auto j = obc->watchers.begin();
+           j != obc->watchers.end();
+           j = obc->watchers.erase(j)) {
+        j->second->discard_state();
+      }
+  });
+}
+
 bool PG::can_discard_op(const MOSDOp& m) const {
   if ((m.get_flags() & (CEPH_OSD_FLAG_BALANCE_READS |
                         CEPH_OSD_FLAG_LOCALIZE_READS))
index a98d67861db1ccdd87bc82b61e117761b83f5be3..6d26f58748ffc2d53f723e6e315afdc9ae8a7fd2 100644 (file)
@@ -744,6 +744,7 @@ private:
 
   bool can_discard_replica_op(const Message& m, epoch_t m_map_epoch) const;
   bool can_discard_op(const MOSDOp& m) const;
+  void context_registry_on_change();
   bool is_missing_object(const hobject_t& soid) const {
     return peering_state.get_pg_log().get_missing().get_items().count(soid);
   }
index 84c43b3fec4035e8f532e16bec382892bb1961c8..e69fb4ca14e54c5984f9128e205bed656c9e5937 100644 (file)
@@ -45,7 +45,6 @@ class Watch : public seastar::enable_shared_from_this<Watch> {
   seastar::future<> start_notify(NotifyRef);
   seastar::future<> send_notify_msg(NotifyRef);
   seastar::future<> send_disconnect_msg();
-  void discard_state();
   void do_watch_timeout(Ref<PG> pg);
 
   friend Notify;
@@ -77,6 +76,8 @@ public:
   }
   void got_ping(utime_t);
 
+  void discard_state();
+
   seastar::future<> remove();
 
   /// Call when notify_ack received on notify_id