FileDataStore not crash safe
----------------------------

                 Key: JCR-2819
                 URL: https://issues.apache.org/jira/browse/JCR-2819
             Project: Jackrabbit Content Repository
          Issue Type: Bug
          Components: jackrabbit-core
    Affects Versions: 2.1.2
         Environment: All
            Reporter: Bernd Eckenfels
            Priority: Minor


The FileDataStore.addRecord() does create a temporary file and rename it to the 
final location. On a crash, this can result in a file which is renamed but the 
content is still empty. This especially happens on systems where data in the 
filesystem is not journaled. You can resolve this problem by calling the 
fdsync() method of the operating system before renaming the file. Typically in 
Java this is done by first flushing all the Java buffers (i.e. calling flush() 
on the highest output stream), and then using the getFD().sync(); method on the 
FileOutputStream.

Note: this introduced some delay/additional IO load on the system, therefore I 
think it might be best to make it configurable. But I think in some 
environments the additional reliability is badly needed.

Sample patch without configuration parameter added.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to