mirror of https://github.com/apache/lucene.git
LUCENE-4209: fix another suggester leak: dont leave behind the file when rename fails (/tmp is its own filesystem)
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1359946 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
80c852e721
commit
20b748a484
|
@ -45,7 +45,8 @@ Bug Fixes
|
|||
|
||||
* LUCENE-4209: Fix FSTCompletionLookup to close its sorter, so that it won't
|
||||
leave temp files behind in /tmp. Fix SortedTermFreqIteratorWrapper to not
|
||||
leave temp files behind in /tmp on Windows. (Uwe Schindler, Robert Muir)
|
||||
leave temp files behind in /tmp on Windows. Fix Sort to not leave
|
||||
temp files behind when /tmp is a separate volume. (Uwe Schindler, Robert Muir)
|
||||
|
||||
Build
|
||||
|
||||
|
|
|
@ -224,10 +224,12 @@ public final class Sort {
|
|||
|
||||
// One partition, try to rename or copy if unsuccessful.
|
||||
if (merges.size() == 1) {
|
||||
File single = merges.get(0);
|
||||
// If simple rename doesn't work this means the output is
|
||||
// on a different volume or something. Copy the input then.
|
||||
if (!merges.get(0).renameTo(output)) {
|
||||
copy(merges.get(0), output);
|
||||
if (!single.renameTo(output)) {
|
||||
copy(single, output);
|
||||
single.delete();
|
||||
}
|
||||
} else {
|
||||
// otherwise merge the partitions with a priority queue.
|
||||
|
|
Loading…
Reference in New Issue