<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1106" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=Arial size=2>Dear all,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>If an opened DETS file (Version 9) was updated but 
not closed properly, what are the odds to have an appropriate MD5 
digest?</FONT></DIV>
<DIV><FONT face=Arial size=2>To that end, what is the point of verifying 
MD5 digest before testing the "closed_properly" flag in 
dets_v9.erl?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>The following is a fragment from 
dets_v9:check_file_header that illustrates the above:</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#000080 size=2> if<BR>     
FH#fileheader.cookie /= ?MAGIC -><BR>        
  {error, not_a_dets_file};<BR>     
FH#fileheader.type == badtype -><BR>      
    {error, invalid_type_code};<BR>     
FH#fileheader.version /= ?FILE_FORMAT_VERSION -> 
<BR>                
{error, bad_version};<BR><FONT 
color=#ff0000>            
FH#fileheader.has_md5 == true, 
<BR>            
FH#fileheader.read_md5 /= FH#fileheader.md5 
-><BR>                
{error, not_a_dets_file}; % harsh but fair<BR></FONT>     
FH#fileheader.trailer /= FH#fileheader.eof 
-><BR>          {error, 
not_closed};<BR>     FH#fileheader.closed_properly == 
?CLOSED_PROPERLY -><BR>          {ok, 
true};<BR>     FH#fileheader.closed_properly == 
?NOT_PROPERLY_CLOSED -><BR>          
{error, not_closed};<BR>     HashBif == undefined 
-><BR>          {error, 
bad_hash_bif};<BR>     true 
-><BR>      {error, 
not_a_dets_file}<BR> end,</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>I had a problem with MNESIA start-up... well, to 
cut a story short, I've been using mensia:activity with async_dirty access 
context on mnesia_frag module. Somehow, after shutting MNESIA down, 
we ended up with a bunch of corrupted DETS files. MNESIA refused to start 
because of the above-mentioned issue, and the only way to fix it was to change 
the evaluation order in DETS_V9 module. This change allowed MNESIA to repair 
corrupted dets files, and start without dumping the core.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Is the original testing order, as specified in 
above code fragment, there by design?</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2>Valentin.</FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial color=#000080 size=2></FONT> </DIV></BODY></HTML>