-
Notifications
You must be signed in to change notification settings - Fork 258
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
rosbag2_cpp: sequential reader specifies no order #1162
Conversation
Signed-off-by: James Smith <james@foxglove.dev>
cf5a3f2
to
246c9e0
Compare
@emersonknapp are you able to review? (I don't have permission to specifically assign you) |
I think that this approach makes sense - there's no particular reason for the SequentialReader to have an opinion unless the user explicitly asks for it. The plugin can have its own default read order. |
Does |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with green CI
Signed-off-by: James Smith <james@foxglove.dev>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a concern about this PR.
I agree that storage plugin could have some default read order.
However in SequantialReader we have some logic which is rely on read order and falling back to some assumption what default read order would be for the plugin without explicitly reading it out also incorrect behavior!
For instance in changes from this PR made implicit assumption for SequantialReader
that default read order for storage plugin is not reverse which might not be necessary the case.
I also opposed to use optional
.
While it looks handy and and fancy new C++ feature - it's actually an "evil" for many corner cases and introduce more uncertainty in design and also require more boiler plate dummy checks for nullopt
which is very easy to miss or incorrectly mixup with other existent logic.
The right solution if we really want to respect default read order from storage plugin would be to bring in a new API aka rosbag2_storage::ReadOrder rosbag2_storage::get_read_order()
and use it in constructor for initialization of the private read_roder
variable in SequantialReader.
I am honestly very doubt that this is a big deal or even a meaningful issue that we are falling back to some predefined read order in SequantialReader and enforcing it for underlying storage plugin if it was not set explicitly.
Thea are not too many storage plugins to be worry about this default value.
IMO current behavior is a WAD (worked as designed) and ok to be as is.
Storage plugin shall raise exception if it doesn't support read order settling up from SequantialReader
.
I am curious why |
Going with a different approach. |
Here is the real life example while it is "Evil" ros-tooling/topic_tools#48 |
Right now
SequentialReader
chooses a default read order (by default constructingReadOrder
) and callsset_read_order()
on the underlying storage plugin. However, the underlying storage plugin may not support that read order. If the user hasn't specified the read order they want, the plugin should just decide for them.It doesn't really make sense for SequentialReader to always specify the read order, unless the user has actually called
set_read_order
on SequentialReader. With that in mind this PR removes that constraint.Fixes ros-tooling/rosbag2_storage_mcap#61