[erlang-bugs] DETS spoils DAT files

Richard Carlsson richardc@REDACTED
Tue Sep 1 10:01:39 CEST 2009


This is great! We've been hit by a spurious "bad object" error
every few months, but never been able to reproduce the conditions.
If this test case makes it possible to find and fix the bug in dets,
you are a certified hero.

    /Richard


Fyodor Ustinov wrote:
> Hi.
> 
> 
> In excess restrictions on 2G to file DETS spoils DAT files. Here's an
> example:
> 
> ufm@REDACTED:~/src$ erl
> Erlang R13B01 (erts-5.7.2) [source] [smp:2:2] [rq:2] [async-threads:0]
> [kernel-poll:false]
> 
> Eshell V5.7.2  (abort with ^G)
> 1> BigL = lists:seq(1,2000000).
> [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,
>  23,24,25,26,27,28,29|...]
> 2> dets:open_file(tab,[{type,set}]).
> {ok,tab}
> 3> dets:info(tab).
> [{type,set},
>  {keypos,1},
>  {size,0},
>  {file_size,5432},
>  {filename,"tab"}]
> 4> lists:foreach(fun(X) -> dets:insert(tab,{X,BigL}) end,
> lists:seq(1,50)).
> ok
> 5>
> dets:info(tab).                                                         
> [{type,set},
>  {keypos,1},
>  {size,50},
>  {file_size,848861394},
>  {filename,"tab"}]
> 6> dets:close(tab).
> ok
> 7>
> dets:open_file(tab,[{type,set}]).                                       
> {ok,tab}
> 8>
> dets:info(tab).                                                         
> [{type,set},
>  {keypos,1},
>  {size,50},
>  {file_size,848861666},
>  {filename,"tab"}]
> 9> lists:foreach(fun(X) -> dets:insert(tab,{X,BigL}) end,
> lists:seq(50,200)).
> ok
> 10>
> dets:info(tab).                                                           
> [{type,set},
>  {keypos,1},
>  {size,126},
>  {file_size,2066820196},
>  {filename,"tab"}]
> 11>
> dets:close(tab).                                                          
> {error,{{bad_object,read_buckets},"tab"}}
> 12>
> dets:close(tab).                                                          
> {error,not_owner}
> 13>
> dets:info(tab).                                                           
> undefined
> 14>
> dets:open_file(tab,[{type,set}]).                                         
> dets: file "tab" not properly closed, repairing ...
> {error,{no_more_space_on_file,"tab.TMP"}}
> 15> 
> 
> 
> 
> 
> ________________________________________________________________
> erlang-bugs mailing list. See http://www.erlang.org/faq.html
> erlang-bugs (at) erlang.org
> 



More information about the erlang-bugs mailing list