}
}
- if (role == 0) { // primary state
+ if (is_primary()) {
last_update_ondisk = info.last_update;
min_last_complete_ondisk = eversion_t(0,0); // we don't know (yet)!
}
assert(is_locked());
set<int> new_peers;
- if (role == 0) {
+ if (is_primary()) {
for (unsigned i=0; i<acting.size(); i++)
new_peers.insert(acting[i]);
for (unsigned i=0; i<up.size(); i++)
vector<int> oldacting, oldup;
int oldrole = get_role();
int oldprimary = get_primary();
+ bool was_old_primary = is_primary();
acting.swap(oldacting);
up.swap(oldup);
actingbackfill.clear();
// reset primary state?
- if (oldrole == 0 || get_role() == 0)
+ if (was_old_primary || is_primary())
clear_primary_state();
assert(!deleting);
- if (role != oldrole) {
- // old primary?
- if (oldrole == 0) {
+ if (role != oldrole ||
+ was_old_primary != is_primary()) {
+ // did primary change?
+ if (was_old_primary != is_primary()) {
state_clear(PG_STATE_CLEAN);
clear_publish_stats();
requeue_ops(waiting_for_active);
// should we tell the primary we are here?
- send_notify = (role != 0);
+ send_notify = !is_primary();
} else {
// no role change.
if (pg.last_complete_ondisk != pg.info.last_complete)
out << " lcod " << pg.last_complete_ondisk;
- if (pg.get_role() == 0) {
+ if (pg.is_primary()) {
out << " mlcod " << pg.min_last_complete_ondisk;
}
PG *pg = context< RecoveryMachine >().pg;
// do we tell someone we're here?
- pg->send_notify = (pg->role != 0);
+ pg->send_notify = (!pg->is_primary());
return transit< Reset >();
}