Skip to content

Commit b473143

Browse files
authored
Merge pull request ceph#59916 from xxhdx1985126/wip-68175
crimson/osd/backfill_state: do at least one time of replica scanning if necessary in the Enqueuing state Reviewed-by: Samuel Just <[email protected]>
2 parents 1316950 + 8db39bc commit b473143

File tree

1 file changed

+29
-23
lines changed

1 file changed

+29
-23
lines changed

src/crimson/osd/backfill_state.cc

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ bool BackfillState::Enqueuing::should_rescan_primary(
225225
const BackfillInterval& backfill_info) const
226226
{
227227
return backfill_info.begin <= earliest_peer_backfill(peer_backfill_info) &&
228-
!backfill_info.extends_to_end();
228+
!backfill_info.extends_to_end() && backfill_info.empty();
229229
}
230230

231231
void BackfillState::Enqueuing::trim_backfilled_object_from_intervals(
@@ -327,16 +327,29 @@ BackfillState::Enqueuing::Enqueuing(my_context ctx)
327327
}
328328
trim_backfill_infos();
329329

330-
while (!all_emptied(primary_bi, backfill_state().peer_backfill_info)) {
330+
if (should_rescan_primary(backfill_state().peer_backfill_info,
331+
primary_bi)) {
332+
// need to grab one another chunk of the object namespace and restart
333+
// the queueing.
334+
logger().debug("{}: reached end for current local chunk", __func__);
335+
post_event(RequestPrimaryScanning{});
336+
return;
337+
}
338+
339+
do {
331340
if (!backfill_listener().budget_available()) {
332341
post_event(RequestWaiting{});
333342
return;
334343
} else if (should_rescan_replicas(backfill_state().peer_backfill_info,
335-
primary_bi)) {
344+
primary_bi)) {
336345
// Count simultaneous scans as a single op and let those complete
337346
post_event(RequestReplicasScanning{});
338347
return;
339348
}
349+
350+
if (all_emptied(primary_bi, backfill_state().peer_backfill_info)) {
351+
break;
352+
}
340353
// Get object within set of peers to operate on and the set of targets
341354
// for which that object applies.
342355
if (const hobject_t check = \
@@ -355,30 +368,23 @@ BackfillState::Enqueuing::Enqueuing(my_context ctx)
355368
trim_backfilled_object_from_intervals(std::move(result),
356369
backfill_state().last_backfill_started,
357370
backfill_state().peer_backfill_info);
358-
primary_bi.pop_front();
371+
if (!primary_bi.empty()) {
372+
primary_bi.pop_front();
373+
}
359374
}
360375
backfill_listener().maybe_flush();
361-
}
376+
} while (!all_emptied(primary_bi, backfill_state().peer_backfill_info));
362377

363-
if (should_rescan_primary(backfill_state().peer_backfill_info,
364-
primary_bi)) {
365-
// need to grab one another chunk of the object namespace and restart
366-
// the queueing.
367-
logger().debug("{}: reached end for current local chunk",
368-
__func__);
369-
post_event(RequestPrimaryScanning{});
370-
} else {
371-
if (backfill_state().progress_tracker->tracked_objects_completed()
372-
&& Enqueuing::all_enqueued(peering_state(),
373-
backfill_state().backfill_info,
374-
backfill_state().peer_backfill_info)) {
375-
backfill_state().last_backfill_started = hobject_t::get_max();
376-
backfill_listener().update_peers_last_backfill(hobject_t::get_max());
377-
}
378-
logger().debug("{}: reached end for both local and all peers "
379-
"but still has in-flight operations", __func__);
380-
post_event(RequestWaiting{});
378+
if (backfill_state().progress_tracker->tracked_objects_completed()
379+
&& Enqueuing::all_enqueued(peering_state(),
380+
backfill_state().backfill_info,
381+
backfill_state().peer_backfill_info)) {
382+
backfill_state().last_backfill_started = hobject_t::get_max();
383+
backfill_listener().update_peers_last_backfill(hobject_t::get_max());
381384
}
385+
logger().debug("{}: reached end for both local and all peers "
386+
"but still has in-flight operations", __func__);
387+
post_event(RequestWaiting{});
382388
}
383389

384390
// -- PrimaryScanning

0 commit comments

Comments
 (0)