diff --git a/.gitignore b/.gitignore index 89a1832..df93b84 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ priv/*.so c_src/system c_src/wiredtiger-*/ c_src/*.o +deps *~ diff --git a/src/riak_kv_wiredtiger_backend.erl b/src/riak_kv_wiredtiger_backend.erl index a0ae7e8..059f938 100644 --- a/src/riak_kv_wiredtiger_backend.erl +++ b/src/riak_kv_wiredtiger_backend.erl @@ -2,7 +2,7 @@ %% %% 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, %% Version 2.0 (the "License"); you may not use this file @@ -80,9 +80,9 @@ capabilities(_, _) -> %% @doc Start the WiredTiger backend -spec start(integer(), config()) -> {ok, state()} | {error, term()}. -start(Partition, Config) -> +start(Partition, Config0) -> %% 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"), {error, data_root_unset}; @@ -93,6 +93,7 @@ start(Partition, Config) -> lager:error("Failed to startup WiredTiger: data_root is not set"), {error, data_root_unset}; DataRoot -> + Config = lists:keydelete(data_root, 1, Config0), CacheSize = case proplists:get_value(cache_size, Config) of undefined -> @@ -508,13 +509,13 @@ best_guess_at_a_reasonable_cache_size(ChunkSizeInMB) -> -ifdef(TEST). simple_test_() -> - ?assertCmd("rm -rf test/wiredtiger-backend"), - application:set_env(wt, data_root, "test/wiredtiger-backend"), + ?assertCmd("rm -rf test/wt-backend"), + application:set_env(wt, data_root, "test/wt-backend"), temp_riak_kv_backend:standard_test(?MODULE, []). custom_config_test_() -> - ?assertCmd("rm -rf test/wiredtiger-backend"), + ?assertCmd("rm -rf test/wt-backend"), 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. diff --git a/src/temp_riak_kv_backend.erl b/src/temp_riak_kv_backend.erl index e82391b..38e41fe 100644 --- a/src/temp_riak_kv_backend.erl +++ b/src/temp_riak_kv_backend.erl @@ -2,7 +2,7 @@ %% %% 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, %% Version 2.0 (the "License"); you may not use this file @@ -36,6 +36,7 @@ -ifdef(TEST). -include_lib("eunit/include/eunit.hrl"). +-compile(export_all). -export([standard_test/2]). -endif. diff --git a/src/wt.erl b/src/wt.erl index 5d69d21..8052247 100644 --- a/src/wt.erl +++ b/src/wt.erl @@ -2,7 +2,7 @@ %% %% 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, %% Version 2.0 (the "License"); you may not use this file @@ -64,7 +64,6 @@ fold/3]). -ifdef(TEST). --export([config_to_bin/1]). -ifdef(EQC). -include_lib("eqc/include/eqc.hrl"). -define(QC_OUT(P), diff --git a/src/wt_conn.erl b/src/wt_conn.erl index 79aeac4..82a364c 100644 --- a/src/wt_conn.erl +++ b/src/wt_conn.erl @@ -2,7 +2,7 @@ %% %% 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, %% 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 -> []; false -> - [{cache_size, config_value(cache_size, Config, "512MB")}] + [config_value(cache_size, Config, "512MB")] end, OptsC = case proplists:is_defined(session_max, Config) of true -> []; false -> - [{session_max, config_value(session_max, Config, 100)}] + [config_value(session_max, Config, 100)] end, Opts = lists:merge([OptsA, OptsB, OptsC, Config]), {Reply, NState} = @@ -233,14 +233,14 @@ simple_test_() -> end}]}. 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(), close(Ref), false = is_open(), ok. open_and_wait(Pid) -> - {ok, Ref} = open("test/wt-backend"), + {ok, Ref} = open("test/wt-backend", [{create,true}]), Pid ! open, receive close ->