Skip to content
Snippets Groups Projects
Commit ba123ddb authored by Daniel Pfeiffer's avatar Daniel Pfeiffer Committed by Hristo Chonov
Browse files

Issue #3029155: General error: 1205 Lock wait timeout exceeded; try restarting transaction

parent 2108f953
No related branches found
No related tags found
1 merge request!7Issue #3029155: General error: 1205 Lock wait timeout exceeded; try restarting transaction
......@@ -69,6 +69,9 @@ function autosave_form_schema() {
],
],
'primary key' => ['form_id', 'form_session_id', 'entity_type_id', 'entity_id', 'langcode', 'uid', 'timestamp'],
'indexes' => [
'entity_type_id__entity_id' => ['entity_type_id', 'entity_id'],
],
];
return $schema;
......@@ -120,3 +123,30 @@ function autosave_form_update_8003() {
$config->save(TRUE);
}
}
/**
* Adds an index to optimize deletion of entities.
*
* @see \Drupal\autosave_form\Storage\AutosaveEntityFormStorageInterface::purgeAutosavedEntityState
*/
function autosave_form_update_8004() {
$schema = \Drupal::database()->schema();
$spec = [
'fields' => [
'entity_type_id' => [
'type' => 'varchar_ascii',
'length' => EntityTypeInterface::ID_MAX_LENGTH,
'not null' => TRUE,
],
'entity_id' => [
'type' => 'varchar_ascii',
'length' => EntityTypeInterface::ID_MAX_LENGTH,
'not null' => TRUE,
],
],
];
$fields = ['entity_type_id', 'entity_id'];
$schema->addIndex(AutosaveEntityFormStorageInterface::AUTOSAVE_ENTITY_FORM_TABLE, 'entity_type_id__entity_id', $fields, $spec);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment