Search code examples
solrcommitdataimporthandler

Difference between updatehandler commit and dataimporthandler commit in solr


I was trying to debug some code in Solr, and just got curious to understand the difference between two:

UpdateRequestHandler extends ContentStreamHandlerBase extends RequestHandlerBase,

and hence UpdateRequestHandler use RequestHandlerBase.handleCommit when commit=true.

But I could not figure which method does DataImportHandler call when commit=true.


Solution

  • The DataImportHandler performs the commit at line 308 - 313 (for 4.8.1 at least) in org.apache.solr.handler.dataimport.DocBuilder. This calls, depending on the implementation, commit on org.apache.solr.handler.dataimport.SolrWriter, which in turn creates an instance of org.apache.solr.update.CommitUpdateCommand that's sent into org.apache.solr.update.processor.UpdateRequestProcessor.

    So the flow is:

    DataImportHandler
      DocBuilder
        SolrWriter
          CommitUpdateCommand
          UpdateRequestProcessor