Skip to content

fault_manager: keep a recording when the PostgreSQL commit outcome is unknown - #856

Draft
bburda wants to merge 1 commit into
feat/rosbag-retention-1bfrom
feat/rosbag-retention-1c
Draft

bburda wants to merge 1 commit into
feat/rosbag-retention-1bfrom
feat/rosbag-retention-1c

Conversation

@bburda

@bburda bburda commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Pull Request

Summary

When PostgreSQL loses the connection while a rosbag change is being committed, libpqxx cannot say whether the commit was applied. Until now the fault manager treated that as a failed store and deleted the recording's directory, even when its row had been committed: the recording was lost, and its row was removed later as stale. This PR keeps the recording in that case.

This PR is on top of four 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:

  • The unknown outcome has a name. PgFaultStorage::apply_rosbag_changes throws RosbagCommitInDoubt when libpqxx reports pqxx::in_doubt_error, and does not retry. A connection lost before COMMIT is still retried, and a commit that fails with a known error is still a failure. The other PostgreSQL transactions are unchanged.
  • A store in doubt keeps the bag. The store returns a new result, kInDoubt. The bag directory stays, one WARN names the path, and no "Bag file created" line follows. No quota eviction runs after it in that store.
  • The node stays up. A commit in doubt while a stale recording is forgotten (GetRosbag, ListRosbags) answers the request with an error, as a lost connection did before, instead of ending the process.
  • Docs: the PostgreSQL section of docs/config/fault-manager.rst, the fault manager README and the design doc.

What changes for users

  • A recording whose commit outcome is unknown is kept. If its row was committed, it is listed and counted as usual. If it was not, the directory stays on disk: it is not listed and not counted against the quota until it is removed by hand. With PostgreSQL on the same machine this happens only when the server stops while a COMMIT is in flight; with a remote server, also on a network outage.
  • New WARN lines for a store in doubt and for a forget in doubt.

Issue


Type

  • Bug fix
  • New feature or tests
  • Breaking change
  • Documentation only

Testing

  • colcon build --packages-up-to ros2_medkit_fault_manager --cmake-args -DPOSTGRES_SUPPORT=ON, then colcon test --packages-select ros2_medkit_fault_manager with ROS2_MEDKIT_TEST_PG_CONN set, and colcon test-result --verbose.
  • The new test is src/ros2_medkit_fault_manager/test/integration/test_rosbag_commit_in_doubt_pg.test.py. It runs the real fault manager against PostgreSQL through a TCP proxy that cuts the connection at the COMMIT of a rosbag change, either after the server committed or before it got the COMMIT. It also checks that a lost connection before COMMIT is retried, that a known store error still discards the bag, and that a forget in doubt keeps the node up.
  • I ran this on Jazzy with PostgreSQL 14. Humble and Lyrical run in CI. clang-tidy on the changed files reports nothing new.

Checklist

  • Breaking changes are clearly described (and announced in docs / changelog if needed)
  • Tests were added or updated if needed
  • Docs were updated if behavior or public API changed

@bburda
bburda added this pull request to stack #836 December 1, 2026 13:21
@bburda
bburda force-pushed the feat/rosbag-retention-1c branch from 44685aa to 97d2f27 Compare December 1, 2026 15:43
@bburda
bburda force-pushed the feat/rosbag-retention-1c branch from 97d2f27 to b63a84d Compare December 2, 2026 12:15
… unknown

* fix(fault_manager): keep a recording whose PostgreSQL commit outcome is unknown
* fix(fault_manager): keep the node up when a forget's PostgreSQL commit is in doubt
* test(fault_manager): pin a known store failure on PostgreSQL as a discard
* docs(fault_manager): name the exceptions to unchanged rows and to bags without a row
@bburda
bburda force-pushed the feat/rosbag-retention-1c branch from b63a84d to 2db2e68 Compare December 2, 2026 18:24

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant