mon: PaxosService: cache {first,last}_committed versions

Avoid unnecessary overhead from looking them up on-disk every time.

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
mon: Monitor: update PaxosService's cached values before update_from_paxos

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
mon: PaxosService: add refresh() to update_from_paxos & update cached vers

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
mon: Monitor: add finish_paxos_proposal()

Calls PaxosService::refresh() on all services once any Paxos proposal
is finished.

This introduces yet another cycle in the class dependency graph, but it's
the simplest and more easily followed option from all those I could come
up with after discussing this with Sage.

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
mon: Paxos: call Monitor::finish_paxos_proposal() upon finishing a proposal

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
mon: PaxosService: no need to update_from_paxos() everytime now

Given Paxos will inform the monitor it should refresh all PaxosServices
upon finishing a proposal, we no longer need to keep on updating from
paxos just because we *might* have something new there.

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
mon: Monitor: refresh() services on init_paxos()

Signed-off-by: Joao Eduardo Luis <joao.luis@inktank.com>
rename to update_from_paxos()

call it before doing the completions, so that everyone sees up to date
state
remvoe unnecessary update_from_paxos calls

the refresh() will do this when the state changes; no need to
opportunistically call it hte rest of hte time
not needed?  seems fragile, and makes for a weaker invariant.  better to
say the paxosservices will always be in sync with the committed paxos
state.
simplify update_cached_versions

no other callers
mon: debug proposal timers

Signed-off-by: Sage Weil <sage@inktank.com>
mon: no need to refresh from _active

The refresh is done explicitly by the monitor, independent of the more
fragile PaxosService callbacks.

Signed-off-by: Sage Weil <sage@inktank.com>
mon/Paxos: do paxos refresh in finish_proposal; and refactor

Do the paxos refresh inside finish_proposal, ordered *after* the leader
assertion so that MonmapMonitor::update_from_paxos() calling bootstrap()
does not kill us.

Also, remove unnecessary finish_queued_proposal() and move the logic inline
where the bad leader assertion is obvious.

Signed-off-by: Sage Weil <sage@inktank.com>
mon: fix whitespace

Signed-off-by: Sage Weil <sage@inktank.com>
mon/MonmapMonitor: fix typo in check to remove mkfs info

Signed-off-by: Sage Weil <sage@inktank.com>
mon: safely signal bootstrap from MonmapMonitor::update_from_paxos()

Signed-off-by: Sage Weil <sage@inktank.com>
mon/MonmapMonitor: remove some dead code

Signed-off-by: Sage Weil <sage@inktank.com>
mon/Paxos: go active *after* refreshing

The update_from_paxos() methods occasionally like to trigger new activity.
As long as they check is_readable() and is_writeable(), they will defer
until we go active and that activity will happen in the normal callbacks.

This fixes the problem where we active but is_writeable() is still false,
triggered by PGMonitor::check_osd_map().

Signed-off-by: Sage Weil <sage@inktank.com>
mon: simplify Monitor::init_paxos()

Signed-off-by: Sage Weil <sage@inktank.com>