#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,
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();
::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() &&
::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() {}
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);
// 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());
}