diff options
author | Sage Weil <sage@inktank.com> | 2013-07-29 17:14:57 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-07-29 17:14:57 -0700 |
commit | b8af38b6fc161691d637631d9ce8ab84fb3d27c7 (patch) | |
tree | 4b68e663e8f92901338761295baaa157ed810f90 | |
parent | 634dcf3362a068b0b459cc64bd31db7768a1388b (diff) | |
download | ceph-b8af38b6fc161691d637631d9ce8ab84fb3d27c7.tar.gz |
mon: allow others to sync from us across bootstrap calls
If someone is syncing from us and there is an election, they currently get
reset and have to restart their sync. This can lead to situations where
they can never finish, e.g., when the load from them syncing makes us time
out commits and call elections.
There is nothing that changes during bootstrap that would prevent a sync
from proceeding. The only time we need to stop providing is when we
ourselves decide to sync from someone else; modify that reset call to
reset provider state. All other resets become requester resets.
Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r-- | src/mon/Monitor.cc | 18 | ||||
-rw-r--r-- | src/mon/Monitor.h | 10 |
2 files changed, 18 insertions, 10 deletions
diff --git a/src/mon/Monitor.cc b/src/mon/Monitor.cc index 3b19b514054..2c21e6eac69 100644 --- a/src/mon/Monitor.cc +++ b/src/mon/Monitor.cc @@ -619,7 +619,7 @@ void Monitor::bootstrap() { dout(10) << "bootstrap" << dendl; - sync_reset(); + sync_reset_requester(); unregister_cluster_logger(); cancel_probe_timeout(); @@ -806,23 +806,27 @@ void Monitor::sync_obtain_latest_monmap(bufferlist &bl) latest_monmap.encode(bl, CEPH_FEATURES_ALL); } -void Monitor::sync_reset() +void Monitor::sync_reset_requester() { + dout(10) << __func__ << dendl; + if (sync_timeout_event) { timer.cancel_event(sync_timeout_event); sync_timeout_event = NULL; } - // leader state - sync_providers.clear(); - - // requester state sync_provider = entity_inst_t(); sync_cookie = 0; sync_full = false; sync_start_version = 0; } +void Monitor::sync_reset_provider() +{ + dout(10) << __func__ << dendl; + sync_providers.clear(); +} + void Monitor::sync_start(entity_inst_t &other, bool full) { dout(10) << __func__ << " " << other << (full ? " full" : " recent") << dendl; @@ -832,7 +836,7 @@ void Monitor::sync_start(entity_inst_t &other, bool full) state = STATE_SYNCHRONIZING; // make sure are not a provider for anyone! - sync_reset(); + sync_reset_provider(); sync_full = full; diff --git a/src/mon/Monitor.h b/src/mon/Monitor.h index bed48ecee34..35975e7a90f 100644 --- a/src/mon/Monitor.h +++ b/src/mon/Monitor.h @@ -301,10 +301,14 @@ private: set<string> get_sync_targets_names(); /** - * Reset the monitor's sync-related data structures and state, both - * for the requester- and provider-side. + * Reset the monitor's sync-related data structures for syncing *from* a peer */ - void sync_reset(); + void sync_reset_requester(); + + /** + * Reset sync state related to allowing others to sync from us + */ + void sync_reset_provider(); /** * Caled when a sync attempt times out (requester-side) |