Skip to content

Commit

Permalink
PG: insert into stray set if !us_up() && !is_acting()
Browse files Browse the repository at this point in the history
This is simpler than checking actingbackfill
since it may not yet be filled in.

Fixes: ceph#7470
Signed-off-by: Samuel Just <[email protected]>
Reviewed-by: Greg Farnum <[email protected]>
  • Loading branch information
Samuel Just committed Feb 19, 2014
1 parent a33874d commit 314116e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/osd/PG.cc
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,7 @@ bool PG::proc_replica_info(pg_shard_t from, const pg_info_t &oinfo)
reg_next_scrub();

// stray?
if ((!is_active() && !is_acting(from)) ||
(is_active() && !is_actingbackfill(from))) {
if (!is_up(from) && !is_acting(from)) {
dout(10) << " osd." << from << " has stray content: " << oinfo << dendl;
stray_set.insert(from);
if (is_clean()) {
Expand Down Expand Up @@ -1303,7 +1302,7 @@ bool PG::choose_acting(pg_shard_t &auth_log_shard_id)
for (set<pg_shard_t>::iterator i = backfill_targets.begin();
i != backfill_targets.end();
++i) {
stray_set.erase(*i);
assert(!stray_set.count(*i));
}
} else {
// Will not change if already set because up would have had to change
Expand Down
7 changes: 7 additions & 0 deletions src/osd/PG.h
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,13 @@ class PG {
return std::find(acting.begin(), acting.end(), osd.osd) != acting.end();
}
}
bool is_up(pg_shard_t osd) const {
if (pool.info.ec_pool()) {
return up.size() > osd.shard && up[osd.shard] == osd.osd;
} else {
return std::find(up.begin(), up.end(), osd.osd) != up.end();
}
}

bool needs_recovery() const;
bool needs_backfill() const;
Expand Down

0 comments on commit 314116e

Please sign in to comment.