• Julien Muchembled's avatar
    client: fix conflict of node id by never reading from storage without being connected to the master · 11d83ad9
    Julien Muchembled authored
    Client nodes ignored the state of the connection to the master node when reading
    data from storage, as long as their partition tables were recent enough. This
    way, they were able to finish read-only transactions even if they could't reach
    the master, which could be useful for high availability. The downside is that
    the master node ignored that their node ids were still used, which causes "uuid"
    conflicts when reallocating them.
    
    Rejected solutions:
    - An unused NEO Storage should not insist in staying connected to master node.
    - Reverting to big random node identifiers is a lot of work and it would make
      debugging annoying (see commit 23fad3af).
    - Always increasing node ids could have been a simple solution if we accepted
      that the cluster dies after that all 2^24 possible ids were allocated.
    
    Given that reading from storage without being connected to the master can only
    be useful to finish the current transaction (because we always ping the master
    at the beginning of every transaction), keeping such feature is not worth the
    effort.
    
    This commit fixes id conflicts in a very simple way, by clearing the partition
    table upon primary node failure, which forces reconnection to the master before
    querying any storage node. In such case, we raise a special exception that will
    cause the transaction to be restarted, so that the user does not get errors for
    temporary connection failures.
    11d83ad9
node.py 21.1 KB