[23974] Fix DataReader history enforcement to respect max_samples_per_instance (backport #6228)#6284
Open
mergify[bot] wants to merge 1 commit into3.2.xfrom
Open
[23974] Fix DataReader history enforcement to respect max_samples_per_instance (backport #6228)#6284mergify[bot] wants to merge 1 commit into3.2.xfrom
mergify[bot] wants to merge 1 commit into3.2.xfrom
Conversation
#6228) * Fix DataReader history enforcement to respect max_samples_per_instance Signed-off-by: Raül <raulojeda@eprosima.com> * Take into account LENGTH_UNLIMITED, go back to max_samples allocation and add tests accordingly Signed-off-by: Raül <raulojeda@eprosima.com> * Uncrustify Signed-off-by: Raül <raulojeda@eprosima.com> * More uncrustify Signed-off-by: Raül <raulojeda@eprosima.com> * Refactor history depth vs mspi tests Signed-off-by: Raül <raulojeda@eprosima.com> * Uncrustify Signed-off-by: Raül <raulojeda@eprosima.com> * Update src/cpp/fastdds/publisher/DataWriterHistory.cpp Co-authored-by: Miguel Company <miguelcompany@eprosima.com> Signed-off-by: Raül Ojeda Gandia <raulojeda@eprosima.com> * Refactor tests and add keyed keep_all tests Signed-off-by: Raül <raulojeda@eprosima.com> * Update src/cpp/fastdds/publisher/DataWriterHistory.cpp Co-authored-by: Miguel Company <miguelcompany@eprosima.com> Signed-off-by: Raül Ojeda Gandia <raulojeda@eprosima.com> * New uncrustify Signed-off-by: Raül <raulojeda@eprosima.com> --------- Signed-off-by: Raül <raulojeda@eprosima.com> Signed-off-by: Raül Ojeda Gandia <raulojeda@eprosima.com> Co-authored-by: Miguel Company <miguelcompany@eprosima.com> (cherry picked from commit 30b6351) # Conflicts: # test/unittest/dds/subscriber/DataReaderTests.cpp
Contributor
Author
|
Cherry-pick of 30b6351 has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
13 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR fixes a bug where
DataReaderwas incorrectly usinghistory.depthinstead ofmax_samples_per_instancewhendepth > max_samples_per_instance.Current Behavior (Bug)
When a DataReader is configured with:
history.depth = 10max_samples_per_instance = 5The QoS validation correctly warns:
However, the DataReader was actually storing 10 samples (using
depth) instead of 5 (usingmax_samples_per_instance), making the warning misleading.Root Cause
The bug existed in three locations:
max_samples_per_instancewas being overwritten withmax_samples, destroying the user's QoS settinginstance_changes.size() < depthinstead ofinstance_changes.size() < min(depth, max_samples_per_instance)Changes
min(history.depth, max_samples_per_instance)as the effective limitDataWriterHistory::to_history_attributesfor consistency in memory allocationImpact
This fix ensures the DataReader behavior matches the documented QoS warning message. Applications relying on
max_samples_per_instanceto limit memory usage will now work correctly.@Mergifyio backport 3.4.x 3.2.x 2.14.x
Contributor Checklist
versions.mdfile (if applicable).Reviewer Checklist
This is an automatic backport of pull request #6228 done by [Mergify](https://mergify.com).