guojialiang92 opened a new pull request, #13017:
URL: https://github.com/apache/lucene/pull/13017

   ### Description
   
   This PR aims to address issue #13015.
   A more detailed explanation of the issue and the reasoning behind the fix 
can be found in the report link above.
   
   ### Solution
   
   - Before the file merge starts, execute `IndexFileDeleter#incRef` on the 
files referenced by merge to ensure that the file will not be deleted.
   - After the file merge is completed/abort, execute `IndexFileDeleter#decRef`.
   - In `ReadersAndUpdates#writeFieldUpdates`, 
`ReadersAndUpdates#swapNewReaderWithLatestLiveDocs` should be executed after 
`SegmentCommitInfo#setDocValuesUpdatesFiles`, ensuring that `SegmentReader` 
contains a deep clone of the `SegmentCommitInfo#dvUpdatesFiles`.
   
   ### Tests
   
   - I introduced `MockAssertFileExistIndexInput` which validate file exists 
before reading it.
   - I introduced `testForceMergeDVUpdateFileWithConcurrentFlush` which fails 
on `main` branch since the DV update file not exist, but passes on this branch.
   - I added corresponding 
`testMergeDVUpdateFileOnGetReaderWithConcurrentFlush` which passes on both 
`main` and this branch. Because before merge, `IndexFileDeleter#incRef` is 
executed in `StandardDirectoryReader#open`.
   - I added corresponding `testMergeDVUpdateFileOnCommitWithConcurrentFlush` 
which passes on both `main` and this branch. Because before merge, 
`IndexFileDeleter#incRef` is executed in `IndexWriter#prepareCommitInternal`.
   
   ### Checklist
   
   - [x]  I have reviewed the guidelines for [How to 
Contribute](https://github.com/apache/lucene/blob/main/CONTRIBUTING.md) and my 
code conforms to the standards described there to the best of my ability.
   - [x]  I have given Lucene maintainers 
[access](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/allowing-changes-to-a-pull-request-branch-created-from-a-fork)
 to contribute to my PR branch. (optional but recommended)
   - [x]  I have developed this patch against the `main` branch.
   - [x]  I have run `./gradlew check`.
   - [x]  I have added tests for my changes.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to