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: Object level shard errors are tracked and used if no auth available #15397

Merged
merged 3 commits into from Jun 2, 2017
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
31 changes: 26 additions & 5 deletions src/osd/PGBackend.cc
Expand Up @@ -750,6 +750,7 @@ void PGBackend::be_compare_scrubmaps(
be_select_auth_object(*k, maps, &auth_oi, shard_map, object_error);

list<pg_shard_t> auth_list;
set<pg_shard_t> object_errors;
if (auth == maps.end()) {
object_error.set_version(0);
object_error.set_auth_missing(*k, maps, shard_map, shallow_errors, deep_errors);
Expand Down Expand Up @@ -782,16 +783,21 @@ void PGBackend::be_compare_scrubmaps(
object_error,
ss);
// Some errors might have already been set in be_select_auth_object()
if (found || shard_map[j->first].errors != 0) {
if (shard_map[j->first].errors != 0) {
cur_inconsistent.insert(j->first);
if (shard_map[j->first].has_deep_errors())
++deep_errors;
else if (shard_map[j->first].has_shallow_errors())
else
++shallow_errors;
// Only true if be_compare_scrub_objects() found errors and put something
// in ss.
errorstream << pgid << " shard " << j->first << ": soid " << *k
if (found)
errorstream << pgid << " shard " << j->first << ": soid " << *k
<< " " << ss.str() << "\n";
} else if (found) {
// Track possible shard to use as authoritative, if needed
// There are errors, without identifying the shard
object_errors.insert(j->first);
} else {
// XXX: The auth shard might get here that we don't know
// that it has the "correct" data.
Expand All @@ -809,10 +815,25 @@ void PGBackend::be_compare_scrubmaps(
}

if (auth_list.empty()) {
errorstream << pgid.pgid << " soid " << *k
if (object_errors.empty()) {
errorstream << pgid.pgid << " soid " << *k
<< ": failed to pick suitable auth object\n";
goto out;
goto out;
}
// Object errors exist and we haven't found an authortative shard
// Prefer the primary shard otherwise take first from list.
pg_shard_t auth_shard;
if (object_errors.count(get_parent()->whoami_shard())) {
auth_shard = get_parent()->whoami_shard();
} else {
auth_shard = *(object_errors.begin());
}
auth_list.push_back(auth_shard);
object_errors.erase(auth_shard);
}
// At this point auth_list is populated, so we add the object errors shards
// as inconsistent.
cur_inconsistent.insert(object_errors.begin(), object_errors.end());
if (!cur_missing.empty()) {
missing[*k] = cur_missing;
}
Expand Down