diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/couchdb/couch_btree.erl | 17 | ||||
-rw-r--r-- | src/couchdb/couch_file.erl | 8 |
2 files changed, 13 insertions, 12 deletions
diff --git a/src/couchdb/couch_btree.erl b/src/couchdb/couch_btree.erl index f2212aa0..4c94a68c 100644 --- a/src/couchdb/couch_btree.erl +++ b/src/couchdb/couch_btree.erl @@ -597,7 +597,7 @@ drop_nodes(_Bt, Reds, _StartKey, []) -> drop_nodes(Bt, Reds, StartKey, [{NodeKey, {Pointer, Red}} | RestKPs]) -> case less(Bt, NodeKey, StartKey) of true -> drop_nodes(Bt, [Red | Reds], StartKey, RestKPs); - false -> {Reds, [{NodeKey, {Pointer, Reds}} | RestKPs]} + false -> {Reds, [{NodeKey, {Pointer, Red}} | RestKPs]} end. stream_kp_node(Bt, Reds, KPs, StartKey, Dir, Fun, Acc) -> @@ -621,10 +621,10 @@ stream_kp_node(Bt, Reds, KPs, StartKey, Dir, Fun, Acc) -> case NodesToStream of [] -> {ok, Acc}; - [{_Key, PointerInfo} | Rest] -> - case stream_node(Bt, NewReds, PointerInfo, StartKey, Dir, Fun, Acc) of + [{_Key, {Pointer, Red}} | Rest] -> + case stream_node(Bt, NewReds, {Pointer, Red}, StartKey, Dir, Fun, Acc) of {ok, Acc2} -> - stream_kp_node(Bt, NewReds, Rest, Dir, Fun, Acc2); + stream_kp_node(Bt, [Red | NewReds], Rest, Dir, Fun, Acc2); {stop, Acc2} -> {stop, Acc2} end @@ -703,12 +703,13 @@ test_btree(KeyValues) -> % get the leading reduction as we foldl/r % and count of all from start to Val1 Val1 = Len div 3, - {ok, true} = foldl(Btree10, Val1, fun(_X, LeadingReds, _Acc) -> - CountToStart = Val1 - 1, + {ok, _} = foldl(Btree10, Val1, + fun(_X, LeadingReds, Acc) -> + CountToStart = Val1 + Acc - 1, CountToStart = final_reduce(Btree10, LeadingReds), - {stop, true} % change Acc to 'true' + {ok, Acc + 1} end, - false), + 0), {ok, true} = foldr(Btree10, Val1, fun(_X, LeadingReds, _Acc) -> CountToEnd = Len - Val1, diff --git a/src/couchdb/couch_file.erl b/src/couchdb/couch_file.erl index 4db55e70..ecab455b 100644 --- a/src/couchdb/couch_file.erl +++ b/src/couchdb/couch_file.erl @@ -285,14 +285,14 @@ init({Filepath, Options, ReturnPid, Ref}) -> true -> {ok, 0} = file:position(Fd, 0), ok = file:truncate(Fd), - couch_stats_collector:increment({couchdb, open_os_files}), + catch couch_stats_collector:increment({couchdb, open_os_files}), {ok, Fd}; false -> ok = file:close(Fd), init_status_error(ReturnPid, Ref, file_exists) end; false -> - couch_stats_collector:increment({couchdb, open_os_files}), + catch couch_stats_collector:increment({couchdb, open_os_files}), {ok, Fd} end; Error -> @@ -304,7 +304,7 @@ init({Filepath, Options, ReturnPid, Ref}) -> {ok, Fd_Read} -> {ok, Fd} = file:open(Filepath, [read, write, raw, binary]), ok = file:close(Fd_Read), - couch_stats_collector:increment({couchdb, open_os_files}), + catch couch_stats_collector:increment({couchdb, open_os_files}), {ok, Fd}; Error -> init_status_error(ReturnPid, Ref, Error) @@ -313,7 +313,7 @@ init({Filepath, Options, ReturnPid, Ref}) -> terminate(_Reason, _Fd) -> - couch_stats_collector:decrement({couchdb, open_os_files}), + catch couch_stats_collector:decrement({couchdb, open_os_files}), ok. |