aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mnesia/src/mnesia_dumper.erl
diff options
context:
space:
mode:
authorUlf Wiger <[email protected]>2013-11-20 18:21:44 +0100
committerRichard Carlsson <[email protected]>2014-12-22 22:43:16 +0100
commit85112014bd136055b56e6ec5218f82f74951e0c6 (patch)
treeedd417722a7f48a0a1dc1a2d5cd360b1e3f997e3 /lib/mnesia/src/mnesia_dumper.erl
parent07b8f441ca711f9812fad9e9115bab3c3aa92f79 (diff)
downloadotp-85112014bd136055b56e6ec5218f82f74951e0c6.tar.gz
otp-85112014bd136055b56e6ec5218f82f74951e0c6.tar.bz2
otp-85112014bd136055b56e6ec5218f82f74951e0c6.zip
Make Mnesia DCD dump behaviour available via configuration
Setting the new Mnesia parameter 'dump_disc_copies_at_startup' to 'false' will completely disable the DCD dumping while tables are being loaded. If it is set to 'true' (the default), the same test will now be performed as for normal dumps, i.e., using the 'dc_dump_limit' parameter. Previously, the test performed at load time was different from the one used at runtime, and caused a lot of unnecessary dumping which slowed down the startup.
Diffstat (limited to 'lib/mnesia/src/mnesia_dumper.erl')
-rw-r--r--lib/mnesia/src/mnesia_dumper.erl44
1 files changed, 24 insertions, 20 deletions
diff --git a/lib/mnesia/src/mnesia_dumper.erl b/lib/mnesia/src/mnesia_dumper.erl
index 14665797a0..b784f2aca3 100644
--- a/lib/mnesia/src/mnesia_dumper.erl
+++ b/lib/mnesia/src/mnesia_dumper.erl
@@ -34,6 +34,7 @@
-export([
get_log_writes/0,
incr_log_writes/0,
+ needs_dump_ets/1,
raw_dump_table/2,
raw_named_dump_table/2,
start_regulator/0,
@@ -981,28 +982,10 @@ open_files(_Tab, _Storage, _UpdateInPlace, _InitBy) ->
false.
open_disc_copies(Tab, InitBy) ->
- DclF = mnesia_lib:tab2dcl(Tab),
- DumpEts =
- case file:read_file_info(DclF) of
- {error, enoent} ->
- false;
- {ok, DclInfo} ->
- DcdF = mnesia_lib:tab2dcd(Tab),
- case file:read_file_info(DcdF) of
- {error, Reason} ->
- mnesia_lib:dbg_out("File ~p info_error ~p ~n",
- [DcdF, Reason]),
- true;
- {ok, DcdInfo} ->
- Mul = case ?catch_val(dc_dump_limit) of
- {'EXIT', _} -> ?DumpToEtsMultiplier;
- Val -> Val
- end,
- DcdInfo#file_info.size =< (DclInfo#file_info.size * Mul)
- end
- end,
+ DumpEts = needs_dump_ets(Tab),
if
DumpEts == false; InitBy == startup ->
+ DclF = mnesia_lib:tab2dcl(Tab),
mnesia_log:open_log({?MODULE,Tab},
mnesia_log:dcl_log_header(),
DclF,
@@ -1017,6 +1000,27 @@ open_disc_copies(Tab, InitBy) ->
false
end.
+needs_dump_ets(Tab) ->
+ DclF = mnesia_lib:tab2dcl(Tab),
+ case file:read_file_info(DclF) of
+ {error, enoent} ->
+ false;
+ {ok, DclInfo} ->
+ DcdF = mnesia_lib:tab2dcd(Tab),
+ case file:read_file_info(DcdF) of
+ {error, Reason} ->
+ mnesia_lib:dbg_out("File ~p info_error ~p ~n",
+ [DcdF, Reason]),
+ true;
+ {ok, DcdInfo} ->
+ Mul = case ?catch_val(dc_dump_limit) of
+ {'EXIT', _} -> ?DumpToEtsMultiplier;
+ Val -> Val
+ end,
+ DcdInfo#file_info.size =< (DclInfo#file_info.size * Mul)
+ end
+ end.
+
%% Always opens the dcl file for writing overriding already_dumped
%% mechanismen, used for schema transactions.
open_dcl(Tab) ->