Uploaded image for project: 'Lucene - Core'
  1. Lucene - Core
  2. LUCENE-7335

IndexWriter.setCommitData should be late binding


    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 6.2, 7.0
    • None
    • None
    • New


      Today, IndexWriter.setCommitData is early-binding: as soon as you call it, it clones the provided map and later on when commit is called, it uses that clone.

      But this makes it hard for some use cases where the app needs to record more timely information based on when specifically the commit actually occurs. E.g., with LUCENE-7302, it would be helpful to store the max completed sequence number in the commit point: that would be a lower bound of operations that were after the commit.

      I think the most minimal way to do this would be to upgrade the existing method to take an Iterable<Map.Entry<String,String>, and document that it's now late binding, i.e. IW will pull an Iterator from that when it's time to write the segments file.

      Or we could also make an explicit interface that you pass (seems like overkill), or maybe have a listener or something (or you subclass IW) that's invoked when the commit is about to write the segments file, but that also seems like overkill.


        1. LUCENE-7335.patch
          34 kB
          Michael McCandless



            mikemccand Michael McCandless
            mikemccand Michael McCandless
            0 Vote for this issue
            3 Start watching this issue