SOLR-1184: Add option to not reopen readers

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@781716 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2009-06-04 12:17:31 +00:00
parent b007152303
commit 0334f5e447
4 changed files with 13 additions and 2 deletions

View File

@ -491,6 +491,10 @@ Other Changes
36. SOLR-458: Add equals and hashCode methods to NamedList (Stefan Rinner, shalin)
37. SOLR-1184: Add option in solrconfig to open a new IndexReader rather than
using reopen. Done mainly as a fail-safe in the case that a user runs into
a reopen bug/issue. (Mark Miller)
Build
----------------------
1. SOLR-776: Added in ability to sign artifacts via Ant for releases (gsingers)

View File

@ -114,6 +114,11 @@
-->
<unlockOnStartup>false</unlockOnStartup>
<!-- If true, IndexReaders will be reopened (often more efficient) instead
of closed and then opened.
-->
<reopenReaders>true</reopenReaders>
<!--
Custom deletion policies can specified here. The class must
implement org.apache.lucene.index.IndexDeletionPolicy.

View File

@ -116,6 +116,7 @@ public class SolrConfig extends Config {
super(loader, name, is, "/config/");
defaultIndexConfig = new SolrIndexConfig(this, null, null);
mainIndexConfig = new SolrIndexConfig(this, "mainIndex", defaultIndexConfig);
reopenReaders = getBool("mainIndex/reopenReaders", true);
booleanQueryMaxClauseCount = getInt("query/maxBooleanClauses", BooleanQuery.getMaxClauseCount());
filtOptEnabled = getBool("query/boolTofilterOptimizer/@enabled", false);
@ -188,6 +189,7 @@ public class SolrConfig extends Config {
public final int queryResultWindowSize;
public final int queryResultMaxDocsCached;
public final boolean enableLazyFieldLoading;
public final boolean reopenReaders;
// DocSet
public final float hashSetInverseLoadFactor;
public final int hashDocSetMaxSize;

View File

@ -1055,7 +1055,7 @@ public final class SolrCore implements SolrInfoMBean {
String newIndexDir = getNewIndexDir();
if (newestSearcher != null) {
IndexReader currentReader = newestSearcher.get().getReader();
if(new File(getIndexDir()).getCanonicalFile().equals(new File(newIndexDir).getCanonicalFile())) {
if(solrConfig.reopenReaders && new File(getIndexDir()).getCanonicalFile().equals(new File(newIndexDir).getCanonicalFile())) {
IndexReader newReader = currentReader.reopen();
if(newReader == currentReader) {