Eliminate more compiler warnings.

This commit is contained in:
Gregory Burd 2012-07-17 18:38:59 -04:00
parent 8a53ed0cd5
commit d46fd077ed
3 changed files with 65 additions and 43 deletions

View file

@ -135,35 +135,41 @@ scan(BT1, BT2, Out, IsLastLevel, AKVs, [], Step) ->
scan_only(BT1, Out, IsLastLevel, AKVs, Step) scan_only(BT1, Out, IsLastLevel, AKVs, Step)
end; end;
scan(BT1, BT2, Out, IsLastLevel, [{Key1,Value1}|AT]=AKVs, [{Key2,Value2}|BT]=BKVs, Step) -> scan(BT1, BT2, Out, IsLastLevel, [{Key1,Value1}|AT]=_AKVs, [{Key2,_Value2}|_BT]=BKVs, Step)
if Key1 < Key2 -> when Key1 < Key2 ->
case ?LOCAL_WRITER of Out3 =
true -> case ?LOCAL_WRITER of
{noreply, Out2} = hanoidb_writer:handle_cast({add, Key1, Value1}, Out); true ->
false -> {noreply, Out2} = hanoidb_writer:handle_cast({add, Key1, Value1}, Out),
ok = hanoidb_writer:add(Out2=Out, Key1, Value1) Out2;
end, false ->
scan(BT1, BT2, Out2, IsLastLevel, AT, BKVs, step(Step)); ok = hanoidb_writer:add(Out, Key1, Value1),
Out
Key2 < Key1 -> end,
case ?LOCAL_WRITER of scan(BT1, BT2, Out3, IsLastLevel, AT, BKVs, step(Step));
true -> scan(BT1, BT2, Out, IsLastLevel, [{Key1,_Value1}|_AT]=AKVs, [{Key2,Value2}|BT]=_BKVs, Step)
{noreply, Out2} = hanoidb_writer:handle_cast({add, Key2, Value2}, Out); when Key1 > Key2 ->
false -> Out3 =
ok = hanoidb_writer:add(Out2=Out, Key2, Value2) case ?LOCAL_WRITER of
end, true ->
scan(BT1, BT2, Out2, IsLastLevel, AKVs, BT, step(Step)); {noreply, Out2} = hanoidb_writer:handle_cast({add, Key2, Value2}, Out),
Out2;
true -> false ->
case ?LOCAL_WRITER of ok = hanoidb_writer:add(Out, Key2, Value2),
true -> Out
{noreply, Out2} = hanoidb_writer:handle_cast({add, Key2, Value2}, Out); end,
false -> scan(BT1, BT2, Out3, IsLastLevel, AKVs, BT, step(Step));
ok = hanoidb_writer:add(Out2=Out, Key2, Value2) scan(BT1, BT2, Out, IsLastLevel, [{_Key1,_Value1}|AT]=_AKVs, [{Key2,Value2}|BT]=_BKVs, Step) ->
end, Out3 =
scan(BT1, BT2, Out2, IsLastLevel, AT, BT, step(Step, 2)) case ?LOCAL_WRITER of
end. true ->
{noreply, Out2} = hanoidb_writer:handle_cast({add, Key2, Value2}, Out),
Out2;
false ->
ok = hanoidb_writer:add(Out, Key2, Value2),
Out
end,
scan(BT1, BT2, Out3, IsLastLevel, AT, BT, step(Step, 2)).
hibernate_scan_only(Keep) -> hibernate_scan_only(Keep) ->
erlang:garbage_collect(), erlang:garbage_collect(),
@ -213,10 +219,13 @@ scan_only(BT, Out, true, [{_,?TOMBSTONE}|Rest], Step) ->
scan_only(BT, Out, true, Rest, step(Step)); scan_only(BT, Out, true, Rest, step(Step));
scan_only(BT, Out, IsLastLevel, [{Key,Value}|Rest], Step) -> scan_only(BT, Out, IsLastLevel, [{Key,Value}|Rest], Step) ->
case ?LOCAL_WRITER of Out3 =
true -> case ?LOCAL_WRITER of
{noreply, Out2} = hanoidb_writer:handle_cast({add, Key, Value}, Out); true ->
false -> {noreply, Out2} = hanoidb_writer:handle_cast({add, Key, Value}, Out),
ok = hanoidb_writer:add(Out2=Out, Key, Value) Out2;
end, false ->
scan_only(BT, Out2, IsLastLevel, Rest, step(Step)). ok = hanoidb_writer:add(Out, Key, Value),
Out
end,
scan_only(BT, Out3, IsLastLevel, Rest, step(Step)).

View file

@ -208,7 +208,7 @@ finish(#nursery{ dir=Dir, cache=Cache, log_file=LogFile,
%% Issue some work if this is a top-level inject (blocks until previous such %% Issue some work if this is a top-level inject (blocks until previous such
%% incremental merge is finished). %% incremental merge is finished).
{ok, Nursery2} = do_inc_merge(Nursery, Count, TopLevel); {ok, _Nursery2} = do_inc_merge(Nursery, Count, TopLevel);
_ -> _ ->
ok ok

View file

@ -25,7 +25,20 @@
-module(hanoidb_util). -module(hanoidb_util).
-author('Kresten Krab Thorup <krab@trifork.com>'). -author('Kresten Krab Thorup <krab@trifork.com>').
-compile(export_all). -export([ compress/2
, uncompress/1
, index_file_name/1
, estimate_node_size_increment/3
, encode_index_node/2
, decode_index_node/2
, crc_encapsulate_kv_entry/2
, decode_crc_data/3
, file_exists/1
, crc_encapsulate_transaction/2
, tstamp/0
, expiry_time/1
, has_expired/1
, ensure_expiry/1 ]).
-include("src/hanoidb.hrl"). -include("src/hanoidb.hrl").
@ -100,14 +113,14 @@ do_compression(gzip, Bin) ->
do_compression(_, Bin) -> do_compression(_, Bin) ->
{?NO_COMPRESSION, Bin}. {?NO_COMPRESSION, Bin}.
decompress(<<?NO_COMPRESSION, Data/binary>>) -> uncompress(<<?NO_COMPRESSION, Data/binary>>) ->
Data; Data;
decompress(<<?SNAPPY_COMPRESSION, Data/binary>>) -> uncompress(<<?SNAPPY_COMPRESSION, Data/binary>>) ->
{ok, UncompressedData} = snappy:decompress(Data), {ok, UncompressedData} = snappy:decompress(Data),
UncompressedData; UncompressedData;
%decompress(<<?LZ4_COMPRESSION, Data/binary>>) -> %uncompress(<<?LZ4_COMPRESSION, Data/binary>>) ->
% lz4:uncompress(Data); % lz4:uncompress(Data);
decompress(<<?GZIP_COMPRESSION, Data/binary>>) -> uncompress(<<?GZIP_COMPRESSION, Data/binary>>) ->
zlib:gunzip(Data). zlib:gunzip(Data).
encode_index_node(KVList, Method) -> encode_index_node(KVList, Method) ->
@ -120,7 +133,7 @@ encode_index_node(KVList, Method) ->
{ok, [MethodName | OutData]}. {ok, [MethodName | OutData]}.
decode_index_node(Level, Data) -> decode_index_node(Level, Data) ->
TermData = decompress(Data), TermData = uncompress(Data),
{ok, KVList} = decode_kv_list(TermData), {ok, KVList} = decode_kv_list(TermData),
{ok, {node, Level, KVList}}. {ok, {node, Level, KVList}}.