Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpp: read messages in deterministic order, yield message offset in MessageView #760

Merged
merged 7 commits into from
Dec 7, 2022

Conversation

james-rms
Copy link
Collaborator

@james-rms james-rms commented Dec 5, 2022

This PR contains a few changes required to get the rosbag2_storage_mcap plugin to actually behave correctly with respect to message ordering and selecting messages by time range.

  • Messages with the same timestamp are returned in the order of their position in the file. This is neccessary to have a well-defined return order from ReadMessages, since log timestamps are not required to be unique.
  • MessageView includes a new "messageOffset" field, informing the reader of the returned messages' offset within the file. This allows readers to tell if a message returned from one iterator is the same message as returned from a different iterator.

Testing

  • unit test added to test new read message order.

@james-rms james-rms marked this pull request as draft December 5, 2022 05:08
@james-rms james-rms force-pushed the jrms/cpp-correct-chunk-selection branch 2 times, most recently from 45a5d00 to 9955e77 Compare December 5, 2022 23:28
@james-rms james-rms marked this pull request as ready for review December 5, 2022 23:56
@james-rms james-rms changed the title cpp: use message offset in file to determine order when timestamps are equal cpp: read messages in deterministic order, yield message offset in MessageView Dec 6, 2022
@james-rms james-rms force-pushed the jrms/cpp-correct-chunk-selection branch 2 times, most recently from d4a00b5 to d594ad3 Compare December 6, 2022 09:01
Copy link
Contributor

@jhurliman jhurliman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. It would be helpful to add a test where there are two chunks, A and B, but the time range of B is partially or fully before A.

@james-rms james-rms enabled auto-merge (squash) December 7, 2022 00:06
@james-rms james-rms force-pushed the jrms/cpp-correct-chunk-selection branch from 66daea0 to b324998 Compare December 7, 2022 00:24
@james-rms james-rms force-pushed the jrms/cpp-correct-chunk-selection branch from b324998 to 4543624 Compare December 7, 2022 00:25
@james-rms james-rms merged commit 801c4ae into main Dec 7, 2022
@james-rms james-rms deleted the jrms/cpp-correct-chunk-selection branch December 7, 2022 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants