I'm getting an 'EXIT' error response from a call to dets:from_ets. The error response is shown below.<br><br>Steps to reproduce: Do dets:open_file/2 with a binary() type filename,
then a dets:from_ets/2 where the ets table is large (small ets tables
don't cause the error). My guess is that the ets table needs to be
large enough that the dets:from_ets needs to use a temporary file.
Don't know if this matters, but in my case the dets:open_file always
creates a new file and the ets table is type ordered_set..<br>
<br>The documentation for dets:open_file/2 states that the filename for the file option can be a binary: <span>{file, <span><a>file:name()</a></span>}</span>. file:name() includes the binary() type.<br>
<br>dets:from_ets return result:<br><span style="font-family:courier new,monospace"> {'EXIT',{function_clause,[{lists,thing_to_list,</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> [<<"d:/misc/workspaces/Erlang workspace/test1/scratch/fs_Node_test1@Stympy_5848_1323_314191_102937.">>]},</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> {lists,flatmap,2},</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> {file_sorter,next_temp,1},</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> {file_sorter,write_run,2},</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> {file_sorter,fun_run,5},</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> {file_sorter,do_sort,5},</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> {dets,do_sort,6},</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace"> {dets,do_finit,4}]}}</span><br style="font-family:courier new,monospace"><br><br>Code fragment:<br><div style="margin-left:40px"><span style="font-family:courier new,monospace">DetsName = <<"db.dets">>,</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">Filename = filename:join(<<"d:/misc/workspaces/Erlang workspace/test1/scratch">>, DetsName),</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> {error, enoent} = file:read_link_info(Filename),</span> %make sure the name is unique<br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">{ok, DetsName} = dets:open_file(DetsName, [{file, Filename} , {type, set}, {ram_file, true}]),</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace"> ok = dets:from_ets(DetsName, EtsName),</span><br style="font-family:courier new,monospace">
</div><br>A "exception error: no match of right hand side value" exception occurs on the "<span style="font-family:courier new,monospace">ok = dets:from_ets(DetsName, EtsName)</span>" statement, obviously because ok /= {'EXIT', ...}.<br>
<br>
Changing the <span style="font-family:courier new,monospace">{file, Filename}</span> option to <span style="font-family:courier new,monospace">{file, binary_to_list(Filename)} </span>makes the error go away. The resultant dets table is about 2MB in size.<br>
<span style="font-family: courier new,monospace;"><br></span>OS: Windows 7 64 bit<br>
Erlang version (installed from the R14B04
release Windows Binary File download) (erl +V): Erlang
(SMP,ASYNC_THREADS) (BEAM) emulator version 5.8.5<br>
Node name (node()): Node_test1@Stympy<br>
<br>
<br>