From 12cccff72b487bcedc1b9a057f479c16055bd4be Mon Sep 17 00:00:00 2001 From: Martin Sumner Date: Wed, 27 Oct 2021 13:04:03 +0100 Subject: [PATCH] Correct unavailable spaces don't create a [0, -1] case --- src/riak_core_coverage_plan.erl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/riak_core_coverage_plan.erl b/src/riak_core_coverage_plan.erl index 72ac083fb..aeebddd32 100644 --- a/src/riak_core_coverage_plan.erl +++ b/src/riak_core_coverage_plan.erl @@ -840,7 +840,13 @@ multi_failure_tester(PartitionCount, CoverageFun) when PartitionCount >= 32 -> % Fail two vnodes together - now can only get partial coverage from a r=2 % plan RVN = rand:uniform(PartitionCount), - UnavailableKeySpaces1 = [RVN - 1, (RVN - 2) rem PartitionCount], + UnavailableKeySpaces1 = + case RVN of + 1 -> + [0, PartitionCount - 1]; + _ -> + [RVN - 1, RVN - 2] + end, {insufficient_vnodes_available, _, VnodeCovers1} = CoverageFun(ReqId, NVal, PartitionCount, UnavailableKeySpaces1, PVC),