[erlang-bugs] mnesia_loader:db_match_erase/2 can only badmatch with dets
Niclas Eklund
nick@REDACTED
Mon Jul 21 10:59:41 CEST 2008
Hello!
Thank you for reporting this! This might simply be a documentation bug
since dets:match_delete/2 can return ok (see below). I'll notify the
person responsible for the Dets application about this.
Best Regards,
Niclas Erlang/OTP
%% dets.erl
match_delete(Tab, Pat) ->
badarg(match_delete(Tab, Pat, delete), [Tab, Pat]).
match_delete(Tab, Pat, What) ->
safe_fixtable(Tab, true),
case compile_match_spec(What, Pat) of
{Spec, MP} ->
Proc = dets_server:get_pid(Tab),
R = req(Proc, {match_delete_init, MP, Spec}),
do_match_delete(Tab, Proc, R, What, 0);
badarg ->
badarg
end.
do_match_delete(Tab, _Proc, {done, N1}, select, N) ->
safe_fixtable(Tab, false),
N + N1;
do_match_delete(Tab, _Proc, {done, _N1}, _What, _N) ->
safe_fixtable(Tab, false),
ok;
do_match_delete(Tab, Proc, {cont, State, N1}, What, N) ->
do_match_delete(Tab, Proc, req(Proc, {match_delete, State}), What,
N+N1);
do_match_delete(Tab, _Proc, Error, _What, _N) ->
safe_fixtable(Tab, false),
Error.
On Sun, 20 Jul 2008, Paul Mineiro wrote:
> Heads up, I found another instance of the same problem in
> mnesia_index:db_match_erase/2 .
>
> -- p
>
> On Sun, 20 Jul 2008, Paul Mineiro wrote:
>
>> The return value of dets:match_delete/2 is an integer, or an error tuple;
>> mnesia_loader is matching against ok.
>>
>> Attached is a suggested patch.
>>
>> -- p
>>
>> p.z. I wonder if the dialyzer would have found this ...
>
> In an artificial world, only extremists live naturally.
>
> -- Paul Graham
> _______________________________________________
> erlang-bugs mailing list
> erlang-bugs@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-bugs
>
More information about the erlang-bugs
mailing list