]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/bluestore: make alerting onode dump less frequent. 28010/head
authorIgor Fedotov <ifedotov@suse.com>
Wed, 1 May 2019 17:12:27 +0000 (20:12 +0300)
committerIgor Fedotov <ifedotov@suse.com>
Thu, 9 May 2019 11:05:24 +0000 (14:05 +0300)
Signed-off-by: Igor Fedotov <ifedotov@suse.com>
src/os/bluestore/BlueStore.cc
src/os/bluestore/BlueStore.h

index 962d1db5780bb54dff88589b32f9602415aa8efa..5db054135e167ed80f56ba949d9d184da2dc2ba8 100644 (file)
@@ -2541,9 +2541,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;
@@ -2561,6 +2566,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
@@ -2600,15 +2606,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];
+               }
+             }
            }
          }
        }
@@ -2620,6 +2632,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 b74a873cd5241982b8c38ba2cc3c6330ac055497..227716dfe3cd0a8f890f371dcb29827cf3af7d4e 100644 (file)
@@ -1097,6 +1097,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) {}