aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mnesia/src/mnesia_log.erl
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2016-03-29 15:22:37 +0200
committerDan Gudmundsson <[email protected]>2016-05-09 14:55:54 +0200
commit6fad79dbddf78f6fa4a91bc922234437c8181b7b (patch)
tree5207e3fa11c0437c738f0ae91a458d1a2dac0ea6 /lib/mnesia/src/mnesia_log.erl
parent545d88ac5b1a6bb6fe219c3175e1cafd716f1581 (diff)
downloadotp-6fad79dbddf78f6fa4a91bc922234437c8181b7b.tar.gz
otp-6fad79dbddf78f6fa4a91bc922234437c8181b7b.tar.bz2
otp-6fad79dbddf78f6fa4a91bc922234437c8181b7b.zip
mnesia_ext: reuse snmp field for ext updates
Minimal impact when talking to older nodes.
Diffstat (limited to 'lib/mnesia/src/mnesia_log.erl')
-rw-r--r--lib/mnesia/src/mnesia_log.erl27
1 files changed, 11 insertions, 16 deletions
diff --git a/lib/mnesia/src/mnesia_log.erl b/lib/mnesia/src/mnesia_log.erl
index d9f46d1d96..9536effd42 100644
--- a/lib/mnesia/src/mnesia_log.erl
+++ b/lib/mnesia/src/mnesia_log.erl
@@ -224,18 +224,12 @@ sappend(Log, Term) ->
ok = disk_log:log(Log, Term).
%% Write commit records to the latest_log
-log(C) when C#commit.disc_copies == [],
- C#commit.disc_only_copies == [],
- C#commit.external_copies == [],
- C#commit.schema_ops == [] ->
- ignore;
log(C) ->
- case mnesia_monitor:use_dir() of
+ case need_log(C) andalso mnesia_monitor:use_dir() of
true ->
if
is_record(C, commit) ->
- C2 = C#commit{ram_copies = [], snmp = []},
- append(latest_log, C2);
+ append(latest_log, strip_snmp(C));
true ->
%% Either a commit record as binary
%% or some decision related info
@@ -248,18 +242,12 @@ log(C) ->
%% Synced
-slog(C) when C#commit.disc_copies == [],
- C#commit.disc_only_copies == [],
- C#commit.external_copies == [],
- C#commit.schema_ops == [] ->
- ignore;
slog(C) ->
- case mnesia_monitor:use_dir() of
+ case need_log(C) andalso mnesia_monitor:use_dir() of
true ->
if
is_record(C, commit) ->
- C2 = C#commit{ram_copies = [], snmp = []},
- sappend(latest_log, C2);
+ sappend(latest_log, strip_snmp(C));
true ->
%% Either a commit record as binary
%% or some decision related info
@@ -270,6 +258,13 @@ slog(C) ->
ignore
end.
+need_log(#commit{disc_copies=[], disc_only_copies=[], schema_ops=[], ext=Ext}) ->
+ lists:keymember(ext_copies, 1, Ext);
+need_log(_) -> true.
+
+strip_snmp(#commit{ext=[]}=CR) -> CR;
+strip_snmp(#commit{ext=Ext}=CR) ->
+ CR#commit{ext=lists:keydelete(snmp, 1, Ext)}.
%% Stuff related to the file LOG