diff options
author | Ulf Wiger <[email protected]> | 2013-11-20 18:21:44 +0100 |
---|---|---|
committer | Richard Carlsson <[email protected]> | 2014-12-22 22:44:06 +0100 |
commit | fefb2d78cb10606f83ad4010fee6a8be4d4191f2 (patch) | |
tree | 15565ad48081f302d930cb504d9747259c4646c1 /lib/mnesia/src/mnesia_dumper.erl | |
parent | 85112014bd136055b56e6ec5218f82f74951e0c6 (diff) | |
download | otp-fefb2d78cb10606f83ad4010fee6a8be4d4191f2.tar.gz otp-fefb2d78cb10606f83ad4010fee6a8be4d4191f2.tar.bz2 otp-fefb2d78cb10606f83ad4010fee6a8be4d4191f2.zip |
Make Mnesia DCD dump behaviour available via API
If a DCD dump is desired on-demand, use the function
mnesia_controller:snapshot_dcd(Tables). Tables must be a list of
tables that have a local disc_copy, otherwise an error will be
returned. Once the operation actually executes, any table that doesn't
have a local disc_copy is ignored.
Specifically, the dump_log worker record has been changed to allow an
arity-0 fun instead of the default log dump. This fun will be executed
as if it were a normal log dump, and must return 'dumped'. This could
also be used to e.g. insert a backup operation between log dumps.
Diffstat (limited to 'lib/mnesia/src/mnesia_dumper.erl')
-rw-r--r-- | lib/mnesia/src/mnesia_dumper.erl | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/mnesia/src/mnesia_dumper.erl b/lib/mnesia/src/mnesia_dumper.erl index b784f2aca3..509b765dee 100644 --- a/lib/mnesia/src/mnesia_dumper.erl +++ b/lib/mnesia/src/mnesia_dumper.erl @@ -39,7 +39,8 @@ raw_named_dump_table/2, start_regulator/0, opt_dump_log/1, - update/3 + update/3, + snapshot_dcd/1 ]). %% Internal stuff @@ -100,6 +101,19 @@ opt_dump_log(InitBy) -> end, perform_dump(InitBy, Reg). +snapshot_dcd(Tables) -> + lists:foreach( + fun(Tab) -> + case mnesia_lib:storage_type_at_node(node(), Tab) of + disc_copies -> + mnesia_log:ets2dcd(Tab); + _ -> + %% Storage type was checked before queueing the op, though + skip + end + end, Tables), + dumped. + %% Scan for decisions perform_dump(InitBy, Regulator) when InitBy == scan_decisions -> ?eval_debug_fun({?MODULE, perform_dump}, [InitBy]), |