This page contains information on helping to maintain Site Studio Layout Revisions database table size and how to resolve associated issues.
Site Studio Layout revisions are being created and deleted whenever a node revision is created or deleted. This means that for each revision of the node with a Layout Canvas there will be a Site Studio Layout Revision entity. This is normal behaviour for revisionable content entities in Drupal, however in specific scenarios it can become problematic. An example scenario would be a constantly updated homepage node that has revisions enabled but no mechanism for limiting or cleaning up revisions. In such cases both node revisions and Site Studio Layout database tables will be proportional to the amount of edits the node has received over its lifespan.
A Good way to ensure revisions do not get to abnormal size is to use a "Node Revision Delete" module that when properly configured will ensure that only a limited amount of revisions are being kept in the database.
Drupal Core has an unresolved issue about entity reference field items not being removed when the referenced entity is deleted. This applies to Site Studio Layout Revision entities. However, one of the dependencies for Site Studio is the "Entity Reference Revisions" module which provides tooling to fix this.
In version 1.7 of "Entity Reference Revisions" module a new feature "Orphaned Paragraph cleanup" was introduced and in version 1.9 a new feature "Implement a Drush command to clean obsolete composite entities" was introduced. These two features apply to composite entities such as Site Studio Layout and can be used to clean up orphaned revisions.
As with any process that deals with content deletion or modification, we strongly recommend thorough testing on Staging/Development environments and backing up data before attempting to clean up revisions on production environments.
To clean up Site Studio Layout Revision entities via UI:
- Navigate to https://<your.hostname>/admin/config/system/delete-orphans
- Select “Layout canvas” by checking the checkbox
- Click “Delete orphaned composite revisions” button
- Allow the process to finish and confirm that Site Studio Layout Revision entities have been cleaned up.
To clean up Site Studio Layout Revision entities via CLI with Drush:
- Open your terminal of choice and navigate (or connect) to location appropriate for your Drupal installation
- Use the following Drush command: `drush err:purge cohesion_layout`
Confirm the information in the output of the command about the success of command and the stats of the removed entities.