ameyakarve opened a new issue, #13477:
URL: https://github.com/apache/lucene/issues/13477

   Context: I was working on a custom merge policy implementation:
   
   
https://github.com/apache/lucene/blob/edba83e63652f414c50305b7c3b545f374d1108c/lucene/core/src/java/org/apache/lucene/index/IndexWriter.java#L4839
   
   I was working on a custom implementation where:
   1. I was capturing the indexCommit object using 
`SnapshotDeletionPolicy#snapshot`
   2. While merging, I was trying to use this indexCommit object to reconstruct 
the SegmentCommitInfos using:
   
   ```java
   
   SegmentInfos segmentCommitInfos = 
SegmentInfos.readCommit(commit.getDirectory(), commit.getSegmentsFileName());
   
   ```
   
   Which I was trying to pass in the `findMerges` and `findForcedMerges` 
methods in `MergePolicy`
   
   The `SegmentInfos.readCommit` objects are different from the objects 
`IndexWriter` holds in its own datastructure, causing the referenced if 
condition to fail.
   
   I was able to work around this by forcefully remapping the instances from 
`SegmentInfos.readCommit` to the instances from the method parameter 
`segmentInfos` in `findMerges` and `findForcedMerges` by mapping on the id.
   
   Can we fix this in Lucene itself - either by changing the hashcode method of 
`SegmentCommitInfo`, or (probably safer) changing this condition to match 
explicitly on ids provided rather than on the objects themselves? 
   
   If not, this expected behavior should ideally be documented clearly
   
   


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