aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mnesia/src/mnesia_controller.erl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2018-08-09 17:28:31 +0200
committerErlang/OTP <[email protected]>2018-08-09 17:28:31 +0200
commit7f32afa90f0116567055f7491d3186f26ea6bfef (patch)
tree8c1aa59e01d3bd3a5883facd137917e1c779e4a1 /lib/mnesia/src/mnesia_controller.erl
parenta076883bc29832dc6f2c2a465781440abf4effdb (diff)
parent11174a0a472a59f011a3530ebeb11eaa7f9d9b02 (diff)
downloadotp-7f32afa90f0116567055f7491d3186f26ea6bfef.tar.gz
otp-7f32afa90f0116567055f7491d3186f26ea6bfef.tar.bz2
otp-7f32afa90f0116567055f7491d3186f26ea6bfef.zip
Merge branch 'dgud/mnesia/add_table_copy_ram/OTP-15226' into maint-20
* dgud/mnesia/add_table_copy_ram/OTP-15226: Relax add_table_copy restriction
Diffstat (limited to 'lib/mnesia/src/mnesia_controller.erl')
-rw-r--r--lib/mnesia/src/mnesia_controller.erl27
1 files changed, 11 insertions, 16 deletions
diff --git a/lib/mnesia/src/mnesia_controller.erl b/lib/mnesia/src/mnesia_controller.erl
index 7a592f25f9..11185a1762 100644
--- a/lib/mnesia/src/mnesia_controller.erl
+++ b/lib/mnesia/src/mnesia_controller.erl
@@ -771,22 +771,6 @@ handle_call({unannounce_add_table_copy, [Tab, Node], From}, ReplyTo, State) ->
noreply(State#state{early_msgs = [{call, Msg, undefined} | Msgs]})
end;
-handle_call({net_load, Tab, Cs}, From, State) ->
- State2 =
- case State#state.schema_is_merged of
- true ->
- Worker = #net_load{table = Tab,
- opt_reply_to = From,
- reason = {dumper,{add_table_copy, unknown}},
- cstruct = Cs
- },
- add_worker(Worker, State);
- false ->
- reply(From, {not_loaded, schema_not_merged}),
- State
- end,
- noreply(State2);
-
handle_call(Msg, From, State) when State#state.schema_is_merged /= true ->
%% Buffer early messages
Msgs = State#state.early_msgs,
@@ -2162,6 +2146,15 @@ load_table_fun(#net_load{cstruct=Cs, table=Tab, reason=Reason, opt_reply_to=Repl
{dumper,{add_table_copy,_}} -> true;
_ -> false
end,
+
+ OnlyRamCopies = case Cs of
+ #cstruct{disc_copies = DC,
+ disc_only_copies = DOC,
+ external_copies = Ext} ->
+ [] =:= (DC ++ (DOC ++ Ext)) -- [node()];
+ _ ->
+ false
+ end,
if
ReadNode == node() ->
%% Already loaded locally
@@ -2173,6 +2166,8 @@ load_table_fun(#net_load{cstruct=Cs, table=Tab, reason=Reason, opt_reply_to=Repl
end;
AccessMode == read_only, not AddTableCopy ->
fun() -> disc_load_table(Tab, Reason, ReplyTo) end;
+ Active =:= [], AddTableCopy, OnlyRamCopies ->
+ fun() -> disc_load_table(Tab, Reason, ReplyTo) end;
true ->
fun() ->
%% Either we cannot read the table yet