]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd/pg: reset the snap mapper's backend when pg interval changes 58826/head
authorXuehan Xu <xuxuehan@qianxin.com>
Mon, 29 Apr 2024 04:11:51 +0000 (12:11 +0800)
committerMatan Breizman <mbreizma@redhat.com>
Thu, 25 Jul 2024 07:36:30 +0000 (10:36 +0300)
Fixes: https://tracker.ceph.com/issues/65679
Signed-off-by: Xuehan Xu <xuxuehan@qianxin.com>
(cherry picked from commit 9f6ccafb8656865c87c3052b12422322e1d1d276)

src/common/map_cacher.hpp
src/common/sharedptr_registry.hpp
src/crimson/osd/pg.cc
src/osd/SnapMapper.h

index a83f924b622c0767b33988061172da1adc112407..4d843be75dc643bf1761c08b35ee738b29582a4f 100644 (file)
@@ -85,6 +85,10 @@ private:
 public:
   MapCacher(StoreDriver<K, V> *driver) : driver(driver) {}
 
+  void reset() {
+    in_progress.reset();
+  }
+
   /// Fetch first key/value std::pair after specified key
   int get_next(
     K key,               ///< [in] key after which to get next
index 3b3cf01bb28a000039832d58fe246c11249927e2..8c0db6c24a7025247596c7517fd80e156b3c3c18 100644 (file)
@@ -18,6 +18,7 @@
 #include <map>
 #include <memory>
 #include "common/ceph_mutex.h"
+#include "include/ceph_assert.h"
 
 /**
  * Provides a registry of shared_ptr<V> indexed by K while
@@ -61,6 +62,11 @@ public:
     waiting(0)
   {}
 
+  void reset() {
+    ceph_assert(!waiting);
+    contents.clear();
+  }
+
   bool empty() {
     std::lock_guard l(lock);
     return contents.empty();
index ad777c49d60118b66973abd10116d61196173294..fd7e09a8984624ded3cee5fd0ab2cb1adf391efc 100644 (file)
@@ -1592,6 +1592,7 @@ void PG::on_change(ceph::os::Transaction &t) {
   // is save and in time.
   peering_state.state_clear(PG_STATE_SNAPTRIM);
   peering_state.state_clear(PG_STATE_SNAPTRIM_ERROR);
+  snap_mapper.reset_backend();
 }
 
 void PG::context_registry_on_change() {
index 70d1b6c39add78a977f3a3695ed80be37bcdf4b0..688a7b8f1fffe22e4c9406cb1eddd6180a5d223e 100644 (file)
@@ -357,6 +357,11 @@ private:
     return prefix_itr;
   }
 
+  /// reset the MapCacher backend, this should be called on pg interval change
+  void reset_backend() {
+    backend.reset();
+  }
+
   /// Update snaps for oid, empty new_snaps removes the mapping
   int update_snaps(
     const hobject_t &oid,       ///< [in] oid to update