anchor.diff:              [{set, {node, node(), config_version}, {1,8,0}} |
                upgrade_config_from_1_7_2_to_1_8_0(Config)];
           {value, {1,8,0}} ->
  -            []
  +            HistoryUpgrade = maybe_add_vbucket_map_history(Config),
  +            HistoryUpgrade
       end.
   
   upgrade_config_from_1_6_to_1_7(Config) ->
  
positive.code: -include_lib("eunit/include/eunit.hrl").
  
  -export([default/0, mergable/1, upgrade_config/1]).
  
  % Allow all keys to be mergable.
  
  
negative.code:     list_to_tuple(prefix_replace(Prefix, ReplacementPrefix, tuple_to_list(T)));
  prefix_replace(_Prefix, _ReplacementPrefix, X) -> X.
  
  maybe_add_vbucket_map_history(Config) ->
      case ns_config:search(Config, vbucket_map_history) of
          {value, _} -> [];
          false ->
              Buckets = ns_bucket:get_buckets(Config),
              History = lists:flatmap(
                          fun ({_Bucket, BucketConfig}) ->
                                  case proplists:get_value(map, BucketConfig, []) of
                                      [] -> [];
                                      Map ->
                                          case ns_rebalancer:unbalanced(Map, proplists:get_value(servers, BucketConfig, [])) of
                                              true ->
                                                  [];
                                              false ->
                                                  MapOptions = [{max_slaves, proplists:get_value(max_slaves, BucketConfig, 10)}],
                                                  [{Map, MapOptions}]
                                          end
                                  end
                          end, Buckets),
              [{set, vbucket_map_history, History}]
      end.
  
  %% returns list of changes to config to upgrade it to current version.
  %% This will be invoked repeatedly by ns_config until list is empty.
  %%
  