SOLR-4624: remove leftover forceNew params.

SOLR-4626: getIndexWriter(null) should also respect pauseWriter.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1459570 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mark Robert Miller 2013-03-21 23:03:21 +00:00
parent 5b3cdaca44
commit f6fa8c215d
7 changed files with 20 additions and 18 deletions

View File

@ -219,6 +219,8 @@ Bug Fixes
longer and it appears to be causing a missing close directory bug. forceNew
is no longer respected and will be removed in 4.3. (Mark Miller)
* SOLR-4626: getIndexWriter(null) should also respect pauseWriter. (Mark Miller)
Optimizations
----------------------

View File

@ -409,7 +409,7 @@ public final class SolrCore implements SolrInfoMBean {
schema, coreDescriptor, updateHandler, this.solrDelPolicy, prev);
core.solrDelPolicy = this.solrDelPolicy;
core.getUpdateHandler().getSolrCoreState().newIndexWriter(core, false, false);
core.getUpdateHandler().getSolrCoreState().newIndexWriter(core, false);
core.getSearcher(true, false, null, true);

View File

@ -642,7 +642,7 @@ public class SnapPuller {
SolrQueryRequest req = new LocalSolrQueryRequest(solrCore,
new ModifiableSolrParams());
// reboot the writer on the new index and get a new searcher
solrCore.getUpdateHandler().newIndexWriter(isFullCopyNeeded, false);
solrCore.getUpdateHandler().newIndexWriter(isFullCopyNeeded);
RefCounted<SolrIndexSearcher> searcher = null;
IndexCommit commitPoint;

View File

@ -72,6 +72,7 @@ public final class DefaultSolrCoreState extends SolrCoreState implements Recover
log.info("closing IndexWriter...");
indexWriter.close();
}
indexWriter = null;
} catch (Throwable t) {
log.error("Error during shutdown of writer.", t);
}
@ -86,13 +87,7 @@ public final class DefaultSolrCoreState extends SolrCoreState implements Recover
}
synchronized (writerPauseLock) {
if (core == null) {
// core == null is a signal to just return the current writer, or null
// if none.
if (refCntWriter != null) refCntWriter.incref();
return refCntWriter;
}
while (pauseWriter) {
try {
writerPauseLock.wait(100);
@ -103,6 +98,14 @@ public final class DefaultSolrCoreState extends SolrCoreState implements Recover
}
}
if (core == null) {
// core == null is a signal to just return the current writer, or null
// if none.
if (refCntWriter != null) refCntWriter.incref();
return refCntWriter;
}
if (indexWriter == null) {
indexWriter = createMainIndexWriter(core, "DirectUpdateHandler2");
}
@ -129,7 +132,7 @@ public final class DefaultSolrCoreState extends SolrCoreState implements Recover
}
@Override
public synchronized void newIndexWriter(SolrCore core, boolean rollback, boolean forceNewDir) throws IOException {
public synchronized void newIndexWriter(SolrCore core, boolean rollback) throws IOException {
if (closed) {
throw new AlreadyClosedException("SolrCoreState already closed");
}
@ -186,7 +189,7 @@ public final class DefaultSolrCoreState extends SolrCoreState implements Recover
@Override
public synchronized void rollbackIndexWriter(SolrCore core) throws IOException {
newIndexWriter(core, true, false);
newIndexWriter(core, true);
}
protected SolrIndexWriter createMainIndexWriter(SolrCore core, String name) throws IOException {

View File

@ -611,8 +611,8 @@ public class DirectUpdateHandler2 extends UpdateHandler implements SolrCoreState
}
@Override
public void newIndexWriter(boolean rollback, boolean forceNewDir) throws IOException {
solrCoreState.newIndexWriter(core, rollback, forceNewDir);
public void newIndexWriter(boolean rollback) throws IOException {
solrCoreState.newIndexWriter(core, rollback);
}
/**

View File

@ -86,7 +86,7 @@ public abstract class SolrCoreState {
* @param rollback close IndexWriter if false, else rollback
* @throws IOException If there is a low-level I/O error.
*/
public abstract void newIndexWriter(SolrCore core, boolean rollback, boolean forceNewDir) throws IOException;
public abstract void newIndexWriter(SolrCore core, boolean rollback) throws IOException;
/**
* Get the current IndexWriter. If a new IndexWriter must be created, use the

View File

@ -22,8 +22,6 @@ import java.io.File;
import java.io.IOException;
import java.util.Vector;
import org.apache.solr.common.SolrException;
import org.apache.solr.common.SolrException.ErrorCode;
import org.apache.solr.core.PluginInfo;
import org.apache.solr.core.SolrCore;
import org.apache.solr.core.SolrEventListener;
@ -147,11 +145,10 @@ public abstract class UpdateHandler implements SolrInfoMBean {
* all of the index files.
*
* @param rollback IndexWriter if true else close
* @param forceNewDir Force a new Directory instance
*
* @throws IOException If there is a low-level I/O error.
*/
public abstract void newIndexWriter(boolean rollback, boolean forceNewDir) throws IOException;
public abstract void newIndexWriter(boolean rollback) throws IOException;
public abstract SolrCoreState getSolrCoreState();