Mnesia Bug with select and disc_only_copies tables
Rudolph van Graan
rvg@REDACTED
Tue Oct 4 17:01:29 CEST 2005
>
> See the manual:
>
> For efficiency
> the NObjects is a recommendation only and the result
> may contain anything from an empty list to all avail-
> able results.
Does "Empty list" here mean "empty" even though the query matched
results? Or does it mean "Empty" when there was no results? For me
"recommendation" means that the query should return *at most*
NObjects if any results matched, or if the continuation mechanism
fails (for dets) *all* the data. But not nothing.
My experience shows that by only removing the NObjects argument, the
query worked, otherwise it did not return *any* data. The same query
without NObjects did return data.
I haven't had time to dig around too much, but your code runs here as
well. My table has indices, which might be part of the issue. I am
happy if the query *ignores* the NObject, but not for it to return no
data.
Do you want me to try and narrow this down to a reproducable scenario?
>
> (it is written because of dets :-)
>
> It works here:
>
> 1> mnesia:start().
> 2> mnesia:create_table(a, []).
> {atomic,ok}
> 6> mnesia:change_table_copy_type(schema, node(), disc_copies).
> {atomic,ok}
> 7> [mnesia:dirty_write({a, N,N}) || N <- lists:seq(1,1000)].
> 8> mnesia:change_table_copy_type(a, node(), disc_only_copies).
> {atomic,ok}
> 14> P = ets:fun2ms(fun({a,_,A}) when A > 990 -> A end).
> 16> F = fun('$end_of_table', _, Acc) -> Acc;
> ({Recs,Cont}, Fun,Acc) ->
> R = mnesia:select(Cnt),
> Fun(R, Fun, Recs ++Acc)
> end.
> 17> mnesia:transaction(fun() ->
> Cont = mnesia:select(a, P, 10, read),
> F(Cont, F, [])
> end).
> {atomic,[996,997,1000,998,994,992,993,995,999,991]}
Regards,
Rudolph
More information about the erlang-questions
mailing list