public class DirectUpdateHandler2 extends UpdateHandler implements SolrCoreState.IndexWriterCloser, SolrMetricProducer
DirectUpdateHandler2 implements an UpdateHandler where documents are added
directly to the main Lucene index as opposed to adding to a separate smaller index.SolrInfoBean.Category, SolrInfoBean.Group| Modifier and Type | Field and Description |
|---|---|
protected CommitTracker |
commitTracker |
protected boolean |
commitWithinSoftCommit |
protected boolean |
indexWriterCloseWaitsForMerges |
protected CommitTracker |
softCommitTracker |
protected SolrCoreState |
solrCoreState |
commitCallbacks, core, idField, idFieldType, metricNames, optimizeCallbacks, softCommitCallbacks, ulog| Constructor and Description |
|---|
DirectUpdateHandler2(SolrCore core) |
DirectUpdateHandler2(SolrCore core,
UpdateHandler updateHandler) |
| Modifier and Type | Method and Description |
|---|---|
int |
addDoc(AddUpdateCommand cmd) |
void |
clearIndex() |
void |
close()
Implementations should always call
SolrMetricProducer.super.close() to ensure that
metrics with the same life-cycle as this component are properly unregistered. |
void |
closeWriter(IndexWriter writer) |
void |
commit(CommitUpdateCommand cmd) |
void |
delete(DeleteUpdateCommand cmd) |
void |
deleteByQuery(DeleteUpdateCommand cmd) |
CommitTracker |
getCommitTracker() |
String |
getDescription()
Simple one or two line description
|
String |
getName()
Simple common usage name, e.g.
|
CommitTracker |
getSoftCommitTracker() |
SolrCoreState |
getSolrCoreState() |
SolrMetricsContext |
getSolrMetricsContext()
Implementing classes should override this method to provide the context obtained in
SolrMetricProducer.initializeMetrics(SolrMetricsContext, String) to ensure proper cleanup of metrics
at the end of the life-cycle of this component. |
UpdateLog |
getUpdateLog() |
void |
initializeMetrics(SolrMetricsContext parentContext,
String scope)
Initialize metrics specific to this producer.
|
int |
mergeIndexes(MergeIndexesCommand cmd) |
void |
newIndexWriter(boolean rollback)
Called when the Writer should be opened again - eg when replication replaces
all of the index files.
|
void |
prepareCommit(CommitUpdateCommand cmd) |
void |
rollback(RollbackUpdateCommand cmd) |
protected void |
rollbackWriter() |
void |
split(SplitIndexCommand cmd) |
callPostCommitCallbacks, callPostOptimizeCallbacks, callPostSoftCommitCallbacks, getCategory, getMetricNames, informEventListeners, registerCommitCallback, registerOptimizeCallback, registerSoftCommitCallbackclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetUniqueMetricTag, initializeMetricsgetMetricRegistry, getMetricsSnapshot, registerMetricNameprotected final SolrCoreState solrCoreState
protected final CommitTracker commitTracker
protected final CommitTracker softCommitTracker
protected boolean commitWithinSoftCommit
protected boolean indexWriterCloseWaitsForMerges
public DirectUpdateHandler2(SolrCore core)
public DirectUpdateHandler2(SolrCore core, UpdateHandler updateHandler)
public SolrMetricsContext getSolrMetricsContext()
SolrMetricProducerSolrMetricProducer.initializeMetrics(SolrMetricsContext, String) to ensure proper cleanup of metrics
at the end of the life-cycle of this component.getSolrMetricsContext in interface SolrMetricProducerpublic void initializeMetrics(SolrMetricsContext parentContext, String scope)
SolrMetricProducerinitializeMetrics in interface SolrMetricProducerparentContext - parent metrics context. If this component has the same life-cycle as the parent
it can simply use the parent context, otherwise it should obtain a child context
using SolrMetricsContext.getChildContext(Object) passing this
as the child.scope - component scopeprotected void rollbackWriter()
throws IOException
IOExceptionpublic int addDoc(AddUpdateCommand cmd) throws IOException
addDoc in class UpdateHandlerIOExceptionpublic void delete(DeleteUpdateCommand cmd) throws IOException
delete in class UpdateHandlerIOExceptionpublic void clearIndex()
throws IOException
IOExceptionpublic void deleteByQuery(DeleteUpdateCommand cmd) throws IOException
deleteByQuery in class UpdateHandlerIOExceptionpublic int mergeIndexes(MergeIndexesCommand cmd) throws IOException
mergeIndexes in class UpdateHandlerIOExceptionpublic void prepareCommit(CommitUpdateCommand cmd) throws IOException
IOExceptionpublic void commit(CommitUpdateCommand cmd) throws IOException
commit in class UpdateHandlerIOExceptionpublic void newIndexWriter(boolean rollback)
throws IOException
UpdateHandlernewIndexWriter in class UpdateHandlerrollback - IndexWriter if true else closeIOException - If there is a low-level I/O error.public void rollback(RollbackUpdateCommand cmd) throws IOException
rollback in class UpdateHandlerIOExceptionpublic UpdateLog getUpdateLog()
getUpdateLog in class UpdateHandlerpublic void close()
throws IOException
SolrMetricProducerSolrMetricProducer.super.close() to ensure that
metrics with the same life-cycle as this component are properly unregistered. This prevents
obscure memory leaks.
from: https://docs.oracle.com/javase/8/docs/api/java/lang/AutoCloseable.html
While this interface method is declared to throw Exception, implementers are strongly encouraged
to declare concrete implementations of the close method to throw more specific exceptions, or to
throw no exception at all if the close operation cannot fail.close in interface AutoCloseableclose in interface SolrMetricProducerclose in class UpdateHandlerIOExceptionpublic void closeWriter(IndexWriter writer) throws IOException
closeWriter in interface SolrCoreState.IndexWriterCloserIOExceptionpublic void split(SplitIndexCommand cmd) throws IOException
split in class UpdateHandlerIOExceptionpublic String getName()
SolrInfoBeangetName in interface SolrInfoBeanpublic String getDescription()
SolrInfoBeangetDescription in interface SolrInfoBeanpublic SolrCoreState getSolrCoreState()
getSolrCoreState in class UpdateHandlerpublic CommitTracker getCommitTracker()
public CommitTracker getSoftCommitTracker()
Copyright © 2000-2020 Apache Software Foundation. All Rights Reserved.