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

Change default cache size for sequential_writer to a non zero value #533

Merged
merged 5 commits into from
Oct 9, 2020

Conversation

jaisontj
Copy link
Contributor

@jaisontj jaisontj commented Oct 7, 2020

MERGE AFTER PR #530

Currently, the default cache size for the sequential_writer is 0 which leads to a write to disk on every write call. This PR aims at changing that default value to 1MB [or any other value greater than 0]

Addresses #464

A note on changing the default value: This PR focuses on changing the default cache size when rosbag2 is invoked using the CLI. As for situations where a user might directly use the library, there is no mention of default but a note that a value of 0 will force all writes to disk.

For quick reference, these are all the files where max_cache_size is used/set:

@@ -67,6 +67,7 @@ TEST_F(RecordFixture, record_end_to_end_test_with_zstd_file_compression) {
cmd << "ros2 bag record" <<
" --compression-mode file" <<
" --compression-format zstd" <<
" --max-cache-size 0" <<
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These tests assume the cache size to be 0 [disk write always] and therefore this flag is now required for them to pass.

@@ -40,8 +40,6 @@ void Reader::open(const std::string & uri)
rosbag2_cpp::StorageOptions storage_options;
storage_options.uri = uri;
storage_options.storage_id = "sqlite3";
storage_options.max_bagfile_size = 0; // default
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe this assignment in unnecessary and keeps the code clean and consistent

[Note: if we want to keep this then storage_options.max_bagfile_duration = 0, is something we should add to this.]

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes - I think you are right. It might also make sense to move the "sqlite3" default value to the struct definition as well. No need to do that right now though

@jaisontj jaisontj marked this pull request as ready for review October 7, 2020 18:11
@jaisontj jaisontj requested a review from a team as a code owner October 7, 2020 18:11
Copy link
Collaborator

@emersonknapp emersonknapp left a comment

Choose a reason for hiding this comment

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

I assume this depends on #533 - you should probably mark it as such in the PR description so that we remember to merge this only after the other.

@jaisontj
Copy link
Contributor Author

jaisontj commented Oct 7, 2020

I assume this depends on #533 - you should probably mark it as such in the PR description so that we remember to merge this only after the other.

[Edited] Well, technically, it does not depend on #530 since this just changes the default value for the cache size and handles the test for them as well. But I want to merge this after #530 and have added the dependency in the comment.

@emersonknapp
Copy link
Collaborator

This would change the default cache to one million messages if it was merged before #533 - I think that is probably an unreasonable amount, therefore I'd call it a dependency. E.g. you are storing an IMU message, this could easily make the default cache end up something like >300MB

@jaisontj
Copy link
Contributor Author

jaisontj commented Oct 7, 2020

This would change the default cache to one million messages if it was merged before #533 - I think that is probably an unreasonable amount, therefore I'd call it a dependency. E.g. you are storing an IMU message, this could easily make the default cache end up something like >300MB

True, agreed. That makes sense.

@jaisontj jaisontj force-pushed the jaisontj/fix-464-change-default branch from 756f331 to 044c664 Compare October 9, 2020 19:11
@jaisontj jaisontj requested review from a team and removed request for a team October 9, 2020 19:12
@jaisontj
Copy link
Contributor Author

jaisontj commented Oct 9, 2020

Running CI
build_args: --packages-up-to rosbag2 ros2bag rosbag2_performance_writer_benchmarking rosbag2_py
test_args: --packages-select-regex rosbag2 ros2bag

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@jaisontj
Copy link
Contributor Author

jaisontj commented Oct 9, 2020

Looks like xmllint is failing on all packages currently in the nightly build - so the instability is not related to this PR.

@jaisontj jaisontj merged commit 253c11b into ros2:master Oct 9, 2020
@jaisontj jaisontj deleted the jaisontj/fix-464-change-default branch October 9, 2020 21:04
emersonknapp pushed a commit that referenced this pull request Feb 2, 2021
…533)

* Change default value for max-cache-size to 1MB

Signed-off-by: Jaison Titus <[email protected]>
emersonknapp pushed a commit that referenced this pull request Feb 17, 2021
…533)

* Change default value for max-cache-size to 1MB

Signed-off-by: Jaison Titus <[email protected]>
skudryas pushed a commit to skudryas/rosbag2 that referenced this pull request Mar 12, 2021
…os2#533)

* Change default value for max-cache-size to 1MB

Signed-off-by: Jaison Titus <[email protected]>
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.

3 participants