In Sitecore 10.1 (released in February 2021) was introduced a new functionality that will make indexing data to SolR to retry an operation if the first attempt to run the operation fails.
Makes sense to activate this functionality when there are network problems on your SolR setup or there are other kind of availability issues.
The setting for this functionality is located in
Sitecore.ContentSearch.Solr.DefaultIndexConfiguration.config in this section
<sitecore> <contentSearch> <indexConfigurations> <!- here --> </indexConfigurations> </contentSearch> </sitecore>
and the default option is
NoRetryRetryer that never retries. And is configured like this:
<solrRetryer type="Sitecore.ContentSearch.SolrProvider.Availability.Retryer.NoRetryRetryer, Sitecore.ContentSearch.SolrProvider" singleInstance="true" />
There are 2 other strategies that can be enabled:
FixedIntervalsRetryer: this strategy retries in fixed intervals that you specify.
For example, with the following configuration, Solr retries three times (in addition to the first try). The first attempt is after one second, the second attempt after two seconds, and the third attempt after three seconds:
<solrRetryer type="Sitecore.ContentSearch.SolrProvider.Availability.Retryer.FixedIntervalsRetryer, Sitecore.ContentSearch.SolrProvider" singleInstance="true" > <sleepDurations hint="list:AddSleepDuration"> <interval>00:00:01</interval> <interval>00:00:02</interval> <interval>00:00:03</interval> </sleepDurations> </solrRetryer>
ExponentialRetryer: this strategy retries using an exponential backoff algorithm. You enable and configure the strategy this way:
<solrRetryer type="Sitecore.ContentSearch.SolrProvider.Availability.Retryer.ExponentialRetryer, Sitecore.ContentSearch.SolrProvider" singleInstance="true"> <param desc="retryCount">3</param> <param desc="deltaBackoff">00:00:01</param> <param desc="maxBackoff">00:00:05</param> <param desc="minBackoff">00:00:01</param> </solrRetryer>
Indeed you can create a custom retryer and customize it, as you probably deduced that:
- Create a class that inherits the
- Implement the methods you need.
- Enable the custom retryer in the
solrRetryersection of the
PS: The official documentation is here: https://doc.sitecore.com/en/developers/101/platform-administration-and-architecture/configure-the-solr-retry-strategy.html