diff --git a/.gitignore b/.gitignore index 91bd023..887b6ee 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ deps *~ .eunit .project +_build diff --git a/rebar.config b/rebar.config index 17b3522..a28d7cb 100644 --- a/rebar.config +++ b/rebar.config @@ -26,14 +26,14 @@ {xref_checks, [undefined_function_calls]}. -{deps, [ {sext, ".*", {git, "git://github.com/uwiger/sext", {branch, "master"}}} - , {lager, ".*", {git, "git://github.com/basho/lager", {branch, "master"}}} - , {snappy, "1.*", {git, "git://github.com/fdmanana/snappy-erlang-nif.git", {branch, "master"}}} - , {plain_fsm, "1.*", {git, "git://github.com/gburd/plain_fsm", {branch, "master"}}} -% , {basho_bench, ".*", {git, "git://github.com/basho/basho_bench", {branch, "master"}}} - , {ebloom, ".*", {git, "git://github.com/basho/ebloom", {branch, "master"}}} - , {triq, ".*", {git, "git://github.com/krestenkrab/triq", {branch, "master"}}} - , {lz4, ".*", {git, "git://github.com/krestenkrab/erlang-lz4.git", {branch, "master"}}} +{deps, [ {sext, ".*", {git, "https://github.com/uwiger/sext.git", {branch, "master"}}} + , {lager, ".*", {git, "https://github.com/basho/lager.git", {branch, "master"}}} + , {snappy, "1.*", {git, "https://github.com/fdmanana/snappy-erlang-nif.git", {branch, "master"}}} + , {plain_fsm, "1.*", {git, "https://github.com/gburd/plain_fsm.git", {branch, "master"}}} + %% , {basho_bench, ".*", {git, "https://github.com/basho/basho_bench.git", {branch, "master"}}} + , {ebloom, ".*", {git, "https://github.com/basho/ebloom.git", {branch, "develop"}}} + , {triq, ".*", {git, "https://github.com/krestenkrab/triq.git", {branch, "master"}}} + , {lz4, ".*", {git, "https://github.com/krestenkrab/erlang-lz4.git", {branch, "master"}}} % , {edown, "0.3.*", {git, "git://github.com/uwiger/edown.git", {branch, "master"}}} % , {asciiedoc, "0.1.*", {git, "git://github.com/norton/asciiedoc.git", {branch, "master"}}} % , {triq, ".*", {git, "git://github.com/krestenkrab/triq.git", {branch, "master"}}} diff --git a/rebar.lock b/rebar.lock new file mode 100644 index 0000000..2772a7e --- /dev/null +++ b/rebar.lock @@ -0,0 +1,32 @@ +[{<<"ebloom">>, + {git,"https://github.com/basho/ebloom.git", + {ref,"0a176b5b41cd418adeaa3747c8138e0e7da0adc7"}}, + 0}, + {<<"goldrush">>, + {git,"https://github.com/basho/goldrush.git", + {ref,"8f1b715d36b650ec1e1f5612c00e28af6ab0de82"}}, + 1}, + {<<"lager">>, + {git,"https://github.com/basho/lager.git", + {ref,"81eaef0ce98fdbf64ab95665e3bc2ec4b24c7dac"}}, + 0}, + {<<"lz4">>, + {git,"https://github.com/krestenkrab/erlang-lz4.git", + {ref,"5fd90ca1e2345bdc359ee43d958da87fafb4fd78"}}, + 0}, + {<<"plain_fsm">>, + {git,"https://github.com/gburd/plain_fsm.git", + {ref,"1de45fba4caccbc76df0b109e7581d0fc6a2e67b"}}, + 0}, + {<<"sext">>, + {git,"https://github.com/uwiger/sext.git", + {ref,"c22486add9cc374dc8138b1f547c0999a1922a65"}}, + 0}, + {<<"snappy">>, + {git,"https://github.com/fdmanana/snappy-erlang-nif.git", + {ref,"ceaceb4d964b33489ab76e2a281bec31a0e84e51"}}, + 0}, + {<<"triq">>, + {git,"https://github.com/krestenkrab/triq.git", + {ref,"c7306b8eaea133d52140cb828817efb5e50a3d52"}}, + 0}]. diff --git a/src/hanoidb.app.src b/src/hanoidb.app.src index 6d0afc3..cd40fc0 100644 --- a/src/hanoidb.app.src +++ b/src/hanoidb.app.src @@ -24,7 +24,7 @@ {application, hanoidb, [ - {description, ""}, + {description, "LSM-tree tiered storage engine with amortized merging"}, {vsn, "1.3.0"}, {registered, []}, {applications, [ diff --git a/src/hanoidb.erl b/src/hanoidb.erl index 94413f9..7da0ac0 100644 --- a/src/hanoidb.erl +++ b/src/hanoidb.erl @@ -210,9 +210,9 @@ receive_fold_range(MRef,PID,Fun,Acc0, Limit) -> try {ok, Fun(K,V,Acc0)} catch - Class:Exception -> + Class:Exception:Stacktrace -> % TODO ?log("Exception in hanoidb fold: ~p ~p", [Exception, erlang:get_stacktrace()]), - {'EXIT', Class, Exception, erlang:get_stacktrace()} + {'EXIT', Class, Exception, Stacktrace} end of {ok, Acc1} -> diff --git a/src/hanoidb_bloom.erl b/src/hanoidb_bloom.erl index c36edad..18dbf88 100644 --- a/src/hanoidb_bloom.erl +++ b/src/hanoidb_bloom.erl @@ -231,7 +231,7 @@ as_array(BM) -> end. %%%========== Bitarray representation - suitable for sparse arrays ========== -bitarray_new(N) -> array:new((N-1) div ?W + 1, {default, 0}). +%% bitarray_new(N) -> array:new((N-1) div ?W + 1, {default, 0}). -ifdef(pre18). -spec bitarray_set( non_neg_integer(), array() ) -> array(). diff --git a/src/hanoidb_fold_worker.erl b/src/hanoidb_fold_worker.erl index e48b160..5643b0b 100644 --- a/src/hanoidb_fold_worker.erl +++ b/src/hanoidb_fold_worker.erl @@ -79,10 +79,10 @@ start(SendTo) -> initialize(#state{sendto=SendTo, sendto_ref=MRef}, []), ?log("fold_worker done ~p~n", [self()]) catch - Class:Ex -> - ?log("fold_worker exception ~p:~p ~p~n", [Class, Ex, erlang:get_stacktrace()]), - error_logger:error_msg("Unexpected: ~p:~p ~p~n", [Class, Ex, erlang:get_stacktrace()]), - exit({bad, Class, Ex, erlang:get_stacktrace()}) + Class:Ex:Stacktrace -> + ?log("fold_worker exception ~p:~p ~p~n", [Class, Ex, Stacktrace]), + error_logger:error_msg("Unexpected: ~p:~p ~p~n", [Class, Ex, Stacktrace]), + exit({bad, Class, Ex, Stacktrace}) end end, PID = plain_fsm:spawn(?MODULE, F), @@ -231,5 +231,3 @@ data_vsn() -> code_change(_OldVsn, _State, _Extra) -> {ok, {#state{}, data_vsn()}}. - - diff --git a/src/hanoidb_level.erl b/src/hanoidb_level.erl index 9d9c067..7d68ade 100644 --- a/src/hanoidb_level.erl +++ b/src/hanoidb_level.erl @@ -159,9 +159,9 @@ initialize(State) -> _Result = initialize2(State), ?log(" ** terminated ~p", [_Result]) catch - Class:Ex when not (Class == exit andalso Ex == normal) -> - ?log("crashing ~p:~p ~p~n", [Class,Ex,erlang:get_stacktrace()]), - error_logger:error_msg("crash: ~p:~p ~p~n", [Class,Ex,erlang:get_stacktrace()]) + Class:Ex:Stacktrace when not (Class == exit andalso Ex == normal) -> + ?log("crashing ~p:~p ~p~n", [Class,Ex,Stacktrace]), + error_logger:error_msg("crash: ~p:~p ~p~n", [Class,Ex,Stacktrace]) end. initialize2(State) -> diff --git a/src/hanoidb_merger.erl b/src/hanoidb_merger.erl index 3b18917..d66fcaf 100644 --- a/src/hanoidb_merger.erl +++ b/src/hanoidb_merger.erl @@ -54,11 +54,11 @@ start(A,B,X, Size, IsLastLevel, Options) -> Owner ! ?CAST(self(),{merge_done, OutCount, X}) catch - C:E -> + C:E:Stacktrace -> %% this semi-bogus code makes sure we always get a stack trace if merging fails error_logger:error_msg("~p: merge failed ~p:~p ~p -> ~s~n", - [self(), C,E,erlang:get_stacktrace(), X]), - erlang:raise(C,E,erlang:get_stacktrace()) + [self(), C,E,Stacktrace, X]), + erlang:raise(C,E,Stacktrace) end end). diff --git a/src/hanoidb_reader.erl b/src/hanoidb_reader.erl index 1944e1d..bffae27 100644 --- a/src/hanoidb_reader.erl +++ b/src/hanoidb_reader.erl @@ -376,8 +376,8 @@ lookup_in_node(File,#node{members=Members},Key) -> end), try plain_rpc:call(PID, read) catch - Class:Ex -> - error_logger:error_msg("crashX: ~p:~p ~p~n", [Class,Ex,erlang:get_stacktrace()]), + Class:Ex:Stacktrace -> + error_logger:error_msg("crashX: ~p:~p ~p~n", [Class,Ex,Stacktrace]), not_found end; diff --git a/src/hanoidb_util.erl b/src/hanoidb_util.erl index 6939f10..0228828 100644 --- a/src/hanoidb_util.erl +++ b/src/hanoidb_util.erl @@ -56,7 +56,7 @@ -define(BISECT_ENCODED, 126). --define(FILE_ENCODING, bisect). +-define(FILE_ENCODING, hanoi2). -compile({inline, [crc_encapsulate/1, crc_encapsulate_kv_entry/2 ]}). @@ -298,8 +298,8 @@ ensure_expiry(Opts) -> undefined -> try exit(err) catch - exit:err -> - io:format(user, "~p~n", [erlang:get_stacktrace()]) + exit:err:Stacktrace -> + io:format(user, "~p~n", [Stacktrace]) end, exit(expiry_secs_not_set); N when N >= 0 -> @@ -345,4 +345,3 @@ bloom_contains({sbloom, Bloom}, Key) -> hanoidb_bloom:member(Key, Bloom); bloom_contains({ebloom, Bloom}, Key) -> ebloom:contains(Bloom, Key). - diff --git a/tools/visualize-hanoi.sh b/tools/visualize-hanoi.sh index 7047202..3616974 100755 --- a/tools/visualize-hanoi.sh +++ b/tools/visualize-hanoi.sh @@ -48,9 +48,9 @@ function periodic() { } merge_diff() { - SA=`ls -l A-${ID}.data 2> /dev/null | awk '{print $5}'` - SB=`ls -l B-${ID}.data 2> /dev/null | awk '{print $5}'` - SX=`ls -l X-${ID}.data 2> /dev/null | awk '{print $5}'` + SA=`/bin/ls -l A-${ID}.data 2> /dev/null | awk '{print $5}'` + SB=`/bin/ls -l B-${ID}.data 2> /dev/null | awk '{print $5}'` + SX=`/bin/ls -l X-${ID}.data 2> /dev/null | awk '{print $5}'` if [ \( -n "$SA" \) -a \( -n "$SB" \) -a \( -n "$SX" \) ]; then export RES=`expr ${SX}0 / \( $SA + $SB \)` else @@ -64,7 +64,7 @@ function dynamic() { start=`date +%s` while true ; do s="" - for ((i=8; i<22; i++)) ; do + for ((i=10; i<22; i++)) ; do if [ -f "C-$i.data" ] ; then s="${s}C" else