Thanks,

The close() method should save the contents of the file. But since we have 
previously seen cases of Java runtimes not working consistently, it would be 
a good idea to add the synch() explicitly. I have added the extra line to 
the CVS.

Fred

----- Original Message ----- 
From: "Yudhi Widyatama" <[EMAIL PROTECTED]>
To: "Developer issues for the hsqldb Database Engine." 
<hsqldb-developers@lists.sourceforge.net>
Sent: 08 August 2007 08:22
Subject: Re: [Hsqldb-developers] does FileOutputStream.close imply sync?


Dear hsqldb developers,
I am wondering about this one method, the close()
method in org/hsqldb/scriptio/ScriptWriterBase.java.
It does a flush without doing a sync, then it closes
the file.  I could imagine a scenario:
- HSQLDB started after a dirty shutdown.
- new and old files deleted
- backup restored
- .script file read
- .data file read
- .log file read
- .log file closed
- .script.new file written
- .script.new file closed
- .log file deleted
- .data file compressed into .backup.new
- .backup.new renamed into .backup
- .script.new renamed into .script
--- ** server powered down abruptly ** ---

If close doesn't imply sync, at this point the data
for the .script file maybe still in the OS write cache
. And depending on host OS's write cache logic, the
.log file deletion maybe still queued in the OS write
cache, or the .log file deletion already written to
the storage medium. In Windows the disk cache for data
area  is flushed independently from the disk cache for
system area (filename etc). So we (may) get : a
corrupt .script file and a missing .log file. I think
that what happened in my server, I got an empty
.script file (filled with 49KB of zeros) and no .log
file. I'm running HSQLDB on a Win2003 Server with JRE
1.4.2.

So, I think we should put a outDescriptor.sync()
call in the close() method. I'm attaching the proposed
patch with this email.
What do you think?

NB: sorry about the first post, the touch pad is a
little touchy



____________________________________________________________________________________
Yahoo! oneSearch: Finally, mobile search
that gives answers, not web links.
http://mobile.yahoo.com/mobileweb/onesearch?refer=1ONXIC


--------------------------------------------------------------------------------


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/


--------------------------------------------------------------------------------


_______________________________________________
hsqldb-developers mailing list
hsqldb-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hsqldb-developers


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
hsqldb-developers mailing list
hsqldb-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hsqldb-developers

Reply via email to