Modification of the Properties table does not respect EventDisabler


Description

To share the data among different instances, Sitecore may use the Properties table of the Sitecore databases. The examples of the data that Sitecore usually stores in this table are: the time of the last publishing, a timestamp of the last processed EventQueue entry, the data related to the index updates etc.

Sitecore has a caching layer around the aforementioned table so that the values read from it can be cached and reused. Caching requires changes to the table to be synchronized among different Sitecore instances, which is achieved via the EventQueue mechanism in the following way:

A modification of the Sitecore.Data.Database.Properties collection used for accessing the specific Properties table results in the PropertyChangedRemoteEvent event that is recorded into the EventQueue table, so other Sitecore instances subscribed to this event can alter their cached value.

In some situations, such synchronization logic can be considered excessive, and unnecessarily occupy server resources. For example, this may happen if a custom piece of the data is stored in the Properties table and that data is used only by a single Sitecore instance. In such cases, there is no need to synchronize the caches between all Sitecore instances.

To disable the above-mentioned event, prevent population of the EventQueue table, and disable cache synchronization. Using the EventDisabler object is recommended:

using (new Sitecore.Data.Events.EventDisabler())
{
    database.Properties["key"] = "value";
}

However, regardless of using the EventDisabler, Sitecore still produces an aforementioned event and populates the EventQueue table with the appropriate record.

Solution

Perform the steps below to make Sitecore CMS respect the EventDisabler state when working with the Sitecore.Data.Database.Properties collection:

  1. Place the attached Sitecore.Support.420602.dll assembly into the \bin folder of your solution.
  2. Place the attached Sitecore.Support.420602.config file into the \App_Config\Include folder of your solution.

Note: the solution above is applicable only to SQL Server databases.