fix new config problems, tests all pass again

The tests pass but there's still a "NIF upgrade" error reported at the end
of each test run. Will fix later.
This commit is contained in:
Steve Vinoski 2013-03-11 11:12:12 -04:00
parent 83dfc9e396
commit e6dc7a5936
5 changed files with 17 additions and 15 deletions

1
.gitignore vendored
View file

@ -5,4 +5,5 @@ priv/*.so
c_src/system c_src/system
c_src/wiredtiger-*/ c_src/wiredtiger-*/
c_src/*.o c_src/*.o
deps
*~ *~

View file

@ -2,7 +2,7 @@
%% %%
%% riak_kv_wiredtiger_backend: Use WiredTiger for Riak/KV storage %% riak_kv_wiredtiger_backend: Use WiredTiger for Riak/KV storage
%% %%
%% Copyright (c) 2012 Basho Technologies, Inc. All Rights Reserved. %% Copyright (c) 2012-2013 Basho Technologies, Inc. All Rights Reserved.
%% %%
%% This file is provided to you under the Apache License, %% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file %% Version 2.0 (the "License"); you may not use this file
@ -80,9 +80,9 @@ capabilities(_, _) ->
%% @doc Start the WiredTiger backend %% @doc Start the WiredTiger backend
-spec start(integer(), config()) -> {ok, state()} | {error, term()}. -spec start(integer(), config()) -> {ok, state()} | {error, term()}.
start(Partition, Config) -> start(Partition, Config0) ->
%% Get the data root directory %% Get the data root directory
case app_helper:get_prop_or_env(data_root, Config, wt) of case app_helper:get_prop_or_env(data_root, Config0, wt) of
<<"">> -> <<"">> ->
lager:error("Failed to startup WiredTiger: data_root is not valid"), lager:error("Failed to startup WiredTiger: data_root is not valid"),
{error, data_root_unset}; {error, data_root_unset};
@ -93,6 +93,7 @@ start(Partition, Config) ->
lager:error("Failed to startup WiredTiger: data_root is not set"), lager:error("Failed to startup WiredTiger: data_root is not set"),
{error, data_root_unset}; {error, data_root_unset};
DataRoot -> DataRoot ->
Config = lists:keydelete(data_root, 1, Config0),
CacheSize = CacheSize =
case proplists:get_value(cache_size, Config) of case proplists:get_value(cache_size, Config) of
undefined -> undefined ->
@ -508,13 +509,13 @@ best_guess_at_a_reasonable_cache_size(ChunkSizeInMB) ->
-ifdef(TEST). -ifdef(TEST).
simple_test_() -> simple_test_() ->
?assertCmd("rm -rf test/wiredtiger-backend"), ?assertCmd("rm -rf test/wt-backend"),
application:set_env(wt, data_root, "test/wiredtiger-backend"), application:set_env(wt, data_root, "test/wt-backend"),
temp_riak_kv_backend:standard_test(?MODULE, []). temp_riak_kv_backend:standard_test(?MODULE, []).
custom_config_test_() -> custom_config_test_() ->
?assertCmd("rm -rf test/wiredtiger-backend"), ?assertCmd("rm -rf test/wt-backend"),
application:set_env(wt, data_root, ""), application:set_env(wt, data_root, ""),
temp_riak_kv_backend:standard_test(?MODULE, [{data_root, "test/wiredtiger-backend"}]). temp_riak_kv_backend:standard_test(?MODULE, [{data_root, "test/wt-backend"}]).
-endif. -endif.

View file

@ -2,7 +2,7 @@
%% %%
%% riak_kv_backend: Riak backend behaviour %% riak_kv_backend: Riak backend behaviour
%% %%
%% Copyright (c) 2007-2010 Basho Technologies, Inc. All Rights Reserved. %% Copyright (c) 2007-2013 Basho Technologies, Inc. All Rights Reserved.
%% %%
%% This file is provided to you under the Apache License, %% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file %% Version 2.0 (the "License"); you may not use this file
@ -36,6 +36,7 @@
-ifdef(TEST). -ifdef(TEST).
-include_lib("eunit/include/eunit.hrl"). -include_lib("eunit/include/eunit.hrl").
-compile(export_all).
-export([standard_test/2]). -export([standard_test/2]).
-endif. -endif.

View file

@ -2,7 +2,7 @@
%% %%
%% wt: Erlang Wrapper for WiredTiger %% wt: Erlang Wrapper for WiredTiger
%% %%
%% Copyright (c) 2012 Basho Technologies, Inc. All Rights Reserved. %% Copyright (c) 2012-2013 Basho Technologies, Inc. All Rights Reserved.
%% %%
%% This file is provided to you under the Apache License, %% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file %% Version 2.0 (the "License"); you may not use this file
@ -64,7 +64,6 @@
fold/3]). fold/3]).
-ifdef(TEST). -ifdef(TEST).
-export([config_to_bin/1]).
-ifdef(EQC). -ifdef(EQC).
-include_lib("eqc/include/eqc.hrl"). -include_lib("eqc/include/eqc.hrl").
-define(QC_OUT(P), -define(QC_OUT(P),

View file

@ -2,7 +2,7 @@
%% %%
%% wt_conn: manage a connection to WiredTiger %% wt_conn: manage a connection to WiredTiger
%% %%
%% Copyright (c) 2012 Basho Technologies, Inc. All Rights Reserved. %% Copyright (c) 2012-2013 Basho Technologies, Inc. All Rights Reserved.
%% %%
%% This file is provided to you under the Apache License, %% This file is provided to you under the Apache License,
%% Version 2.0 (the "License"); you may not use this file %% Version 2.0 (the "License"); you may not use this file
@ -93,14 +93,14 @@ handle_call({open, Dir, Config, Caller}, _From, #state{conn=undefined}=State) ->
true -> true ->
[]; [];
false -> false ->
[{cache_size, config_value(cache_size, Config, "512MB")}] [config_value(cache_size, Config, "512MB")]
end, end,
OptsC = OptsC =
case proplists:is_defined(session_max, Config) of case proplists:is_defined(session_max, Config) of
true -> true ->
[]; [];
false -> false ->
[{session_max, config_value(session_max, Config, 100)}] [config_value(session_max, Config, 100)]
end, end,
Opts = lists:merge([OptsA, OptsB, OptsC, Config]), Opts = lists:merge([OptsA, OptsB, OptsC, Config]),
{Reply, NState} = {Reply, NState} =
@ -233,14 +233,14 @@ simple_test_() ->
end}]}. end}]}.
open_one() -> open_one() ->
{ok, Ref} = open("test/wt-backend", [{session_max, 20}]), {ok, Ref} = open("test/wt-backend", [{create,true},{session_max, 20}]),
true = is_open(), true = is_open(),
close(Ref), close(Ref),
false = is_open(), false = is_open(),
ok. ok.
open_and_wait(Pid) -> open_and_wait(Pid) ->
{ok, Ref} = open("test/wt-backend"), {ok, Ref} = open("test/wt-backend", [{create,true}]),
Pid ! open, Pid ! open,
receive receive
close -> close ->