Fatals in make_menu_link_content_revisionable when combined with make_taxonomy_term_revisionable

Created on 14 March 2019, almost 6 years ago
Updated 25 August 2024, 4 months ago

Problem/Motivation

Testing updating to 8.7 HEAD on an existing D8 project, I get the following error running an updb:

 ------------------- ------------------------------------- --------------- --------------------------------------------------------
  Module              Update ID                             Type            Description
 ------------------- ------------------------------------- --------------- --------------------------------------------------------
  system              8601                                  hook_update_n   8601 -  Fix missing install profile after updating to
                                                                            Drupal 8.6.9 with Drush 8.
  system              8701                                  hook_update_n   Remove the unused 'system.theme.data' from state.
  layout_builder      discover_blank_layout_plugin          post-update     Clear caches to discover new blank layout plugin.
  layout_builder      fix_tempstore_keys                    post-update     Fix Layout Builder tempstore keys of existing entries.
  layout_builder      routing_defaults                      post-update     Clear caches due to routing changes to changing the
                                                                            URLs for defaults.
  layout_builder      section_third_party_settings_schema   post-update     Clear caches due to config schema additions.
  menu_link_content   make_menu_link_content_revisionable   post-update     Update custom menu links to be revisionable.
  taxonomy            make_taxonomy_term_revisionable       post-update     Update taxonomy terms to be revisionable.
  views               make_placeholders_translatable        post-update     Rebuild cache to allow placeholder texts to be
                                                                            translatable.
 ------------------- ------------------------------------- --------------- --------------------------------------------------------
 // Do you wish to run the specified pending updates?: yes.
...
 [notice] Update started: menu_link_content_post_update_make_menu_link_content_revisionable
 [error]  SQLSTATE[42S22]: Column not found: 1054 Unknown column 'base_table.revision_id' in 'field list': SELECT base_table.revision_id AS revision_id, base_table.tid AS tid
FROM
{taxonomy_term_data} base_table
INNER JOIN {taxonomy_term_field_data} taxonomy_term_field_data ON taxonomy_term_field_data.tid = base_table.tid
WHERE taxonomy_term_field_data.vid IN (:db_condition_placeholder_0); Array
(
    [:db_condition_placeholder_0] => event_age_ranges
)

 [error]  Update failed: menu_link_content_post_update_make_menu_link_content_revisionable
 [error]  Update aborted by: menu_link_content_post_update_make_menu_link_content_revisionable
 [error]  Finished performing updates.

Then running it again, I get into a broken state:

 // Do you wish to run the specified pending updates?: yes.

 [notice] Update started: menu_link_content_post_update_make_menu_link_content_revisionable
 [error]  Exception thrown while performing a schema update. Cannot rename tmp_e49ddcmenu_link_content_revision to menu_link_content_revision: table menu_link_content_revision already exists.
 [error]  Update failed: menu_link_content_post_update_make_menu_link_content_revisionable
 [error]  Update aborted by: menu_link_content_post_update_make_menu_link_content_revisionable
 [error]  Finished performing updates.

Here is the sequence of events from xdebug:

  1. make_menu_link_content_revisionable dispatches an EntityTypeEvent for an "update" of the menu link entity type.
  2. ViewsEntitySchemaSubscriber subscribes to this event.
  3. All views are loaded and resaved.
  4. The views config objects recalculate their dependencies and consult all of their plugins in the process.
  5. In order to consult the plugins of the view \Drupal\views\Plugin\views\display\DisplayPluginBase::getHandlers calls "init" on the plugins.
  6. Switching over now to options.module, in \Drupal\options\Plugin\views\filter\ListField::init, we call options_allowed_values in ::init which gathers all the options for the list field.
  7. If any field definitions use an allowed_values_function that loads a taxonomy term, it will blow up with the error listed above.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

πŸ› Bug report
Status

Closed: duplicate

Version

8.8 ⚰️

Component
Menu system  β†’

Last updated 1 day ago

Created by

πŸ‡¦πŸ‡ΊAustralia Sam152

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡©πŸ‡ͺGermany rhiss

    Hello @ll, thanks for the effort and discussion so far. I have the joy of updateing an old Drupal 8.6.1, in times of Drupal 11, and also came to this issue, hopefully the last one ever, but just in case:
    drupal/web/core/lib/Drupal/Core/Database/Driver/mysql/Schema.php -> renameTable()

      public function renameTable($table, $new_name) {
        if (!$this->tableExists($table)) {
          $this->connection->schema()->dropTable($table);
    //      throw new SchemaObjectDoesNotExistException("Cannot rename '$table' to '$new_name': table '$table' doesn't exist.");
        }
        if ($this->tableExists($new_name)) {
          $this->connection->schema()->dropTable($new_name);
    //      throw new SchemaObjectExistsException("Cannot rename '$table' to '$new_name': table '$new_name' already exists.");
        }
    
        $info = $this->getPrefixInfo($new_name);
        $this->connection->query('ALTER TABLE {' . $table . '} RENAME TO `' . $info['table'] . '`');
      }
Production build 0.71.5 2024