Skip to content

Questions About Durability and Efficient Merging of Time-Split Bags (Humble) #2335

@Baranbologur

Description

@Baranbologur

Hi, I am currently using rosbag2 Humble and would like to ask a few questions regarding my recording use cases.

1) Durability in Case of Power Loss

I am recording bags for several hours using rosbag2_transport::Recorder.
Since power shortages are very likely in my deployment scenario, I am using split-by-duration with a 5-minute interval to reduce potential data loss.

  • Is this approach recommended?
  • Is rosbag2 durable enough against unexpected power loss without splitting?
  • Would splitting meaningfully reduce the risk of corruption or data loss?

I would appreciate any clarification on how robust rosbag2 is in such scenarios.

2) Merging Time-Split Bags Efficiently

At the end of recording, I have multiple split bag files that I want to merge into a single file. Because I am using an old version of Foxglove which does not play multiple mcaps. I am using rosbag2_transport::bag_rewrite function to perform merging operation.

However, this introduces a storage issue:

  • Let's say I have 300 GB of data, I effectively need ~600 GB of free space because bag_rewrite does not delete input bags as it progresses.
  • Deleting intermediate files automatically may not be desirable in general, but it would be very useful when merging time-split bags.

To reduce peak disk usage, I tried merging sequentially:

  • merge bag_0 + bag_1
  • then merge result + bag_2
  • and so on

This reduces space usage but increases time complexity significantly (approaching O(n²)).

Do you have any recommendation for merginf process of time-splitted bag files?


Thank you for your time and for the great work on rosbag2.

Best regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions