MB-100 Ensure ns_config:merge_values/2 is commutative.

That is, merge_values(A, B) equals to merge_values(B, A) for
all A and B. This seems to be enough to prevent all the potential
ping-pong situations that could theoretically still happen.

Change-Id: I1cbb087a7737964c006c9ebd64782e44e7b09ed1
Reviewed-on: http://review.couchbase.org/30074
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-9430 Factor out moves minimization function.

Change-Id: I5d5d40f17789d81a17051a09baefdd8f7af68725
Reviewed-on: http://review.couchbase.org/30075
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-9430 Apply simple vbucket moves minimization to vbmap output.

Change-Id: I1b347328835762c6a3669e65dcce7f58ab9e3ade
Reviewed-on: http://review.couchbase.org/30076
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>