Index: CHANGES.txt =================================================================== --- CHANGES.txt (revision 552781) +++ CHANGES.txt (working copy) @@ -1,4 +1,4 @@ -Lucene Change Log +Lucene Change Log $Id$ @@ -167,6 +167,10 @@ 23. LUCENE-913: Two consecutive score() calls return different scores for Boolean Queries. (Michael Busch, Doron Cohen) +24. LUCENE-948: Fix FNFE exception caused by stale NFS client + directory listing caches when writers on different machines are + sharing an index over NFS. + New features 1. LUCENE-759: Added two n-gram-producing TokenFilters. Index: src/java/org/apache/lucene/index/IndexFileDeleter.java =================================================================== --- src/java/org/apache/lucene/index/IndexFileDeleter.java (revision 552781) +++ src/java/org/apache/lucene/index/IndexFileDeleter.java (working copy) @@ -23,6 +23,7 @@ import org.apache.lucene.store.Directory; import java.io.IOException; +import java.io.FileNotFoundException; import java.io.PrintStream; import java.util.Map; import java.util.HashMap; @@ -153,13 +154,26 @@ message("init: load commit \"" + fileName + "\""); } SegmentInfos sis = new SegmentInfos(); - sis.read(directory, fileName); - CommitPoint commitPoint = new CommitPoint(sis); - if (sis.getGeneration() == segmentInfos.getGeneration()) { - currentCommitPoint = commitPoint; + try { + sis.read(directory, fileName); + } catch (FileNotFoundException e) { + // LUCENE-948: on NFS (and maybe others), if + // you have writers switching back and forth + // between machines, it's very likely that the + // dir listing will be stale and will claim a + // file segments_X exists when in fact it + // doesn't. So, we catch this and handle it + // as if the file does not exist + sis = null; } - commits.add(commitPoint); - incRef(sis, true); + if (sis != null) { + CommitPoint commitPoint = new CommitPoint(sis); + if (sis.getGeneration() == segmentInfos.getGeneration()) { + currentCommitPoint = commitPoint; + } + commits.add(commitPoint); + incRef(sis, true); + } } } }