From 9f58773e0a0991ae1fb7d77f654b52660caf65ce Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Fri, 19 Jun 2009 12:46:21 -0700 Subject: [PATCH] osd: on scrub repair, update replica pg stats as necessary An MOSDPGInfo to an active replica is treated as a pg stat repair. The replica just saves it to disk. --- src/osd/OSD.cc | 11 +++++++++-- src/osd/ReplicatedPG.cc | 8 ++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 9599cb9f9dea0..a2d4f643d5401 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -2996,8 +2996,15 @@ void OSD::_process_pg_info(epoch_t epoch, int from, } else { if (!pg->info.dne()) { // i am REPLICA - pg->merge_log(t, info, log, missing, from); - pg->activate(t, info_map); + if (!pg->is_active()) { + pg->merge_log(t, info, log, missing, from); + pg->activate(t, info_map); + } else { + // just update our stats + dout(10) << *pg << " writing updated stats" << dendl; + pg->info.stats = info.stats; + pg->write_info(t); + } } } diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 33271d8f0776b..c8b0aa06544c2 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -25,6 +25,7 @@ #include "messages/MOSDSubOpReply.h" #include "messages/MOSDPGNotify.h" +#include "messages/MOSDPGInfo.h" #include "messages/MOSDPGRemove.h" #include "messages/MOSDPGTrim.h" @@ -3286,6 +3287,13 @@ int ReplicatedPG::_scrub(ScrubMap& scrubmap, int& errors, int& fixed) info.stats.num_bytes = stat.num_bytes; info.stats.num_kb = stat.num_kb; update_stats(); + + // tell replicas + for (unsigned i=1; iosdmap->get_epoch()); + m->pg_info.push_back(info); + osd->messenger->send_message(m, osd->osdmap->get_inst(acting[i])); + } } } -- 2.39.5