osd/: mark info.stats as invalid after split, fix in scrub

Signed-off-by: Samuel Just <sam.just@inktank.com>
This commit is contained in:
Samuel Just 2012-09-19 18:41:34 -07:00
parent 5f8a3634c4
commit 9835e19015
4 changed files with 17 additions and 1 deletions

View File

@ -2028,6 +2028,8 @@ void PG::split_into(pg_t child_pgid, PG *child, unsigned split_bits)
child->info.last_backfill = info.last_backfill;
child->info.stats = info.stats;
info.stats.stats_invalid = true;
child->info.stats.stats_invalid = true;
child->snap_trimq = snap_trimq;

View File

@ -7089,6 +7089,11 @@ void ReplicatedPG::_scrub_finish()
bool deep_scrub = state_test(PG_STATE_DEEP_SCRUB);
const char *mode = (repair ? "repair": (deep_scrub ? "deep-scrub" : "scrub"));
if (info.stats.stats_invalid) {
info.stats.stats = scrub_cstat;
info.stats.stats_invalid = false;
}
dout(10) << mode << " got "
<< scrub_cstat.sum.num_objects << "/" << info.stats.stats.sum.num_objects << " objects, "
<< scrub_cstat.sum.num_object_clones << "/" << info.stats.stats.sum.num_object_clones << " clones, "

View File

@ -1019,6 +1019,7 @@ void pg_stat_t::dump(Formatter *f) const
f->dump_stream("last_deep_scrub_stamp") << last_deep_scrub_stamp;
f->dump_unsigned("log_size", log_size);
f->dump_unsigned("ondisk_log_size", ondisk_log_size);
f->dump_stream("stats_invalid") << stats_invalid;
stats.dump(f);
f->open_array_section("up");
for (vector<int>::const_iterator p = up.begin(); p != up.end(); ++p)
@ -1032,7 +1033,7 @@ void pg_stat_t::dump(Formatter *f) const
void pg_stat_t::encode(bufferlist &bl) const
{
ENCODE_START(10, 8, bl);
ENCODE_START(11, 8, bl);
::encode(version, bl);
::encode(reported, bl);
::encode(state, bl);
@ -1057,6 +1058,7 @@ void pg_stat_t::encode(bufferlist &bl) const
::encode(mapping_epoch, bl);
::encode(last_deep_scrub, bl);
::encode(last_deep_scrub_stamp, bl);
::encode(stats_invalid, bl);
ENCODE_FINISH(bl);
}
@ -1126,6 +1128,11 @@ void pg_stat_t::decode(bufferlist::iterator &bl)
}
}
}
if (struct_v < 11) {
stats_invalid = false;
} else {
::decode(stats_invalid, bl);
}
DECODE_FINISH(bl);
}

View File

@ -887,6 +887,7 @@ struct pg_stat_t {
utime_t last_deep_scrub_stamp;
object_stat_collection_t stats;
bool stats_invalid;
int64_t log_size;
int64_t ondisk_log_size; // >= active_log_size
@ -898,6 +899,7 @@ struct pg_stat_t {
: state(0),
created(0), last_epoch_clean(0),
parent_split_bits(0),
stats_invalid(false),
log_size(0), ondisk_log_size(0),
mapping_epoch(0)
{ }