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

   ### Description
   
   When setIndexCommit points to the latest commit IndexWriter still calls 
changed(). This makes hasUncommittedChanges() return true and creates a new 
commit on close even though nothing has changed. It can also make 
DirectoryReader.isCurrent() return false.
   
   Only call changed() when the requested commit is different from the latest 
one. Comparing segments_N file names is enough since Lucene never overwrites 
these files.
   
   Add testOpenLatestCommitIsNotAChange to check that opening on the latest 
commit does not create a new commit while opening on an older commit still 
works as before. The test fails without the fix.
   
   Fixes #13151
   


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to