]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PrimaryLogPG: maintain pessimistic estimate of num_legacy_snapsets
authorSage Weil <sage@redhat.com>
Tue, 28 Feb 2017 00:49:11 +0000 (18:49 -0600)
committerSage Weil <sage@redhat.com>
Fri, 5 May 2017 17:38:12 +0000 (13:38 -0400)
- Assume that any snapset we update, if not require_luminous, is a net-new
legacy SnapSet.  (It might be an existing one, which would be net-0, but
that is harder to tell.)

Then, during scrub,

- Any unreadable oi is assumed to include a legacy snapset
- Any snapset we encounter if !require_luminous is legacy
- Any object that should have a snapset but doesn't (corrupt or missing)
is assumed to be legacy.
- If were trying to update a legacy Snapset but have to abort, then it is
still legacy.

We could assume that a missing/broken snapset is not legacy since it has
to be repaired anyway (and therefore shouldn't block upgrade), but I'm
not sure.  For now, we'll take the conservative approach of blocking the
upgrade if the snapset metadata is missing/corrupt.

Signed-off-by: Sage Weil <sage@redhat.com>
# Conflicts:
# src/osd/PrimaryLogPG.cc

src/osd/PrimaryLogPG.cc

index 930fe589a3e9aefa419c5f1c9027f6d8fe464a94..ce37da52297f5b20e343d453c35cd914b35cefcc 100644 (file)
@@ -6833,6 +6833,11 @@ void PrimaryLogPG::make_writeable(OpContext *ctx)
   ctx->new_snapset.snaps = snapc.snaps;
   ctx->new_snapset.head_exists = ctx->new_obs.exists;
   dout(20) << "make_writeable " << soid << " done, snapset=" << ctx->new_snapset << dendl;
+
+  if (!get_osdmap()->test_flag(CEPH_OSDMAP_REQUIRE_LUMINOUS)) {
+    // pessimistic assumption that this is a net-new legacy SnapSet
+    ctx->delta_stats.num_legacy_snapsets++;
+  }
 }
 
 
@@ -13151,6 +13156,10 @@ void PrimaryLogPG::scrub_snapshot_metadata(
        if (oi->is_cache_pinned())
          ++stat.num_objects_pinned;
       }
+    } else {
+      // pessimistic assumption that this object might contain a
+      // legacy SnapSet
+      stat.num_legacy_snapsets++;
     }
 
     // Check for any problems while processing clones
@@ -13279,7 +13288,13 @@ void PrimaryLogPG::scrub_snapshot_metadata(
            dout(10) << " will convert legacy snapset on " << soid << dendl;
            snapset_to_repair[soid.get_head()] = *snapset;
          }
+       } else {
+         stat.num_legacy_snapsets++;
        }
+      } else {
+       // pessimistic assumption that this object might contain a
+       // legacy SnapSet
+       stat.num_legacy_snapsets++;
       }
     } else {
       assert(soid.is_snap());
@@ -13436,6 +13451,7 @@ void PrimaryLogPG::scrub_snapshot_metadata(
       // or extra clone.
       dout(10) << __func__ << " not writing snapset to " << p.first
               << " " << p.second << "; didn't convert fully" << dendl;
+      scrub_cstat.sum.num_legacy_snapsets++;
       continue;
     }
     dout(10) << __func__ << " writing snapset to " << p.first
@@ -13569,6 +13585,14 @@ void PrimaryLogPG::_scrub_finish()
       publish_stats_to_osd();
       share_pg_info();
     }
+  } else if (scrub_cstat.sum.num_legacy_snapsets !=
+            info.stats.stats.sum.num_legacy_snapsets) {
+    osd->clog->info() << info.pgid << " " << mode << " updated num_legacy_snapsets"
+                     << " from " << info.stats.stats.sum.num_legacy_snapsets
+                     << " -> " << scrub_cstat.sum.num_legacy_snapsets << "\n";
+    info.stats.stats.sum.num_legacy_snapsets = scrub_cstat.sum.num_legacy_snapsets;
+    publish_stats_to_osd();
+    share_pg_info();
   }
 }