Removing a large number of archived items might be slow and reverted in case of a timeout


Description

In order to reduce resource consumption and enhance the application performance, older item versions can be deleted or archived. Deleted and archived items are stored in dedicated SQL tables and not loaded into Sitecore caches. As the size of those SQL tables grows over time, permanent deletion of all outdated items might be required. Because Sitecore cleans up the archive tables in a single SQL transaction, an attempt to permanently delete all outdated items at once might result in a timeout. In case of the timeout, the entire progress is rolled back, and the following message can be found in the logs:

Exception: System.Exception
Message: Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.
Operation cancelled by user.
The statement has been terminated.
Source: Sitecore.Kernel
   at Sitecore.Data.DataProviders.Sql.DataProviderCommand.ExecuteNonQuery()
   at Sitecore.Data.DataProviders.Sql.SqlDataApi.<>c__DisplayClass33_0.<Execute>b__0()
   at Sitecore.Data.DataProviders.NullRetryer.Execute[T](Func`1 action, Action recover)
   at Sitecore.Data.Archiving.SqlArchive.<RemoveEntries>b__16_0()
   at Sitecore.Data.DataProviders.NullRetryer.ExecuteNoResult(Action action, Action recover)
   at Sitecore.Shell.Framework.Commands.Archives.Empty.Run(ClientPipelineArgs args)

There are two scenarios for the issue to occur:

Solution

To resolve the issue, for Sitecore XP 10.3, download and install the pre-release as specified in KB1002844.