Repository navigation
Conversation
bburda
force-pushed
the
feat/rosbag-retention-1b
branch
from
December 1, 2026 15:43
7b4eb66 to
5c2e5ab
Compare
mfaferek93
reviewed
Dec 2, 2026
| pending.assign(pending_bytes_.begin(), pending_bytes_.end()); | ||
| } | ||
| const double window = config_.duration_sec > 0.0 ? config_.duration_after_sec / config_.duration_sec : 0.0; | ||
| const auto reserve = static_cast<size_t>(static_cast<double>(buffered_bytes) * (1.0 + std::max(0.0, window))); |
Collaborator
There was a problem hiding this comment.
With topics: entity this reserve comes from buffer_bytes_, which covers every buffered topic, while the recording only gets the faulting entity's topics (the caller already has entity_topics resolved at this point). On a busy graph with over_quota: drop, or with an invalid configuration where this check gates every fault, a fault whose filtered bag would fit is refused and gets no recording. Could the estimate sum only the buffered messages that pass the entity filter?
bburda
force-pushed
the
feat/rosbag-retention-1b
branch
from
December 2, 2026 12:15
5c2e5ab to
8e723eb
Compare
* feat(fault_manager): evict rosbag recordings by priority, honour over_quota, check the quota before a recording starts * docs(fault_manager): describe priority eviction, over_quota and the open-time quota check * fix(fault_manager): count closed recordings that are not stored yet in the open-time quota check * docs(fault_manager): an invalid retention configuration is a hard stop for the quota, pending recordings count in the check * fix(fault_manager): count a pending recording once in the open-time quota check * docs(fault_manager): the pending term of the open-time check is a payload estimate * test(fault_manager): pin the restore order, end the drop test's window by SIGTERM, make the failed open independent of the window
bburda
force-pushed
the
feat/rosbag-retention-1b
branch
from
December 2, 2026 18:24
8e723eb to
77fd4ef
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
This PR is part of configurable rosbag retention. The PR below it parses and validates the rules. This PR makes the store and the start of a recording use them. Without any
snapshots.rosbag.retention.*parameter, which recordings are kept or removed does not change.This PR is the top of a stack of four. Please review the three below it first. The diff of this PR is against the branch of the PR directly below it.
What it adds:
Eviction by priority. With valid rules, a new recording evicts only recordings whose priority is less than or equal to its own. Lowest priority goes first, then recordings whose faults are all cleared, then healed, then active, then the oldest. A recording shared by a burst of faults ranks by its highest-priority fault, using each fault's current severity. The whole decision is made before anything is applied.
over_quota. A new recording can still not fit after every allowed eviction. Withkeep(the default), it is stored over the limit with a warning, as happens today with a recording alone over the quota. Withdrop, it is dropped alone and nothing is deleted. In both cases the removal is logged after the directory is gone.Open-time check. For a fault whose rule says
drop, the fault manager predicts whether the recording can fit before it starts it. The prediction counts:A recording predicted not to fit is not started, and the ring buffer stays for the next fault. A recording that grows past the prediction is still dropped when it is stored.
Invalid configuration. While the retention configuration is invalid, the quota is a hard stop for new recordings: nothing is evicted for the quota, and a recording that does not fit is dropped. The per-fault cap and
auto_cleanupwork as without rules.Docs:
docs/config/fault-manager.rst, the fault manager README and design doc, and the example parameters file.What changes for users
duration_secgets its history. This applies with and without rules.ROSBAG_RETENTION_CONFIG_INVALIDshows the cause.keeplogs a WARN.Issue
Type
Testing
colcon build --packages-up-to ros2_medkit_fault_manager ros2_medkit_integration_tests --cmake-args -DPOSTGRES_SUPPORT=ON, thencolcon test --packages-select ros2_medkit_fault_manager ros2_medkit_integration_testsandcolcon test-result --verbose.src/ros2_medkit_fault_manager/test/integration/test_rosbag_quota.test.pyandtest_rosbag_quota_pg.test.py. The test through the gateway issrc/ros2_medkit_integration_tests/test/features/test_rosbag_retention_priority.test.py: CRITICAL and WARN faults on one app, andGET /api/v1/apps/<app>/bulk-data/rosbagslists the CRITICAL recording but not the evicted one, nor one dropped underover_quota: drop.severity.CRITICAL.priority: 900anddefaults.priority: 10undersnapshots.rosbag.retention, and set a smallsnapshots.rosbag.max_total_storage_mb. Then confirm a few WARN faults and one CRITICAL fault: the CRITICAL recording stays, and the oldest WARN ones are evicted.Checklist