From: Sage Weil Date: Tue, 28 Feb 2017 00:49:11 +0000 (-0600) Subject: osd/PrimaryLogPG: maintain pessimistic estimate of num_legacy_snapsets X-Git-Tag: v12.0.3~28^2~26 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=48e3f0eeed27025aa99cc7d3662d57d8c3e92ef9;p=ceph.git osd/PrimaryLogPG: maintain pessimistic estimate of num_legacy_snapsets - 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 # Conflicts: # src/osd/PrimaryLogPG.cc --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 930fe589a3e9..ce37da52297f 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -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(); } }