Skip to content

Commit

Permalink
mon: set_healthy_stretch_mode in update_from_paxos, not random leader…
Browse files Browse the repository at this point in the history
… calls!

Add header comment describing how this works now.

Fixes: https://tracker.ceph.com/issues/50308

Signed-off-by: Greg Farnum <gfarnum@redhat.com>
  • Loading branch information
gregsfortytwo committed Apr 13, 2021
1 parent 73b461a commit adbaeee
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/mon/Monitor.cc
Expand Up @@ -6655,7 +6655,6 @@ void Monitor::go_recovery_stretch_mode()
if (!osdmon()->is_writeable()) {
osdmon()->wait_for_writeable_ctx(new CMonGoRecovery(this));
}
set_recovery_stretch_mode();
osdmon()->trigger_recovery_stretch_mode();
}

Expand Down Expand Up @@ -6749,7 +6748,6 @@ void Monitor::trigger_healthy_stretch_mode()
}

ceph_assert(osdmon()->osdmap.recovering_stretch_mode);
set_healthy_stretch_mode();
osdmon()->trigger_healthy_stretch_mode();
monmon()->trigger_healthy_stretch_mode();
}
Expand Down
13 changes: 13 additions & 0 deletions src/mon/Monitor.h
Expand Up @@ -266,6 +266,19 @@ class Monitor : public Dispatcher,
bool is_stretch_mode() { return stretch_mode_engaged; }
bool is_degraded_stretch_mode() { return degraded_stretch_mode; }
bool is_recovering_stretch_mode() { return recovering_stretch_mode; }

/**
* This set of functions maintains the in-memory stretch state
* and sets up transitions of the map states by calling in to
* MonmapMonitor and OSDMonitor.
*
* The [maybe_]go_* functions are called on the leader to
* decide if transitions should happen; the trigger_* functions
* set up the map transitions; and the set_* functions actually
* change the memory state -- but these are only called
* via OSDMonitor::update_from_paxos, to guarantee consistent
* updates across the entire cluster.
*/
void try_engage_stretch_mode();
void maybe_go_degraded_stretch_mode();
void trigger_degraded_stretch_mode(const set<string>& dead_mons,
Expand Down
2 changes: 2 additions & 0 deletions src/mon/OSDMonitor.cc
Expand Up @@ -959,6 +959,8 @@ void OSDMonitor::update_from_paxos(bool *need_bootstrap)
} else {
mon.set_recovery_stretch_mode();
}
} else {
mon.set_healthy_stretch_mode();
}
if (marked_osd_down &&
(!osdmap.degraded_stretch_mode || osdmap.recovering_stretch_mode)) {
Expand Down

0 comments on commit adbaeee

Please sign in to comment.