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.