Hi

When tried to Run database update after updating core 8.6.16 to 8.7.2 got

Do you wish to run all pending updates? (y/n): y
Efter opdatering af menu_link_content [ok]
Efter opdatering af menu_link_content [ok]
Efter opdatering af menu_link_content [ok]
Failed: Drupal\Core\Entity\EntityStorageException: Exception thrown while [error]
performing a schema update. Cannot rename table to table_new: The table table already exists. i
Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrapSchemaException() (linje
1611 af
/var/www/site/web/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php)

Comments

mudassar774 created an issue. See original summary.

mudassar774’s picture

Issue summary: View changes
cilefen’s picture

Component: database update system » menu_link_content.module
Related issues: +#3039586: Cannot rename tmp_2362aemenu_link_content_revision to menu_link_content_revision

I think this could be a duplicate of this existing issue.

mudassar774’s picture

Hi @cilefen thanks for quick prompt

when i ran the UPDB first time end up with issue

TypeError: Argument 1 passed to Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber::Drupal\views\EventSubscriber\{closure}() must be of the type array, null given, called in /var/www/site/web/core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php on line 279 in /var/www/site/web/core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php on line 368 #0 /var/www/site/web/core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php(279): Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber->Drupal\views\EventSubscriber\{closure}(NULL, Object(Drupal\views\Entity\View))
#1 /var/www/site/web/core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php(376): Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber->processHandlers(Array, Object(Closure))
#2 /var/www/site/web/core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php(205): Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber->dataTableAddition(Array, Object(Drupal\Core\Entity\ContentEntityType), 'menu_link_conte...', 'menu_link_conte...')
#3 /var/www/site/web/core/lib/Drupal/Core/Entity/EntityTypeEventSubscriberTrait.php(47): Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber->onEntityTypeUpdate(Object(Drupal\Core\Entity\ContentEntityType), Object(Drupal\Core\Entity\ContentEntityType))
#4 [internal function]: Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber->onEntityTypeEvent(Object(Drupal\Core\Entity\EntityTypeEvent), 'entity_type.def...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#5 /var/www/site/web/core/lib/Drupal/Component/EventDispatcher/ContainerAwareEventDispatcher.php(111): call_user_func(Array, Object(Drupal\Core\Entity\EntityTypeEvent), 'entity_type.def...', Object(Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher))
#6 /var/www/site/web/core/lib/Drupal/Core/Entity/EntityTypeListener.php(138): Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher->dispatch('entity_type.def...', Object(Drupal\Core\Entity\EntityTypeEvent))
#7 /var/www/site/web/core/lib/Drupal/Core/Entity/EntityDefinitionUpdateManager.php(229): Drupal\Core\Entity\EntityTypeListener->onFieldableEntityTypeUpdate(Object(Drupal\Core\Entity\ContentEntityType), Object(Drupal\Core\Entity\ContentEntityType), Array, Array, Array)
#8 /var/www/site/web/core/modules/menu_link_content/menu_link_content.post_update.php(100): Drupal\Core\Entity\EntityDefinitionUpdateManager->updateFieldableEntityType(Object(Drupal\Core\Entity\ContentEntityType), Array, Array)
#9 /var/www/site/web/core/includes/update.inc(247): menu_link_content_post_update_make_menu_link_content_revisionable(Array)
#10 /var/www/site/vendor/drush/drush/commands/core/drupal/batch.inc(163): update_invoke_post_update('menu_link_conte...', Object(DrushBatchContext))
#11 /var/www/site/vendor/drush/drush/commands/core/drupal/batch.inc(111): _drush_batch_worker()
#12 /var/www/site/vendor/drush/drush/includes/batch.inc(98): _drush_batch_command('2631')
#13 /var/www/site/vendor/drush/drush/commands/core/drupal/update.inc(193): drush_batch_command('2631')
#14 /var/www/site/vendor/drush/drush/commands/core/core.drush.inc(1227): _update_batch_command('2631')
#15 /var/www/site/vendor/drush/drush/includes/command.inc(422): drush_core_updatedb_batch_process('2631')
#16 /var/www/site/vendor/drush/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#17 /var/www/site/vendor/drush/drush/includes/command.inc(199): drush_command('2631')
#18 /var/www/site/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#19 /var/www/site/vendor/drush/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#20 /var/www/site/vendor/drush/drush/drush.php(12): drush_main()
#21 {main}

If i clear the cache and run UPDB again this type error go away but failed with Cannot rename table to table_new: The table table already exists.
As per suggestion in related issue i drop the tables menu_link_content_field_revision and menu_link_content_revision manually and run UPDB it brings above type error again. Look like a chicken and egg problem

cilefen’s picture

Priority: Normal » Major
cilefen’s picture

Did you restore the entire database before executing update.php or only removed two tables?

mmjvb’s picture

No, not really like a chicken and egg problem. What this tells you is that clearing cache is not solving the update issue. The related issue tells you that the update is not reentrant. That is what makes the removal of those tables necessary. When something goes wrong it doesn't go back to a situation that you can update. You need to do that yourself manually. The best way is to properly restore your database, making sure it is in a consistent state. With intimate knowledge of the update process and what went wrong the removal of the tables might be enough. Advice a proper restore, because the cause of what went wrong is stil to be determined.

That leaves the original error to be analyzed, the data corruption fixed and run into the next issue with the update. When lucky, the update succeeds without issues. Then the search for the cause of the data corruption starts. That cause needs to be resolved as well.

mudassar774’s picture

@cilefen I just remove those 2 tables after first updb fails. What does you mean restore database. Does it SQL-DROP and than dump in again??

seems there is no way to get rid of this TYPED ERROR except cache clear as per discussion here.
https://www.drupal.org/project/drupal/issues/3031128#comment-12959541

plach’s picture

Should mark this as a duplicate of #3006815: ViewsEntitySchemaSubscriber may fail when a view has a broken handler, now that a patch is available over there?

plach’s picture

Status: Active » Closed (duplicate)
Issue tags: +8.7.0 update