• yacovm's avatar
    [FAB-13180] Orderer: auto-join existing inactive chains · 4bc13c8e
    yacovm authored
    This change set makes cluster type OSNs autonomously detect channels
    that exist and that they should be part of (the channel configuration
    has their public credentials as a consenter for the channel),
    but that they do not run chains for, or have the blocks in their ledger.
    This can happen from several reasons:
    - The OSN is added to an existing chain, and since it didn't participate
      in the chain so far, it didn't get the blocks that tell it is now
      part of the channel.
    - The OSN tried to detect whether it is part of a channel, but it
      wasn't able, because all OSNs of the system channel returned
      service-unavailable. This can happen if:
      - a leader election takes place
      - the network is acting up so the leadership was lost
      - a channel has been deserted (all OSNs left it).
    To take care of such use cases, all OSNs now:
    - Track inactive chains that they know of, but they do not participate in
    - Periodically(*) probe the system channel OSNs to see if they are now
      part of these chains or not.
    - If so, then they replicate the chains, and create instances of them,
      and replace the instances of the inactive chains in the registrar
      with the new instances of type etcdraft.
    (*) - 10 seconds after boot, then after 20 seconds,
          then after 40 seconds, etc. etc. eventually- every 5 minutes.
    Change-Id: I3c2a84e6f4f402e011e7a895345b3d3982247083
    Signed-off-by: default avataryacovm <yacovm@il.ibm.com>
    Signed-off-by: default avatarArtem Barger <bartem@il.ibm.com>