MB-1143 Use old map generation with no tags and num_replicas<=1.

As a temporary measure to prevent known regression in vbucket map
time.

Change-Id: I672bab69f19df60e3d2777b036178888baf0e697
Reviewed-on: http://review.couchbase.org/31511
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-100 Introduce generic misc:rewrite function.

Which behaves like misc:rewrite_value but takes another function that
decides which terms are rewritten and which are not. Also express all
the other rewrite_* functions via the new one.

Change-Id: I9522b30c8190bb5690c53435d90fe1590dd11c8c
Reviewed-on: http://review.couchbase.org/31512
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-1143 Recognize swap rebalance when nodes are unchanged.

Change-Id: Iddd4c0d685b320facac5104cfcc609d18d079d6c
Reviewed-on: http://review.couchbase.org/31513
Tested-by: Aliaksey Artamonau <aliaksiej.artamonau@gmail.com>
Reviewed-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Tested-by: Aliaksey Kandratsenka <alkondratenko@gmail.com>
MB-1143 Detect nodes swapped between groups in old vbucket maps.

Which allows to perform swap rebalance in such cases.

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