pg->put("pg_stat_queue");
continue;
}
- pg->pg_stats_lock.Lock();
- if (pg->pg_stats_valid) {
- m->pg_stat[pg->info.pgid] = pg->pg_stats_stable;
- dout(25) << " sending " << pg->info.pgid << " " << pg->pg_stats_stable.reported << dendl;
+ pg->pg_stats_publish_lock.Lock();
+ if (pg->pg_stats_publish_valid) {
+ m->pg_stat[pg->info.pgid] = pg->pg_stats_publish;
+ dout(25) << " sending " << pg->info.pgid << " " << pg->pg_stats_publish.reported << dendl;
} else {
- dout(25) << " NOT sending " << pg->info.pgid << " " << pg->pg_stats_stable.reported << ", not valid" << dendl;
+ dout(25) << " NOT sending " << pg->info.pgid << " " << pg->pg_stats_publish.reported << ", not valid" << dendl;
}
- pg->pg_stats_lock.Unlock();
+ pg->pg_stats_publish_lock.Unlock();
}
if (!outstanding_pg_stats) {
if (ack->pg_stat.count(pg->info.pgid)) {
eversion_t acked = ack->pg_stat[pg->info.pgid];
- pg->pg_stats_lock.Lock();
- if (acked == pg->pg_stats_stable.reported) {
- dout(25) << " ack on " << pg->info.pgid << " " << pg->pg_stats_stable.reported << dendl;
+ pg->pg_stats_publish_lock.Lock();
+ if (acked == pg->pg_stats_publish.reported) {
+ dout(25) << " ack on " << pg->info.pgid << " " << pg->pg_stats_publish.reported << dendl;
pg->stat_queue_item.remove_myself();
pg->put("pg_stat_queue");
} else {
- dout(25) << " still pending " << pg->info.pgid << " " << pg->pg_stats_stable.reported
+ dout(25) << " still pending " << pg->info.pgid << " " << pg->pg_stats_publish.reported
<< " > acked " << acked << dendl;
}
- pg->pg_stats_lock.Unlock();
+ pg->pg_stats_publish_lock.Unlock();
} else {
- dout(30) << " still pending " << pg->info.pgid << " " << pg->pg_stats_stable.reported << dendl;
+ dout(30) << " still pending " << pg->info.pgid << " " << pg->pg_stats_publish.reported << dendl;
}
}
wake_pg_waiters(pg->info.pgid);
pg->handle_create(&rctx);
pg->write_if_dirty(*rctx.transaction);
- pg->update_stats();
+ pg->publish_stats_to_osd();
pg->unlock();
num_created++;
}
backfill_reserved(0),
backfill_reserving(0),
flushed(false),
- pg_stats_lock("PG::pg_stats_lock"),
- pg_stats_valid(false),
+ pg_stats_publish_lock("PG::pg_stats_publish_lock"),
+ pg_stats_publish_valid(false),
osr(osd->osr_registry.lookup_or_create(p, (stringify(p)))),
finish_sync_event(NULL),
scrub_after_recovery(false),
found_missing = true;
}
if (stats_updated) {
- update_stats();
+ publish_stats_to_osd();
}
dout(20) << "search_for_missing missing " << missing.missing << dendl;
AllReplicasRecovered())));
}
- update_stats();
+ publish_stats_to_osd();
}
// we need to flush this all out before doing anything else..
requeue_ops(replay);
requeue_ops(waiting_for_active);
- update_stats();
+ publish_stats_to_osd();
}
void PG::_activate_committed(epoch_t e)
info.history.last_epoch_started = info.last_epoch_started;
share_pg_info();
- update_stats();
+ publish_stats_to_osd();
queue_peering_event(
CephPeeringEvtRef(
finish_sync_event = 0;
purge_strays();
- update_stats();
+ publish_stats_to_osd();
if (scrub_after_recovery) {
dout(10) << "_finish_recovery requeueing for scrub" << dendl;
osd->need_heartbeat_peer_update();
}
-void PG::update_stats()
+void PG::publish_stats_to_osd()
{
- pg_stats_lock.Lock();
+ pg_stats_publish_lock.Lock();
if (is_primary()) {
// update our stat summary
info.stats.reported.inc(info.history.same_primary_since);
info.stats.log_start = log.tail;
info.stats.ondisk_log_start = log.tail;
- pg_stats_valid = true;
- pg_stats_stable = info.stats;
+ pg_stats_publish_valid = true;
+ pg_stats_publish = info.stats;
// calc copies, degraded
unsigned target = MAX(get_osdmap()->get_pg_size(info.pgid), acting.size());
- pg_stats_stable.stats.calc_copies(target);
- pg_stats_stable.stats.sum.num_objects_degraded = 0;
+ pg_stats_publish.stats.calc_copies(target);
+ pg_stats_publish.stats.sum.num_objects_degraded = 0;
if ((is_degraded() || !is_clean()) && is_active()) {
// NOTE: we only generate copies, degraded, unfound values for
// the summation, not individual stat categories.
- uint64_t num_objects = pg_stats_stable.stats.sum.num_objects;
+ uint64_t num_objects = pg_stats_publish.stats.sum.num_objects;
uint64_t degraded = 0;
degraded += (target - acting.size()) * num_objects;
// missing on primary
- pg_stats_stable.stats.sum.num_objects_missing_on_primary = missing.num_missing();
+ pg_stats_publish.stats.sum.num_objects_missing_on_primary = missing.num_missing();
degraded += missing.num_missing();
for (unsigned i=1; i<acting.size(); i++) {
// not yet backfilled
degraded += num_objects - peer_info[acting[i]].stats.stats.sum.num_objects;
}
- pg_stats_stable.stats.sum.num_objects_degraded = degraded;
- pg_stats_stable.stats.sum.num_objects_unfound = get_num_unfound();
+ pg_stats_publish.stats.sum.num_objects_degraded = degraded;
+ pg_stats_publish.stats.sum.num_objects_unfound = get_num_unfound();
}
- dout(15) << "update_stats " << pg_stats_stable.reported << dendl;
+ dout(15) << "publish_stats_to_osd " << pg_stats_publish.reported << dendl;
} else {
- pg_stats_valid = false;
- dout(15) << "update_stats -- not primary" << dendl;
+ pg_stats_publish_valid = false;
+ dout(15) << "publish_stats_to_osd -- not primary" << dendl;
}
- pg_stats_lock.Unlock();
+ pg_stats_publish_lock.Unlock();
if (is_primary())
osd->pg_stat_queue_enqueue(this);
}
-void PG::clear_stats()
+void PG::clear_publish_stats()
{
dout(15) << "clear_stats" << dendl;
- pg_stats_lock.Lock();
- pg_stats_valid = false;
- pg_stats_lock.Unlock();
+ pg_stats_publish_lock.Lock();
+ pg_stats_publish_valid = false;
+ pg_stats_publish_lock.Unlock();
osd->pg_stat_queue_dequeue(this);
}
state_clear(PG_STATE_SCRUBBING);
state_clear(PG_STATE_REPAIR);
state_clear(PG_STATE_DEEP_SCRUB);
- update_stats();
+ publish_stats_to_osd();
unlock();
return;
}
scrubber.active = true;
scrubber.classic = true;
- update_stats();
+ publish_stats_to_osd();
scrubber.received_maps.clear();
scrubber.epoch_start = info.history.same_interval_since;
case PG::Scrubber::INACTIVE:
dout(10) << "scrub start" << dendl;
- update_stats();
+ publish_stats_to_osd();
scrubber.epoch_start = info.history.same_interval_since;
scrubber.active = true;
state_clear(PG_STATE_SCRUBBING);
state_clear(PG_STATE_REPAIR);
state_clear(PG_STATE_DEEP_SCRUB);
- update_stats();
+ publish_stats_to_osd();
// active -> nothing.
if (scrubber.active)
// old primary?
if (oldrole == 0) {
state_clear(PG_STATE_CLEAN);
- clear_stats();
+ clear_publish_stats();
// take replay queue waiters
list<OpRequestRef> ls;
{
dout(7) << "handle ActMap primary" << dendl;
PG *pg = context< RecoveryMachine >().pg;
- pg->update_stats();
+ pg->publish_stats_to_osd();
pg->take_waiters();
return discard_event();
}
pg->mark_clean();
pg->share_pg_info();
- pg->update_stats();
+ pg->publish_stats_to_osd();
}
pg->state_clear(PG_STATE_DEGRADED);
else
pg->state_set(PG_STATE_DEGRADED);
- pg->update_stats(); // degraded may have changed
+ pg->publish_stats_to_osd(); // degraded may have changed
}
return forward_event();
}
if (!prior_set.get())
pg->build_prior(prior_set);
- pg->update_stats();
+ pg->publish_stats_to_osd();
get_infos();
if (peer_info_requested.empty() && !prior_set->pg_down) {
pg->state_clear(PG_STATE_PEERING);
pg->state_set(PG_STATE_INCOMPLETE);
- pg->update_stats();
+ pg->publish_stats_to_osd();
}
boost::statechart::result PG::RecoveryState::Incomplete::react(const AdvMap &advmap) {