]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: make alerting onode dump less frequent. 36756/head
authorIgor Fedotov <ifedotov@suse.com>
Wed, 1 May 2019 17:12:27 +0000 (20:12 +0300)
committerNathan Cutler <ncutler@suse.com>
Fri, 21 Aug 2020 15:48:33 +0000 (17:48 +0200)
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
(cherry picked from commit 1d6a4730a0398a7970cfd0a8effebff39a1e887a)

src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index 473085b7ad647cea4a86460f5ddbd6b3ea1023b5..4a60c54e92e4fdc8e270b0fe17bfb5268c1bc060 100644 (file)
@@ -2483,9 +2483,14 @@ void BlueStore::ExtentMap::reshard(
       shard_end = sp->offset;
     }
     Extent dummy(needs_reshard_begin);
-    bool was_too_many_dump = false;
+
+    bool was_too_many_blobs_check = false;
     auto too_many_blobs_threshold =
       g_conf()->bluestore_debug_too_many_blobs_threshold;
+    auto& dumped_onodes = onode->c->cache->dumped_onodes;
+    decltype(onode->c->cache->dumped_onodes)::value_type* oid_slot = nullptr;
+    decltype(onode->c->cache->dumped_onodes)::value_type* oldest_slot = nullptr;
+
     for (auto e = extent_map.lower_bound(dummy); e != extent_map.end(); ++e) {
       if (e->logical_offset >= needs_reshard_end) {
        break;
@@ -2503,6 +2508,7 @@ void BlueStore::ExtentMap::reshard(
        dout(30) << __func__ << "  shard 0x" << std::hex << shard_start
                 << " to 0x" << shard_end << std::dec << dendl;
       }
+
       if (e->blob_escapes_range(shard_start, shard_end - shard_start)) {
        if (!e->blob->is_spanning()) {
          // We have two options: (1) split the blob into pieces at the
@@ -2542,15 +2548,21 @@ void BlueStore::ExtentMap::reshard(
             b->id = bid;
            spanning_blob_map[b->id] = b;
            dout(20) << __func__ << "    adding spanning " << *b << dendl;
-           if (!was_too_many_dump &&
+           if (!was_too_many_blobs_check &&
              too_many_blobs_threshold &&
              spanning_blob_map.size() >= size_t(too_many_blobs_threshold)) {
-               dout(0) << __func__
-                       << " spanning blob count exceeds threshold, "
-                       << spanning_blob_map.size() << " spanning blobs"
-                       << dendl;
-               _dump_onode<0>(cct, *onode);
-             was_too_many_dump = true;
+
+             was_too_many_blobs_check = true;
+             for (size_t i = 0; i < dumped_onodes.size(); ++i) {
+               if (dumped_onodes[i].first == onode->oid) {
+                 oid_slot = &dumped_onodes[i];
+                 break;
+               }
+               if (!oldest_slot || (oldest_slot &&
+                   dumped_onodes[i].second < oldest_slot->second)) {
+                 oldest_slot = &dumped_onodes[i];
+               }
+             }
            }
          }
        }
@@ -2562,6 +2574,23 @@ void BlueStore::ExtentMap::reshard(
        }
       }
     }
+    bool do_dump = (!oid_slot && was_too_many_blobs_check) ||
+      (oid_slot &&
+       (mono_clock::now() - oid_slot->second >= make_timespan(5 * 60)));
+    if (do_dump) {
+      dout(0) << __func__
+             << " spanning blob count exceeds threshold, "
+             << spanning_blob_map.size() << " spanning blobs"
+             << dendl;
+      _dump_onode<0>(cct, *onode);
+      if (oid_slot) {
+       oid_slot->second = mono_clock::now();
+      } else {
+       ceph_assert(oldest_slot);
+       oldest_slot->first = onode->oid;
+       oldest_slot->second = mono_clock::now();
+      }
+    }
   }
 
   clear_needs_reshard();
index 64f484efd8d322704ce944e267f7bc4177d77051..3e0aaa26061681b10f4ee5ddb30159d4babe4df4 100644 (file)
@@ -1115,6 +1115,8 @@ public:
     std::atomic<uint64_t> num_extents = {0};
     std::atomic<uint64_t> num_blobs = {0};
 
+    std::array<std::pair<ghobject_t, mono_clock::time_point>, 64> dumped_onodes;
+
     static Cache *create(CephContext* cct, string type, PerfCounters *logger);
 
     Cache(CephContext* cct) : cct(cct), logger(nullptr) {}