Whitespace

This commit is contained in:
Gregory Burd 2013-04-01 14:00:06 -04:00
parent e3219ff2c5
commit 95a6f52a1d
2 changed files with 47 additions and 47 deletions

View file

@ -30,8 +30,8 @@ case "$1" in
--enable-bzip2 \ --enable-bzip2 \
--prefix=$BASEDIR/system && \ --prefix=$BASEDIR/system && \
make -j && make install) make -j && make install)
[ -d $BASEDIR/../priv ] || mkdir $BASEDIR/../priv [ -d $BASEDIR/../priv ] || mkdir $BASEDIR/../priv
cp $BASEDIR/system/bin/wt $BASEDIR/../priv cp $BASEDIR/system/bin/wt $BASEDIR/../priv
cp $BASEDIR/system/lib/*.so $BASEDIR/../priv cp $BASEDIR/system/lib/*.so $BASEDIR/../priv
;; ;;
esac esac

View file

@ -52,12 +52,12 @@
-define(CAPABILITIES, [async_fold]). -define(CAPABILITIES, [async_fold]).
-record(pass, {session :: wterl:session(), -record(pass, {session :: wterl:session(),
cursor :: wterl:cursor()}). cursor :: wterl:cursor()}).
-type pass() :: #pass{}. -type pass() :: #pass{}.
-record(state, {table :: string(), -record(state, {table :: string(),
connection :: wterl:connection(), connection :: wterl:connection(),
passes :: [pass()]}). passes :: [pass()]}).
-type state() :: #state{}. -type state() :: #state{}.
-type config() :: [{atom(), term()}]. -type config() :: [{atom(), term()}].
@ -99,8 +99,8 @@ start(Partition, Config) ->
ok -> ok ->
Table = "lsm:wt" ++ integer_to_list(Partition), Table = "lsm:wt" ++ integer_to_list(Partition),
{ok, Connection} = establish_connection(Config), {ok, Connection} = establish_connection(Config),
Passes = establish_passes(erlang:system_info(schedulers), Connection, Table), Passes = establish_passes(erlang:system_info(schedulers), Connection, Table),
{ok, #state{table=Table, connection=Connection, passes=Passes}}; {ok, #state{table=Table, connection=Connection, passes=Passes}};
{error, Reason2} -> {error, Reason2} ->
{error, Reason2} {error, Reason2}
end. end.
@ -109,10 +109,10 @@ start(Partition, Config) ->
-spec stop(state()) -> ok. -spec stop(state()) -> ok.
stop(#state{passes=Passes}) -> stop(#state{passes=Passes}) ->
lists:foreach(fun(Elem) -> lists:foreach(fun(Elem) ->
{Session, Cursor} = Elem, {Session, Cursor} = Elem,
ok = wterl:cursor_close(Cursor), ok = wterl:cursor_close(Cursor),
ok = wterl:session_close(Session) ok = wterl:session_close(Session)
end, Passes), end, Passes),
ok. ok.
%% @doc Retrieve an object from the wterl backend %% @doc Retrieve an object from the wterl backend
@ -191,7 +191,7 @@ fold_buckets(FoldBucketsFun, Acc, Opts, #state{table=Table}) ->
AccFinal AccFinal
after after
ok = wterl:cursor_close(Cursor), ok = wterl:cursor_close(Cursor),
ok = wterl:session_close(Session) ok = wterl:session_close(Session)
end end
end end
end, end,
@ -238,7 +238,7 @@ fold_keys(FoldKeysFun, Acc, Opts, #state{table=Table}) ->
AccFinal AccFinal
after after
ok = wterl:cursor_close(Cursor), ok = wterl:cursor_close(Cursor),
ok = wterl:session_close(Session) ok = wterl:session_close(Session)
end end
end end
end, end,
@ -272,7 +272,7 @@ fold_objects(FoldObjectsFun, Acc, Opts, #state{table=Table}) ->
AccFinal AccFinal
after after
ok = wterl:cursor_close(Cursor), ok = wterl:cursor_close(Cursor),
ok = wterl:session_close(Session) ok = wterl:session_close(Session)
end end
end end
end, end,
@ -329,10 +329,10 @@ callback(_Ref, _Msg, State) ->
max_sessions(Config) -> max_sessions(Config) ->
RingSize = RingSize =
case app_helper:get_prop_or_env(ring_creation_size, Config, riak_core) of case app_helper:get_prop_or_env(ring_creation_size, Config, riak_core) of
undefined -> 1024; undefined -> 1024;
Size -> Size Size -> Size
end, end,
2 * (RingSize * erlang:system_info(schedulers)). 2 * (RingSize * erlang:system_info(schedulers)).
%% @private %% @private
@ -344,28 +344,28 @@ establish_connection(Config) ->
{error, data_root_unset}; {error, data_root_unset};
DataRoot -> DataRoot ->
ok = filelib:ensure_dir(filename:join(DataRoot, "x")), ok = filelib:ensure_dir(filename:join(DataRoot, "x")),
RequestedCacheSize = app_helper:get_prop_or_env(cache_size, Config, wterl), RequestedCacheSize = app_helper:get_prop_or_env(cache_size, Config, wterl),
Opts = Opts =
orddict:from_list( orddict:from_list(
[ wterl:config_value(create, Config, true), [ wterl:config_value(create, Config, true),
wterl:config_value(sync, Config, false), wterl:config_value(sync, Config, false),
wterl:config_value(logging, Config, true), wterl:config_value(logging, Config, true),
wterl:config_value(transactional, Config, true), wterl:config_value(transactional, Config, true),
wterl:config_value(session_max, Config, max_sessions(Config)), wterl:config_value(session_max, Config, max_sessions(Config)),
wterl:config_value(cache_size, Config, size_cache(RequestedCacheSize)), wterl:config_value(cache_size, Config, size_cache(RequestedCacheSize)),
wterl:config_value(statistics_log, Config, [{wait, 30}]), % sec wterl:config_value(statistics_log, Config, [{wait, 30}]), % sec
%% NOTE: LSM auto-checkpoints, so we don't have too. %% NOTE: LSM auto-checkpoints, so we don't have too.
%% wterl:config_value(checkpoint, Config, [{wait, 10}]), % sec %% wterl:config_value(checkpoint, Config, [{wait, 10}]), % sec
wterl:config_value(verbose, Config, [ wterl:config_value(verbose, Config, [
%"ckpt" "block", "shared_cache", "evictserver", "fileops", %"ckpt" "block", "shared_cache", "evictserver", "fileops",
%"hazard", "mutex", "read", "readserver", "reconcile", %"hazard", "mutex", "read", "readserver", "reconcile",
%"salvage", "verify", "write", "evict", "lsm" %"salvage", "verify", "write", "evict", "lsm"
]) ] ++ proplists:get_value(wterl, Config, [])), % sec ]) ] ++ proplists:get_value(wterl, Config, [])), % sec
case wterl_conn:open(DataRoot, Opts) of case wterl_conn:open(DataRoot, Opts) of
{ok, Connection} -> {ok, Connection} ->
{ok, Connection}; {ok, Connection};
{error, Reason2} -> {error, Reason2} ->
lager:error("Failed to establish a WiredTiger connection, wterl backend unable to start: ~p\n", [Reason2]), lager:error("Failed to establish a WiredTiger connection, wterl backend unable to start: ~p\n", [Reason2]),
{error, Reason2} {error, Reason2}
end end
end. end.
@ -373,10 +373,10 @@ establish_connection(Config) ->
establish_passes(Count, Connection, Table) establish_passes(Count, Connection, Table)
when is_number(Count), Count > 0 -> when is_number(Count), Count > 0 ->
lists:map(fun(_Elem) -> lists:map(fun(_Elem) ->
{ok, Session} = establish_session(Connection, Table), {ok, Session} = establish_session(Connection, Table),
{ok, Cursor} = wterl:cursor_open(Session, Table), {ok, Cursor} = wterl:cursor_open(Session, Table),
{Session, Cursor} {Session, Cursor}
end, lists:seq(1, Count)). end, lists:seq(1, Count)).
%% @private %% @private
establish_session(Connection, Table) -> establish_session(Connection, Table) ->
@ -387,21 +387,21 @@ establish_session(Connection, Table) ->
{internal_page_max, "128K"}, {internal_page_max, "128K"},
{leaf_page_max, "128K"}, {leaf_page_max, "128K"},
{lsm_chunk_size, "25MB"}, {lsm_chunk_size, "25MB"},
{lsm_bloom_newest, true}, {lsm_bloom_newest, true},
{lsm_bloom_oldest, true} , {lsm_bloom_oldest, true} ,
{lsm_bloom_bit_count, 128}, {lsm_bloom_bit_count, 128},
{lsm_bloom_hash_count, 64}, {lsm_bloom_hash_count, 64},
{lsm_bloom_config, [{leaf_page_max, "8MB"}]} ], {lsm_bloom_config, [{leaf_page_max, "8MB"}]} ],
case wterl:session_create(Session, Table, wterl:config_to_bin(SessionOpts)) of case wterl:session_create(Session, Table, wterl:config_to_bin(SessionOpts)) of
ok -> ok ->
{ok, Session}; {ok, Session};
{error, Reason} -> {error, Reason} ->
lager:error("Failed to start wterl backend: ~p\n", [Reason]), lager:error("Failed to start wterl backend: ~p\n", [Reason]),
{error, Reason} {error, Reason}
end; end;
{error, Reason} -> {error, Reason} ->
lager:error("Failed to open a WiredTiger session: ~p\n", [Reason]), lager:error("Failed to open a WiredTiger session: ~p\n", [Reason]),
{error, Reason} {error, Reason}
end. end.
%% @private %% @private