3

We are using Azure Search for a custom index and I have SwitchOnRebuild enabled in my config patch.

  <!--  USE SWITCHONREBUILD
        Determines if Azure Search provider uses SwitchOnRebuild() function to avoid Search functionality downtime during index rebuild.
        Each time you do a full index rebuild, this rebuild take place in the secondary index.
        The secondary index becomes the primary one after the rebuild

        Default value: true
  -->
  <setting name="ContentSearch.Azure.SwitchOnRebuild" value="true"/>

This all seems to work quite well. As I understand it (and can see in the Azure Search Service) an second index is created with the suffix: '_secondary' at the point of rebuilding and is switched to the primary index once the rebuild is complete and the old index is deleted.

I'm wondering where Sitecore stores the name of the current/primary index in use and if this is accessible in some way?

It would be good to understand more about how the Azure Search provider is switched on each role in Azure also as there doesn't seem to be much info on this.

2 Answers 2

3

You should check https://sitecore.stackexchange.com/a/16325/237

SwitchOnRebuild was introduced for Azure Search in Sitecore 9.0.2 and 8.2.7

As from that version, Sitecore has this feature, and it is turned on by default. To know which actual index to use, Sitecore keeps data in the Properties table of the Core database. After an index is rebuild, the apps change their value and switch indexes.

In that SSE question mentioned above, I noticed issues with the 9.0.2 version that should be fixed in 9.1.

4
  • Thanks for letting me know where this is stored. It should be noted however that this is supported in 8.2 update 7 as well (which is the version we are using): doc.sitecore.com/developers/91/… Commented Feb 6, 2019 at 18:48
  • Indeed, I just saw in the release notes that it was also introduced in that version. If you have a staging slot, I would test if you are facing the same bug as 9.0.1.. might be the case.
    – Gatogordo
    Commented Feb 6, 2019 at 18:59
  • Hi In this regard we have a different issue here. In our project, we are using Azure function to get data from Azure indexes to populate it to external third parties like Mobile APP, etc. Now the problem lies within disconnected mode i.e the Azure function APP is unaware that a full index has happened and the index name are changed. Hence, it results in an error. what should be the right way to fix this? Please note we know that GraphQL is an option but looking toward the complexity asked in the project, we want to use azure function to search Azure Search Indexes. any suggestions Commented Nov 4, 2019 at 16:41
  • I would create a new question for this ;)
    – Gatogordo
    Commented Nov 4, 2019 at 17:10
0

I've now blogged about this here: http://www.flux-digital.com/blog/azure-switch-rebuild-bug-index-name-not-always-updating-cd-servers/

In summary...

Sitecore Support confirmed this is an bug with Sitecore XP 8.2 rev. 180406 (Update-7) – bug report #254072 and provide a hotfix: SC Hotfix-294596. This is also an issue in 9.0.2 and likely any version below 9.1, this is resolved in Sitecore 9.1 Initial release.

Prior to the hotfix Sitecore stores a reference to the Primary index name (the one in use) in the properties table of the Core database. This is where the issue was as CD servers were not getting the updated index name correctly, only CA was.

After applying the hotfix, Instead of being stored in the properties table of the Core database these values are now stored in their own Azure Index called index-catalog. This means both CA and CD servers get the correct names for the index.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.