Repository navigation
Conversation
bburda
force-pushed
the
feat/rosbag-retention-0b
branch
from
December 1, 2026 15:43
7f0f1a2 to
52e1659
Compare
mfaferek93
reviewed
Dec 2, 2026
| // fault's other, healthy recordings with it because one of them vanished. | ||
| try { | ||
| storage_->delete_rosbag_recording(rosbag_info->recording_id); | ||
| auto removal = rosbag_retention_->forget_recording(rosbag_info->recording_id); |
Collaborator
There was a problem hiding this comment.
Only IgnorableConnectionException and RosbagCommitInDoubt are caught around this best-effort cleanup. A plain storage error (SQLite busy after the timeout, IOERR or full disk, or any non-connection PostgreSQL error) escapes the GetRosbag callback, leaves rclcpp::spin and stops the node, so a read can take the fault manager down. The same applies to the ListRosbags site below (around line 932). Catching std::exception here, as the startup check already does around the same call, would keep the rows and let the next lookup retry.
bburda
force-pushed
the
feat/rosbag-retention-0b
branch
from
December 2, 2026 12:15
52e1659 to
20258b8
Compare
* test(fault_manager): pin that a shutdown inside a post-roll removes the recording its cap replaced * feat(fault_manager): make every rosbag retention decision in one component * fix(fault_manager): log each recording removal after it happened * fix(fault_manager): remove and log every recording through one helper * fix(fault_manager): log a removal only when something was removed
bburda
force-pushed
the
feat/rosbag-retention-0b
branch
from
December 2, 2026 18:24
20258b8 to
7f381ec
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
Issue 705 adds configurable rosbag retention. Today the cap, the quota, the clear and the stale-row cleanup each decide on their own, in the storage backends and in
RosbagCapture. Each rule for priority, healing or age would have to be written in three backends and inRosbagCapture.This PR depends on the first PR of the stack (rosbag-retention-0a, the
apply_rosbag_changesprimitive). Please review that one first. The diff of this PR is against its branch.What it changes:
core::RosbagRetention. It holds the store, the per-fault cap, the quota, the clear and the stale-recording cleanup on top ofapply_rosbag_changes, each under one retention mutex. The store runs its cleared check, cap, insert and quota step in one hold. The retention never deletes files. Each call returns the directories that no row names any more.Bag file created/Bag file completedis logged, as before. The directories a clear or a stale-row cleanup frees are deleted by a newRetentionWorker, a one-thread worker that the node owns and drains at shutdown afterRosbagCapture::stop(). ARosbagCapturebuilt with the old constructor makes its own retention and an inline worker, so standalone captures stay synchronous.store_rosbag_file(s),delete_rosbag_file(s),delete_rosbag_recordingandset_max_rosbags_per_faultare removed fromFaultStorageand the three backends, and so isRosbagCapture::evict_bags_over_quota.apply_rosbag_changes. The cap, quota and removal tests go throughRosbagRetention. The cap tests are one typed suite over the in-memory, SQLite and PostgreSQL backends.Which recordings are kept or deleted does not change.
What changes for users
Recording removed: <id> (max_bags_per_fault)andRecording removed: <id> (fault cleared). A quota eviction keeps the existingDeleted old bag '<path>' to enforce storage limitline. A removal that fails is logged as a WARN with the path, the reason and the error. A directory that was already missing is not logged as removed. A failed removal of a stale row was silent before and is now a WARN.Auto-cleanup: deleted bag file for faultline is written once the directories are gone.Issue
Type
Testing
colcon build --packages-up-to ros2_medkit_fault_manager(add--cmake-args -DPOSTGRES_SUPPORT=ONfor the PostgreSQL backend), thencolcon test --packages-select ros2_medkit_fault_managerandcolcon test-result --verbose.test_rosbag_quota.test.pyandtest_rosbag_quota_pg.test.pyinsrc/ros2_medkit_fault_manager/test/integration. Run them withctest -R rosbag.auto_cleanup: true, confirm a fault and clear it: the log showsRecording removed: <id> (fault cleared), thenAuto-cleanup: deleted bag file for fault '<code>'.test_removals_are_loggedchecks that each line is written after its directory is gone.Checklist