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
DirectUpdateHandler2 implements 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
FieldsModifier and TypeFieldDescriptionprotected final CommitTrackerprotected booleanprotected final CommitTrackerprotected final SolrCoreStateFields inherited from class org.apache.solr.update.UpdateHandler
commitCallbacks, core, idField, idFieldType, optimizeCallbacks, softCommitCallbacks, solrMetricsContext, ulogFields inherited from interface org.apache.solr.metrics.SolrMetricProducer
CATEGORY_ATTR, HANDLER_ATTR, NAME_ATTR, OPERATION_ATTR, PLUGIN_NAME_ATTR, RESULT_ATTR, TYPE_ATTR -
Constructor Summary
ConstructorsConstructorDescriptionDirectUpdateHandler2(SolrCore core) DirectUpdateHandler2(SolrCore core, UpdateHandler updateHandler) -
Method Summary
Modifier and TypeMethodDescriptionintaddDoc(AddUpdateCommand cmd) voidvoidclose()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) voidvoidvoidSimple one or two line descriptiongetName()Simple common usage name, e.g.voidinitializeMetrics(SolrMetricsContext parentContext, io.opentelemetry.api.common.Attributes attributes) Implementation should initialize all metrics to aSolrMetricsContextRegistry/MeterProvider withAttributesas the common set of attributes that will be attached to every metric that is initialized for that class/componentintvoidnewIndexWriter(boolean rollback) Called when the Writer should be opened again - eg when replication replaces all of the index files.voidvoidprotected voidprotected booleanshouldCommit(CommitUpdateCommand cmd, org.apache.lucene.index.IndexWriter writer) Determines whether the commit command should effectively trigger a commit on the index writer.voidsplit(SplitIndexCommand cmd) Methods inherited from class org.apache.solr.update.UpdateHandler
callPostCommitCallbacks, callPostOptimizeCallbacks, callPostSoftCommitCallbacks, getCategory, getSolrMetricsContext, informEventListeners, initUlog, registerCommitCallback, registerOptimizeCallback, registerSoftCommitCallbackMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.solr.metrics.SolrMetricProducer
getSolrMetricsContext
-
Field Details
-
solrCoreState
-
commitTracker
-
softCommitTracker
-
commitWithinSoftCommit
protected boolean commitWithinSoftCommit
-
-
Constructor Details
-
DirectUpdateHandler2
-
DirectUpdateHandler2
-
-
Method Details
-
initializeMetrics
public void initializeMetrics(SolrMetricsContext parentContext, io.opentelemetry.api.common.Attributes attributes) Description copied from interface:SolrMetricProducerImplementation should initialize all metrics to aSolrMetricsContextRegistry/MeterProvider withAttributesas the common set of attributes that will be attached to every metric that is initialized for that class/component- Specified by:
initializeMetricsin interfaceSolrMetricProducer- Parameters:
parentContext- The registry that the component will initialize metrics toattributes- Base set of attributes that will be bound to all metrics for that component
-
rollbackWriter
- Throws:
IOException
-
addDoc
- Specified by:
addDocin classUpdateHandler- Throws:
IOException
-
delete
- Specified by:
deletein classUpdateHandler- Throws:
IOException
-
clearIndex
- Throws:
IOException
-
deleteByQuery
- Specified by:
deleteByQueryin classUpdateHandler- Throws:
IOException
-
mergeIndexes
- Specified by:
mergeIndexesin classUpdateHandler- Throws:
IOException
-
prepareCommit
- Throws:
IOException
-
commit
- Specified by:
commitin classUpdateHandler- Throws:
IOException
-
shouldCommit
protected boolean shouldCommit(CommitUpdateCommand cmd, org.apache.lucene.index.IndexWriter writer) throws IOException Determines whether the commit command should effectively trigger a commit on the index writer. This method is called with the commit lock and is the last step before effectively callingIndexWriter.commit().- Throws:
IOException
-
newIndexWriter
Description 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
- Specified by:
rollbackin classUpdateHandler- Throws:
IOException- Since:
- Solr 1.4
-
getUpdateLog
- Specified by:
getUpdateLogin classUpdateHandler
-
close
Description 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.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.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceSolrMetricProducer- Throws:
IOException
-
closeWriter
- Specified by:
closeWriterin interfaceSolrCoreState.IndexWriterCloser- Throws:
IOException
-
split
- Specified by:
splitin classUpdateHandler- Throws:
IOException
-
getName
Description copied from interface:SolrInfoBeanSimple common usage name, e.g. BasicQueryHandler, or fully qualified class name.- Specified by:
getNamein interfaceSolrInfoBean
-
getDescription
Description copied from interface:SolrInfoBeanSimple one or two line description- Specified by:
getDescriptionin interfaceSolrInfoBean
-
getSolrCoreState
- Specified by:
getSolrCoreStatein classUpdateHandler
-
getCommitTracker
-
getSoftCommitTracker
-