anchor.diff:                get_doc_rev(Db, DbId, DocId, RevId, ReadOptions);
               false -> {ok, nil}
             end,
  -    
  +
       Fun(DocId, DocInfo, Doc, Acc)
     end,
  -  
  +
     try fold_prefix(Db, Prefix, WrapperFun, AccIn, Opts2)
     after erocksdb:release_snapshot(Snapshot)
     end.
  
positive.code: get_doc(DbId, DocId, Rev, WithHistory, MaxHistory, HistoryFrom, #{ db := Db}) ->
    {ok, Snapshot} = erocksdb:snapshot(Db),
    ReadOptions = [{snapshot, Snapshot}],
    
    try get_doc1(DbId, DocId, Db, Rev, WithHistory, MaxHistory, HistoryFrom, ReadOptions)
    after erocksdb:release_snapshot(Snapshot)
    end.
  
negative.code: clean_db(Name, DbId, #{db := Db}) ->
    DbKey = << 0, 0, 0, 100, (barrel_lib:to_binary(Name))/binary >>,
    ok = erocksdb:delete(Db, DbKey, [{sync, true}]),
    _ = spawn(fun() ->
            fold_prefix(Db, DbId, fun clean_db_fun/3, {Db, []})
          end),
    ok.
  
  clean_db_fun(K, _V, {Db, Acc}) ->
    Acc2 = [{delete, K} | Acc],
    Sz = length(Acc2),
    if
      Sz >= 500 ->
        _ = erocksdb:write(Db, Acc2, []),
        {ok, {Db, []}};
      true ->
        {ok, {Db, Acc2}}
    end.
  
  all_dbs(#{db := Db}) ->
    Fun = fun
  