Skip to content

Commit

Permalink
Merge pull request ceph#9874 from athanatos/wip-16185
Browse files Browse the repository at this point in the history
OSDMonitor::prepare_pgtemp: only update up_thru if newer

Reviewed-by: Sage Weil <[email protected]>
  • Loading branch information
athanatos authored Jun 22, 2016
2 parents 55d5392 + 5f2bd7b commit 8833e8e
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/mon/OSDMonitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2270,7 +2270,8 @@ bool OSDMonitor::prepare_alive(MonOpRequestRef op)

dout(7) << "prepare_alive want up_thru " << m->want << " have " << m->version
<< " from " << m->get_orig_source_inst() << dendl;
pending_inc.new_up_thru[from] = m->version; // set to the latest map the OSD has

update_up_thru(from, m->version); // set to the latest map the OSD has
wait_for_finished_proposal(op, new C_ReplyMap(this, op, m->version));
return true;
}
Expand Down Expand Up @@ -2373,6 +2374,19 @@ bool OSDMonitor::preprocess_pgtemp(MonOpRequestRef op)
return true;
}

void OSDMonitor::update_up_thru(int from, epoch_t up_thru)
{
epoch_t old_up_thru = osdmap.get_up_thru(from);
auto ut = pending_inc.new_up_thru.find(from);
if (ut != pending_inc.new_up_thru.end()) {
old_up_thru = ut->second;
}
if (up_thru > old_up_thru) {
// set up_thru too, so the osd doesn't have to ask again
pending_inc.new_up_thru[from] = up_thru;
}
}

bool OSDMonitor::prepare_pgtemp(MonOpRequestRef op)
{
op->mark_osdmon_event(__func__);
Expand Down Expand Up @@ -2400,7 +2414,10 @@ bool OSDMonitor::prepare_pgtemp(MonOpRequestRef op)
pending_inc.new_primary_temp.count(p->first))
pending_inc.new_primary_temp[p->first] = -1;
}
pending_inc.new_up_thru[from] = m->map_epoch; // set up_thru too, so the osd doesn't have to ask again

// set up_thru too, so the osd doesn't have to ask again
update_up_thru(from, m->map_epoch);

wait_for_finished_proposal(op, new C_ReplyMap(this, op, m->map_epoch));
return true;
}
Expand Down
1 change: 1 addition & 0 deletions src/mon/OSDMonitor.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ class OSDMonitor : public PaxosService {
bool prepare_boot(MonOpRequestRef op);
void _booted(MonOpRequestRef op, bool logit);

void update_up_thru(int from, epoch_t up_thru);
bool preprocess_alive(MonOpRequestRef op);
bool prepare_alive(MonOpRequestRef op);
void _reply_map(MonOpRequestRef op, epoch_t e);
Expand Down

0 comments on commit 8833e8e

Please sign in to comment.