pvc/node-daemon/pvcnoded
Joshua Boniface b413e042a6 Improve handling of primary contention
Previously, contention could occasionally cause a flap/dual primary
contention state due to the lack of checking within this function. This
could cause a state where a node transitions to primary than is almost
immediately shifted away, which could cause undefined behaviour in the
cluster.

The solution includes several elements:
    * Implement an exclusive lock operation in zkhandler
    * Switch the become_primary function to use this exclusive lock
    * Implement exclusive locking during the contention process
    * As a failsafe, check stat versions before setting the node as the
      primary node, in case another node already has
    * Delay the start of takeover/relinquish operations by slightly
      longer than the lock timeout
    * Make the current router_state conditions more explicit (positive
      conditionals rather than negative conditionals)

The new scenario ensures that during contention, only one secondary will
ever succeed at acquiring the lock. Ideally, the other would then grab
the lock and pass, but in testing this does not seem to be the case -
the lock always times out, so the failsafe check is technically not
needed but has been left as an added safety mechanism. With this setup,
the node that fails the contention will never block the switchover nor
will it try to force itself onto the cluster after another node has
successfully won contention.

Timeouts may need to be adjusted in the future, but the base timeout of
0.4 seconds (and transition delay of 0.5 seconds) seems to work reliably
during preliminary tests.
2020-04-12 03:40:17 -04:00
..
CephInstance.py Remove /ceph/cmd pipe for (most) Ceph commands 2020-02-08 23:40:02 -05:00
DNSAggregatorInstance.py Handle invalid cursor setup cleanly 2020-02-19 16:29:59 -05:00
Daemon.py Improve handling of primary contention 2020-04-12 03:40:17 -04:00
MetadataAPIInstance.py Use consistent naming of components 2020-02-08 19:34:07 -05:00
NodeInstance.py Improve handling of primary contention 2020-04-12 03:40:17 -04:00
VMConsoleWatcherInstance.py Use consistent naming of components 2020-02-08 19:34:07 -05:00
VMInstance.py Correct issues with VM lock freeing 2020-03-02 12:45:12 -05:00
VXNetworkInstance.py Properly handle takeover state in VXNetworks 2020-03-02 10:41:00 -05:00
__init__.py Use consistent naming of components 2020-02-08 19:34:07 -05:00
common.py Use consistent naming of components 2020-02-08 19:34:07 -05:00
dnsmasq-zookeeper-leases.py Use consistent naming of components 2020-02-08 19:34:07 -05:00
fencing.py Use consistent naming of components 2020-02-08 19:34:07 -05:00
log.py Use consistent naming of components 2020-02-08 19:34:07 -05:00
zkhandler.py Improve handling of primary contention 2020-04-12 03:40:17 -04:00