add_metric("thread_busy", "role", "scan", -1);
bool gotone = scanq.wait_front(p);
add_metric("thread_busy", "role", "scan", 1);
- if (! gotone) continue; // or break
+
+ if (! gotone) continue; // go back to waiting
try
{
e.report(cerr);
}
- inc_metric("thread_work_total", "role","scan");
-
- if (sigusr2 != forced_groom_count) // stop early if groom triggered
- {
- scanq.clear();
- break;
- }
+ // finished a scanning step -- not a "loop", because we just
+ // consume the traversal loop's work, whenever
+ inc_metric("thread_work_total","role","scan");
}
add_metric("thread_busy", "role", "scan", -1);
if (interrupted) break;
if (sigusr2 != forced_groom_count) // stop early if groom triggered
- break;
+ {
+ scanq.clear(); // clear previously issued work for scanner threads
+ break;
+ }
fts_scanned ++;
if (verbose > 3)
obatched(clog) << "fts skipped by regex " << (!ri ? "I" : "") << (rx ? "X" : "") << endl;
fts_regex ++;
+ if (!ri)
+ inc_metric("traversed_total","type","regex-skipped-I");
+ if (rx)
+ inc_metric("traversed_total","type","regex-skipped-X");
continue;
}
{
case FTS_F:
scanq.push_back (make_pair(rps, *f->fts_statp));
+ inc_metric("traversed_total","type","file");
break;
case FTS_ERR:
auto x = libc_exception(f->fts_errno, string("fts traversal ") + string(f->fts_path));
x.report(cerr);
}
+ inc_metric("traversed_total","type","error");
break;
- default:
- ;
- /* ignore */
+ case FTS_D: // ignore
+ inc_metric("traversed_total","type","directory");
+ break;
+
+ default: // ignore
+ inc_metric("traversed_total","type","other");
+ break;
}
}
gettimeofday (&tv_end, NULL);
set_metric("thread_busy", "role","traverse", 1);
scan_source_paths();
last_rescan = time(NULL); // NB: now was before scanning
+ // finished a traversal loop
inc_metric("thread_work_total", "role","traverse");
set_metric("thread_busy", "role","traverse", 0);
}
files_del_f_de.reset().bind(1,fileid).bind(2,mtime).step_ok_done();
files_del_r_de.reset().bind(1,fileid).bind(2,mtime).step_ok_done();
files_del_scan.reset().bind(1,fileid).bind(2,mtime).step_ok_done();
+ inc_metric("groomed_total", "decision", "stale");
}
-
- inc_metric("thread_work_total", "role", "groom");
+ else
+ inc_metric("groomed_total", "decision", "fresh");
+
if (sigusr1 != forced_rescan_count) // stop early if scan triggered
break;
}
set_metric("thread_busy", "role", "groom", 1);
groom ();
last_groom = time(NULL); // NB: now was before grooming
+ // finished a grooming loop
+ inc_metric("thread_work_total", "role", "groom");
set_metric("thread_busy", "role", "groom", 0);
}
catch (const sqlite_exception& e)
kill -USR2 $PID1 # groom cycle
# Expect 3 rpms to be deleted by the groom
# 1 groom cycle already took place at/soon-after startup, so -USR2 makes 2
-# ... times the # of files checked in each cycle
-wait_ready $PORT1 'thread_work_total{role="groom"}' 51
+wait_ready $PORT1 'thread_work_total{role="groom"}' 2
wait_ready $PORT1 'groom{statistic="file d/e"}' 3
rm -rf $DEBUGINFOD_CACHE_PATH # clean it from previous tests
# run a groom cycle to force server to drop its fdcache
kill -USR2 $PID1 # groom cycle
-wait_ready $PORT1 'thread_work_total{role="groom"}' 98 # 3 complete cycles
+wait_ready $PORT1 'thread_work_total{role="groom"}' 3
# move it around a couple of times to make it likely to hit a nonexistent entry during iteration
mv R/debuginfod-rpms/rhel7 R/debuginfod-rpms/rhel7renamed
kill -USR1 $PID1 # scan cycle