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

IndexWriter.setCommitData should be late binding

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 6.2, 7.0
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      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.

        Attachments

        1. LUCENE-7335.patch
          34 kB
          Michael McCandless

          Activity

            People

            • Assignee:
              mikemccand Michael McCandless
              Reporter:
              mikemccand Michael McCandless
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: