If I had to choose between being able to change things in real time to better concurrency thanks to immutability, I would definitely go with better concurrency.
We're not talking about better concurrency here – making these fields
volatile will be in the noise.
If ever it were not in the noise, I agree better concurrency should
I don't think we are talking about that many setter to begin with (I don't think we should bring those back to the IndexWriter).
True, but we are setting a precedent here. Ie this will apply to
further settings we add to IWC, apply to any other classes that we
pull config out of (eg IR), etc. I don't like that factoring out
config means loss of functionality.
It should not be consulted once the construction phase of IW is done.
Why such purity? What do we gain?
I'm all for purity, but only if it doesn't interfere w/ functionality.
Here, it's taking away freedom...
I would prefer to have the config you passed into IW remain "live".
You can also do IW.getConfig().setXXX later too.
In fact it should be fine to share an IWC across multiple writers; you
can change the RAM buffer for all of them at once.
If explicit real time parameters are to be set, then IW should expose it as a setter.
But then whenever we change our mind about liveness, we have to change
the API? I'd like to decouple liveness of a setter (really a semantic
aspect of that API, documented in the jdocs) from which API is used to
I think a config param should be live by default and only if there's
some hardship / reason to not have it so, should we make an
exception. Most of these params are trivial to be live (they were
before the IWC change).
making nonvolatile mutable references introduces you to a world of hard-to-catch unsafe publication bugs (yes, infoStream is currently broken!).
Well, in theory, yes, in practice, no. This is like stating your HTML is
buggy because it fails to put a closing </html> tag and so some
browser could fail to render it
I doubt there's any JVM out there where our lack-of-volatile
infoStream causes any problems.
But, of course, we should make them volatile to be safe...
Each and every live reconfigurable setting adds to complexity.
That's the exception not the rule. Most of these settings are used at
certain times – on flushing a new seg, on warming a seg, etc. – and
there's no added complexity to simply pulling their current value from
For more complex cases, certain on-change logic is required.
For such cases we can state that changes to the config do not take
effect; eg IndexingChain is a good example I think. But I think the
default should be that changes are live, unless otherwise stated
I don't think we should go out of our way to be making settings live,
if there's any hair involved. But for the settings where there's no
hair involved, they should be live.