Reset Sitecore Publish Service tables

We ran into an issue with the Sitecore publishing service whereby the following exceptions were being logged:

[Information] Executing Cleanup Task : "PublishOperationCleanupTask-60832bb9509e4a37855285a8346a6a53"

[Error] There was an error adding 1 publisher operations. - Error : "Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding." 

Following some investigation we discovered this was caused by the PublishOperationCleanUpTask running on the PublishService.

The PublishOperationCleanupTask works like the following:

  1. The “Publishing_TargetSyncState” table contains entries containing a publishing target, language, and timestamp
  2. These entries are updated when one of the following publishes is done:
    a. Incremental publish
    b. Publishing the root “sitecore” item with subitems
  3. The PublishOperationCleanupTask checks the entries in the “Publishing_PublisherOperation” table, and removes entries that are older than the timestamp in the “Publishing_TargetSyncState” specific to the language.
  4. This task runs by default once a day but can be configured to run as frequently as required.

So this job is suppose to cleanup Publishing_PublisherOperation table, however on inspection of this table we discovered it contained much older records that had not yet been removed. Indicating the job was having problems completing its task or at least it was not able to cleanout the records.

Part of the solution to resolve the Timeout Expired exception was to increase the <CommandTimeout> setting located in the sc.publishing.sqlazure.xml file. The default value is set to 120.

But what if you wanted to just cleanup the publishing service tables? The following tables are created in the Sitecore master database when you install and setup the publishing service:

  • Publishing_ActivationLock
  • Publishing_Data_Params_FieldIds
  • Publishing_Data_Params_Languages
  • Publishing_JobManifest
  • Publishing_JobMetadata
  • Publishing_JobQueue
  • Publishing_ManifestOperationResult
  • Publishing_ManifestStatus
  • Publishing_PublisherOperation
  • Publishing_TargetSyncState

To reset these tables you can run the following command from the Publish Service webroot: Sitecore.Framework.Publishing.Host schema reset –force

NOTE: The only risk in running this would be if you have any publishing jobs that are in-flight will need to be republished.

Useful Links

Happy Publishing!

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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