[erlang-bugs] mnesia-4.3.5 select continuation problem

Dan Gudmundsson <>
Mon Dec 10 17:19:03 CET 2007


And Patrik^D^D^D the author says that your patch is correct,
it will be included in the next release.

/Dan

Dan Gudmundsson wrote:
> Thank you, it is indeed an ets bug.
> I filed a report with ID: OTP-7025
> 
> /Dan
> 
> Paul Mineiro wrote:
>> by the way, my immediate problem goes away if i just remove the offending
>> guard (so i'm good for today!).  however i have no idea if this is the
>> correct way to fix the problem.
>>
>> -------
>> % diff -u ets.erl.orig ets.erl
>> --- ets.erl.orig        2007-12-08 20:48:53.000000000 -0800
>> +++ ets.erl     2007-12-08 20:48:55.000000000 -0800
>> @@ -88,7 +88,7 @@
>>  % ordered_set
>>  repair_continuation(Untouched = {Table,Lastkey,L1,N2,Bin,L2,N3,N4}, MS)
>> when
>>  (is_atom(Table) or is_integer(Table)),
>> -is_list(L1),
>> +%is_list(L1),
>>  is_integer(N2),
>>  is_binary(Bin),
>>  size(Bin) =:= 0,
>>
>> -------
>>
>> -- p
>>
>> On Sat, 8 Dec 2007, Paul Mineiro wrote:
>>
>>> mnesia:select/4 and mnesia:select/1 are failing with ordered set tables
>>> and a tuple key pattern.  a little module demonstrating the effect is
>>> attached, the output (on my machine) is:
>>>
>>> -------
>>> 21> c (selectbug), selectbug:showbug ().
>>> {a,'$1'} set: {atomic,'$end_of_table'}
>>> {a,'$1'} ordered_set: {'EXIT',
>>>                           {{badmatch,
>>>                                {aborted,
>>>                                    {badarg,
>>>                                        [ram_copies,
>>>                                         {bug,{a,b},{a,'$1'},1,<<>>,[],0,0},
>>>                                         [{{'_',{a,'$1'},'_'},[],['$1']}]]}}},
>>>                            [{selectbug,selector,2},
>>>                             {selectbug,'-showbug/0-fun-0-',1},
>>>                             {lists,foreach,2},
>>>                             {erl_eval,do_apply,5},
>>>                             {shell,exprs,6},
>>>                             {shell,eval_loop,3}]}}
>>> {a,'$1'} bag: {atomic,'$end_of_table'}
>>> '$1' set: {atomic,'$end_of_table'}
>>> '$1' ordered_set: {atomic,'$end_of_table'}
>>> '$1' bag: {atomic,'$end_of_table'}
>>> ok
>>> -------
>>>
>>> looking at things, it looks like ets:repair_continuation/2 is expecting
>>> a list in the 3rd element of the first argument.  i put an io:format on
>>> the { badrpc, Reason } clause of mnesia:do_dirty_rpc/5 to print out the
>>> reason:
>>>
>>> -------
>>> {'EXIT',{function_clause,[{ets,repair_continuation,
>>>                                [{bug,{a,b},{a,'$1'},1,<<>>,[],0,0},
>>>                                 [{{'_',{a,'$1'},'_'},[],['$1']}]]},
>>>                           {mnesia_lib,db_select_cont,3},
>>>                           {rpc,local_call,3},
>>>                           {mnesia,do_dirty_rpc,5},
>>>                           {mnesia,select_cont,3},
>>>                           {mnesia_tm,apply_fun,3},
>>>                           {mnesia_tm,execute_transaction,5},
>>>                           {selectbug,selector,2}]}}
>>> ------
>>>
>>> the 3rd element is a tuple here.
>>>
>>> poking around i can see that the ets:select/3 call from
>>> mnesia_lib:db_select_init/4 is actually returning a continuation whose 3rd
>>> argument is not a list.  this is now a BIF so i feel a bit stuck at this
>>> point.  since it's a BIF here's some extra info:
>>>
>>> ------
>>> % erl -s erlang halt
>>> Erlang (BEAM) emulator version 5.5.5 [source] [async-threads:0] [kernel-poll:false]
>>>
>>> % dpkg -s erlang-otp
>>> Package: erlang-otp
>>> Status: install ok installed
>>> Priority: optional
>>> Section: languages
>>> Installed-Size: 139084
>>> Maintainer: None <>
>>> Architecture: darwin-i386
>>> Source: erlang-otp
>>> Version: 11b-5-1
>>> Depends: libncurses5-shlibs, unixodbc2-shlibs | unixodbc2-nox-shlibs, darwin (>= 8-1)
>>> Description: General-purpose programming language
>>>  Erlang is a general-purpose programming language and runtime environment.
>>>  Erlang has built-in support for concurrency, distribution and fault
>>>  tolerance. Erlang is used in several large telecommunication systems
>>>  from Ericsson.  The most popular implementation of Erlang is available as
>>>  open source from the open source erlang site.
>>>  .
>>>  Web site: http://www.erlang.org/
>>>  .
>>>  Maintainer: None <>
>>> BuildDependsOnly: Undefined
>>>
>>> % uname -a
>>> Darwin paul-mineiros-computer.local 8.9.3 Darwin Kernel Version 8.9.3: Fri Apr 27 14:50:07 PDT 2007; root:xnu-792.19.5~2/RELEASE_I386 i386 i386
>>>
>>> ------
>>>
>>> thanks,
>>>
>>> -- p
>>>
>>> Optimism is an essential ingredient of innovation. How else can the
>>> individual favor change over security?
>>>
>>>   -- Robert Noyce
>> Optimism is an essential ingredient of innovation. How else can the
>> individual favor change over security?
>>
>>   -- Robert Noyce
>> _______________________________________________
>> erlang-bugs mailing list
>> 
>> http://www.erlang.org/mailman/listinfo/erlang-bugs
>>
> _______________________________________________
> erlang-bugs mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-bugs
> 



More information about the erlang-bugs mailing list