Repository navigation
Conversation
89cc257 to
17a60e8
Compare
| std::map<std::string, size_t> index_by_path; | ||
| // The first recording of each fault code: the storage reads the rows oldest first. | ||
| std::map<std::string, std::string> first_path_by_code; | ||
| for (const auto & row : storage_.get_all_rosbag_files()) { |
There was a problem hiding this comment.
The floor candidates are all stored rows, but only the filesystem of the current storage_path is measured. If storage_path is moved to another disk and the database is kept, the old recordings are still found at startup, and once the new disk drops below the floor each pass deletes them one by one without freeing any measured space, until it runs out of candidates. Skipping candidates whose directory is on a different device than the measured path (st_dev) would keep the floor from deleting data it cannot reclaim.
| return step; | ||
| } | ||
| auto chosen = std::find_if(candidates.begin(), candidates.end(), [&last_resort_recording_id](const auto & c) { | ||
| return c.recording_id != last_resort_recording_id; |
There was a problem hiding this comment.
This skips the pass's own recording and takes the first candidate in rank order, so a recording stored after it is not protected. With a floor-only config (all priority 0), recording R1 is stored and its pass is queued, R2 is stored before that pass reaches the last candidates, and the pass deletes R2 and keeps the older R1. R2's own pass then finds nothing to do. That inverts the oldest-first order the docs describe. Skipping candidates created after the pass's own recording, or ranking it in place instead of skipping it, would keep the order.
17a60e8 to
b7fd9f0
Compare
…rage path * feat(fault_manager): min_free_disk_mb keeps free space under the rosbag storage path * feat(fault_manager): a test capacity file replaces the free-space measurement in tests * fix(fault_manager): no floor pass after a store that kept nothing; one WARN per failed step * test(fault_manager): the in-doubt floor test counts every WARN of the pass
b7fd9f0 to
957d7db
Compare
Pull Request
Summary
Today the fault manager limits recordings only by the sizes it wrote into their rows, so other data that fills the disk is not seen. Issue 705 asks for a floor of free space on the filesystem of
storage_path. This PR addssnapshots.rosbag.retention.min_free_disk_mb.This PR is on top of nine PRs in the stack. Please review those first. The diff of this PR is against the branch of the PR directly below it.
What it adds:
min_free_disk_mb(MiB, default0= off). Below it, recordings are deleted in eviction order: lowest priority first, then cleared, healed, active, then oldest.ROS2_MEDKIT_TEST_STORAGE_CAPACITY_FILEmakes the fault manager compute free space as a capacity from a file minus the bytes under the storage path. Tests then do not depend on other writers of the disk. It logs a WARN at startup, cannot be set over the API, and must never be set on a robot.docs/config/fault-manager.rst, the example retention file, the fault manager README and design doc.What changes for users
min_free_disk_mb. A configuration that sets only this field is a configured retention: quota eviction then follows the eviction order, with every priority0. An invalid value is reported asROSBAG_RETENTION_CONFIG_INVALID, and while the configuration is invalid the floor is off.sweep_interval_sec) now also runs when only the floor is set. The startup policy line ends withfloor: offorfloor: <n> MB.Recording removed: <id> (min_free_disk_mb)per removed recording, andfloor pass: removed=<n> free=<bytes> floor=<bytes> met=<true|false> source=<filesystem|test-capacity>at DEBUG per pass.Issue
Type
Testing
colcon build --packages-up-to ros2_medkit_fault_manager --cmake-args -DPOSTGRES_SUPPORT=ON, thencolcon test --packages-select ros2_medkit_fault_managerandcolcon test-result --verbose.src/ros2_medkit_fault_manager/test/integration/test_rosbag_free_space.test.py. It covers:over_quota: keepnot breaking the floor;test_rosbag_capture.cpphas one in-process case for a removal step that fails, because no real storage reaches that path.Checklist