diff options
author | Dan Gudmundsson <[email protected]> | 2013-04-11 08:53:57 +0200 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2013-04-11 10:15:22 +0200 |
commit | 4f1f29eca9984c33f563b57a4d82f02ed0bf9c21 (patch) | |
tree | 4126a7424cd675b31ae01d86196a44cff258c8d1 /lib/mnesia/src/mnesia_loader.erl | |
parent | f3c1b7246407b28a3134c45f16ab7bcdc4775a89 (diff) | |
download | otp-4f1f29eca9984c33f563b57a4d82f02ed0bf9c21.tar.gz otp-4f1f29eca9984c33f563b57a4d82f02ed0bf9c21.tar.bz2 otp-4f1f29eca9984c33f563b57a4d82f02ed0bf9c21.zip |
mnesia: Fixed bad data in table
If mnesia:cleartable/1 was called during a table_load an schema event
with delete and write of that table is sent, which caused the table
to contain the schema record instead of clearing the table.
Diffstat (limited to 'lib/mnesia/src/mnesia_loader.erl')
-rw-r--r-- | lib/mnesia/src/mnesia_loader.erl | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/lib/mnesia/src/mnesia_loader.erl b/lib/mnesia/src/mnesia_loader.erl index 4ba400fbbf..4afbea1cc2 100644 --- a/lib/mnesia/src/mnesia_loader.erl +++ b/lib/mnesia/src/mnesia_loader.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 1998-2011. All Rights Reserved. +%% Copyright Ericsson AB 1998-2013. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -487,7 +487,8 @@ finish_copy(Storage,Tab,Cs,SenderPid,DatBin,OrigTabRec) -> subscr_receiver(TabRef = {_, Tab}, RecName) -> receive - {mnesia_table_event, {Op, Val, _Tid}} -> + {mnesia_table_event, {Op, Val, _Tid}} + when element(1, Val) =:= Tab -> if Tab == RecName -> handle_event(TabRef, Op, Val); @@ -496,6 +497,15 @@ subscr_receiver(TabRef = {_, Tab}, RecName) -> end, subscr_receiver(TabRef, RecName); + {mnesia_table_event, {Op, Val, _Tid}} when element(1, Val) =:= schema -> + %% clear_table is faked via two schema events + %% a schema record delete and a write + case Op of + delete -> handle_event(TabRef, clear_table, {Tab, all}); + _ -> ok + end, + subscr_receiver(TabRef, RecName); + {'EXIT', Pid, Reason} -> handle_exit(Pid, Reason), subscr_receiver(TabRef, RecName) |