• Levin Zimmermann's avatar
    identification: Set possible answers to same msgid · b775379a
    Levin Zimmermann authored
    This patchs origin is !20.
    With recent changes on kirr/neo!2
    and levin.zimmermann/wendelin.core@f546d836
    we can already use WCFS with multiple master nodes in combination with this
    patch. Until we proceed in !20
    we can already use a NEO/py with this patch in order to test WCFS on our
    wind clone.
    
    ---
    
    Original patch content:
    
    When a node tries to connect to another node it initially sends a
    'RequestIdentification' packet. The other node can either reply with
    'AcceptIdentification' or in case of a secondary master with
    'NotPrimaryMaster'.
    
    In the second case the message id differs from the initial requests
    message id. This makes it difficult in a multi-threaded implementation
    to proceed this answer: due to the different msg/connection - id the
    multi-threaded implementation tries to proceed this incoming message in
    a different thread, while the requesting thread waits forever for its
    peers reply.
    
    The most straightforward solution is to use the same connection - id for
    both possible answers to the 'RequestIdentification' packet. This
    doesn't break given NEO/py implementation and is only a small patch.
    A workaround in a multi-threaded implementation on the other hand
    seems to be much more complicated and time-consuming. Finally it also makes
    sense semantically, because "Message IDs are used to identify response
    packets" and in the given context the 'NotPrimaryMaster' *is* the de facto
    response of a 'RequestIdentification'.
    
    Because the msgid is the same now, '_ask' uses the
    'PrimaryBootstrapHandler' (if it's the same connection) [1], so it may also
    be necessary to move 'notPrimaryMaster' to 'PrimaryBootstrapHandler'.
    
    [1] https://lab.nexedi.com/nexedi/neoppod/blob/ecc9c63c7/neo/lib/threaded_app.py#L142
    b775379a
identification.py 6.57 KB