for (map<pg_t,pg_stat_t>::iterator p = stats->pg_stat.begin();
p != stats->pg_stat.end();
p++)
- ack->pg_stat[p->first] = p->second.reported;
+ ack->pg_stat[p->first] = p->second.version;
mon->messenger->send_message(ack, stats->get_orig_source_inst());
return true;
}
p != stats->pg_stat.end();
p++) {
pg_t pgid = p->first;
- ack->pg_stat[pgid] = p->second.reported;
+ ack->pg_stat[pgid] = p->second.version;
if ((pg_map.pg_stat.count(pgid) &&
- pg_map.pg_stat[pgid].reported > p->second.reported)) {
- dout(15) << " had " << pgid << " from " << pg_map.pg_stat[pgid].reported << dendl;
+ pg_map.pg_stat[pgid].version > p->second.version)) {
+ dout(15) << " had " << pgid << " from " << pg_map.pg_stat[pgid].version << dendl;
continue;
}
if (pending_inc.pg_stat_updates.count(pgid) &&
- pending_inc.pg_stat_updates[pgid].reported > p->second.reported) {
- dout(15) << " had " << pgid << " from " << pending_inc.pg_stat_updates[pgid].reported
+ pending_inc.pg_stat_updates[pgid].version > p->second.version) {
+ dout(15) << " had " << pgid << " from " << pending_inc.pg_stat_updates[pgid].version
<< " (pending)" << dendl;
continue;
}
if (pg_map.pg_stat.count(pgid) == 0) {
- dout(15) << " got " << pgid << " reported at " << p->second.reported
+ dout(15) << " got " << pgid << " reported at " << p->second.version
<< " state " << pg_state_string(p->second.state)
<< " but DNE in pg_map!!"
<< dendl;
}
dout(15) << " got " << pgid
- << " reported at " << p->second.reported
+ << " reported at " << p->second.version
<< " state " << pg_state_string(pg_map.pg_stat[pgid].state)
<< " -> " << pg_state_string(p->second.state)
<< dendl;
ss << "version " << pg_map.version << std::endl;
ss << "last_osdmap_epoch " << pg_map.last_osdmap_epoch << std::endl;
ss << "last_pg_scan " << pg_map.last_pg_scan << std::endl;
- ss << "pg_stat\tobjects\tkb\tbytes\treported\tstate" << std::endl;
+ ss << "pg_stat\tobjects\tkb\tbytes\tv\treported\tstate\tosds" << std::endl;
for (set<pg_t>::iterator p = pg_map.pg_set.begin();
p != pg_map.pg_set.end();
p++) {
<< "\t" << st.num_kb
<< "\t" << st.num_bytes
<< "\t" << pg_state_string(st.state)
+ << "\t" << st.version
<< "\t" << st.reported
+ << "\t" << st.acting
<< std::endl;
}
- ss << "osdstat\tobject\tkbused\tkbavail\tkb" << std::endl;
+ ss << "osdstat\tobject\tkbused\tkbavail\tkb\thb in\thb out" << std::endl;
for (hash_map<int,osd_stat_t>::iterator p = pg_map.osd_stat.begin();
p != pg_map.osd_stat.end();
p++)
<< "\t" << p->second.kb_used
<< "\t" << p->second.kb_avail
<< "\t" << p->second.kb
+ << "\t" << p->second.hb_in
+ << "\t" << p->second.hb_out
<< std::endl;
while (!ss.eof()) {
string s;
m->osd_stat.kb_used = (stbuf.f_blocks - stbuf.f_bfree) * stbuf.f_bsize / 1024;
m->osd_stat.kb_avail = stbuf.f_bavail * stbuf.f_bsize / 1024;
m->osd_stat.num_objects = stbuf.f_files;
+ for (set<int>::iterator p = heartbeat_from.begin(); p != heartbeat_from.end(); p++)
+ m->osd_stat.hb_in.push_back(*p);
+ for (set<int>::iterator p = heartbeat_to.begin(); p != heartbeat_to.end(); p++)
+ m->osd_stat.hb_out.push_back(*p);
dout(20) << " osd_stat " << m->osd_stat << dendl;
int mon = monmap->pick_mon();
if (is_primary()) {
// update our stat summary
pg_stats_valid = true;
- pg_stats.reported = info.last_update;
+ pg_stats.version = info.last_update;
+ pg_stats.reported = osd->osdmap->get_epoch();
pg_stats.state = state;
pg_stats.num_bytes = stat_num_bytes;
pg_stats.num_kb = stat_num_kb;
+ pg_stats.acting = acting;
} else {
pg_stats_valid = false;
}
int64_t kb;
int64_t kb_used, kb_avail;
int64_t num_objects;
+ vector<int> hb_in, hb_out;
osd_stat_t() : kb(0), kb_used(0), kb_avail(0), num_objects(0) {}
::encode(kb_used, bl);
::encode(kb_avail, bl);
::encode(num_objects, bl);
+ ::encode(hb_in, bl);
+ ::encode(hb_out, bl);
}
void decode(bufferlist::iterator &bl) {
::decode(kb, bl);
::decode(kb_used, bl);
::decode(kb_avail, bl);
::decode(num_objects, bl);
+ ::decode(hb_in, bl);
+ ::decode(hb_out, bl);
}
};
WRITE_CLASS_ENCODER(osd_stat_t)
inline ostream& operator<<(ostream& out, const osd_stat_t& s) {
return out << "osd_stat(" << (s.kb_used) << "/" << s.kb << " KB used, "
<< s.kb_avail << " avail, "
- << s.num_objects << " objects)";
+ << s.num_objects << " objects, "
+ << "peers " << s.hb_in << "/" << s.hb_out << ")";
}
* aggregate stats for a single PG.
*/
struct pg_stat_t {
- eversion_t reported;
- epoch_t created;
+ eversion_t version;
+ epoch_t reported, created;
pg_t parent;
int32_t parent_split_bits;
int32_t state;
int64_t num_bytes; // in bytes
int64_t num_kb; // in KB
int64_t num_objects;
+ vector<int> acting;
void encode(bufferlist &bl) const {
+ ::encode(version, bl);
::encode(reported, bl);
::encode(created, bl);
::encode(parent, bl);
::encode(num_bytes, bl);
::encode(num_kb, bl);
::encode(num_objects, bl);
+ ::encode(acting, bl);
}
void decode(bufferlist::iterator &bl) {
+ ::decode(version, bl);
::decode(reported, bl);
::decode(created, bl);
::decode(parent, bl);
::decode(num_bytes, bl);
::decode(num_kb, bl);
::decode(num_objects, bl);
+ ::decode(acting, bl);
}
- pg_stat_t() : created(0), parent_split_bits(0), state(0), num_bytes(0), num_kb(0), num_objects(0) {}
+ pg_stat_t() : reported(0), created(0), parent_split_bits(0), state(0), num_bytes(0), num_kb(0), num_objects(0) {}
};
WRITE_CLASS_ENCODER(pg_stat_t)