eProsima / Fast-DDS

The most complete DDS - Proven: Plenty of success cases. Looking for commercial support? Contact info@eprosima.com
https://eprosima.com
Apache License 2.0
2.16k stars 765 forks source link

[20815] Only apply content filter to ALIVE changes (backport #4876) #4904

Closed mergify[bot] closed 3 months ago

mergify[bot] commented 4 months ago

Description

Backport of #4835 to 2.x

This PR fixes a bug that caused the content filter to also be applied to unregister and disposed samples. Since in those messages the only fields populated (if any) are the ones annotated with @key, the unregister and dispose samples did not pass the filter (in general) and thus were being discarded. This caused several issues:

  1. When writing to more than 10 instances with default Qos (keep last 1, max_instances 10), only the first 10 samples were been received.
  2. In best effort, when setting the history depth and max instances appropriately, all samples were received, but calls to unregister or dispose followed by a write were triggering sample_lost events, as the received sequence numbers were not consecutive (because of the filtering out of the unregister/dispose).

This PR fixes these issues by only querying for sample relevance when the CacheChange kind is ALIVE.

@Mergifyio backport 2.13.x 2.10.x 2.6.x

Contributor Checklist

Reviewer Checklist

mergify[bot] commented 4 months ago

Cherry-pick of 9a64956e2155704f546b0750f8620b3513e136b8 has failed:

On branch mergify/bp/2.6.x/pr-4876
Your branch is up to date with 'origin/2.6.x'.

You are currently cherry-picking commit 9a64956e2.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
    new file:   include/fastrtps/types/DynamicLoanableSequence.hpp
    modified:   include/fastrtps/types/DynamicPubSubType.h
    modified:   src/cpp/CMakeLists.txt
    modified:   src/cpp/fastdds/publisher/filtering/ReaderFilterCollection.hpp
    new file:   src/cpp/rtps/reader/reader_utils.cpp
    new file:   src/cpp/rtps/reader/reader_utils.hpp
    modified:   test/blackbox/api/dds-pim/PubSubParticipant.hpp
    new file:   test/blackbox/api/dds-pim/PubSubTypeTraits.hpp
    modified:   test/blackbox/api/dds-pim/PubSubWriterReader.hpp
    modified:   test/blackbox/common/DDSBlackboxTestsContentFilter.cpp
    new file:   test/blackbox/types/dynamic_types_traits.hpp

Unmerged paths:
  (use "git add <file>..." to mark resolution)
    both modified:   src/cpp/rtps/reader/StatefulReader.cpp
    both modified:   src/cpp/rtps/reader/StatelessReader.cpp
    both modified:   test/blackbox/api/dds-pim/PubSubReader.hpp
    both modified:   test/blackbox/api/dds-pim/PubSubWriter.hpp
    both modified:   test/unittest/dds/publisher/CMakeLists.txt
    both modified:   test/unittest/statistics/dds/CMakeLists.txt

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

EduPonz commented 4 months ago

Depends on:

EduPonz commented 4 months ago

@richiprosima please test discovery-server

EduPonz commented 3 months ago

@richiprosima please test discovery-server