anchor.diff:                      {Log5, AddAcc4, DelAcc4}
               end
           end, Acc, VIdKeys)
  -    end, {Log, dict:new(), dict:new()}, KVsToLook),
  +    end, {Log0, dict:new(), dict:new()}, KVsToLook),
   
       ToAdd = [{Id, DIKeys} || {Id, DIKeys} <- dict:to_list(Log1), DIKeys /= []],
       % store the new logs
  
positive.code:     {ok, dict:new(), dict:new(), LogBtree2};
  update_log(Btree, Log, UpdatedSeq, _) ->
      %% build list of updated keys and Id
      {ToLook, Updated} = dict:fold(fun(Id, DIKeys, {IdsAcc, KeysAcc}) ->
          KeysAcc1 = lists:foldl(fun({ViewId, {Key, _Seq, _Op}}, KeysAcc2) ->
              [{Id, ViewId, Key} | KeysAcc2]
          end, KeysAcc, DIKeys),
          {[Id | IdsAcc], KeysAcc1}
      end, {[], []}, Log),
  
      MapFun = fun({ok, KV}) -> [KV]; (not_found) -> [] end,
      KVsToLook = lists:flatmap(MapFun, couch_btree:lookup(Btree, ToLook)),
  
negative.code:             {[{Key, {dups, [Val1, Val2]}} | Rest], IdKeys, Log2};
          ({Key, Value}, {Rest, IdKeys, Log2}) ->
              {[{Key, Value} | Rest], [{Id, Key} | IdKeys],
               dict:append({DocId, Rev}, {Id, {Key, Seq, add}}, Log2)}
      end,
      InitAcc = {[], VIdKeys, Log},
      couch_stats:increment_counter([couchdb, mrview, emits], length(KVs)),
  