confusing code..., but we can't release the searcher in a get result case
we need that searcher later on..., need to think of how to simplify that..., added a comment for now
This commit is contained in:
parent
36ffd6d582
commit
815917fbf8
|
@ -333,15 +333,17 @@ public class RobinEngine extends AbstractIndexShardComponent implements Engine {
|
||||||
AtomicReaderContext readerContext = readers.get(i);
|
AtomicReaderContext readerContext = readers.get(i);
|
||||||
UidField.DocIdAndVersion docIdAndVersion = UidField.loadDocIdAndVersion(readerContext, get.uid());
|
UidField.DocIdAndVersion docIdAndVersion = UidField.loadDocIdAndVersion(readerContext, get.uid());
|
||||||
if (docIdAndVersion != null && docIdAndVersion.docId != Lucene.NO_DOC) {
|
if (docIdAndVersion != null && docIdAndVersion.docId != Lucene.NO_DOC) {
|
||||||
|
// note, we don't release the searcher here, since it will be released as part of the external
|
||||||
|
// API usage, since it still needs it to load data...
|
||||||
return new GetResult(searcher, docIdAndVersion);
|
return new GetResult(searcher, docIdAndVersion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
searcher.release();
|
||||||
//TODO: A better exception goes here
|
//TODO: A better exception goes here
|
||||||
throw new EngineException(shardId(), "failed to load document", e);
|
throw new EngineException(shardId(), "failed to load document", e);
|
||||||
} finally {
|
|
||||||
searcher.release();
|
|
||||||
}
|
}
|
||||||
|
searcher.release();
|
||||||
return GetResult.NOT_EXISTS;
|
return GetResult.NOT_EXISTS;
|
||||||
} finally {
|
} finally {
|
||||||
rwl.readLock().unlock();
|
rwl.readLock().unlock();
|
||||||
|
|
Loading…
Reference in New Issue