Package org.apache.solr.update
Class DirectUpdateHandler2
- java.lang.Object
-
- org.apache.solr.update.UpdateHandler
-
- org.apache.solr.update.DirectUpdateHandler2
-
- All Implemented Interfaces:
AutoCloseable,SolrInfoBean,SolrMetricProducer,SolrCoreState.IndexWriterCloser
public class DirectUpdateHandler2 extends UpdateHandler implements SolrCoreState.IndexWriterCloser, SolrMetricProducer
DirectUpdateHandler2implements an UpdateHandler where documents are added directly to the main Lucene index as opposed to adding to a separate smaller index.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoBean
SolrInfoBean.Category, SolrInfoBean.Group
-
-
Field Summary
Fields Modifier and Type Field Description protected CommitTrackercommitTrackerprotected booleancommitWithinSoftCommitprotected booleanindexWriterCloseWaitsForMergesprotected CommitTrackersoftCommitTrackerprotected SolrCoreStatesolrCoreState-
Fields inherited from class org.apache.solr.update.UpdateHandler
commitCallbacks, core, idField, idFieldType, metricNames, optimizeCallbacks, softCommitCallbacks, ulog
-
-
Constructor Summary
Constructors Constructor Description DirectUpdateHandler2(SolrCore core)DirectUpdateHandler2(SolrCore core, UpdateHandler updateHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intaddDoc(AddUpdateCommand cmd)voidclearIndex()voidclose()Implementations should always callSolrMetricProducer.super.close()to ensure that metrics with the same life-cycle as this component are properly unregistered.voidcloseWriter(org.apache.lucene.index.IndexWriter writer)voidcommit(CommitUpdateCommand cmd)voiddelete(DeleteUpdateCommand cmd)voiddeleteByQuery(DeleteUpdateCommand cmd)CommitTrackergetCommitTracker()StringgetDescription()Simple one or two line descriptionStringgetName()Simple common usage name, e.g.CommitTrackergetSoftCommitTracker()SolrCoreStategetSolrCoreState()SolrMetricsContextgetSolrMetricsContext()Implementing classes should override this method to provide the context obtained inSolrMetricProducer.initializeMetrics(SolrMetricsContext, String)to ensure proper cleanup of metrics at the end of the life-cycle of this component.UpdateLoggetUpdateLog()voidinitializeMetrics(SolrMetricsContext parentContext, String scope)Initialize metrics specific to this producer.intmergeIndexes(MergeIndexesCommand cmd)voidnewIndexWriter(boolean rollback)Called when the Writer should be opened again - eg when replication replaces all of the index files.voidprepareCommit(CommitUpdateCommand cmd)voidrollback(RollbackUpdateCommand cmd)protected voidrollbackWriter()voidsplit(SplitIndexCommand cmd)-
Methods inherited from class org.apache.solr.update.UpdateHandler
callPostCommitCallbacks, callPostOptimizeCallbacks, callPostSoftCommitCallbacks, getCategory, getMetricNames, informEventListeners, registerCommitCallback, registerOptimizeCallback, registerSoftCommitCallback
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.solr.core.SolrInfoBean
getMetricRegistry, getMetricsSnapshot, registerMetricName
-
Methods inherited from interface org.apache.solr.metrics.SolrMetricProducer
initializeMetrics
-
-
-
-
Field Detail
-
solrCoreState
protected final SolrCoreState solrCoreState
-
commitTracker
protected final CommitTracker commitTracker
-
softCommitTracker
protected final CommitTracker softCommitTracker
-
commitWithinSoftCommit
protected boolean commitWithinSoftCommit
-
indexWriterCloseWaitsForMerges
protected boolean indexWriterCloseWaitsForMerges
-
-
Constructor Detail
-
DirectUpdateHandler2
public DirectUpdateHandler2(SolrCore core)
-
DirectUpdateHandler2
public DirectUpdateHandler2(SolrCore core, UpdateHandler updateHandler)
-
-
Method Detail
-
getSolrMetricsContext
public SolrMetricsContext getSolrMetricsContext()
Description copied from interface:SolrMetricProducerImplementing classes should override this method to provide the context obtained inSolrMetricProducer.initializeMetrics(SolrMetricsContext, String)to ensure proper cleanup of metrics at the end of the life-cycle of this component.- Specified by:
getSolrMetricsContextin interfaceSolrMetricProducer
-
initializeMetrics
public void initializeMetrics(SolrMetricsContext parentContext, String scope)
Description copied from interface:SolrMetricProducerInitialize metrics specific to this producer.- Specified by:
initializeMetricsin interfaceSolrMetricProducer- Parameters:
parentContext- 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 usingSolrMetricsContext.getChildContext(Object)passingthisas the child.scope- component scope
-
rollbackWriter
protected void rollbackWriter() throws IOException- Throws:
IOException
-
addDoc
public int addDoc(AddUpdateCommand cmd) throws IOException
- Specified by:
addDocin classUpdateHandler- Throws:
IOException
-
delete
public void delete(DeleteUpdateCommand cmd) throws IOException
- Specified by:
deletein classUpdateHandler- Throws:
IOException
-
clearIndex
public void clearIndex() throws IOException- Throws:
IOException
-
deleteByQuery
public void deleteByQuery(DeleteUpdateCommand cmd) throws IOException
- Specified by:
deleteByQueryin classUpdateHandler- Throws:
IOException
-
mergeIndexes
public int mergeIndexes(MergeIndexesCommand cmd) throws IOException
- Specified by:
mergeIndexesin classUpdateHandler- Throws:
IOException
-
prepareCommit
public void prepareCommit(CommitUpdateCommand cmd) throws IOException
- Throws:
IOException
-
commit
public void commit(CommitUpdateCommand cmd) throws IOException
- Specified by:
commitin classUpdateHandler- Throws:
IOException
-
newIndexWriter
public void newIndexWriter(boolean rollback) throws IOExceptionDescription copied from class:UpdateHandlerCalled when the Writer should be opened again - eg when replication replaces all of the index files.- Specified by:
newIndexWriterin classUpdateHandler- Parameters:
rollback- IndexWriter if true else close- Throws:
IOException- If there is a low-level I/O error.
-
rollback
public void rollback(RollbackUpdateCommand cmd) throws IOException
- Specified by:
rollbackin classUpdateHandler- Throws:
IOException- Since:
- Solr 1.4
-
getUpdateLog
public UpdateLog getUpdateLog()
- Specified by:
getUpdateLogin classUpdateHandler
-
close
public void close() throws IOExceptionDescription copied from interface:SolrMetricProducerImplementations should always callSolrMetricProducer.super.close()to ensure that metrics with the same life-cycle as this component are properly unregistered. This prevents obscure memory leaks.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSolrMetricProducer- Specified by:
closein classUpdateHandler- Throws:
IOException
-
closeWriter
public void closeWriter(org.apache.lucene.index.IndexWriter writer) throws IOException- Specified by:
closeWriterin interfaceSolrCoreState.IndexWriterCloser- Throws:
IOException
-
split
public void split(SplitIndexCommand cmd) throws IOException
- Specified by:
splitin classUpdateHandler- Throws:
IOException
-
getName
public String getName()
Description copied from interface:SolrInfoBeanSimple common usage name, e.g. BasicQueryHandler, or fully qualified class name.- Specified by:
getNamein interfaceSolrInfoBean
-
getDescription
public String getDescription()
Description copied from interface:SolrInfoBeanSimple one or two line description- Specified by:
getDescriptionin interfaceSolrInfoBean
-
getSolrCoreState
public SolrCoreState getSolrCoreState()
- Specified by:
getSolrCoreStatein classUpdateHandler
-
getCommitTracker
public CommitTracker getCommitTracker()
-
getSoftCommitTracker
public CommitTracker getSoftCommitTracker()
-
-