Pick smallest available participant ID for new paricipants#3437
Pick smallest available participant ID for new paricipants#3437EduPonz merged 7 commits intoeProsima:masterfrom
Conversation
|
@richiprosima please test this |
2dc0abf to
f446ceb
Compare
|
@sloretz Reusing a participant ID within the same process is a bad idea, since it will allow for two participants to have the same GUID. I am developing a different way of achieving the expected behavior, where the ports used do not depend on the participantID, and we always try with the lowest possible port. |
@MiguelCompany I thought the ports being calculated from the participant ID was part of the RTPS standard. and https://www.omg.org/spec/DDSI-RTPS/2.3/PDF I see in 9.6.1.1 it says
It seems like it would be OK to reuse a participant ID as no two participants would have the same ID at the same time. If I understand correctly, wouldn't the same thing happen if participants were in different processes and someone were to stop and restart the last participant on a machine? If the GUID being reused is a problem, maybe a solution is to change how the participant GUID is generated? It looks like the standard is more flexible about that. |
|
@richiprosima Please test this |
|
@sloretz On f6f9840c28ed4282a70b95bd32a052ab98a6d46a I added a small change that makes the GUID be different when creating the same participant ID twice. The idea is to use a counter on the high part of the ID that is used to generate the GUID. |
|
@richiprosima Please test this |
Signed-off-by: Shane Loretz <sloretz@google.com>
Signed-off-by: Shane Loretz <sloretz@google.com>
Signed-off-by: Shane Loretz <sloretz@google.com>
Signed-off-by: Shane Loretz <sloretz@google.com>
Signed-off-by: Shane Loretz <sloretz@google.com>
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
7160972 to
e4f0c60
Compare
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
e4f0c60 to
8850078
Compare
|
@richiprosima Please test this |
|
@EduPonz Would you mind reviewing this? |
There was a problem hiding this comment.
This LGTM. I think the added members (data & functions) would benefit from some hpp documentation. The same goes for some of the not so straight forward code both around the reserved/used pattern (clever way of going around the full locking BTW), and around the get_id_for_prefix function, which shows some nice out-of-the-box thinking 🤯 .
|
@Mergifyio backport 2.6.x |
✅ Backports have been createdDetails
|
* Pick smallest available participant ID for new paricipants Signed-off-by: Shane Loretz <sloretz@google.com> * Fix style issues Signed-off-by: Shane Loretz <sloretz@google.com> * Eliminate m_maxRTPSParticipantId Signed-off-by: Shane Loretz <sloretz@google.com> * Clearer comments on rationale behind return value Signed-off-by: Shane Loretz <sloretz@google.com> * static_cast to avoid warning on WIN32 Signed-off-by: Shane Loretz <sloretz@google.com> * Use special participant id value for prefix creation. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * New reservation mechanism Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> --------- Signed-off-by: Shane Loretz <sloretz@google.com> Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> Co-authored-by: Miguel Company <MiguelCompany@eprosima.com> (cherry picked from commit e46e875) # Conflicts: # src/cpp/rtps/RTPSDomain.cpp # src/cpp/rtps/RTPSDomainImpl.hpp
…4555) * Pick smallest available participant ID for new paricipants (#3437) * Pick smallest available participant ID for new paricipants Signed-off-by: Shane Loretz <sloretz@google.com> * Fix style issues Signed-off-by: Shane Loretz <sloretz@google.com> * Eliminate m_maxRTPSParticipantId Signed-off-by: Shane Loretz <sloretz@google.com> * Clearer comments on rationale behind return value Signed-off-by: Shane Loretz <sloretz@google.com> * static_cast to avoid warning on WIN32 Signed-off-by: Shane Loretz <sloretz@google.com> * Use special participant id value for prefix creation. Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> * New reservation mechanism Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> --------- Signed-off-by: Shane Loretz <sloretz@google.com> Signed-off-by: Miguel Company <MiguelCompany@eprosima.com> Co-authored-by: Miguel Company <MiguelCompany@eprosima.com> (cherry picked from commit e46e875) # Conflicts: # src/cpp/rtps/RTPSDomain.cpp # src/cpp/rtps/RTPSDomainImpl.hpp * Refs #20120: Solve conflicts Signed-off-by: Jesus Perez <jesusperez@eprosima.com> * Refs #20120: Fix wrong deleted return Signed-off-by: Jesus Perez <jesusperez@eprosima.com> * Refs #20120: Uncrustify Signed-off-by: Jesus Perez <jesusperez@eprosima.com> --------- Signed-off-by: Jesus Perez <jesusperez@eprosima.com> Co-authored-by: Shane Loretz <sloretz@google.com> Co-authored-by: Jesus Perez <jesusperez@eprosima.com>
Picks the smallest available participant ID.
Description
This picks the smallest available participant ID when creating new participants.
This is necessary for the out of box discovery improvements in ROS 2: ros2/rmw_fastrtps#653
The issue with picking one greater than the maximum participant ID is that it's possible for the ID to increase well beyond the number of alive participants. For example, Participant A is created with 0, and B is created with 1. A is destroyed, and C is created. C takes ID 2 even though 0 is available and there are only two participants. When using unicast discovery this can cause participants to no longer be discoverable after the maximum ID climbs past
maxInititialPeersRange. This is currently causing thetest_launch_rostests to fail with the change to unicast discovery by default.Assuming the change looks ok, would it be possible to backport this to the 2.10 branch (assuming that's the branch that will be used for ROS Iron)?
Contributor Checklist
versions.mdfile (if applicable).Reviewer Checklist