Skip to content
November 10, 2013 / kiranpatils

Sitecore Link Database Basics


We are facing one challenge with link database, The behavior is as following:

  1. At times our content authors reported that, few renderings stopped working. After doing investigation we found that they have deleted Items — which they have assigned to a page in fields. But when they recycled/delete item — they didn’t get any broken link pop up and they confidently deleted items.  But due to such behavior, they can’t say confidently whether there is any broken link [Whether current page is linked somewhere or not] and that decreased reliability of recycle/delete functionality.
  2. It decreases reliability of recycle/delete functionality, and takes the lot of human hours to find out, whether this page got any references or not
  3. No, at this point of time, we don’t have steps to reproduce this issue. We faced this issue for one section [bunch of items] on our CM Environment. To reproduce this scenario, what we did is created package from CM Environment and installed it in our local environment. And here it was working fine. Means links were perfect! [As far as I can think of a reason behind this is — When we install package — SC must be rebuilding link database]

You are also facing similar challenge?

We raised this issue with Sitecore support guys, And as always they have been helpful for us to dig more in this issue. We’ve not been able to find the solution yet. But during discussion we understood Links Database Basics and found few behaviors, Which has not been documented anywhere. And I believe It will be a good to know for you as well!

In summary, This post will cover following topics:

  1. Basics of Sitecore Links Database — How it works?
  2. Few tips and tricks related to links database.

So, here we go!


This is what we checked during this whole ticket:

  1. Checked CustomFields configuration :When Sitecore updates links for the item, it’s expecting that field type is derived from Sitecore.Data.Fields.CustomField.
    Sitecore searches field type by name in the /App_Config/FieldTypes.config and try to cast this type to CustomField and use some methods from this class (links update logic). I would suggest the following solution for your issue:
    1. Add the following field type to FieldTypes.config:
    <fieldType name=”SiteSubtree” type=”Sitecore.Data.Fields.MultilistField,Sitecore.Kernel” />
    2. Rebuild Links database (it’s important!)
    This approach is working properly on my side. Please not that all your overriden SiteSubtree methods will be used in this  case, not the MultilistField ones.

    We verified it, And it was already as per standards in our case.

  2. Do Rebuild link database — Unfortunately this is also not an option for us, because our DB size is huge and rebuild link DB will take the lot of time, which will need an outage.
  3. So, If you can’t rebuild entire link database now, You can suggest you to use the following code to rebuild only necessary items which can be affected by this problem (where mentioned fields is used): Globals.LinkDatabase.UpdateReferences(item)
  4. We checked all above options. And nothing was fitting in our need. So, as per basics concept, We stepped back and asked SC Support guys “How Links Database works?“, and they explained it very nicely:
    1. Generally, links in Link Database are updated using Sitecore.Links.ItemEventHandler class. There are 3 events that are
      handled by Sitecore.Links.ItemEventHandler: item:deleted (OnItemDeleted method), item:saved (OnItemSaved method), item:versionRemoved (OnVersionRemoved method)
    2. When you delete an item, Broken Links validation is running before the item is deleted, it allows you to decide what you
      will do with broken links. This validation is run as a processor in the <uiDeleteItems> pipeline, please see the processor
      definition in your web.config: <processor mode=”on” type=”Sitecore.Shell.Framework.Pipelines.DeleteItems,Sitecore.Kernel” method=”CheckLinks” />
  5. Following are the few scenarios In which case such issue can occur:
    1. Using of the custom code that stop the link database from updating: Sitecore.Links.LinkDisabler(){….}
    2. Synchronizing of Link Database on your scaling environment has not been configured properly. You can read about this in the following article: (Chapter 3.6.1)
    3. Following custom code can disable invoking of events : using (new Sitecore.Data.Events.EventDisabler()){…..}
    4. item.Editing.EndEdit(true, true) method. A new link won’t be added to the LinkDatabase if the corresponding multilist field (for example) will be updated in the ‘silent’ mode. And therefore the ‘Broken link’ dialog won’t work for this link.

We are still working on to find the root cause of this issue (Because of our Multisite environment) . But now, We know where to look at? And we know exactly what all are the possible options for such behavior. And I’m sure you will also find this information useful while troubleshooting such challenge.

I’m sure one day, We will find root cause and will share it with you for sure! And we expect same from you! 🙂

Happy Linking! 🙂

PS : Special thanks to  Alexey Zhukov and Yuriy Yurkovsky(Sitecore Support) for providing this suggestion and Devashri who did all this investigation and worked on this challenge!


One Comment

Leave a Comment
  1. Josh McKenney / May 20 2014 10:56 pm

    I believe I just replicated this after quite a few tickets complained of missing links within content. What I discovered, in Sitecore 7.0, is that whenever ANY items that are linked to from that page are deleted, and the option to remove links to that item is selected upon deletion, ALL links on the page that included this link are removed. Looking to find if 7.1 or 7.2 remedy this issue.

    This happened on a page with links to multiple media items as well as a page linked to multiple page items.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: