// update pg count now since we might not get an osdmap any time soon.
if (pg->is_primary())
service.logger->dec(l_osd_pg_primary);
- else if (pg->is_replica())
- service.logger->dec(l_osd_pg_replica);
+ else if (pg->is_nonprimary())
+ service.logger->dec(l_osd_pg_replica); // misnomver
else
service.logger->dec(l_osd_pg_stray);
// any time soon.
if (pg->is_primary())
logger->dec(l_osd_pg_primary);
- else if (pg->is_replica())
- logger->dec(l_osd_pg_replica);
+ else if (pg->is_nonprimary())
+ logger->dec(l_osd_pg_replica); // misnomer
else
logger->dec(l_osd_pg_stray);
}
// racy, but we don't want to take pg lock here.
if (pg->is_primary())
num_pg_primary++;
- else if (pg->is_replica())
- num_pg_replica++;
+ else if (pg->is_nonprimary())
+ num_pg_replica++; // misnomer
else
num_pg_stray++;
}
bool is_deleted() const {
return recovery_state.is_deleted();
}
- bool is_replica() const {
- return recovery_state.is_replica();
+ bool is_nonprimary() const {
+ return recovery_state.is_nonprimary();
}
bool is_primary() const {
return recovery_state.is_primary();
pg_shard_t old_acting_primary = get_primary();
pg_shard_t old_up_primary = up_primary;
bool was_old_primary = is_primary();
- bool was_old_replica = is_replica();
+ bool was_old_nonprimary = is_nonprimary();
acting.swap(oldacting);
up.swap(oldup);
// reset primary/replica state?
if (was_old_primary || is_primary()) {
pl->clear_want_pg_temp();
- } else if (was_old_replica || is_replica()) {
+ } else if (was_old_nonprimary || is_nonprimary()) {
pl->clear_want_pg_temp();
}
clear_primary_state();
hb_stamps[i++] = pl->get_hb_stamps(p);
}
hb_stamps.resize(i);
- } else if (is_replica()) {
+ } else if (is_nonprimary()) {
// we care about just the primary
hb_stamps.resize(1);
hb_stamps[0] = pl->get_hb_stamps(get_primary().osd);
void PeeringState::proc_lease(const pg_lease_t& l)
{
- if (get_role() < 0) {
+ if (!is_nonprimary()) {
return;
}
psdout(10) << __func__ << " " << l << dendl;
const PastIntervals& get_past_intervals() const {
return past_intervals;
}
- bool is_replica() const {
- return role > 0;
+ /// acting osd that is not the primary
+ bool is_nonprimary() const {
+ return role >= 0 && pg_whoami != primary;
}
+ /// primary osd
bool is_primary() const {
return pg_whoami == primary;
}
op->may_read() &&
!(op->may_write() || op->may_cache())) {
// balanced reads; any replica will do
- if (!(is_primary() || is_replica())) {
+ if (!(is_primary() || is_nonprimary())) {
osd->handle_misdirected_op(this, op);
return;
}