Skip to content
Snippets Groups Projects
  • Vladislav Shpilevoy's avatar
    226f79bd
    swim: make swim_upsert_member returning two values · 226f79bd
    Vladislav Shpilevoy authored
    swim_upsert_member is a function to add new members or update
    existing ones using info received from other cluster
    participants. At this moment it is quite simple and
    straightforward: either create a new member and return it, or
    update an existing member and return it.
    
    But things are going to change in failure detection and
    dissemination components. A couple of examples showing that a
    member should be returned separately from success/error status:
    
      * To prevent undead members the failure detection forbids to
        add dead members. Otherwise a dead member would be added and
        removed back and forth by different components infinitely.
        Upsert for such members should return NULL, but it is not an
        error - it is a normal function of the protocol;
    
      * When the dissemination component receives a UUID update of
        an existing member, but with too old incarnation, it does not
        apply that update. On the other hand it can not return that
        old member from upsert because of UUID being different from
        the one in the 'request'. In such a case it should be ok to
        return NULL, but do not deem it an error.
    
    Part of #3234
    226f79bd
    History
    swim: make swim_upsert_member returning two values
    Vladislav Shpilevoy authored
    swim_upsert_member is a function to add new members or update
    existing ones using info received from other cluster
    participants. At this moment it is quite simple and
    straightforward: either create a new member and return it, or
    update an existing member and return it.
    
    But things are going to change in failure detection and
    dissemination components. A couple of examples showing that a
    member should be returned separately from success/error status:
    
      * To prevent undead members the failure detection forbids to
        add dead members. Otherwise a dead member would be added and
        removed back and forth by different components infinitely.
        Upsert for such members should return NULL, but it is not an
        error - it is a normal function of the protocol;
    
      * When the dissemination component receives a UUID update of
        an existing member, but with too old incarnation, it does not
        apply that update. On the other hand it can not return that
        old member from upsert because of UUID being different from
        the one in the 'request'. In such a case it should be ok to
        return NULL, but do not deem it an error.
    
    Part of #3234