summaryrefslogtreecommitdiff
path: root/src/osd/ReplicatedPG.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/osd/ReplicatedPG.cc')
-rw-r--r--src/osd/ReplicatedPG.cc32
1 files changed, 21 insertions, 11 deletions
diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc
index f6c84843529..85a6d472906 100644
--- a/src/osd/ReplicatedPG.cc
+++ b/src/osd/ReplicatedPG.cc
@@ -7476,17 +7476,22 @@ void ReplicatedPG::check_recovery_sources(const OSDMapRef osdmap)
}
-int ReplicatedPG::start_recovery_ops(
+bool ReplicatedPG::start_recovery_ops(
int max, RecoveryCtx *prctx,
- ThreadPool::TPHandle &handle)
+ ThreadPool::TPHandle &handle,
+ int& ops_begun)
{
- int started = 0;
+ int& started = ops_begun;
+ started = 0;
+ bool work_in_progress = false;
assert(is_primary());
if (!state_test(PG_STATE_RECOVERING) &&
!state_test(PG_STATE_BACKFILL)) {
+ /* TODO: I think this case is broken and will make do_recovery()
+ * unhappy since we're returning false */
dout(10) << "recovery raced and were queued twice, ignoring!" << dendl;
- return 0;
+ return false;
}
const pg_missing_t &missing = pg_log.get_missing();
@@ -7512,6 +7517,9 @@ int ReplicatedPG::start_recovery_ops(
started = recover_replicas(max, handle);
}
+ if (started)
+ work_in_progress = true;
+
bool deferred_backfill = false;
if (recovering.empty() &&
state_test(PG_STATE_BACKFILL) &&
@@ -7535,7 +7543,7 @@ int ReplicatedPG::start_recovery_ops(
}
deferred_backfill = true;
} else {
- started += recover_backfill(max - started, handle);
+ started += recover_backfill(max - started, handle, work_in_progress);
}
}
@@ -7543,8 +7551,8 @@ int ReplicatedPG::start_recovery_ops(
osd->logger->inc(l_osd_rop, started);
if (!recovering.empty() ||
- started || recovery_ops_active > 0 || deferred_backfill)
- return started;
+ work_in_progress || recovery_ops_active > 0 || deferred_backfill)
+ return work_in_progress;
assert(recovering.empty());
assert(recovery_ops_active == 0);
@@ -7552,21 +7560,21 @@ int ReplicatedPG::start_recovery_ops(
int unfound = get_num_unfound();
if (unfound) {
dout(10) << " still have " << unfound << " unfound" << dendl;
- return started;
+ return work_in_progress;
}
if (missing.num_missing() > 0) {
// this shouldn't happen!
osd->clog.error() << info.pgid << " recovery ending with " << missing.num_missing()
<< ": " << missing.missing << "\n";
- return started;
+ return work_in_progress;
}
if (needs_recovery()) {
// this shouldn't happen!
// We already checked num_missing() so we must have missing replicas
osd->clog.error() << info.pgid << " recovery ending with missing replicas\n";
- return started;
+ return work_in_progress;
}
if (state_test(PG_STATE_RECOVERING)) {
@@ -7917,7 +7925,7 @@ int ReplicatedPG::recover_replicas(int max, ThreadPool::TPHandle &handle)
*/
int ReplicatedPG::recover_backfill(
int max,
- ThreadPool::TPHandle &handle)
+ ThreadPool::TPHandle &handle, bool& work_started)
{
dout(10) << "recover_backfill (" << max << ")" << dendl;
assert(backfill_target >= 0);
@@ -8097,6 +8105,8 @@ int ReplicatedPG::recover_backfill(
dout(10) << " peer num_objects now " << pinfo.stats.stats.sum.num_objects
<< " / " << info.stats.stats.sum.num_objects << dendl;
+ if (ops)
+ work_started = true;
return ops;
}