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

osd/ReplicatedPG: fix promotion recency logic #6702

Merged
merged 2 commits into from Dec 31, 2015
Merged
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
44 changes: 20 additions & 24 deletions src/osd/ReplicatedPG.cc
Expand Up @@ -2254,33 +2254,29 @@ bool ReplicatedPG::maybe_promote(ObjectContextRef obc,
}
break;
default:
if (in_hit_set) {
promote_object(obc, missing_oid, oloc, promote_op);
} else {
// Check if in other hit sets
map<time_t,HitSetRef>::iterator itor;
bool in_other_hit_sets = false;
unsigned max_in_memory_read = pool.info.min_read_recency_for_promote > 0 ? pool.info.min_read_recency_for_promote - 1 : 0;
unsigned max_in_memory_write = pool.info.min_write_recency_for_promote > 0 ? pool.info.min_write_recency_for_promote - 1 : 0;
unsigned max_in_memory = MAX(max_in_memory_read, max_in_memory_write);
for (itor = agent_state->hit_set_map.begin(); itor != agent_state->hit_set_map.end() && max_in_memory--; ++itor) {
if (obc.get()) {
if (obc->obs.oi.soid != hobject_t() && itor->second->contains(obc->obs.oi.soid)) {
in_other_hit_sets = true;
break;
}
} else {
if (missing_oid != hobject_t() && itor->second->contains(missing_oid)) {
in_other_hit_sets = true;
break;
}
}
{
unsigned count = (int)in_hit_set;
if (count) {
// Check if in other hit sets
const hobject_t& oid = obc.get() ? obc->obs.oi.soid : missing_oid;
for (map<time_t,HitSetRef>::reverse_iterator itor =
agent_state->hit_set_map.rbegin();
itor != agent_state->hit_set_map.rend();
++itor) {
if (!itor->second->contains(oid)) {
break;
}
++count;
if (count >= recency) {
break;
}
}
}
if (in_other_hit_sets) {
promote_object(obc, missing_oid, oloc, promote_op);
if (count >= recency) {
promote_object(obc, missing_oid, oloc, promote_op);
} else {
// not promoting
return false;
return false;
}
}
break;
Expand Down