[ 
https://issues.apache.org/jira/browse/OAK-2855?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Marth updated OAK-2855:
-------------------------------
    Labels: resilience  (was: )

> CopyOnReadDirectory mode might delete a valid local file upon close
> -------------------------------------------------------------------
>
>                 Key: OAK-2855
>                 URL: https://issues.apache.org/jira/browse/OAK-2855
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: lucene
>            Reporter: Chetan Mehrotra
>            Assignee: Chetan Mehrotra
>              Labels: resilience
>             Fix For: 1.3.0, 1.0.14, 1.2.3
>
>
> {{CopyOnReadDirectory}} currently deletes local files which are not found in 
> remote upon close. The list of remote file is fixed for a given revision 
> however list of local files may vary. 
> {{IndexTracker}} opens a new {{IndexNode}} upon update before closing the 
> older one. When CopyOnRead is enabled it can happen that same local directory 
> might be in use by two wrapper directories at the same time. 
> This introduces a race condition in {{removeDeletedFiles}} method as by the 
> time it is invoked a newer wrapped directory might have started adding new 
> files so those files would get included in the listing done for local 
> directory and hence cause them to be deleted as they would not be found in 
> remote directory which is pinned to older revision. Leading to following 
> exception
> {noformat}
> Caused by: java.io.FileNotFoundException: 
> /path/to/crx-quickstart/repository/index/e5a943cdec3000bd8ce54924fd2070ab5d1d35b9ecf530963a3583d43bf28293/4/_1r.cfe
>  (No such file or directory)
>       at java.io.RandomAccessFile.open(Native Method)
>       at java.io.RandomAccessFile.<init>(RandomAccessFile.java:241)
>       at 
> org.apache.lucene.store.MMapDirectory.openInput(MMapDirectory.java:193)
>       at 
> org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier$CopyOnReadDirectory$FileReference.openLocalInput(IndexCopier.java:393)
>       at 
> org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier$CopyOnReadDirectory.openInput(IndexCopier.java:221)
>       at org.apache.lucene.store.Directory.copy(Directory.java:185)
>       at 
> org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexMBeanImpl.dumpIndexContent(LuceneIndexMBeanImpl.java:104)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> {noformat}
> As a fix the list of local file should be maintained as progress is made once 
> the CopyOnRead instance gets created to ensure it does not pick up files 
> which are added once the directory is closed



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to