You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2016/02/08 19:53:26 UTC

lucene-solr git commit: LUCENE-6835, LUCENE-6684: keep the 'suppress NSFE on windows' hack inside IFD as well

Repository: lucene-solr
Updated Branches:
  refs/heads/master 5e6f22b92 -> 2cee9f169


LUCENE-6835, LUCENE-6684: keep the 'suppress NSFE on windows' hack inside IFD as well


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/2cee9f16
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/2cee9f16
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/2cee9f16

Branch: refs/heads/master
Commit: 2cee9f16934b6458ee18a60d194e586c33ed36d9
Parents: 5e6f22b
Author: Mike McCandless <mi...@apache.org>
Authored: Mon Feb 8 13:54:05 2016 -0500
Committer: Mike McCandless <mi...@apache.org>
Committed: Mon Feb 8 13:54:05 2016 -0500

----------------------------------------------------------------------
 .../apache/lucene/index/IndexFileDeleter.java    | 19 +++++++++++++++++--
 .../lucene/store/BaseLockFactoryTestCase.java    |  9 ++-------
 2 files changed, 19 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2cee9f16/lucene/core/src/java/org/apache/lucene/index/IndexFileDeleter.java
----------------------------------------------------------------------
diff --git a/lucene/core/src/java/org/apache/lucene/index/IndexFileDeleter.java b/lucene/core/src/java/org/apache/lucene/index/IndexFileDeleter.java
index 52f0b40..38d1688 100644
--- a/lucene/core/src/java/org/apache/lucene/index/IndexFileDeleter.java
+++ b/lucene/core/src/java/org/apache/lucene/index/IndexFileDeleter.java
@@ -705,14 +705,29 @@ final class IndexFileDeleter implements Closeable {
       if (name.startsWith(IndexFileNames.SEGMENTS) == false) {
         continue;
       }
-      directory.deleteFile(name);
+      deleteFile(name);
     }
 
     for(String name : names) {
       if (name.startsWith(IndexFileNames.SEGMENTS) == true) {
         continue;
       }
-      directory.deleteFile(name);
+      deleteFile(name);
+    }
+  }
+
+  private void deleteFile(String fileName) throws IOException {
+    try {
+      directory.deleteFile(fileName);
+    } catch (NoSuchFileException | FileNotFoundException e) {
+      if (Constants.WINDOWS) {
+        // TODO: can we remove this OS-specific hacky logic?  If windows deleteFile is buggy, we should instead contain this workaround in
+        // a WindowsFSDirectory ...
+        // LUCENE-6684: we suppress this assert for Windows, since a file could be in a confusing "pending delete" state, where we already
+        // deleted it once, yet it still shows up in directory listings, and if you try to delete it again you'll hit NSFE/FNFE:
+      } else {
+        throw e;
+      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/2cee9f16/lucene/test-framework/src/java/org/apache/lucene/store/BaseLockFactoryTestCase.java
----------------------------------------------------------------------
diff --git a/lucene/test-framework/src/java/org/apache/lucene/store/BaseLockFactoryTestCase.java b/lucene/test-framework/src/java/org/apache/lucene/store/BaseLockFactoryTestCase.java
index f2c7268..b2ad178 100644
--- a/lucene/test-framework/src/java/org/apache/lucene/store/BaseLockFactoryTestCase.java
+++ b/lucene/test-framework/src/java/org/apache/lucene/store/BaseLockFactoryTestCase.java
@@ -233,19 +233,14 @@ public abstract class BaseLockFactoryTestCase extends LuceneTestCase {
         iwc.setOpenMode(OpenMode.APPEND);
         try {
           writer = new IndexWriter(dir, iwc);
-        } catch (LockObtainFailedException e) {
-          // lock obtain timed out
-          // NOTE: we should at some point
-          // consider this a failure?  The lock
-          // obtains, across IndexReader &
-          // IndexWriters should be "fair" (ie
-          // FIFO).
         } catch (Throwable t) {
           if (Constants.WINDOWS && t instanceof AccessDeniedException) {
             // LUCENE-6684: suppress this: on Windows, a file in the curious "pending delete" state can
             // cause this exc on IW init, where one thread/process deleted an old
             // segments_N, but the delete hasn't finished yet because other threads/processes
             // still have it open
+            printStream.println("TEST: AccessDeniedException on init witer");
+            t.printStackTrace(printStream);
           } else {
             hitException = true;
             System.out.println("Stress Test Index Writer: creation hit unexpected exception: " + t.toString());