mirror of https://github.com/apache/lucene.git
SOLR-730: use read-only IndexReaders
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@689514 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
c22010a1c3
commit
82c3334f9f
|
@ -399,6 +399,11 @@ Optimizations
|
|||
9. SOLR-587: Delete by Query performance greatly improved by using
|
||||
new underlying Lucene IndexWriter implementation. (yonik)
|
||||
|
||||
10. SOLR-730: Use read-only IndexReaders that don't synchronize
|
||||
isDeleted(). This will speed up function queries and *:* queries
|
||||
as well as improve their scalability on multi-CPU systems.
|
||||
(Mark Miller via yonik)
|
||||
|
||||
Bug Fixes
|
||||
1. Make TextField respect sortMissingFirst and sortMissingLast fields.
|
||||
(J.J. Larrea via yonik)
|
||||
|
|
|
@ -260,7 +260,12 @@ public final class SolrCore implements SolrInfoMBean {
|
|||
|
||||
// gets a non-caching searcher
|
||||
public SolrIndexSearcher newSearcher(String name) throws IOException {
|
||||
return new SolrIndexSearcher(this, schema, name,getIndexDir(),false);
|
||||
return newSearcher(name, false);
|
||||
}
|
||||
|
||||
// gets a non-caching searcher
|
||||
public SolrIndexSearcher newSearcher(String name, boolean readOnly) throws IOException {
|
||||
return new SolrIndexSearcher(this, schema, "main", IndexReader.open(FSDirectory.getDirectory(getIndexDir()), readOnly), true, false);
|
||||
}
|
||||
|
||||
|
||||
|
@ -852,6 +857,10 @@ public final class SolrCore implements SolrInfoMBean {
|
|||
* be registered before running the event handlers (a slow searcher is better than no searcher).
|
||||
*
|
||||
* <p>
|
||||
* These searchers contain read-only IndexReaders. To access a non read-only IndexReader,
|
||||
* see newSearcher(String name, boolean readOnly).
|
||||
*
|
||||
* <p>
|
||||
* If <tt>forceNew==true</tt> then
|
||||
* A new searcher will be opened and registered regardless of whether there is already
|
||||
* a registered searcher or other searchers in the process of being created.
|
||||
|
@ -935,7 +944,7 @@ public final class SolrCore implements SolrInfoMBean {
|
|||
// if this fails, we need to decrement onDeckSearchers again.
|
||||
SolrIndexSearcher tmp;
|
||||
try {
|
||||
tmp = new SolrIndexSearcher(this, schema, "main", getIndexDir(), true);
|
||||
tmp = new SolrIndexSearcher(this, schema, "main", IndexReader.open(FSDirectory.getDirectory(getIndexDir()), true), true, true);
|
||||
} catch (Throwable th) {
|
||||
synchronized(searcherLock) {
|
||||
onDeckSearchers--;
|
||||
|
|
|
@ -104,7 +104,7 @@ public class SolrIndexSearcher extends Searcher implements SolrInfoMBean {
|
|||
this(core, schema,name,r, false, enableCache);
|
||||
}
|
||||
|
||||
private SolrIndexSearcher(SolrCore core, IndexSchema schema, String name, IndexReader r, boolean closeReader, boolean enableCache) {
|
||||
public SolrIndexSearcher(SolrCore core, IndexSchema schema, String name, IndexReader r, boolean closeReader, boolean enableCache) {
|
||||
this.core = core;
|
||||
this.schema = schema;
|
||||
this.name = "Searcher@" + Integer.toHexString(hashCode()) + (name!=null ? " "+name : "");
|
||||
|
|
Loading…
Reference in New Issue