You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by dw...@apache.org on 2019/01/30 08:44:41 UTC
[lucene-solr] branch master updated: LUCENE-8663:
NRTCachingDirectory.slowFileExists may open a file while it's inaccessible
This is an automated email from the ASF dual-hosted git repository.
dweiss pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/master by this push:
new b802a52 LUCENE-8663: NRTCachingDirectory.slowFileExists may open a file while it's inaccessible
b802a52 is described below
commit b802a526857110ce3fc6e8b09c4e6c7cb26c1e8d
Author: Dawid Weiss <dw...@apache.org>
AuthorDate: Wed Jan 30 09:44:32 2019 +0100
LUCENE-8663: NRTCachingDirectory.slowFileExists may open a file while it's inaccessible
---
lucene/CHANGES.txt | 4 ++++
lucene/core/src/java/org/apache/lucene/store/NRTCachingDirectory.java | 2 +-
2 files changed, 5 insertions(+), 1 deletion(-)
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index bb392a8..c3d43ad 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -10,6 +10,10 @@ API Changes
* LUCENE-8474: RAMDirectory and associated deprecated classes have been
removed. (Dawid Weiss)
+Bug fixes:
+
+* LUCENE-8663: NRTCachingDirectory.slowFileExists may open a file while
+ it's inaccessible. (Dawid Weiss)
======================= Lucene 8.1.0 =======================
(No Changes)
diff --git a/lucene/core/src/java/org/apache/lucene/store/NRTCachingDirectory.java b/lucene/core/src/java/org/apache/lucene/store/NRTCachingDirectory.java
index ee8aac0..6352674 100644
--- a/lucene/core/src/java/org/apache/lucene/store/NRTCachingDirectory.java
+++ b/lucene/core/src/java/org/apache/lucene/store/NRTCachingDirectory.java
@@ -289,7 +289,7 @@ public class NRTCachingDirectory extends FilterDirectory implements Accountable
* there's some unexpected error. */
static boolean slowFileExists(Directory dir, String fileName) throws IOException {
try {
- dir.openInput(fileName, IOContext.DEFAULT).close();
+ dir.fileLength(fileName);
return true;
} catch (NoSuchFileException | FileNotFoundException e) {
return false;