mirror of https://github.com/apache/lucene.git
SOLR-8015: HdfsLock may fail to close a FileSystem instance if it cannot immediately obtain an index lock.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1720773 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a7569ce25b
commit
9794ec7705
|
@ -276,6 +276,8 @@ Bug Fixes
|
|||
* SOLR-8419: TermVectorComponent for distributed search when distrib.singlePass could include term
|
||||
vectors 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
|
||||
----------------------
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue