Repository navigation
Conversation
bburda
force-pushed
the
feat/rosbag-retention-5b
branch
from
December 1, 2026 15:43
0fdf71d to
9c9ccc2
Compare
mfaferek93
reviewed
Dec 2, 2026
| RCLCPP_WARN(get_logger(), "%zu recorded rosbag directories could not be looked up and are kept, first %s", | ||
| not_found.size() - missing.size(), first_failure.c_str()); | ||
| } | ||
| const bool available = found > 0 || rows.empty(); |
Collaborator
There was a problem hiding this comment.
With storage_path empty the bags go to the system temp dir, which a reboot usually wipes, while the default SQLite database in /var/lib survives. After such a reboot no directory is found, so this marks the storage unavailable, raises a CRITICAL ROSBAG_STORAGE_UNAVAILABLE that new recordings never clear, and protects every stale row for good. Those rows still count toward the quota, so once they get close to max_total_storage_mb each store evicts every other recording. For the temp-dir fallback the old behaviour (forget the missing rows) looks right, and for a real mount a marker file in storage_path would also stop a bag written onto the bare mount point from counting as found on the next start.
5 of 7 tasks
bburda
force-pushed
the
feat/rosbag-retention-5b
branch
from
December 2, 2026 12:15
9c9ccc2 to
b22e622
Compare
* feat(fault_manager): check the recorded rosbag directories at startup * fix(fault_manager): a new recording does not end an unavailable rosbag storage * fix(fault_manager): no rule removes the missing recordings while the storage is unavailable * fix(fault_manager): a failed directory lookup proves nothing, and keep_first counts only unprotected recordings * fix(fault_manager): keep_first ranks the first unprotected recording in the eviction order
bburda
force-pushed
the
feat/rosbag-retention-5b
branch
from
December 2, 2026 18:24
b22e622 to
fd04c35
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Summary
Today rows whose bag directory is gone are removed lazily, by the first GetRosbag or ListRosbags call that finds the directory missing. A disk that did not mount therefore empties the recording list at the first listing. Issue 705 rule 7 asks for a check at startup instead: rows of bags that no longer exist are removed, and if none of the recorded bags is found, the storage path is treated as unavailable and nothing is removed.
This PR is on top of ten 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:
Startup check. After the retention starts and before the services start, the fault manager reads the rosbag rows once and looks up each recording's directory.
ROSBAG_STORAGE_UNAVAILABLE(CRITICAL) is reported.While unavailable, no rule removes the missing recordings. That covers:
Recording goes on as before. New recordings follow the rules as usual.
max_bagsandkeep_firstcount only the other recordings. The quota still counts the missing recordings' sizes, and its warning names those bytes.Recovery. The first GetRosbag or ListRosbags call that finds the directory of a recording stored at startup clears the state and the fault. A new recording written under the unmounted path does not count. The rows that call found missing are kept until a later call.
Failed lookups. A directory lookup that fails (for example a symbolic link loop or an I/O error) is neither found nor missing:
Before this PR, such a ListRosbags call threw out of the service callback and the fault manager stopped with exit code 1. I reproduced that on the branch below this PR;
mainhas the same call.Docs:
docs/config/fault-manager.rst, the fault manager README and design doc.What changes for users
ROSBAG_STORAGE_UNAVAILABLE. To recover, mount the disk. The first listing that finds a recorded directory clears the fault, and a restart with the disk mounted clears it too.Issue
Type
Testing
colcon build --packages-up-to ros2_medkit_fault_manager --cmake-args -DPOSTGRES_SUPPORT=ON, thencolcon test --packages-select ros2_medkit_fault_manager(withROS2_MEDKIT_TEST_PG_CONNfor the PostgreSQL cases) andcolcon test-result --verbose.The real-process test is
src/ros2_medkit_fault_manager/test/integration/test_rosbag_storage_availability.test.py, with two process runs on one database per case. It covers:test_rosbag_quota_pg.test.pyandtest_retention_config_pg.test.pyhave the PostgreSQL cases, including an unreachable server at startup.One subtest of
test_rosbag_quota.test.py(rosbag off on the next run) removed the only recorded directory between runs and expected the listing to remove its row. Under rule 7 that start is unavailable, so the subtest now keeps a second recording and removes the directory after startup.I ran this on Jazzy with PostgreSQL 14. Humble and Lyrical run in CI. clang-tidy on the changed files reports nothing new.
Checklist