From: Samuel Just Date: Tue, 26 Mar 2013 22:10:37 +0000 (-0700) Subject: ReplicatedPG: send entire stats on OP_BACKFILL_FINISH X-Git-Tag: v0.60~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=76b296f01fd0d337c8fc9f79013883e62146f0c6;p=ceph.git ReplicatedPG: send entire stats on OP_BACKFILL_FINISH Otherwise, we update the stat.stat structure, but not the stat.invalid_stats part. This will result in a recently split primary propogating the invalid stats but not the invalid marker. Sending the whole pg_stat_t structure also mirrors MOSDSubOp. Fixes: #4557 Backport: bobtail Signed-off-by: Samuel Just Reviewed-by: Sage Weil --- diff --git a/src/messages/MOSDPGBackfill.h b/src/messages/MOSDPGBackfill.h index bc2a696b6ce7..5700f9675268 100644 --- a/src/messages/MOSDPGBackfill.h +++ b/src/messages/MOSDPGBackfill.h @@ -19,6 +19,8 @@ #include "osd/osd_types.h" class MOSDPGBackfill : public Message { + static const int HEAD_VERSION = 2; + static const int COMPAT_VERSION = 1; public: enum { OP_BACKFILL_PROGRESS = 2, @@ -38,7 +40,8 @@ public: epoch_t map_epoch, query_epoch; pg_t pgid; hobject_t last_backfill; - object_stat_collection_t stats; + bool compat_stat_sum; + pg_stat_t stats; virtual void decode_payload() { bufferlist::iterator p = payload.begin(); @@ -47,7 +50,15 @@ public: ::decode(query_epoch, p); ::decode(pgid, p); ::decode(last_backfill, p); - ::decode(stats, p); + + // For compatibility with version 1 + ::decode(stats.stats, p); + + if (header.version >= 2) { + ::decode(stats, p); + } else { + compat_stat_sum = true; + } // Handle hobject_t format change if (!last_backfill.is_max() && @@ -61,16 +72,22 @@ public: ::encode(query_epoch, payload); ::encode(pgid, payload); ::encode(last_backfill, payload); + + // For compatibility with version 1 + ::encode(stats.stats, payload); + ::encode(stats, payload); } - MOSDPGBackfill() : Message(MSG_OSD_PG_BACKFILL) {} + MOSDPGBackfill() : + Message(MSG_OSD_PG_BACKFILL, HEAD_VERSION, COMPAT_VERSION), + compat_stat_sum(false) {} MOSDPGBackfill(__u32 o, epoch_t e, epoch_t qe, pg_t p) - : Message(MSG_OSD_PG_BACKFILL), + : Message(MSG_OSD_PG_BACKFILL, HEAD_VERSION, COMPAT_VERSION), op(o), map_epoch(e), query_epoch(e), - pgid(p) { - } + pgid(p), + compat_stat_sum(false) {} private: ~MOSDPGBackfill() {} diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index f87e334f48f3..3b28ca280b87 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1268,7 +1268,11 @@ void ReplicatedPG::do_backfill(OpRequestRef op) assert(g_conf->osd_kill_backfill_at != 2); info.last_backfill = m->last_backfill; - info.stats.stats = m->stats; + if (m->compat_stat_sum) { + info.stats.stats = m->stats.stats; // Previously, we only sent sum + } else { + info.stats = m->stats; + } ObjectStore::Transaction *t = new ObjectStore::Transaction; dirty_info = true; @@ -6903,7 +6907,7 @@ int ReplicatedPG::recover_backfill(int max) // Use default priority here, must match sub_op priority } m->last_backfill = bound; - m->stats = pinfo.stats.stats; + m->stats = pinfo.stats; osd->send_message_osd_cluster(backfill_target, m, get_osdmap()->get_epoch()); }