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

[WIP] The time bounded snapshot feature #1844

Draft
wants to merge 6 commits into
base: rolling
Choose a base branch
from

Conversation

MichaelOrlov
Copy link
Contributor

@MichaelOrlov MichaelOrlov commented Oct 28, 2024

This PR adds the "--snapshot-duration" CLI option.

The snapshot duration CLI option is specified as a floating point value in seconds.
The default value 0.0 indicates that the snapshot will be limited by the --max-cache-size parameter only. If the value is more than 0.0, the cyclic buffer for the snapshot will be limited by both the series of messages duration and the maximum cache size parameter. To override the upper bound by total messages size, the --maximum-cache-size CLI option can be settled to 0.

- Added the "--snapshot-duration" CLI option. Default value 0 indicates
that the snapshot will be limited by the --max-cache-size parameter
only. If the value is more than 0, the cyclic buffer for the snapshot
will be limited by both the series of messages duration and the maximum
cache size parameter.
- To override the upper bound by total messages size, the
"--maximum-cache-size" CLI option can be settled to 0.

Signed-off-by: Michael Orlov <[email protected]>
@MichaelOrlov MichaelOrlov linked an issue Oct 28, 2024 that may be closed by this pull request
@MichaelOrlov MichaelOrlov changed the title The time bounded snapshot feature [WIP] The time bounded snapshot feature Oct 28, 2024
@MichaelOrlov MichaelOrlov force-pushed the morlov/add_max_snapshot_duration_option branch 3 times, most recently from caa3c08 to 0e076ec Compare October 29, 2024 01:09
@MichaelOrlov
Copy link
Contributor Author

MichaelOrlov commented Nov 4, 2024

@reinzor I've made good progress on this PR. I would say I've made all the required changes for this feature. However, I didn't have time to test it and write unit tests.

The help here would be really appreciated. Feel free to cherry-pick commits from this PR or create a fork above it.
Need to review #1844, test it locally, write unit tests, and update documentation.

@MichaelOrlov MichaelOrlov added the help wanted Extra attention is needed label Nov 4, 2024
Copy link
Contributor

@fujitatomoya fujitatomoya left a comment

Choose a reason for hiding this comment

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

@reinzor FYI, i left a few comments for your reference when you take this over.

@@ -1,4 +1,4 @@
// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// Copyright 2021 Amazonhe t.com, Inc. or its affiliates. All Rights Reserved.
Copy link
Contributor

Choose a reason for hiding this comment

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

accidental typo?

Comment on lines +34 to +35
ROSBAG2_CPP_LOG_ERROR_STREAM("Invalid arguments for the MessageCacheCircularBuffer. "
"Both max_bytes_size and max_cache_duration are zero.");
Copy link
Contributor

Choose a reason for hiding this comment

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

if this is debug message, it should include some extra debug information that the following exception cannot throw as in the message? otherwise, it is the same information with the following exception, so maybe debugging message here is not really useful since user can see the exact same message via exception?

Comment on lines +148 to +149
use_cache_ = storage_options.max_cache_size > 0u ||
(storage_options.snapshot_mode && storage_options.snapshot_duration.nanoseconds() > 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

checking storage_options.snapshot_mode is redundant?

Suggested change
use_cache_ = storage_options.max_cache_size > 0u ||
(storage_options.snapshot_mode && storage_options.snapshot_duration.nanoseconds() > 0);
use_cache_ = storage_options.max_cache_size > 0u || storage_options.snapshot_duration.nanoseconds() > 0;

@@ -49,4 +49,7 @@ player_params_node:
max_cache_size: 9898
storage_preset_profile: "resilient"
snapshot_mode: false
snapshot_duration:
sec: 1
nsec: 500000000
custom_data: ["key1=value1", "key2=value2"]
Copy link
Contributor

Choose a reason for hiding this comment

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

Requires a newline at the end of the file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Snapshot based on duration
2 participants