ceph/ceph — pull request #299 by jecluis (2013-05-17 18:00:08+00:00)
Title: mon: Paxos: handle all pending proposals before we bootstrap

We were already taking into account our need to propose any pending
proposals before we went ahead to bootstrap the monitor, while guaranteeing
that no other proposals would be proposed in the meantime by considering
the need to bootstrap in our 'is_active()' condition on PaxosService.

However, we were asserting on propose_pending() whenever it was called
from the proposal_timer, which could be scheduled in-between delaying a
proposal and finding out about our need to bootstrap.

The easy fix would be to bootstrap on propose_pending() if we were to
notice that we had been marked in such need. However, this would mean
losing the pending value, and that is not acceptable.

This patch refactors the previous approach, forcing services to request
a bootstrap to the Monitor class instead of doing it to the Paxos class.
This allows the Monitor to force all PaxosServices to flush their proposals
as soon as possible, if there are any to be flushed. Once all services
acknowledge they have successfully proposed their pending state, the
Monitor will let Paxos know it should bootstrap, allowing Paxos to
finish any proposal it may have going on (this should however only happen
during early stages of Paxos recovery), and then bootstrap once it's
active.

Peons will follow the same behavior. However, a peon's Paxos instance
will never bootstrap. This allows us to flush all the leader's proposals
before the leader indeed decides to bootstrap, at which point all peons
should follow suit.

Fixes: #5102

Signed-off-by: Joao Eduardo Luis