Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

(Green) Extract function.

  • Loading branch information...
commit bbb677541bc5321cf5cce97940ebeccd33bd1b6f 1 parent cd46583
@higepon authored
Showing with 27 additions and 11 deletions.
  1. +11 −11 src/mio_memcached.erl
  2. +16 −0 src/mio_skip_graph.erl
View
22 src/mio_memcached.erl
@@ -61,17 +61,17 @@ init_start_node(Sup, MaxLevel, Capacity, BootNode) ->
_ ->
{ok, BootBucket, Allocator, Serializer} = mio_bootstrap:get_boot_info(BootNode),
Supervisor = whereis(mio_sup),
-%% ?INFOF("create_schema=~p", [mnesia:create_schema([node()])]),
- ?INFOF("start=~p", [mnesia:start()]),
- ?INFOF("result=~p", [mnesia:change_config(extra_db_nodes, [BootNode])]),
- case mnesia:wait_for_tables([path_stat], 5000) of
- ok -> ok;
- {timeout, BadTabList} ->
- ?INFOF("wait_for_tables error ~p", [BadTabList]);
- {error, Reason4} ->
- ?INFOF("Error ~p", [Reason4])
- end,
-% ?INFOF("COP=~p", [mnesia:add_table_copy(path_stat, node(), ram_copies)]),
+ mio_skip_graph:attach_to_path_stat(BootNode),
+%% ?INFOF("start=~p", [mnesia:start()]),
+%% ?INFOF("result=~p", [mnesia:change_config(extra_db_nodes, [BootNode])]),
+%% case mnesia:wait_for_tables([path_stat], 5000) of
+%% ok -> ok;
+%% {timeout, BadTabList} ->
+%% ?INFOF("wait_for_tables error ~p", [BadTabList]);
+%% {error, Reason4} ->
+%% ?INFOF("Error ~p", [Reason4])
+%% end,
+%% % ?INFOF("COP=~p", [mnesia:add_table_copy(path_stat, node(), ram_copies)]),
ok = mio_allocator:add_node(Allocator, Supervisor),
ok = mio_local_store:set(LocalSetting, start_buckets, [BootBucket]),
{Serializer, LocalSetting}
View
16 src/mio_skip_graph.erl
@@ -52,6 +52,7 @@
link_on_level_ge1/2,
get_local_buckets/1,
make_path_stat/0,
+ attach_to_path_stat/1,
show_path_stat/1
]).
@@ -226,6 +227,21 @@ make_path_stat() ->
end,
mnesia:clear_table(path_stat).
+attach_to_path_stat(PathStatNode) ->
+ case mnesia:start() of
+ ok -> ok;
+ {error, Reason2} ->
+ ?INFOF("Error ~p", [Reason2])
+ end,
+ ?INFOF("result=~p", [mnesia:change_config(extra_db_nodes, [PathStatNode])]),
+ case mnesia:wait_for_tables([path_stat], 5000) of
+ ok -> ok;
+ {timeout, BadTabList} ->
+ ?INFOF("wait_for_tables error ~p", [BadTabList]);
+ {error, Reason4} ->
+ ?INFOF("Error ~p", [Reason4])
+ end.
+
push_path_stat(SearchKey, Datum) ->
case mnesia:dirty_read({path_stat, SearchKey}) of
Please sign in to comment.
Something went wrong with that request. Please try again.