[consensus] KUDU-2443 fix replica replacement of RF=1

Fixed bug in the consensus::ShouldEvictReplica() function for the case
when the leader replica of a tablet with replication factor of 1
is marked with the REPLACE attribute and there is an extra voter
replica in the tablet's Raft config.

Prior to this fix, the master would evict the extra voter from the
configuration and then it would add a new non-voter because of the
consensus::ShouldAddReplica() method's behavior.  After the newly
added non-voter replica catches up and becomes a voter, that would
happen again and again, until the REPLACE attribute is removed.

This changelist also includes regression tests to cover the
corresponding functionality.  Also, additional test scenarios added
to extend the coverage for the single-replica edge case.

Change-Id: I9da9fe6788f28b40f7adc53e23540bcdf103c1ea
Reviewed-on: http://gerrit.cloudera.org:8080/10438
Tested-by: Kudu Jenkins
Reviewed-by: Mike Percy <mpercy@apache.org>
(cherry picked from commit cb203729255dba06120d2a2f8702032a2ffd9694)
Reviewed-on: http://gerrit.cloudera.org:8080/10464
Reviewed-by: Alexey Serbin <aserbin@cloudera.com>
2 files changed