Skip to content

Commit

Permalink
Merge pull request ceph#3142 from ceph/wip-10220
Browse files Browse the repository at this point in the history
mon: suspend proposing paxos values when flushing pending writes

Reviewed-by: Sage Weil <[email protected]>
  • Loading branch information
liewegas committed Dec 15, 2014
2 parents 1396e55 + 1853461 commit a282f7e
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/common/config_opts.h
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,8 @@ OPTION(mon_mds_force_trim_to, OPT_INT, 0) // force mon to trim mdsmaps to this
// dump transactions
OPTION(mon_debug_dump_transactions, OPT_BOOL, false)
OPTION(mon_debug_dump_location, OPT_STR, "/var/log/ceph/$cluster-$name.tdump")
OPTION(mon_inject_transaction_delay_max, OPT_DOUBLE, 10.0) // seconds
OPTION(mon_inject_transaction_delay_probability, OPT_DOUBLE, 0) // range [0, 1]

OPTION(mon_sync_provider_kill_at, OPT_INT, 0) // kill the sync provider at a specific point in the work flow
OPTION(mon_sync_requester_kill_at, OPT_INT, 0) // kill the sync requester at a specific point in the work flow
Expand Down
18 changes: 18 additions & 0 deletions src/mon/MonitorDBStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,24 @@ class MonitorDBStore
: store(s), t(t), oncommit(f)
{}
void finish(int r) {
/* The store serializes writes. Each transaction is handled
* sequentially by the io_work Finisher. If a transaction takes longer
* to apply its state to permanent storage, then no other transaction
* will be handled meanwhile.
*
* We will now randomly inject random delays. We can safely sleep prior
* to applying the transaction as it won't break the model.
*/
double delay_prob = g_conf->mon_inject_transaction_delay_probability;
if (delay_prob && (rand() % 10000 < delay_prob * 10000.0)) {
utime_t delay;
double delay_max = g_conf->mon_inject_transaction_delay_max;
delay.set_from_double(delay_max * (double)(rand() % 10000) / 10000.0);
lsubdout(g_ceph_context, mon, 1)
<< "apply_transaction will be delayed for " << delay
<< " seconds" << dendl;
delay.sleep();
}
int ret = store->apply_transaction(t);
oncommit->complete(ret);
}
Expand Down
14 changes: 8 additions & 6 deletions src/mon/Paxos.cc
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,12 @@ void Paxos::commit_start()
state = STATE_WRITING;
else
assert(0);

if (mon->get_quorum().size() > 1) {
// cancel timeout event
mon->timer.cancel_event(accept_timeout_event);
accept_timeout_event = 0;
}
}

void Paxos::commit_finish()
Expand Down Expand Up @@ -900,16 +906,12 @@ void Paxos::commit_finish()

if (do_refresh()) {
commit_proposal();

finish_contexts(g_ceph_context, waiting_for_commit);

if (mon->get_quorum().size() > 1) {
// cancel timeout event
mon->timer.cancel_event(accept_timeout_event);
accept_timeout_event = 0;
extend_lease();
}

finish_contexts(g_ceph_context, waiting_for_commit);

assert(g_conf->paxos_kill_at != 10);

finish_round();
Expand Down

0 comments on commit a282f7e

Please sign in to comment.