From 53bca9678a7c96ba8a5eea93c2e0a5c2bead0bc7 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 3 Dec 2008 15:14:41 -0800 Subject: [PATCH] osd: log scrub errors to central log --- src/osd/PG.cc | 20 ++++++++++++++++++-- src/osd/ReplicatedPG.cc | 2 +- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/osd/PG.cc b/src/osd/PG.cc index 1b84f84730739..a635ddb4f0932 100644 --- a/src/osd/PG.cc +++ b/src/osd/PG.cc @@ -27,6 +27,8 @@ #include "messages/MOSDPGInfo.h" #include "messages/MOSDPGScrub.h" +#include + #define DOUT_SUBSYS osd #undef dout_prefix #define dout_prefix _prefix(this, osd->whoami, osd->osdmap) @@ -1827,6 +1829,9 @@ void PG::scrub() for (unsigned i=0; iobjects.begin(); + int num_missing = 0; + int num_bad = 0; + while (1) { ScrubMap::object *po = 0; bool missing = false; @@ -1845,9 +1850,10 @@ void PG::scrub() break; if (missing) { for (unsigned i=0; ipoid != p[i]->poid) + if (po->poid != p[i]->poid) { dout(0) << " osd" << acting[i] << " missing " << po->poid << dendl; - else + num_missing++; + } else p[i]++; } continue; @@ -1860,6 +1866,7 @@ void PG::scrub() dout(0) << " osd" << acting[i] << " " << po->poid << " size " << p[i]->size << " != " << po->size << dendl; ok = false; + num_bad++; } // fixme: check attrs } @@ -1873,6 +1880,15 @@ void PG::scrub() p[i]++; } + if (num_missing || num_bad) { + dout(10) << "scrub " << num_missing << " missing, " << num_bad << " bad objects" << dendl; + stringstream ss; + ss << "scrub " << info.pgid << " " << num_missing << " missing, " << num_bad << " bad objects"; + string s; + getline(ss, s); + osd->log(10, s); + } + // discard peer scrub info. peer_scrub_map.clear(); diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 978a0ced119d8..9115b152ef0d1 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -2965,7 +2965,7 @@ void ReplicatedPG::_scrub(ScrubMap& scrubmap) stat.num_bytes != info.stats.num_bytes || stat.num_kb != info.stats.num_kb) { stringstream ss; - ss << info.pgid << " scrub got " + ss << "scrub " << info.pgid << " stat mismatch, got " << stat.num_objects << "/" << info.stats.num_objects << " objects, " << stat.num_object_clones << "/" << info.stats.num_object_clones << " clones, " << stat.num_bytes << "/" << info.stats.num_bytes << " bytes, " -- 2.39.5