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: set min_version to newest version in maybe_force_recovery #17752

Merged
merged 2 commits into from
Oct 2, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/osd/PrimaryLogPG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ void PrimaryLogPG::maybe_force_recovery()
return;

// find the oldest missing object
version_t min_version = 0;
version_t min_version = pg_log.get_log().head.version;
Copy link
Contributor

Choose a reason for hiding this comment

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

could you elaborate a little bit the rationale of this change in the commit message?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

if min_version is 0, if (min_version > xxx) always return false

Copy link
Contributor

Choose a reason for hiding this comment

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

the question is why pg_log.get_log().head.version is correct, but 0 is not.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what we want to get is the minimum of the objects' versions. so we should initialize to as head version and compare it with other version

Copy link
Contributor

Choose a reason for hiding this comment

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

oic, could you amend the commit message with the explanation above?

hobject_t soid;
if (!pg_log.get_missing().get_items().empty()) {
min_version = pg_log.get_missing().get_rmissing().begin()->first;
Expand All @@ -739,10 +739,14 @@ void PrimaryLogPG::maybe_force_recovery()
if (*it == get_primary()) continue;
pg_shard_t peer = *it;
if (peer_missing.count(peer) &&
!peer_missing[peer].get_items().empty() &&
min_version > peer_missing[peer].get_rmissing().begin()->first) {
min_version = peer_missing[peer].get_rmissing().begin()->first;
soid = peer_missing[peer].get_rmissing().begin()->second;
!peer_missing[peer].get_items().empty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

might want to drop this change or split it into another separate "refactor only" commit.

const auto& min_obj = peer_missing[peer].get_rmissing().begin();
dout(20) << __func__ << " peer " << peer << " min_version " << min_obj->first
<< " oid " << min_obj->second << dendl;
if (min_version > min_obj->first) {
min_version = min_obj->first;
soid = min_obj->second;
}
}
}

Expand Down