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

Adding implementation for instance_state and view_state [12758] #2298

Merged

Conversation

MiguelCompany
Copy link
Member

@MiguelCompany MiguelCompany commented Oct 29, 2021

Implementing figure 2.11 (Statechart of the instance_state and view_state for a single instance) of the DDS standard.

@MiguelCompany MiguelCompany marked this pull request as ready for review October 29, 2021 10:17
@MiguelCompany
Copy link
Member Author

@richiprosima Please test windows

@MiguelCompany MiguelCompany added this to the v2.5.0 milestone Nov 4, 2021
Copy link
Contributor

@MiguelBarro MiguelBarro left a comment

Choose a reason for hiding this comment

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

  • Some tests trigger assertions when the WriterProxies are notified of sample removal (history >> reader >> proxies).
  • The DataReaderTests.check_key_history_wholesomeness_on_unmatch must be adapted to the new standard-compliant behaviour (remove only non-notified samples on writer unmatch).
  • New tests must be added to check the generation and state member of the retrieved collections' SampleInfos.

src/cpp/fastdds/subscriber/history/DataReaderInstance.hpp Outdated Show resolved Hide resolved
include/fastdds/rtps/history/ReaderHistory.h Outdated Show resolved Hide resolved
include/fastdds/rtps/history/ReaderHistory.h Outdated Show resolved Hide resolved
@MiguelCompany
Copy link
Member Author

  • New tests must be added to check the generation and state member of the retrieved collections' SampleInfos.

We already added them on #2193, which is already merged.

@MiguelCompany MiguelCompany force-pushed the feature/datareader-history/main branch from e6b7615 to 293300a Compare December 7, 2021 07:20
@MiguelCompany MiguelCompany force-pushed the feature/datareader-history/impl branch from 0052f0d to 64dc3fd Compare December 7, 2021 07:24
@MiguelCompany MiguelCompany force-pushed the feature/datareader-history/main branch from 293300a to 464a9e1 Compare December 13, 2021 07:49
@MiguelCompany MiguelCompany force-pushed the feature/datareader-history/impl branch 2 times, most recently from 8e1416c to 7c473e3 Compare December 13, 2021 16:03
@MiguelCompany
Copy link
Member Author

@richiprosima Please test aarch64

@MiguelCompany MiguelCompany force-pushed the feature/datareader-history/impl branch from 231c5cd to e52fffd Compare December 13, 2021 16:21
@MiguelBarro
Copy link
Contributor

@richiprosima Please test windows

@MiguelCompany MiguelCompany force-pushed the feature/datareader-history/impl branch from e52fffd to 82c54e2 Compare December 14, 2021 08:21
@MiguelCompany
Copy link
Member Author

@richiprosima Please test aarch64

@MiguelCompany MiguelCompany force-pushed the feature/datareader-history/main branch from 464a9e1 to a36c797 Compare December 17, 2021 07:30
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
…istory.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
@MiguelCompany MiguelCompany force-pushed the feature/datareader-history/impl branch from 2dbc9f6 to f956e80 Compare December 17, 2021 07:31
@MiguelCompany
Copy link
Member Author

@richiprosima Please test this

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
@MiguelCompany MiguelCompany added no-aarch Skip build & test for aarch64 no-test Skip CI tests if PR marked with this label labels Dec 20, 2021
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Copy link
Contributor

@JLBuenoLopez JLBuenoLopez left a comment

Choose a reason for hiding this comment

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

LGTM

@MiguelCompany
Copy link
Member Author

Leaving CI for the PR into master.

@MiguelCompany MiguelCompany merged this pull request into feature/datareader-history/main Dec 20, 2021
@MiguelCompany MiguelCompany deleted the feature/datareader-history/impl branch December 20, 2021 08:10
MiguelCompany added a commit that referenced this pull request Dec 20, 2021
* Refs 12400. Added DataReaderCacheChange.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Added DataReaderInstance.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. DataReaderHistory using new types.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Removing unnecessary method from SubscriberHistory.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. ReadTakeCommand receives full instance information.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. ReadTakeCommand checks for instance states.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. ReadTakeCommand fills sample info from instance data.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Added insert method to ResourceLimitedVector.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. DataReaderInstance uses ResourceLimitedVector.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. get_first_untaken_info takes sample info from instance data.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Discard received change when older than oldest.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Fixing KEEP_ALL with keys.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Refactor to always use instances.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Basic structure for update instance state.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Adding alive_writers and current_owner to DataReaderInstance.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Implementing writer_alive.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Implementing writer_dispose.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Implementing writer_unregister.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Setting NOT_NEW on returned instances.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Correct return code when returning samples with no data.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Set view_state to NEW when changing instance_state to ALIVE.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Moving generation counts into CacheChange_t.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Assigning generation counts after processing instance state.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Update instance_state when writer becomes not alive.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Clear alive_writers when changing generation.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Add writer_unmatched to ReaderHistory.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. NOT_ALIVE_UNREGISTERED should not return valid data.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Set autodispose_unregistered_instances to false on test.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Remove instance when it becomes empty and is not alive.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Refactor into writer_not_alive.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Keeping samples from unmatched writers.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Avoid keeping non-notified samples.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Linters.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Fixing compilation warnings on windows.

Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>

