Skip to content

Commit 633e6b2

Browse files
committed
crimson/osd: OSDBeacon to report lec
See: ceph#14504 Signed-off-by: Matan Breizman <[email protected]>
1 parent 8093184 commit 633e6b2

File tree

5 files changed

+20
-11
lines changed

5 files changed

+20
-11
lines changed

src/crimson/mgr/client.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace crimson::mgr
2424
// implement WithStats if you want to report stats to mgr periodically
2525
class WithStats {
2626
public:
27-
virtual seastar::future<MessageURef> get_stats() const = 0;
27+
virtual seastar::future<MessageURef> get_stats() = 0;
2828
virtual ~WithStats() {}
2929
};
3030

src/crimson/osd/osd.cc

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -883,13 +883,20 @@ void OSD::update_stats()
883883
});
884884
}
885885

886-
seastar::future<MessageURef> OSD::get_stats() const
886+
seastar::future<MessageURef> OSD::get_stats()
887887
{
888888
// MPGStats::had_map_for is not used since PGMonitor was removed
889889
auto m = crimson::make_message<MPGStats>(monc->get_fsid(), osdmap->get_epoch());
890890
m->osd_stat = osd_stat;
891891
return pg_shard_manager.get_pg_stats(
892-
).then([m=std::move(m)](auto &&stats) mutable {
892+
).then([this, m=std::move(m)](auto &&stats) mutable {
893+
min_last_epoch_clean = osdmap->get_epoch();
894+
min_last_epoch_clean_pgs.clear();
895+
for (auto [pgid, stat] : stats) {
896+
min_last_epoch_clean = std::min(min_last_epoch_clean,
897+
stat.get_effective_last_epoch_clean());
898+
min_last_epoch_clean_pgs.push_back(pgid);
899+
}
893900
m->pg_stat = std::move(stats);
894901
return seastar::make_ready_future<MessageURef>(std::move(m));
895902
});
@@ -1283,14 +1290,13 @@ seastar::future<> OSD::send_beacon()
12831290
if (!pg_shard_manager.is_active()) {
12841291
return seastar::now();
12851292
}
1286-
// FIXME: min lec should be calculated from pg_stat
1287-
// and should set m->pgs
1288-
epoch_t min_last_epoch_clean = osdmap->get_epoch();
1289-
auto m = crimson::make_message<MOSDBeacon>(osdmap->get_epoch(),
1293+
auto beacon = crimson::make_message<MOSDBeacon>(osdmap->get_epoch(),
12901294
min_last_epoch_clean,
12911295
superblock.last_purged_snaps_scrub,
12921296
local_conf()->osd_beacon_report_interval);
1293-
return monc->send_message(std::move(m));
1297+
beacon->pgs = min_last_epoch_clean_pgs;
1298+
logger().debug("{} {}", __func__, *beacon);
1299+
return monc->send_message(std::move(beacon));
12941300
}
12951301

12961302
seastar::future<> OSD::update_heartbeat_peers()

src/crimson/osd/osd.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,11 @@ class OSD final : public crimson::net::Dispatcher,
106106
// pg statistics including osd ones
107107
osd_stat_t osd_stat;
108108
uint32_t osd_stat_seq = 0;
109+
epoch_t min_last_epoch_clean = 0;
110+
// which pgs were scanned for min_lec
111+
std::vector<pg_t> min_last_epoch_clean_pgs;
109112
void update_stats();
110-
seastar::future<MessageURef> get_stats() const final;
113+
seastar::future<MessageURef> get_stats() final;
111114

112115
// AuthHandler methods
113116
void handle_authentication(const EntityName& name,

src/crimson/osd/shard_services.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ seastar::future<> PerShardState::stop_pgs()
7272
});
7373
}
7474

75-
std::map<pg_t, pg_stat_t> PerShardState::get_pg_stats() const
75+
std::map<pg_t, pg_stat_t> PerShardState::get_pg_stats()
7676
{
7777
assert_core();
7878
std::map<pg_t, pg_stat_t> ret;

src/crimson/osd/shard_services.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class PerShardState {
119119
PGMap pg_map;
120120

121121
seastar::future<> stop_pgs();
122-
std::map<pg_t, pg_stat_t> get_pg_stats() const;
122+
std::map<pg_t, pg_stat_t> get_pg_stats();
123123
seastar::future<> broadcast_map_to_pgs(
124124
ShardServices &shard_services,
125125
epoch_t epoch);

0 commit comments

Comments
 (0)