Skip to content

Commit

Permalink
mon: no delay for single message MSG_ALIVE and MSG_PGTEMP
Browse files Browse the repository at this point in the history
delay and batch proposed as before if lots of messages arrive at the same time

if too many messages are MSG_ALIVE and MSG_PGTEMP, wait a long period as before

Signed-off-by: yaoning <yaoning@unitedstack.com>
  • Loading branch information
yaoning committed Jan 12, 2017
1 parent ab9d375 commit ca65210
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/mon/OSDMonitor.cc
Expand Up @@ -80,6 +80,7 @@ OSDMonitor::OSDMonitor(CephContext *cct, Monitor *mn, Paxos *p, const string& se
cct(cct),
inc_osd_cache(g_conf->mon_osd_cache_size),
full_osd_cache(g_conf->mon_osd_cache_size),
last_attempted_minwait_time(utime_t()),
op_tracker(cct, true, 1)
{}

Expand Down Expand Up @@ -1364,6 +1365,22 @@ bool OSDMonitor::should_propose(double& delay)
return true;
}

// propose as fast as possible if updating up_thru or pg_temp
// want to merge OSDMap changes as much as possible
if ((pending_inc.new_primary_temp.size() == 1
|| pending_inc.new_up_thru.size() == 1)
&& pending_inc.new_state.size() < 2) {
dout(15) << " propose as fast as possible for up_thru/pg_temp" << dendl;

utime_t now = ceph_clock_now();
if (now - last_attempted_minwait_time > g_conf->paxos_propose_interval
&& now - paxos->get_last_commit_time() > g_conf->paxos_min_wait) {
delay = g_conf->paxos_min_wait;
last_attempted_minwait_time = now;
return true;
}
}

return PaxosService::should_propose(delay);
}

Expand Down
3 changes: 3 additions & 0 deletions src/mon/OSDMonitor.h
Expand Up @@ -131,6 +131,9 @@ class OSDMonitor : public PaxosService {
bool check_failure(utime_t now, int target_osd, failure_info_t& fi);
void force_failure(utime_t now, int target_osd);

// the time of last msg(MSG_ALIVE and MSG_PGTEMP) proposed without delay
utime_t last_attempted_minwait_time;

bool _have_pending_crush();
CrushWrapper &_get_stable_crush();
void _get_pending_crush(CrushWrapper& newcrush);
Expand Down
8 changes: 8 additions & 0 deletions src/mon/Paxos.h
Expand Up @@ -1212,6 +1212,14 @@ class Paxos {
* @return the first committed version
*/
version_t get_first_committed() { return first_committed; }
/**
* Get the last commit time
*
* @returns Our last commit time
*/
utime_t get_last_commit_time() const{
return last_commit_time;
}
/**
* Check if a given version is readable.
*
Expand Down

0 comments on commit ca65210

Please sign in to comment.