[humble] Make snapshot writing into a new file each time it is triggered (backport #1842) #1850
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR will make snapshot writing into a new file each time it is triggered.
Note. Snapshot now becomes a blocking call and mutually exclusive with the
writer::write(message)
method to avoid race conditions, i.e., blocking the samewriter_mutex_
.The
set_data_ready()
method from #1839 is not needed since "snapshot" has now become a blocking call; therefore, there are no race conditions, and we will not dump data from the cyclic buffer twice becausedata_ready
will be settled false after the first dump withmessage_cache_->notify_data_ready();
.rosbag2/rosbag2_cpp/src/rosbag2_cpp/cache/circular_message_cache.cpp
Lines 95 to 106 in 786c3c4
However, we still need to call
split_bagfile_local(true)
to trigger callbacks and open a new storage file.This PR could be backported. There are no API/ABI breaking changes in it.
This is an automatic backport of pull request #1842 done by Mergify.