luyuncheng commented on issue #13798:
URL: https://github.com/apache/lucene/issues/13798#issuecomment-4406666252

   
   
   hi, @benwtrent @jpountz 
   we try to use [#13190](https://github.com/apache/lucene/pull/13190)  
parallel forcemerge segments. and we found this issue comes from 
[#13475](https://github.com/apache/lucene/pull/13475) it occurs as followings 
stack:
   
   when parallel merge in docvalues:
   
   1. clone merge state:
   
https://github.com/benwtrent/lucene/blob/92eb78d6a23e01a0a00bb065a1b9933d167291fe/lucene/core/src/java/org/apache/lucene/index/SegmentMerger.java#L204-L210
   
   ```
     private void mergeDocValues(
         SegmentWriteState segmentWriteState, SegmentReadState 
segmentReadState) throws IOException {
       MergeState mergeState = mergeState();
       try (DocValuesConsumer consumer = 
codec.docValuesFormat().fieldsConsumer(segmentWriteState)) {
         consumer.merge(mergeState);
       }
     }
   ```
   
   2. new instance
   
   `MergeState mergeState = mergeState();` would clone readers 
   ```
         if (docValuesProducers[i] != null) {
           docValuesProducers[i] = docValuesProducers[i].getMergeInstance();
         }
   ```
   
   getMergeInstance return new `Lucene90DocValuesProducer`
   
https://github.com/benwtrent/lucene/blob/cd88a97a63a97dc857d692ec3eb73b229bb5f372/lucene/core/src/java/org/apache/lucene/codecs/lucene90/Lucene90DocValuesProducer.java#L168-L181
   
   3. buffer reset
   
   new `Lucene90DocValuesProducer` it would do IndexInput data clone: 
`this.data = data.clone();`  when IndexInput is `NIOFSIndexInput` it would do 
`BufferedIndexInput#clone()` 
   
   when parallel get `MergeState mergeState = mergeState();` and buffer reset 
to `EMPTY_BYTEBUFFER` 
   
   


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