Filter only the wt specific parts, not all of app.config
This commit is contained in:
parent
db28e6b50d
commit
f5a5208b1b
1 changed files with 19 additions and 8 deletions
|
@ -80,14 +80,13 @@ 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, Config0) ->
|
start(Partition, Config) ->
|
||||||
%% Get the data root directory
|
%% Get the data root directory
|
||||||
case app_helper:get_prop_or_env(data_root, Config0, wt) of
|
case app_helper:get_prop_or_env(data_root, Config, wt) of
|
||||||
undefined ->
|
undefined ->
|
||||||
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),
|
|
||||||
AppStarted =
|
AppStarted =
|
||||||
case application:start(wt) of
|
case application:start(wt) of
|
||||||
ok ->
|
ok ->
|
||||||
|
@ -101,15 +100,27 @@ start(Partition, Config0) ->
|
||||||
case AppStarted of
|
case AppStarted of
|
||||||
ok ->
|
ok ->
|
||||||
CacheSize = size_cache(64, Config),
|
CacheSize = size_cache(64, Config),
|
||||||
ConnectionOpts =
|
WTConfig =
|
||||||
[Config,
|
case proplists:lookup(wt, Config) of
|
||||||
{create, true},
|
none ->
|
||||||
|
case application:get_env(wt) of
|
||||||
|
undefined ->
|
||||||
|
[];
|
||||||
|
WTSectionOfEnv ->
|
||||||
|
WTSectionOfEnv
|
||||||
|
end;
|
||||||
|
WTSectionOfConfig ->
|
||||||
|
WTSectionOfConfig
|
||||||
|
end,
|
||||||
|
ConnectionOpts = lists:merge([
|
||||||
|
WTConfig,
|
||||||
|
[{create, true},
|
||||||
{logging, true},
|
{logging, true},
|
||||||
{transactional, true},
|
{transactional, true},
|
||||||
{session_max, 128},
|
{session_max, 128},
|
||||||
{shared_cache, [{chunk, "64MB"},
|
{shared_cache, [{chunk, "64MB"},
|
||||||
{min, "1GB"},
|
{min, "1GB"},
|
||||||
{name, "wt-vnode-cache"},
|
{name, "wt-cache"},
|
||||||
{size, CacheSize}]},
|
{size, CacheSize}]},
|
||||||
{sync, false}
|
{sync, false}
|
||||||
%% {verbose,
|
%% {verbose,
|
||||||
|
@ -117,7 +128,7 @@ start(Partition, Config0) ->
|
||||||
%% "evictserver", "fileops", "hazard", "lsm",
|
%% "evictserver", "fileops", "hazard", "lsm",
|
||||||
%% "mutex", "read", "readserver", "reconcile",
|
%% "mutex", "read", "readserver", "reconcile",
|
||||||
%% "salvage", "verify", "write"]}
|
%% "salvage", "verify", "write"]}
|
||||||
],
|
]]),
|
||||||
ok = filelib:ensure_dir(filename:join(DataRoot, "x")),
|
ok = filelib:ensure_dir(filename:join(DataRoot, "x")),
|
||||||
case wt_conn:open(DataRoot, ConnectionOpts) of
|
case wt_conn:open(DataRoot, ConnectionOpts) of
|
||||||
{ok, ConnRef} ->
|
{ok, ConnRef} ->
|
||||||
|
|
Loading…
Reference in a new issue