heartbeat_inst[from] = m->get_source_inst();
if (locked && m->map_epoch)
- _share_map_incoming(m->get_source_inst(), m->map_epoch);
+ _share_map_incoming(m->get_source_inst(), m->map_epoch,
+ (Session*) m->get_connection()->get_priv());
}
if (heartbeat_from.count(from) &&
// only take peer stat or share map now if map_lock is uncontended
if (locked) {
if (m->map_epoch)
- _share_map_incoming(m->get_source_inst(), m->map_epoch);
+ _share_map_incoming(m->get_source_inst(), m->map_epoch,
+ (Session*) m->get_connection()->get_priv());
take_peer_stat(from, m->peer_stat); // only with map_lock held!
}
// --------------------------------------
// dispatch
-bool OSD::_share_map_incoming(const entity_inst_t& inst, epoch_t epoch)
+bool OSD::_share_map_incoming(const entity_inst_t& inst, epoch_t epoch,
+ Session* session)
{
bool shared = false;
dout(20) << "_share_map_incoming " << inst << " " << epoch << dendl;
// does client have old map?
if (inst.name.is_client()) {
- if (epoch < osdmap->get_epoch()) {
+ bool sendmap = epoch < osdmap->get_epoch();
+ if (sendmap && session) {
+ if ( session->last_sent_epoch < osdmap->get_epoch() ) {
+ session->last_sent_epoch = osdmap->get_epoch();
+ }
+ else {
+ sendmap = false; //we don't need to send it out again
+ dout(15) << inst.name << " already sent incremental to update from epoch "<< epoch << dendl;
+ }
+ }
+ if (sendmap) {
dout(10) << inst.name << " has old map " << epoch << " < " << osdmap->get_epoch() << dendl;
send_incremental_map(epoch, inst, true);
shared = true;
}
// share our map with sender, if they're old
- _share_map_incoming(op->get_source_inst(), op->get_map_epoch());
+ _share_map_incoming(op->get_source_inst(), op->get_map_epoch(),
+ (Session*) op->get_connection()->get_priv());
throttle_op_queue();
if (!require_same_or_newer_map(op, op->map_epoch)) return;
// share our map with sender, if they're old
- _share_map_incoming(op->get_source_inst(), op->map_epoch);
+ _share_map_incoming(op->get_source_inst(), op->map_epoch,
+ (Session*)op->get_connection()->get_priv());
if (!_have_pg(pgid)) {
// hmm.
if (!require_same_or_newer_map(op, op->get_map_epoch())) return;
// share our map with sender, if they're old
- _share_map_incoming(op->get_source_inst(), op->get_map_epoch());
-
+ _share_map_incoming(op->get_source_inst(), op->get_map_epoch(),
+ (Session*)op->get_connection()->get_priv());
if (!_have_pg(pgid)) {
// hmm.
delete op;
struct Session : public RefCountedObject {
EntityName entity_name;
OSDCaps caps;
+ epoch_t last_sent_epoch;
+
+ Session() : last_sent_epoch(0) {}
};
private:
hash_map<entity_name_t, epoch_t> peer_map_epoch; // FIXME types
- bool _share_map_incoming(const entity_inst_t& inst, epoch_t epoch);
+ bool _share_map_incoming(const entity_inst_t& inst, epoch_t epoch,
+ Session *session = 0);
void _share_map_outgoing(const entity_inst_t& inst);
void wait_for_new_map(Message *m);