New patch. Tests pass, but I don't like the hacks I had to resort to,
to have things carefully compute "safe" (write once) temp file names.
There are bugs in those parts (I put nocommits).
I think to fix this more safely we need to add a new required
(abstract) method to Directory:
public abstract IndexOutput createTempOutput(String prefix, String suffix);
This way it's not the caller's (difficult) job of properly recursively
carving up the namespace.
Second, this is an API break for things that secretly used
OfflineSorter (suggesters, Hunspell Dictionary, etc.), but I think
this is good because it makes it clear to the caller that disk space
is going to be used by this method and lets the call control where, vs
running the risk of e.g. filling up your tmp partition.
Some things still wanted access to "the default temp dir", so I moved
it from OfflineSorter to IOUtils, and kept the test infra initializing
that to the mock fs wrapped version. Hmm I think maybe it's just
Hunspell, maybe I can remove that from IOUtils and just put it
(privately) in Hunspell. I think ideally nothing in Lucene should be
secretly using /tmp anymore.
I also think somehow we should extend the "retry the file delete" that
IW/IFD provides "down" to things like OfflineSorter so that virus
checkers won't cause exceptions (this was Rob's idea!) but I think we
should postpone until later, so I just sidestep the issue by having
tests disable the virus checker. This change is already big enough.