mirror of
https://github.com/Zygo/bees.git
synced 2025-07-01 16:22:27 +02:00
roots: make the "idle" label useful
Apply the "idle" label only when the crawl is finished _and_ its transid_max is up to date. This makes the keyword "idle" better reflect when bees is not only finished crawling, but also scanning the crawled extents in the queue. Signed-off-by: Zygo Blaxell <bees@furryterror.org>
This commit is contained in:
@ -1336,7 +1336,7 @@ BeesScanModeExtent::next_transid()
|
||||
string eta_pretty = "-";
|
||||
const auto &deferred_finished = deferred_map.at(subvol);
|
||||
const bool finished = deferred_finished.second;
|
||||
if (finished) {
|
||||
if (finished && m_roots->up_to_date(this_state)) {
|
||||
eta_stamp = "idle";
|
||||
} else if (time_so_far > 10 && bytenr_offset > 1024 * 1024 * 1024) {
|
||||
const time_t eta_duration = time_so_far / bytenr_norm;
|
||||
@ -2311,16 +2311,20 @@ BeesCrawl::BeesCrawl(shared_ptr<BeesContext> ctx, BeesCrawlState initial_state)
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
BeesRoots::up_to_date(const BeesCrawlState &bcs)
|
||||
{
|
||||
// If we are already at transid_max then we are up to date
|
||||
return bcs.m_max_transid >= transid_max();
|
||||
}
|
||||
|
||||
bool
|
||||
BeesCrawl::restart_crawl_unlocked()
|
||||
{
|
||||
const auto roots = m_ctx->roots();
|
||||
const auto next_transid = roots->transid_max();
|
||||
|
||||
auto crawl_state = get_state_end();
|
||||
|
||||
// If we are already at transid_max then we are still finished
|
||||
m_finished = crawl_state.m_max_transid >= next_transid;
|
||||
m_finished = roots->up_to_date(crawl_state);
|
||||
|
||||
if (m_finished) {
|
||||
m_deferred = true;
|
||||
@ -2331,7 +2335,7 @@ BeesCrawl::restart_crawl_unlocked()
|
||||
|
||||
// Start new crawl
|
||||
crawl_state.m_min_transid = crawl_state.m_max_transid;
|
||||
crawl_state.m_max_transid = next_transid;
|
||||
crawl_state.m_max_transid = roots->transid_max();
|
||||
crawl_state.m_objectid = 0;
|
||||
crawl_state.m_offset = 0;
|
||||
crawl_state.m_started = current_time;
|
||||
|
@ -588,8 +588,8 @@ class BeesRoots : public enable_shared_from_this<BeesRoots> {
|
||||
void current_state_set(const BeesCrawlState &bcs);
|
||||
bool crawl_batch(shared_ptr<BeesCrawl> crawl);
|
||||
void clear_caches();
|
||||
|
||||
shared_ptr<BeesCrawl> insert_root(const BeesCrawlState &bcs);
|
||||
bool up_to_date(const BeesCrawlState &bcs);
|
||||
|
||||
friend class BeesCrawl;
|
||||
friend class BeesFdCache;
|
||||
|
Reference in New Issue
Block a user