Eliminate more compiler warnings.
This commit is contained in:
parent
8a53ed0cd5
commit
d46fd077ed
3 changed files with 65 additions and 43 deletions
|
@ -135,35 +135,41 @@ scan(BT1, BT2, Out, IsLastLevel, AKVs, [], Step) ->
|
|||
scan_only(BT1, Out, IsLastLevel, AKVs, Step)
|
||||
end;
|
||||
|
||||
scan(BT1, BT2, Out, IsLastLevel, [{Key1,Value1}|AT]=AKVs, [{Key2,Value2}|BT]=BKVs, Step) ->
|
||||
if Key1 < Key2 ->
|
||||
scan(BT1, BT2, Out, IsLastLevel, [{Key1,Value1}|AT]=_AKVs, [{Key2,_Value2}|_BT]=BKVs, Step)
|
||||
when Key1 < Key2 ->
|
||||
Out3 =
|
||||
case ?LOCAL_WRITER of
|
||||
true ->
|
||||
{noreply, Out2} = hanoidb_writer:handle_cast({add, Key1, Value1}, Out);
|
||||
{noreply, Out2} = hanoidb_writer:handle_cast({add, Key1, Value1}, Out),
|
||||
Out2;
|
||||
false ->
|
||||
ok = hanoidb_writer:add(Out2=Out, Key1, Value1)
|
||||
ok = hanoidb_writer:add(Out, Key1, Value1),
|
||||
Out
|
||||
end,
|
||||
scan(BT1, BT2, Out2, IsLastLevel, AT, BKVs, step(Step));
|
||||
|
||||
Key2 < Key1 ->
|
||||
scan(BT1, BT2, Out3, IsLastLevel, AT, BKVs, step(Step));
|
||||
scan(BT1, BT2, Out, IsLastLevel, [{Key1,_Value1}|_AT]=AKVs, [{Key2,Value2}|BT]=_BKVs, Step)
|
||||
when Key1 > Key2 ->
|
||||
Out3 =
|
||||
case ?LOCAL_WRITER of
|
||||
true ->
|
||||
{noreply, Out2} = hanoidb_writer:handle_cast({add, Key2, Value2}, Out);
|
||||
{noreply, Out2} = hanoidb_writer:handle_cast({add, Key2, Value2}, Out),
|
||||
Out2;
|
||||
false ->
|
||||
ok = hanoidb_writer:add(Out2=Out, Key2, Value2)
|
||||
ok = hanoidb_writer:add(Out, Key2, Value2),
|
||||
Out
|
||||
end,
|
||||
scan(BT1, BT2, Out2, IsLastLevel, AKVs, BT, step(Step));
|
||||
|
||||
true ->
|
||||
scan(BT1, BT2, Out3, IsLastLevel, AKVs, BT, step(Step));
|
||||
scan(BT1, BT2, Out, IsLastLevel, [{_Key1,_Value1}|AT]=_AKVs, [{Key2,Value2}|BT]=_BKVs, Step) ->
|
||||
Out3 =
|
||||
case ?LOCAL_WRITER of
|
||||
true ->
|
||||
{noreply, Out2} = hanoidb_writer:handle_cast({add, Key2, Value2}, Out);
|
||||
{noreply, Out2} = hanoidb_writer:handle_cast({add, Key2, Value2}, Out),
|
||||
Out2;
|
||||
false ->
|
||||
ok = hanoidb_writer:add(Out2=Out, Key2, Value2)
|
||||
ok = hanoidb_writer:add(Out, Key2, Value2),
|
||||
Out
|
||||
end,
|
||||
scan(BT1, BT2, Out2, IsLastLevel, AT, BT, step(Step, 2))
|
||||
end.
|
||||
|
||||
scan(BT1, BT2, Out3, IsLastLevel, AT, BT, step(Step, 2)).
|
||||
|
||||
hibernate_scan_only(Keep) ->
|
||||
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, IsLastLevel, [{Key,Value}|Rest], Step) ->
|
||||
Out3 =
|
||||
case ?LOCAL_WRITER of
|
||||
true ->
|
||||
{noreply, Out2} = hanoidb_writer:handle_cast({add, Key, Value}, Out);
|
||||
{noreply, Out2} = hanoidb_writer:handle_cast({add, Key, Value}, Out),
|
||||
Out2;
|
||||
false ->
|
||||
ok = hanoidb_writer:add(Out2=Out, Key, Value)
|
||||
ok = hanoidb_writer:add(Out, Key, Value),
|
||||
Out
|
||||
end,
|
||||
scan_only(BT, Out2, IsLastLevel, Rest, step(Step)).
|
||||
scan_only(BT, Out3, IsLastLevel, Rest, step(Step)).
|
||||
|
|
|
@ -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
|
||||
%% incremental merge is finished).
|
||||
{ok, Nursery2} = do_inc_merge(Nursery, Count, TopLevel);
|
||||
{ok, _Nursery2} = do_inc_merge(Nursery, Count, TopLevel);
|
||||
|
||||
_ ->
|
||||
ok
|
||||
|
|
|
@ -25,7 +25,20 @@
|
|||
-module(hanoidb_util).
|
||||
-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").
|
||||
|
||||
|
@ -100,14 +113,14 @@ do_compression(gzip, Bin) ->
|
|||
do_compression(_, Bin) ->
|
||||
{?NO_COMPRESSION, Bin}.
|
||||
|
||||
decompress(<<?NO_COMPRESSION, Data/binary>>) ->
|
||||
uncompress(<<?NO_COMPRESSION, Data/binary>>) ->
|
||||
Data;
|
||||
decompress(<<?SNAPPY_COMPRESSION, Data/binary>>) ->
|
||||
uncompress(<<?SNAPPY_COMPRESSION, Data/binary>>) ->
|
||||
{ok, UncompressedData} = snappy:decompress(Data),
|
||||
UncompressedData;
|
||||
%decompress(<<?LZ4_COMPRESSION, Data/binary>>) ->
|
||||
%uncompress(<<?LZ4_COMPRESSION, Data/binary>>) ->
|
||||
% lz4:uncompress(Data);
|
||||
decompress(<<?GZIP_COMPRESSION, Data/binary>>) ->
|
||||
uncompress(<<?GZIP_COMPRESSION, Data/binary>>) ->
|
||||
zlib:gunzip(Data).
|
||||
|
||||
encode_index_node(KVList, Method) ->
|
||||
|
@ -120,7 +133,7 @@ encode_index_node(KVList, Method) ->
|
|||
{ok, [MethodName | OutData]}.
|
||||
|
||||
decode_index_node(Level, Data) ->
|
||||
TermData = decompress(Data),
|
||||
TermData = uncompress(Data),
|
||||
{ok, KVList} = decode_kv_list(TermData),
|
||||
{ok, {node, Level, KVList}}.
|
||||
|
||||
|
|
Loading…
Reference in a new issue