Shibi-bala opened a new issue, #13151:
URL: https://github.com/apache/lucene/issues/13151

   ### Description
   
   Hey,
   
   I found what looks to be a bug here:
   
https://github.com/apache/lucene/blob/releases/lucene/9.9.0/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java#L1102-L1105
   
   ```
   if (commit != null) {
     // Swap out all segments, but, keep metadata in
     // SegmentInfos, like version & generation, to
     // preserve write-once.  This is important if
     // readers are open against the future commit
     // points.
     if (commit.getDirectory() != directoryOrig) {
       throw new IllegalArgumentException(
           "IndexCommit's directory doesn't match my directory, expected="
               + directoryOrig
               + ", got="
               + commit.getDirectory());
     }
   
     SegmentInfos oldInfos =
         SegmentInfos.readCommit(directoryOrig, commit.getSegmentsFileName());
     segmentInfos.replace(oldInfos);
     changed();
   
     if (infoStream.isEnabled("IW")) {
       infoStream.message(
           "IW", "init: loaded commit \"" + commit.getSegmentsFileName() + 
"\"");
     }
   }
   ```
   
   When we called `segmentsInfos.replace` point, there is no guarantee that the 
information replaced actually changed. In the cases where information actually 
isn't changed, we still call changed(). This means the next commit we attempt 
will actually write a new commit rather than being a no-op.
   
   I have some ideas on how to fix, like add a check to .replace() to see if 
information actually changed, but want to hear other thoughts.
   
   ### Version and environment details
   
   _No response_


-- 
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.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