Cluster: clear todo_before_sleep flags when executing actions.

Thanks to this change, when there is some code like:

    clusterDoBeforeSleep(CLUSTER_TODO_UPDATE_STATE|...);
    ... and later before returning to the event loop ...
    clusterUpdateState();

The clusterUpdateState() function will clar the flag and will not be
repeated in the clusterBeforeSleep() function. This especially important
for config save/fsync flags which are slow to execute and not a good
idea to repeat without a good reason.

This is implemented for all the CLUSTER_TODO flags.
Cluster: use clusterSetNodeAsMaster() during slave failover.

clusterHandleSlaveFailover() was reimplementing what
clusterSetNodeAsMaster() without any good reason.
Correct the HyperLogLog stale cache flag to prevent unnecessary computations.

Set the MSB as documented.
Cluster test: proper initialization at unit startup.
Cluster test: failure detection initial tests.
Cluster test: better failure detection test and framework improvements.
Merge pull request #1762 from trink/unstable

Correct the HyperLogLog stale cache flag to prevent unnecessary computat...
HyperLogLog regression test for issue #1762.