Apache Lucene open-source search software
SOLR-8015: HdfsLock may fail to close a FileSystem instance if it cannot immediately obtain an index lock.
Mark Robert Miller9794ec770557
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex b544332e0af..5f7154d22ec 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -276,6 +276,8 @@ Bug Fixes* SOLR-8419: TermVectorComponent for distributed search when distrib.singlePass could include termvectors for documents that matched the query yet weren't in the returned documents. (David Smiley)+* SOLR-8015: HdfsLock may fail to close a FileSystem instance if it cannot immediately+ obtain an index lock. (Mark Miller)Other Changes----------------------diff --git a/solr/core/src/java/org/apache/solr/store/hdfs/HdfsLockFactory.java b/solr/core/src/java/org/apache/solr/store/hdfs/HdfsLockFactory.javaindex d403ca362e3..9020a9e12f4 100644--- a/solr/core/src/java/org/apache/solr/store/hdfs/HdfsLockFactory.java+++ b/solr/core/src/java/org/apache/solr/store/hdfs/HdfsLockFactory.java@@ -89,17 +89,17 @@ public class HdfsLockFactory extends LockFactory {}}- return new HdfsLock(fs, lockFile);+ return new HdfsLock(conf, lockFile);}private static final class HdfsLock extends Lock {-- private final FileSystem fs;++ private final Configuration conf;private final Path lockFile;private volatile boolean closed;- HdfsLock(FileSystem fs, Path lockFile) {- this.fs = fs;+ HdfsLock(Configuration conf, Path lockFile) {+ this.conf = conf;this.lockFile = lockFile;}@@ -108,6 +108,7 @@ public class HdfsLockFactory extends LockFactory {if (closed) {return;}+ final FileSystem fs = FileSystem.get(lockFile.toUri(), conf);try {if (fs.exists(lockFile) && !fs.delete(lockFile, false)) {throw new LockReleaseFailedException("failed to delete: " + lockFile);