anchor.diff:  %% before the fold reaches the now out-of-date version of the object, the old
   %% key/hash pair will be ignored.
   %% If `HasIndexTree` is true, also update the index spec tree.
  --spec fold_keys(index(), pid(), boolean()) -> ok.
  -fold_keys(Partition, Tree, HasIndexTree) ->
  -    FoldFun = fold_fun(Tree, HasIndexTree),
  +-spec fold_keys(index(), pid(), partition(), boolean()) -> ok.
  +fold_keys(Partition, HashtreePid, Index, HasIndexTree) ->
  +    FoldFun = fold_fun(HashtreePid, HasIndexTree),
       Req = riak_core_util:make_fold_req(FoldFun,
                                          0, false,
                                          [aae_reconstruction,
                                           {iterator_refresh, true}]),
  -    riak_core_vnode_master:sync_command({Partition, node()},
  +    Result = riak_core_vnode_master:sync_command({Partition, node()},
                                           Req,
                                           riak_kv_vnode_master, infinity),
  -    ok.
  +    handle_fold_keys_result(Result, HashtreePid, Index).
  +
  +
  +%% The accumulator in the fold is the number of bytes hashed
  +%% modulo the "build limit" size. If we get an int back, everything is ok
  +handle_fold_keys_result(Result, Index, HashtreePid) when is_integer(Result) ->
  +    lager:info("Finished AAE tree build: ~p", [Index]),
  +    gen_server:cast(HashtreePid, build_finished);
  +handle_fold_keys_result(Result, Index, HashtreePid) ->
  +    lager:error("Failed to build hashtree for index ~p. Result was: ~p", [Index, Result]),
  +    gen_server:cast(HashtreePid, build_failed).
   
   get_build_throttle() ->
       app_helper:get_env(riak_kv,
  
positive.code: %% a fold/build. Otherwise, trigger a rehash to ensure the hashtrees match the
  %% current on-disk segments.
  -spec build_or_rehash(pid(), state()) -> ok.
  build_or_rehash(Self, State=#state{index=Index}) ->
      Type = case load_built(State) of
                 false -> build;
                 true  -> rehash
             end,
      Locked = get_all_locks(Type, Index, self()),
      build_or_rehash(Self, Locked, Type, State).
  
  build_or_rehash(Self, Locked, Type, #state{index=Index, trees=Trees}) ->
      case {Locked, Type} of
          {true, build} ->
              lager:info("Starting AAE tree build: ~p", [Index]),
              fold_keys(Index, Self, has_index_tree(Trees)),
              lager:info("Finished AAE tree build: ~p", [Index]),
              gen_server:cast(Self, build_finished);
          {true, rehash} ->
              lager:debug("Starting AAE tree rehash: ~p", [Index]),
              _ = [hashtree:rehash_tree(T) || {_,T} <- Trees],
              lager:debug("Finished AAE tree rehash: ~p", [Index]),
              gen_server:cast(Self, build_finished);
          _ ->
              gen_server:cast(Self, build_failed)
      end.
  
  -spec maybe_rebuild(state()) -> state().
  maybe_rebuild(State=#state{lock=undefined, built=true, expired=true, index=Index}) ->
  
negative.code:             Acc2 = maybe_throttle_build(RObj, Limit, Wait, Acc),
              Acc2
      end;
  fold_fun(HashtreePid, _HasIndexTree = true) ->
      %% Index AAE backend, so hash the indexes
      ObjectFoldFun = object_fold_fun(HashtreePid),
      IndexFoldFun = index_fold_fun(HashtreePid),
      {Limit, Wait} = get_build_throttle(),
      fun(BKey = {Bucket, Key}, BinObj, Acc) ->
              RObj = riak_object:from_binary(Bucket, Key, BinObj),
  