From 9ca1b706784dcf122259b3a0caa847a03c67ac00 Mon Sep 17 00:00:00 2001 From: Kefu Chai Date: Mon, 18 Mar 2019 13:42:46 +0800 Subject: [PATCH] messages,osd: remove MPGStats::had_map_for MPGStats::had_map_for was added back in 7844d0e5, the last release that still checks this field was mimic -- monitor sends OSD incremental osdmaps if the monitor finds that the pg_stats' had_map_for is greater than 30 and the epoch is less than that of latest osdmap. but DaemonServer as the new consumer of MPGStats does not check had_map_for anymore -- it simply updates the cluster state with the pg_stats reported by OSD. and we directs OSD to mgr for sending pg_stats since mimic. so, we can safely drop the support of had_map_for in octopus, as it has been 2 releases. Signed-off-by: Kefu Chai --- src/messages/MPGStats.h | 11 +++++------ src/osd/OSD.cc | 5 +---- src/osd/OSD.h | 1 - src/test/mon/test_mon_workloadgen.cc | 3 +-- 4 files changed, 7 insertions(+), 13 deletions(-) diff --git a/src/messages/MPGStats.h b/src/messages/MPGStats.h index ca907a48aa0..4bf7afda5c5 100644 --- a/src/messages/MPGStats.h +++ b/src/messages/MPGStats.h @@ -29,14 +29,12 @@ public: osd_stat_t osd_stat; map pool_stat; epoch_t epoch = 0; - utime_t had_map_for; MPGStats() : MessageInstance(MSG_PGSTATS, 0, HEAD_VERSION, COMPAT_VERSION) {} - MPGStats(const uuid_d& f, epoch_t e, utime_t had) + MPGStats(const uuid_d& f, epoch_t e) : MessageInstance(MSG_PGSTATS, 0, HEAD_VERSION, COMPAT_VERSION), fsid(f), - epoch(e), - had_map_for(had) + epoch(e) {} private: @@ -55,7 +53,7 @@ public: encode(osd_stat, payload, features); encode(pg_stat, payload); encode(epoch, payload); - encode(had_map_for, payload); + encode(utime_t{}, payload); encode(pool_stat, payload, features); } void decode_payload() override { @@ -65,7 +63,8 @@ public: decode(osd_stat, p); decode(pg_stat, p); decode(epoch, p); - decode(had_map_for, p); + utime_t dummy; + decode(dummy, p); if (header.version >= 2) decode(pool_stat, p); } diff --git a/src/osd/OSD.cc b/src/osd/OSD.cc index 25425dd8087..fb40671d71e 100644 --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@ -7628,11 +7628,10 @@ MPGStats* OSD::collect_pg_stats() // their stats are always enqueued for sending. RWLock::RLocker l(map_lock); - utime_t had_for = ceph_clock_now() - had_map_since; osd_stat_t cur_stat = service.get_osd_stat(); cur_stat.os_perf_stat = store->get_cur_stats(); - auto m = new MPGStats(monc->get_fsid(), osdmap->get_epoch(), had_for); + auto m = new MPGStats(monc->get_fsid(), osdmap->get_epoch()); m->osd_stat = cur_stat; std::lock_guard lec{min_last_epoch_clean_lock}; @@ -8208,8 +8207,6 @@ void OSD::_committed_osd_maps(epoch_t first, epoch_t last, MOSDMap *m) } } - had_map_since = ceph_clock_now(); - epoch_t _bind_epoch = service.get_bind_epoch(); if (osdmap->is_up(whoami) && osdmap->get_addrs(whoami).legacy_equals( diff --git a/src/osd/OSD.h b/src/osd/OSD.h index 68c00f4fc0a..12ceefc9f5f 100644 --- a/src/osd/OSD.h +++ b/src/osd/OSD.h @@ -1855,7 +1855,6 @@ protected: pool_pg_num_history_t pg_num_history; - utime_t had_map_since; RWLock map_lock; list waiting_for_osdmap; deque osd_markdown_log; diff --git a/src/test/mon/test_mon_workloadgen.cc b/src/test/mon/test_mon_workloadgen.cc index 666342c979e..70b23dd3a93 100644 --- a/src/test/mon/test_mon_workloadgen.cc +++ b/src/test/mon/test_mon_workloadgen.cc @@ -537,8 +537,7 @@ class OSDStub : public TestStub void send_pg_stats() { dout(10) << __func__ << " pgs " << pgs.size() << " osdmap " << osdmap << dendl; - utime_t now = ceph_clock_now(); - MPGStats *mstats = new MPGStats(monc.get_fsid(), osdmap.get_epoch(), now); + MPGStats *mstats = new MPGStats(monc.get_fsid(), osdmap.get_epoch()); mstats->set_tid(1); mstats->osd_stat = osd_stat; -- 2.39.5