diff options
author | Sage Weil <sage@inktank.com> | 2013-04-22 15:11:46 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-04-22 15:11:46 -0700 |
commit | 5792be81add9041e3af2c9b27a939a4e2e7d378a (patch) | |
tree | 7da75ab53709421df7c19075dc27cb117a8bbc4f | |
parent | c200cdb08108ae901c4c6f3625d55da707a38e5a (diff) | |
parent | 4b34b0e52b72a4a09bf193a6a556d2204bef8e6e (diff) | |
download | ceph-5792be81add9041e3af2c9b27a939a4e2e7d378a.tar.gz |
Merge pull request #230 from ceph/wip-mon-paxos-fixes
Wip mon paxos fixes
Reviewed-by: Greg Farnum <greg@inktank.com>
Reviewed-by: Sage Weil <sage@inktank.com>
-rw-r--r-- | src/common/config_opts.h | 2 | ||||
-rw-r--r-- | src/mon/MDSMonitor.h | 2 | ||||
-rw-r--r-- | src/mon/OSDMonitor.cc | 2 | ||||
-rw-r--r-- | src/mon/OSDMonitor.h | 2 | ||||
-rw-r--r-- | src/mon/Paxos.cc | 4 | ||||
-rw-r--r-- | src/mon/PaxosService.cc | 17 | ||||
-rw-r--r-- | src/mon/PaxosService.h | 20 |
7 files changed, 40 insertions, 9 deletions
diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 78c57a54ae1..7b915f2dcc4 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -191,6 +191,8 @@ OPTION(paxos_propose_interval, OPT_DOUBLE, 1.0) // gather updates for this long OPTION(paxos_min_wait, OPT_DOUBLE, 0.05) // min time to gather updates for after period of inactivity OPTION(paxos_trim_tolerance, OPT_INT, 30) // number of extra proposals tolerated before trimming OPTION(paxos_trim_disabled_max_versions, OPT_INT, 100) // maximum amount of versions we shall allow passing by without trimming +OPTION(paxos_service_trim_max, OPT_INT, 50) // maximum amount of versions to trim during a single proposal (0 disables it) +OPTION(paxos_service_trim_min, OPT_INT, 30) // minimum amount of versions to trigger a trim (0 disables it) OPTION(clock_offset, OPT_DOUBLE, 0) // how much to offset the system clock in Clock.cc OPTION(auth_cluster_required, OPT_STR, "cephx") // required of mon, mds, osd daemons OPTION(auth_service_required, OPT_STR, "cephx") // required by daemons of clients diff --git a/src/mon/MDSMonitor.h b/src/mon/MDSMonitor.h index 3b1fbf92e2d..bda8f53c4fa 100644 --- a/src/mon/MDSMonitor.h +++ b/src/mon/MDSMonitor.h @@ -75,7 +75,7 @@ class MDSMonitor : public PaxosService { // we don't require full versions; don't encode any. virtual void encode_full(MonitorDBStore::Transaction *t) { } - bool should_trim() { return false; } + bool service_should_trim() { return false; } void encode_trim(MonitorDBStore::Transaction *t) { } void update_logger(); diff --git a/src/mon/OSDMonitor.cc b/src/mon/OSDMonitor.cc index b07ab5e2583..60e0f2c1b39 100644 --- a/src/mon/OSDMonitor.cc +++ b/src/mon/OSDMonitor.cc @@ -536,7 +536,7 @@ void OSDMonitor::update_trim() } } -bool OSDMonitor::should_trim() +bool OSDMonitor::service_should_trim() { update_trim(); return (get_trim_to() > 0); diff --git a/src/mon/OSDMonitor.h b/src/mon/OSDMonitor.h index e9f72298eb6..036aed5ffd3 100644 --- a/src/mon/OSDMonitor.h +++ b/src/mon/OSDMonitor.h @@ -155,7 +155,7 @@ private: bool should_propose(double &delay); void update_trim(); - bool should_trim(); + bool service_should_trim(); bool can_mark_down(int o); bool can_mark_up(int o); diff --git a/src/mon/Paxos.cc b/src/mon/Paxos.cc index bf3eb9253e8..21b9343f14c 100644 --- a/src/mon/Paxos.cc +++ b/src/mon/Paxos.cc @@ -1259,11 +1259,11 @@ void Paxos::propose_queued() assert(!proposal->proposed); cancel_events(); - dout(5) << __func__ << " " << (last_committed + 1) + dout(10) << __func__ << " " << (last_committed + 1) << " " << proposal->bl.length() << " bytes" << dendl; proposal->proposed = true; - dout(10) << __func__ << " "; + dout(30) << __func__ << " "; list_proposals(*_dout); *_dout << dendl; diff --git a/src/mon/PaxosService.cc b/src/mon/PaxosService.cc index a66c5ec0612..44d53c20723 100644 --- a/src/mon/PaxosService.cc +++ b/src/mon/PaxosService.cc @@ -152,7 +152,6 @@ void PaxosService::propose_pending() if (should_trim()) { encode_trim(&t); - set_trim_to(0); } encode_pending(&t); @@ -327,7 +326,19 @@ void PaxosService::encode_trim(MonitorDBStore::Transaction *t) if (first_committed >= trim_to) return; - trim(t, first_committed, trim_to); - put_first_committed(t, trim_to); + version_t trim_to_max = trim_to; + if ((g_conf->paxos_service_trim_max > 0) + && (trim_to - first_committed > (size_t)g_conf->paxos_service_trim_max)) { + trim_to_max = first_committed + g_conf->paxos_service_trim_max; + } + + dout(10) << __func__ << " trimming versions " << first_committed + << " to " << trim_to_max << dendl; + + trim(t, first_committed, trim_to_max); + put_first_committed(t, trim_to_max); + + if (trim_to_max == trim_to) + set_trim_to(0); } diff --git a/src/mon/PaxosService.h b/src/mon/PaxosService.h index 268253599bf..b4232ca3667 100644 --- a/src/mon/PaxosService.h +++ b/src/mon/PaxosService.h @@ -600,6 +600,24 @@ public: */ virtual void encode_trim(MonitorDBStore::Transaction *t); /** + * + */ + virtual bool should_trim() { + bool want_trim = service_should_trim(); + + if (!want_trim) + return false; + + if (g_conf->paxos_service_trim_min > 0) { + version_t trim_to = get_trim_to(); + version_t first = get_first_committed(); + + if ((trim_to > 0) && trim_to > first) + return ((trim_to - first) >= (version_t)g_conf->paxos_service_trim_min); + } + return true; + } + /** * Check if we should trim. * * We define this function here, because we assume that as long as we know of @@ -608,7 +626,7 @@ public: * * @returns true if we should trim; false otherwise. */ - virtual bool should_trim() { + virtual bool service_should_trim() { update_trim(); return (get_trim_to() > 0); } |