1. Basho
  2. Untitled project
  3. riak_search

Commits

Rusty Klophaus  committed 4f97446

Fix merge_index to use app env vars, fix app.config typo.

  • Participants
  • Parent commits 8bc6f04
  • Branches default
  • Tags riak_search-0.12.1rc3

Comments (0)

Files changed (4)

File apps/merge_index/src/merge_index.erl

View file
 
 -export([
     %% API
-    start_link/2,
+    start_link/1,
     stop/1,
     index/7,
     stream/7,
     compact/1
 ]).
 
-start_link(Root, Config) ->
-    gen_server:start_link(mi_server, [Root, Config], [{timeout, infinity}]).
+start_link(Root) ->
+    gen_server:start_link(mi_server, [Root], [{timeout, infinity}]).
 
 stop(_ServerPid) ->
     ok.

File apps/merge_index/src/mi_server.erl

View file
     terms,
     segments,
     buffers,
-    config,
     next_id,
     scheduled_compaction,
     is_compacting
 }).
 
-init([Root, Config]) ->
+init([Root]) ->
     %% Load from disk...
     filelib:ensure_dir(join(Root, "ignore")),
     io:format("Loading merge_index from '~s'~n", [Root]),
         locks    = mi_locks:new(),
         buffers  = [Buffer],
         segments = Segments,
-        config   = Config,
         next_id  = NextID,
         scheduled_compaction = false,
         is_compacting = false

File apps/riak_search/src/merge_index_backend.erl

View file
 %% @spec start(Partition :: integer(), Config :: proplist()) ->
 %%          {ok, state()} | {{error, Reason :: term()}, state()}
 %% @doc Start this backend.
-start(Partition, Config) ->
-    DefaultRootPath = filename:join([".", "data", "merge_index"]),
-    RootPath = proplists:get_value(merge_index_backend_root, Config, DefaultRootPath),
-    Rootfile = filename:join([RootPath, integer_to_list(Partition)]),
-    {ok, Pid} = merge_index:start_link(Rootfile, Config),
+start(Partition, _Config) ->
+    {ok, Root} = application:get_env(merge_index, data_root),
+    PartitionRoot = filename:join([Root, integer_to_list(Partition)]),
+    {ok, Pid} = merge_index:start_link(PartitionRoot),
     {ok, #state { partition=Partition, pid=Pid }}.
 
 %% @spec stop(state()) -> ok | {error, Reason :: term()}

File rel/files/app.config

View file
 
  %% Merge Index Config
  {merge_index, [
-                {data_root, "{{merge_index_data_root}}"}
+                {data_root, "{{merge_index_data_root}}"},
                 {max_compact_segments,100},
                 {segment_read_options,[{read_ahead,5242880}]},
                 {segment_write_options,[{delayed_write,5242880,5000}]},