diff options
Diffstat (limited to 'lib/mnesia/src')
-rw-r--r-- | lib/mnesia/src/mnesia_dumper.erl | 6 | ||||
-rw-r--r-- | lib/mnesia/src/mnesia_index.erl | 5 | ||||
-rw-r--r-- | lib/mnesia/src/mnesia_loader.erl | 16 |
3 files changed, 18 insertions, 9 deletions
diff --git a/lib/mnesia/src/mnesia_dumper.erl b/lib/mnesia/src/mnesia_dumper.erl index 845ad0ac39..e404302b71 100644 --- a/lib/mnesia/src/mnesia_dumper.erl +++ b/lib/mnesia/src/mnesia_dumper.erl @@ -562,7 +562,7 @@ insert_op(Tid, _, {op, change_table_copy_type, N, FromS, ToS, TabDef}, InPlace, {{ext,_FromAlias,_FromMod},{ext,ToAlias,ToMod}} -> disc_delete_table(Tab, FromS), ok = ToMod:delete_table(ToAlias, Tab), - ok = ToMod:create_table(ToAlias, Tab, []), + ok = mnesia_monitor:unsafe_create_external(Tab, ToAlias, ToMod, TabDef), ok = ToMod:load_table(ToAlias, Tab, {dumper,change_table_copy_type}, TabDef), ok = load_from_logfile(ToS, Tab, Logtmp), file:delete(Logtmp), @@ -582,7 +582,7 @@ insert_op(Tid, _, {op, change_table_copy_type, N, FromS, ToS, TabDef}, InPlace, end, ok = ToMod:delete_table(ToAlias, Tab), - ok = ToMod:create_table(ToAlias, Tab, []), + ok = mnesia_monitor:unsafe_create_external(Tab, ToAlias, ToMod, TabDef), ok = ToMod:load_table(ToAlias, Tab, {dumper,change_table_copy_type}, TabDef), ok = load_from_logfile(ToS, Tab, Logtmp), file:delete(Logtmp), @@ -1401,6 +1401,8 @@ load_from_logfile(Storage, Tab, F) -> {linkto, self()}]) of {ok, Fd} -> chunk_from_log(disk_log:chunk(Fd, start), Fd, Storage, Tab); + {repaired, Fd, _, _} -> + chunk_from_log(disk_log:chunk(Fd, start), Fd, Storage, Tab); {error, _} = E -> E end. diff --git a/lib/mnesia/src/mnesia_index.erl b/lib/mnesia/src/mnesia_index.erl index 902d0c12ae..d5bd6d7125 100644 --- a/lib/mnesia/src/mnesia_index.erl +++ b/lib/mnesia/src/mnesia_index.erl @@ -348,9 +348,10 @@ init_ext_index(_, _, _, _, []) -> init_ext_index(Tab, Storage, Alias, Mod, [{Pos,Type} | Tail]) -> PosInfo = {Pos, Type}, IxTag = {Tab, index, PosInfo}, - _Res = Mod:create_table(Alias, IxTag, []), CS = val({Tab, cstruct}), - Mod:load_table(Alias, IxTag, init_index, mnesia_schema:cs2list(CS)), + CsList = mnesia_schema:cs2list(CS), + _Res = mnesia_monitor:unsafe_create_external(IxTag, Alias, Mod, CsList), + Mod:load_table(Alias, IxTag, init_index, CsList), case Mod:is_index_consistent(Alias, IxTag) of false -> Mod:index_is_consistent(Alias, IxTag, false), diff --git a/lib/mnesia/src/mnesia_loader.erl b/lib/mnesia/src/mnesia_loader.erl index 93660007f1..67afef6f8c 100644 --- a/lib/mnesia/src/mnesia_loader.erl +++ b/lib/mnesia/src/mnesia_loader.erl @@ -150,11 +150,17 @@ do_get_disc_copy2(Tab, Reason, Storage, Type) when Storage == disc_only_copies - end; do_get_disc_copy2(Tab, Reason, Storage = {ext, Alias, Mod}, _Type) -> - ok = ext_load_table(Mod, Alias, Tab, Reason), - mnesia_index:init_index(Tab, Storage), - set({Tab, load_node}, node()), - set({Tab, load_reason}, Reason), - {loaded, ok}. + Cs = val({Tab, cstruct}), + case mnesia_monitor:unsafe_create_external(Tab, Alias, Mod, Cs) of + ok -> + ok = ext_load_table(Mod, Alias, Tab, Reason), + mnesia_index:init_index(Tab, Storage), + set({Tab, load_node}, node()), + set({Tab, load_reason}, Reason), + {loaded, ok}; + Other -> + {not_loaded, Other} + end. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Load a table from a remote node |