mirror of
https://github.com/ceph/ceph
synced 2024-12-19 09:57:05 +00:00
Merge pull request #3835 from ceph/wip-mon-datahealth-fix.hammer
[hammer] mon: initialize data store stats structs to avoid weird behaviors
This commit is contained in:
commit
3a1ba9368f
@ -30,6 +30,13 @@ struct ceph_data_stats
|
||||
uint64_t byte_avail;
|
||||
int avail_percent;
|
||||
|
||||
ceph_data_stats() :
|
||||
byte_total(0),
|
||||
byte_used(0),
|
||||
byte_avail(0),
|
||||
avail_percent(0)
|
||||
{ }
|
||||
|
||||
void dump(Formatter *f) const {
|
||||
assert(f != NULL);
|
||||
f->dump_int("total", byte_total);
|
||||
@ -37,6 +44,33 @@ struct ceph_data_stats
|
||||
f->dump_int("avail", byte_avail);
|
||||
f->dump_int("avail_percent", avail_percent);
|
||||
}
|
||||
|
||||
void encode(bufferlist &bl) const {
|
||||
ENCODE_START(1, 1, bl);
|
||||
::encode(byte_total, bl);
|
||||
::encode(byte_used, bl);
|
||||
::encode(byte_avail, bl);
|
||||
::encode(avail_percent, bl);
|
||||
ENCODE_FINISH(bl);
|
||||
}
|
||||
|
||||
void decode(bufferlist::iterator &p) {
|
||||
DECODE_START(1, p);
|
||||
::decode(byte_total, p);
|
||||
::decode(byte_used, p);
|
||||
::decode(byte_avail, p);
|
||||
::decode(avail_percent, p);
|
||||
DECODE_FINISH(p);
|
||||
}
|
||||
|
||||
static void generate_test_instances(list<ceph_data_stats*>& ls) {
|
||||
ls.push_back(new ceph_data_stats);
|
||||
ls.push_back(new ceph_data_stats);
|
||||
ls.back()->byte_total = 1024*1024;
|
||||
ls.back()->byte_used = 512*1024;
|
||||
ls.back()->byte_avail = 512*1024;
|
||||
ls.back()->avail_percent = 50;
|
||||
}
|
||||
};
|
||||
typedef struct ceph_data_stats ceph_data_stats_t;
|
||||
|
||||
|
@ -56,6 +56,13 @@ struct LevelDBStoreStats {
|
||||
uint64_t bytes_misc;
|
||||
utime_t last_update;
|
||||
|
||||
LevelDBStoreStats() :
|
||||
bytes_total(0),
|
||||
bytes_sst(0),
|
||||
bytes_log(0),
|
||||
bytes_misc(0)
|
||||
{}
|
||||
|
||||
void dump(Formatter *f) const {
|
||||
assert(f != NULL);
|
||||
f->dump_int("bytes_total", bytes_total);
|
||||
@ -84,6 +91,16 @@ struct LevelDBStoreStats {
|
||||
::decode(last_update, p);
|
||||
DECODE_FINISH(p);
|
||||
}
|
||||
|
||||
static void generate_test_instances(list<LevelDBStoreStats*>& ls) {
|
||||
ls.push_back(new LevelDBStoreStats);
|
||||
ls.push_back(new LevelDBStoreStats);
|
||||
ls.back()->bytes_total = 1024*1024;
|
||||
ls.back()->bytes_sst = 512*1024;
|
||||
ls.back()->bytes_log = 256*1024;
|
||||
ls.back()->bytes_misc = 256*1024;
|
||||
ls.back()->last_update = utime_t();
|
||||
}
|
||||
};
|
||||
WRITE_CLASS_ENCODER(LevelDBStoreStats)
|
||||
|
||||
|
@ -4,6 +4,9 @@ TYPE(CompatSet)
|
||||
#include "include/filepath.h"
|
||||
TYPE(filepath)
|
||||
|
||||
#include "include/util.h"
|
||||
TYPE(ceph_data_stats)
|
||||
|
||||
#include "common/bit_vector.hpp"
|
||||
TYPE(BitVector<2>)
|
||||
|
||||
@ -129,6 +132,9 @@ TYPE_FEATUREFUL(MonMap)
|
||||
#include "mon/MonCap.h"
|
||||
TYPE(MonCap)
|
||||
|
||||
#include "mon/mon_types.h"
|
||||
TYPE(LevelDBStoreStats)
|
||||
|
||||
#include "os/DBObjectMap.h"
|
||||
TYPE(DBObjectMap::_Header)
|
||||
TYPE(DBObjectMap::State)
|
||||
|
Loading…
Reference in New Issue
Block a user