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

Rahul Goswami updated LUCENE-9889:
----------------------------------
    Description: 
 
 If one of the existing segment files is opened by another (say a 3rd party) 
process, it can causing a parallel commit to fail with an error complaining 
about the index files to be locked by another process. Upon debugging, I see 
that fsync is being called during commit on already existing segment files, and 
failure to open the file in write mode causes this. But this should not be an 
expected behavior since there is no reason for a commit to open an existing 
segment file in WRITE mode to fsync. Please note that in this case, the index 
file was also a part of a saved commit point, so there is all the more reason 
to not fsync it.    
  
 The line of code I am referring to is as below:
 try (final FileChannel file = FileChannel.open(fileToSync, isDir ? 
StandardOpenOption.READ : StandardOpenOption.WRITE))
  
 in method fsync(Path fileToSync, boolean isDir) of the class file
  
 lucene\core\src\java\org\apache\lucene\util\IOUtils.java
  
  
 Opening this Jira after discussion with Mike McCandless and Michael Sokolov on 
the dev mailing list here:
 [Lucene - Java Developer - Lucene (unexpected ) fsync on existing segments 
(nabble.com)|https://lucene.472066.n3.nabble.com/Lucene-unexpected-fsync-on-existing-segments-td4469731.html]
  

  was:
 
If one of the existing segment files is opened by another (say a 3rd party) 
process, it can causing a parallel commit to fail with an error complaining 
about the index files to be locked by another process. Upon debugging, I see 
that fsync is being called during commit on already existing segment files, and 
failure to open the file in write mode causes this. But this should not be an 
expected behavior since there is no reason for a commit to open an existing 
segment file in WRITE mode to fsync. Please note that in this case, the index 
file was also a part of a saved commit point, so there is all the more reason 
to not fsync it.    
 
The line of code I am referring to is as below:
try (final FileChannel file = FileChannel.open(fileToSync, isDir ? 
StandardOpenOption.READ : StandardOpenOption.WRITE))
 
in method fsync(Path fileToSync, boolean isDir) of the class file
 
lucene\core\src\java\org\apache\lucene\util\IOUtils.java
 
 
Opening this Jira after discussion with Mike Candless and Michael Sokolov on 
the dev mailing list here:
[Lucene - Java Developer - Lucene (unexpected ) fsync on existing segments 
(nabble.com)|https://lucene.472066.n3.nabble.com/Lucene-unexpected-fsync-on-existing-segments-td4469731.html]
 


> Lucene (unexpected ) fsync on existing segments
> -----------------------------------------------
>
>                 Key: LUCENE-9889
>                 URL: https://issues.apache.org/jira/browse/LUCENE-9889
>             Project: Lucene - Core
>          Issue Type: Bug
>          Components: core/index
>    Affects Versions: 7.7.2
>            Reporter: Rahul Goswami
>            Priority: Major
>
>  
>  If one of the existing segment files is opened by another (say a 3rd party) 
> process, it can causing a parallel commit to fail with an error complaining 
> about the index files to be locked by another process. Upon debugging, I see 
> that fsync is being called during commit on already existing segment files, 
> and failure to open the file in write mode causes this. But this should not 
> be an expected behavior since there is no reason for a commit to open an 
> existing segment file in WRITE mode to fsync. Please note that in this case, 
> the index file was also a part of a saved commit point, so there is all the 
> more reason to not fsync it.    
>   
>  The line of code I am referring to is as below:
>  try (final FileChannel file = FileChannel.open(fileToSync, isDir ? 
> StandardOpenOption.READ : StandardOpenOption.WRITE))
>   
>  in method fsync(Path fileToSync, boolean isDir) of the class file
>   
>  lucene\core\src\java\org\apache\lucene\util\IOUtils.java
>   
>   
>  Opening this Jira after discussion with Mike McCandless and Michael Sokolov 
> on the dev mailing list here:
>  [Lucene - Java Developer - Lucene (unexpected ) fsync on existing segments 
> (nabble.com)|https://lucene.472066.n3.nabble.com/Lucene-unexpected-fsync-on-existing-segments-td4469731.html]
>   



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to