* Refs 12758. Fixing assertion on WriterProxy logic. If we only notify fragmented DATA reception on completion we should only notify removal of fully assembled samples.

Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>

* Refs 12758 Fixing DataReaderHistory test that checks DataWriter disposal behaviour.

Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>

* Refs 12758. Use move semantics.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Use ResourceLimitedVector for writers.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Apply pre-allocation policies.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Uncrustify.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. PubSubReader. Account for writer_guid on last_seq checks.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Added can_change_be_added_nts.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Removed unused method.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Always use completed changes for key computation.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Fixed ResourceLimitedVector::insert.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Uncrustify.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Avoid dynamic allocation inside remove_changes_with_pred.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Optimization on DataReaderHistory::remove_change_nts.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Method writer_unmatched documented and improved.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Do not complete changes for non-keyed topics.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Do not remove incomplete changes for keyed topics.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Different removal policy on ReaderHistory and DataReaderHistory.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Fix unused parameter warning.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Removed unused header.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Doxydoc improvements.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Linters.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

Co-authored-by: Miguel Barro <miguelbarro@eprosima.com>
MiguelCompany added a commit that referenced this pull request Dec 21, 2021
* Refactor DataReaderImpl to use a new DataReaderHistory class (#2177)

* Refs 12400. Duplicating SubscriberHistory into DataReaderHistory.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Using DataReaderHistory on DataReaderImpl.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Avoid using TopicAttributes.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Additional cleanup.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Using DDS SampleInfo.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12404. Uncrustify.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Fixed DataReaderHistory (#2194)

* DataReader test for sample_info fields (#2193)

* Refs 12400. Initial test infrastructure.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Additional tests.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Tests are run twice with a take in the middle.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Uncrustify.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12469. Fixed warnings.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12469. Additional comments.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Adding implementation for instance_state and view_state (#2298)

* Refs 12400. Added DataReaderCacheChange.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Added DataReaderInstance.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. DataReaderHistory using new types.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Removing unnecessary method from SubscriberHistory.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. ReadTakeCommand receives full instance information.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. ReadTakeCommand checks for instance states.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. ReadTakeCommand fills sample info from instance data.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Added insert method to ResourceLimitedVector.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. DataReaderInstance uses ResourceLimitedVector.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. get_first_untaken_info takes sample info from instance data.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Discard received change when older than oldest.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Fixing KEEP_ALL with keys.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Refactor to always use instances.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Basic structure for update instance state.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Adding alive_writers and current_owner to DataReaderInstance.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Implementing writer_alive.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Implementing writer_dispose.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Implementing writer_unregister.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Setting NOT_NEW on returned instances.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Correct return code when returning samples with no data.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Set view_state to NEW when changing instance_state to ALIVE.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Moving generation counts into CacheChange_t.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Assigning generation counts after processing instance state.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Update instance_state when writer becomes not alive.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Clear alive_writers when changing generation.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Add writer_unmatched to ReaderHistory.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. NOT_ALIVE_UNREGISTERED should not return valid data.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Set autodispose_unregistered_instances to false on test.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Remove instance when it becomes empty and is not alive.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Refactor into writer_not_alive.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Keeping samples from unmatched writers.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Avoid keeping non-notified samples.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Linters.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Fixing compilation warnings on windows.

Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>

* Refs 12758. Fixing assertion on WriterProxy logic. If we only notify fragmented DATA reception on completion we should only notify removal of fully assembled samples.

Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>

* Refs 12758 Fixing DataReaderHistory test that checks DataWriter disposal behaviour.

Signed-off-by: Miguel Barro <miguelbarro@eprosima.com>

* Refs 12758. Use move semantics.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Use ResourceLimitedVector for writers.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Apply pre-allocation policies.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Uncrustify.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. PubSubReader. Account for writer_guid on last_seq checks.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Added can_change_be_added_nts.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Removed unused method.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Always use completed changes for key computation.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Fixed ResourceLimitedVector::insert.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Uncrustify.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Avoid dynamic allocation inside remove_changes_with_pred.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Optimization on DataReaderHistory::remove_change_nts.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Method writer_unmatched documented and improved.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Do not complete changes for non-keyed topics.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Do not remove incomplete changes for keyed topics.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Different removal policy on ReaderHistory and DataReaderHistory.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Fix unused parameter warning.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Removed unused header.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Doxydoc improvements.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12758. Linters.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

Co-authored-by: Miguel Barro <miguelbarro@eprosima.com>

* Refs 12400. Adding checks for insert on ResourceLimitedVectorTests.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Fixed rvalue version of ResourceLimitedVector::insert.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Added feature to versions.md.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Linters.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Fixed inclusion of DataReaderHistory.cpp on CMake files.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

* Refs 12400. Add missing feature to versions.md.

Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>

Co-authored-by: Miguel Barro <miguelbarro@eprosima.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-aarch Skip build & test for aarch64 no-test Skip CI tests if PR marked with this label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants