]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/Objecter: apply removed_snaps from gap to in-flight requests
authorSage Weil <sage@redhat.com>
Thu, 12 Oct 2017 20:56:01 +0000 (15:56 -0500)
committerSage Weil <sage@redhat.com>
Sat, 2 Dec 2017 03:26:48 +0000 (21:26 -0600)
If we are so laggy that we aren't contiguous with the mon's latest
map, the mon will provide a summary of removed_snaps for the gap.
Apply those to our in-flight ops.

Signed-off-by: Sage Weil <sage@redhat.com>
src/osdc/Objecter.cc
src/osdc/Objecter.h

index df3d2f5a8855d8365fc9f109e59cb77276239179..b212cb0c36369a40bb3c24b026604b5403be53c4 100644 (file)
@@ -1021,14 +1021,16 @@ bool Objecter::ms_dispatch(Message *m)
   return false;
 }
 
-void Objecter::_scan_requests(OSDSession *s,
-                             bool skipped_map,
-                             bool cluster_full,
-                             map<int64_t, bool> *pool_full_map,
-                             map<ceph_tid_t, Op*>& need_resend,
-                             list<LingerOp*>& need_resend_linger,
-                             map<ceph_tid_t, CommandOp*>& need_resend_command,
-                             shunique_lock& sul)
+void Objecter::_scan_requests(
+  OSDSession *s,
+  bool skipped_map,
+  bool cluster_full,
+  map<int64_t, bool> *pool_full_map,
+  map<ceph_tid_t, Op*>& need_resend,
+  list<LingerOp*>& need_resend_linger,
+  map<ceph_tid_t, CommandOp*>& need_resend_command,
+  shunique_lock& sul,
+  const mempool::osdmap::map<int64_t,OSDMap::snap_interval_set_t> *gap_removed_snaps)
 {
   assert(sul.owns_lock() && sul.mutex() == &rwlock);
 
@@ -1078,6 +1080,9 @@ void Objecter::_scan_requests(OSDSession *s,
     ++p;   // check_op_pool_dne() may touch ops; prevent iterator invalidation
     ldout(cct, 10) << " checking op " << op->tid << dendl;
     _prune_snapc(osdmap->get_new_removed_snaps(), op);
+    if (skipped_map) {
+      _prune_snapc(*gap_removed_snaps, op);
+    }
     bool force_resend_writes = cluster_full;
     if (pool_full_map)
       force_resend_writes = force_resend_writes ||
@@ -1233,16 +1238,21 @@ void Objecter::handle_osd_map(MOSDMap *m)
        // check all outstanding requests on every epoch
        for (auto& i : need_resend) {
          _prune_snapc(osdmap->get_new_removed_snaps(), i.second);
+         if (skipped_map) {
+           _prune_snapc(m->gap_removed_snaps, i.second);
+         }
        }
        _scan_requests(homeless_session, skipped_map, cluster_full,
                       &pool_full_map, need_resend,
-                      need_resend_linger, need_resend_command, sul);
+                      need_resend_linger, need_resend_command, sul,
+                      &m->gap_removed_snaps);
        for (map<int,OSDSession*>::iterator p = osd_sessions.begin();
             p != osd_sessions.end(); ) {
          OSDSession *s = p->second;
          _scan_requests(s, skipped_map, cluster_full,
                         &pool_full_map, need_resend,
-                        need_resend_linger, need_resend_command, sul);
+                        need_resend_linger, need_resend_command, sul,
+                        &m->gap_removed_snaps);
          ++p;
          // osd down or addr change?
          if (!osdmap->is_up(s->osd) ||
@@ -1262,7 +1272,8 @@ void Objecter::handle_osd_map(MOSDMap *m)
             p != osd_sessions.end(); ++p) {
          OSDSession *s = p->second;
          _scan_requests(s, false, false, NULL, need_resend,
-                        need_resend_linger, need_resend_command, sul);
+                        need_resend_linger, need_resend_command, sul,
+                        nullptr);
        }
        ldout(cct, 3) << "handle_osd_map decoding full epoch "
                      << m->get_last() << dendl;
@@ -1270,7 +1281,7 @@ void Objecter::handle_osd_map(MOSDMap *m)
 
        _scan_requests(homeless_session, false, false, NULL,
                       need_resend, need_resend_linger,
-                      need_resend_command, sul);
+                      need_resend_command, sul, nullptr);
       } else {
        ldout(cct, 3) << "handle_osd_map hmm, i want a full map, requesting"
                      << dendl;
@@ -2764,14 +2775,14 @@ int64_t Objecter::get_object_pg_hash_position(int64_t pool, const string& key,
 
 void Objecter::_prune_snapc(
   const mempool::osdmap::map<int64_t,
-  mempool::osdmap::flat_set<snapid_t>>& new_removed_snaps,
+  OSDMap::snap_interval_set_t>& new_removed_snaps,
   Op *op)
 {
   bool match = false;
   auto i = new_removed_snaps.find(op->target.base_pgid.pool());
   if (i != new_removed_snaps.end()) {
     for (auto s : op->snapc.snaps) {
-      if (i->second.count(s)) {
+      if (i->second.contains(s)) {
        match = true;
        break;
       }
@@ -2779,8 +2790,7 @@ void Objecter::_prune_snapc(
     if (match) {
       vector<snapid_t> new_snaps;
       for (auto s : op->snapc.snaps) {
-       if (std::find(i->second.begin(), i->second.end(), s) ==
-           i->second.end()) {
+       if (!i->second.contains(s)) {
          new_snaps.push_back(s);
        }
       }
index f50af90cebb3fdfac9cf2f77fb8d7488612ce206..76d356bb808849cb1ca2f5f7c7490efb30cd9248 100644 (file)
@@ -2081,14 +2081,16 @@ private:
   void set_osdmap_full_try() { osdmap_full_try = true; }
   void unset_osdmap_full_try() { osdmap_full_try = false; }
 
-  void _scan_requests(OSDSession *s,
-                     bool skipped_map,
-                     bool cluster_full,
-                     map<int64_t, bool> *pool_full_map,
-                     map<ceph_tid_t, Op*>& need_resend,
-                     list<LingerOp*>& need_resend_linger,
-                     map<ceph_tid_t, CommandOp*>& need_resend_command,
-                     shunique_lock& sul);
+  void _scan_requests(
+    OSDSession *s,
+    bool skipped_map,
+    bool cluster_full,
+    map<int64_t, bool> *pool_full_map,
+    map<ceph_tid_t, Op*>& need_resend,
+    list<LingerOp*>& need_resend_linger,
+    map<ceph_tid_t, CommandOp*>& need_resend_command,
+    shunique_lock& sul,
+    const mempool::osdmap::map<int64_t,OSDMap::snap_interval_set_t> *gap_removed_snaps);
 
   int64_t get_object_hash_position(int64_t pool, const string& key,
                                   const string& ns);