Support for Fast Queries when using the Publishing Service


Description

Note that you can only use the following approach under limited circumstances because it might affect performance. The approach must not be applied unless it has been preceded by performance testing.

If your Sitecore XP solution utilizes the Fast Query API, you must maintain the Descendants table in the target database(s). The Publishing Service does not update/rebuild the Descendants table by default. This decision was made to improve the performance of the publishing process. However, you can configure the Publishing Service to allow the Descendants table to be maintained.

Solution

To update the Descendants table after publishing, consider the following steps:

  1. Apply the following patch to the Publishing Service host configuration:
    <Settings>
      <Sitecore>
        <Publishing>
          <Services>
            <PromotionCoordinator>
              <Options>
                <RebuildDescendantsTable>true</RebuildDescendantsTable>
              </Options>
            </PromotionCoordinator>
          </Services>
        </Publishing>
      </Sitecore>
    </Settings>
  2. If the following timeout error occurs after applying the previous patch on the Publishing Service host configuration:
    [Error] "Item Descendants Promote" from "Master" to "Internet" failed. - Error: "Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding."
    System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out
    at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
    at System.Data.SqlClient.SqlCommand.InternalEndExecuteNonQuery(IAsyncResult asyncResult, String endMethod, Boolean isInternal)
    at System.Data.SqlClient.SqlCommand.EndExecuteNonQueryInternal(IAsyncResult asyncResult)
    at System.Data.SqlClient.SqlCommand.EndExecuteNonQueryAsync(IAsyncResult asyncResult)
    at System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
    Then increase the CommandTimeout from "120" seconds to "600" seconds and try publishing again:
    <sql-backend-default>
      <Type>Sitecore.Framework.Publishing.Data.AdoNet.ConnectionRetryBehaviour, Sitecore.Framework.Publishing.Data</Type>
      <Options>
        <Name>Default Backend No Retry behaviour</Name>
        <CommandTimeout>600</CommandTimeout>
        <Retryer>NoRetryer</Retryer>
      </Options>
    </sql-backend-default>


Notes