1
0
mirror of https://github.com/Zygo/bees.git synced 2025-07-07 02:42:27 +02:00

context: don't forget to retry locked extents

The caller of scan_forward has to stop advancing the BeesFileCrawl
position when an extent lock blocks a scan, so that it will resume
from the same position when the Task is scheduled again; otherwise,
bees simply skips over the extent and leave it incompletely deduped.

Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
Zygo Blaxell
2022-12-22 00:07:49 -05:00
parent 66b00f8a97
commit c3b664fea5
3 changed files with 15 additions and 9 deletions

View File

@ -626,13 +626,20 @@ BeesFileCrawl::crawl_one_extent()
// It might be corrupted data, the file might have been deleted or truncated,
// or we might hit some other recoverable error. We'll try again with
// the next extent.
bool scanned_ok = false;
catch_all([&]() {
BEESNOTE("scan_forward " << bfr);
// BEESLOGDEBUG("scan_forward #" << Task::current_task().id() << " " << bfr);
m_ctx->scan_forward(bfr);
scanned_ok = m_ctx->scan_forward(bfr);
// BEESLOGDEBUG("done_forward #" << Task::current_task().id() << " " << bfr);
} );
m_hold = new_holder;
if (scanned_ok) {
m_hold = new_holder;
} else {
BEESLOGDEBUG("retrying lock for extent at " << bfr);
BEESCOUNT(crawl_restart);
return true;
}
}
} else {
BEESCOUNT(crawl_hole);