-
Notifications
You must be signed in to change notification settings - Fork 240
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
SequentialWriter to cache by message size instead of message count #530
Conversation
c53b93b
to
52735bf
Compare
@@ -249,11 +249,13 @@ void SequentialWriter::write(std::shared_ptr<rosbag2_storage::SerializedBagMessa | |||
storage_->write(converted_msg); |
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.
@emersonknapp we discussed cleaning this up better, however, I think this initial 0 check is required cause the cache size is set to 0 in this scenario (cause max_cache_size is 0) and so we need to handle it separately.
Let me know what you think.
@@ -314,8 +319,13 @@ TEST_F(SequentialWriterTest, do_not_use_cache_if_cache_size_is_zero) { | |||
|
|||
std::string rmw_format = "rmw_format"; | |||
|
|||
std::string msg_content = "Hello"; |
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.
This test ensures that cache is not used if cache size is 0 and previously did not care about the serialized_data
in the message. However, I thought it is better if we do test with a close to real world scenario where the message has some data as well.
@@ -117,7 +118,7 @@ TEST_F(RecordFixture, record_end_to_end_test) { | |||
wrong_message->string_value = "wrong_content"; | |||
|
|||
auto process_handle = start_execution( | |||
"ros2 bag record --output " + root_bag_path_.string() + " /test_topic"); | |||
"ros2 bag record --max-cache-size 0 --output " + root_bag_path_.string() + " /test_topic"); |
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.
Isn't 0 the default?
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.
Oops, I should add this to the comment and the title also.
0 default = dont use cache and write to disk always, which isnt great for performance. So as per the issue #464 I've also changed the default to 1MB
|
Hi @Karsten1987, this PR does not change the bag splitting functionality, rather it addresses the way messages are stored in cache before being written to a bag. Previously, it used the number of messages to hold in cache whereas bag splitting happens based on bag size or duration. I didnt see any support for split by message count (I could be wrong though). Let me know if I've understood you correctly. |
That's what I meant with this 🤭 |
Haha, its all good :) |
Just noting that this touches the same code as #506 for full visibility |
e810f1c
to
f6e3104
Compare
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.
Seems reasonable with green CI
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, nice and minimal!
Signed-off-by: Jaison Titus <jaisontj@amazon.com>
current_cache_size_ Signed-off-by: Jaison Titus <jaisontj@amazon.com>
f6e3104
to
0fb6aa1
Compare
The CI run above tried testing Here is the correct one with: |
Signed-off-by: Jaison Titus <jaisontj@amazon.com>
Instability on OSX and aarch64 is related to xmllint, which is failing on all packages currently in the nightly build - so it is definitely not related to this PR |
) * Fixes #464 - caches by message size and not message count Signed-off-by: Jaison Titus <jaisontj@amazon.com>
) * Fixes #464 - caches by message size and not message count Signed-off-by: Jaison Titus <jaisontj@amazon.com>
This is part 1 of 2 PRs addressing #464
As for:
It can work the same way as split bag file by duration and split bag file by size in that, it will be "whichever comes first"