Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wip mon paxos fixes #230

Merged
merged 2 commits into from Apr 22, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/common/config_opts.h
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/mon/MDSMonitor.h
Expand Up @@ -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; }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, do we really never trim MDSMaps?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We really don't.

void encode_trim(MonitorDBStore::Transaction *t) { }

void update_logger();
Expand Down
2 changes: 1 addition & 1 deletion src/mon/OSDMonitor.cc
Expand Up @@ -536,7 +536,7 @@ void OSDMonitor::update_trim()
}
}

bool OSDMonitor::should_trim()
bool OSDMonitor::service_should_trim()
{
update_trim();
return (get_trim_to() > 0);
Expand Down
2 changes: 1 addition & 1 deletion src/mon/OSDMonitor.h
Expand Up @@ -155,7 +155,7 @@ class OSDMonitor : public PaxosService {
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);
Expand Down
4 changes: 2 additions & 2 deletions src/mon/Paxos.cc
Expand Up @@ -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;

Expand Down
17 changes: 14 additions & 3 deletions src/mon/PaxosService.cc
Expand Up @@ -152,7 +152,6 @@ void PaxosService::propose_pending()

if (should_trim()) {
encode_trim(&t);
set_trim_to(0);
}

encode_pending(&t);
Expand Down Expand Up @@ -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);
}

20 changes: 19 additions & 1 deletion src/mon/PaxosService.h
Expand Up @@ -599,6 +599,24 @@ class PaxosService {
* the log versions even if we don't have a full map in store.
*/
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.
*
Expand All @@ -608,7 +626,7 @@ class PaxosService {
*
* @returns true if we should trim; false otherwise.
*/
virtual bool should_trim() {
virtual bool service_should_trim() {
update_trim();
return (get_trim_to() > 0);
}
Expand Down