diff options
author | Samuel Just <sam.just@inktank.com> | 2013-03-26 15:10:37 -0700 |
---|---|---|
committer | Samuel Just <sam.just@inktank.com> | 2013-03-28 11:58:27 -0700 |
commit | 750626108616761512271d5a4f10dee82a54e460 (patch) | |
tree | bc7278bf285ff345a80ad9c19203bac11ef807e6 | |
parent | 94321ccdff81d5d6cea1acdb54344c3d930a49eb (diff) | |
download | ceph-750626108616761512271d5a4f10dee82a54e460.tar.gz |
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 <sam.just@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
(cherry picked from commit 76b296f01fd0d337c8fc9f79013883e62146f0c6)
-rw-r--r-- | src/messages/MOSDPGBackfill.h | 29 | ||||
-rw-r--r-- | src/osd/ReplicatedPG.cc | 8 |
2 files changed, 29 insertions, 8 deletions
diff --git a/src/messages/MOSDPGBackfill.h b/src/messages/MOSDPGBackfill.h index bc2a696b6ce..5700f967526 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 5a27ea4a8ae..bbc8dffd3b8 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -1256,7 +1256,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; write_info(*t); @@ -6980,7 +6984,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()); } |