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:
make_menu_link_content_revisionabledispatches anEntityTypeEventfor an "update" of the menu link entity type.ViewsEntitySchemaSubscribersubscribes to this event.- All views are loaded and resaved.
- The views config objects recalculate their dependencies and consult all of their plugins in the process.
- In order to consult the plugins of the view
\Drupal\views\Plugin\views\display\DisplayPluginBase::getHandlerscalls "init" on the plugins. - Switching over now to
options.module, in\Drupal\options\Plugin\views\filter\ListField::init, we calloptions_allowed_valuesin::initwhich gathers all the options for the list field. - If any field definitions use an
allowed_values_functionthat 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
| Comment | File | Size | Author |
|---|---|---|---|
| #25 | error output.txt | 15.94 KB | jini osaka |
Comments
Comment #2
sam152 commentedI'm still investigating if point 7 in the IS is due to the nature of my specific entity type / views data or if it's reproducible with just core.
Stay tuned...
Comment #3
sam152 commentedComment #4
sam152 commentedSo here is what I've found: the
TaxonomyIndexTidplugin entirely circumvents this issue and there don't seem to be any other plugins which attempt to load an entity in a views ::init plugin. So this seems to be the combination of my custom entity type and how I've chosen to integrate an ER field with a views select list:So maybe this is a "wont fix" and maybe I need a filter plugin which extends
PrerenderListinstead ofListField?Comment #5
plachThis might be related to #2554235: Make the content entity storage and entity query use the last installed definitions instead of the ones living in code and or #2274017: Make SqlContentEntityStorage table mapping agnostic .
Comment #6
joelpittetThis looks like the same issue that I reported and @amateescu was working through with me a couple days ago #3039586: Cannot rename tmp_2362aemenu_link_content_revision to menu_link_content_revision He was working on trying "making the content entity storage use the last installed definitions instead of the ones from code"
Comment #7
joelpittetTemporary work around was to comment out the event subscriber saving all views.
Commenting out
$view->trustData()->save();fromcore/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php:202Comment #8
sam152 commentedLooks like the same root cause manifesting itself in slightly different ways. Both try to load a term during
updb, under slightly different circumstances, caused by views resaving config.Comment #9
amateescu commentedI posted a patch in #2554235-19: Make the content entity storage and entity query use the last installed definitions instead of the ones living in code which should fix this issue.
Comment #10
thursday_bw commentedI'm just posting the error output that I got from drush updb for this, because I didn't find this issue when I was search for an existing one.
Comment #11
jweirather commentedEdit: this occurred for me during the update to 8.7 from 8.6.15
I experienced this same issue, after first dealing with the issue(s) mentioned in 3039586 (see @joelpittet's comment #6 above). As per @BrightBold's fix there (#13 in that issue):
(note, I also deleted the "old" and "tmp" tables associated with that update)
After that, the update process proceeded to the issue detailed in this thread. @joelpittet's fix in #7 above resolved the issue for me as well.
+1 for both of these assists, thank you all!
Comment #12
bygeoffthompson commentedTrying to follow the advice in #11 above I encountered:
`[error] SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupal.menu_link_content' doesn't exist`
Which then led to the abort/error message:
`Update aborted by: menu_link_content_post_update_make_menu_link_content_revisionable`
Comment #13
c.e.a commentedI have tried as well the advice from #11 but I got same error as explained in #12:
[error] SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupal.menu_link_content' doesn't existComment #14
c.e.a commented2 days trying on fixing the update failure form 8.6.15 to 8.7.0 with more than 20 attempts all ended with failure...
The only solution worked for me was what mentioned in #7.
$view->trustData()->save();fromcore/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php:202$view->trustData()->save();Hope it will help somebody and thank you @joelpittet
Comment #15
gmonseur commented#7 work for me
Thank you @joelpittet and @C.E.A
Comment #16
Eevvee commented#7 works for me too.
Thank you very much
Comment #17
joelsteidl commentedConfirming #7 as well.
Comment #18
handkerchiefConfirming #14.
Comment #19
watson.sm#14 Worked but I had to perform the following changes on my install.
Perform steps 1 & 2 in #14, then perform these database changes
DROP TABLE menu_link_content_revision;
DROP TABLE menu_link_content_field_revision;
Then perform steps 3 & 4 from #14
Comment #20
c.e.a commented@watson.sm If you followed the #1 about reverting the db to your original one before doing any of the other points then their is no need to below steps:
because drupal 8.6.15 doesn't have the menu_link_content_revision
Just a note for the confusing of others...
Comment #21
mtdaveo commentedNot sure this is exact issue as OP, but upon trying to install updates (non Drush) I'm getting the following error:
menu_link_content module
Update make_menu_link_content_revisionable
Failed: Drupal\Core\Entity\EntityStorageException: The entity update process failed while processing the entity type menu_link_content, ID: 5. in Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema->copyData() (line 216 of /home/xxx/public_html/core/lib/Drupal/Core/Entity/Sql/SqlFieldableEntityTypeListenerTrait.php).
I show neither (1) menu_link_content_revision nor (2) menu_link_content_field_revision tables, as mentioned throughout above. My closest table is menu_link_content, but I have 30-35 (!!!) tmp files with variations of 1-2. Can/should I delete these tmp files outright or export first (if importing again is possible?) Not really sure what I'm doing.
Comment #22
interestingaftermath commentedI'm trying to avoid reverting the database but starting to wonder if that's the only solution. I've tried everything else from this and other threads I can find.
The problem is that we've had a team of 4 people entering content into the site for the last 3 days since the drupal update was performed. The thought of losing that content is bad but it might be the only option. Any ideas?
Comment #23
yuseferi commentedSuch a terrible update.
I tried twice to update the core when it was 8.7.2 and then 8.7.3, again the same issue !!!
it wasted a day of my time !!!
Comment #24
davidalan31From what I'm seeing, it appears that the core update build out is either performing an
entupwhich is causing the table to be created prior to the database update that requests the same thing, or there's not a flag/check informing the core processes that the table has already been built. When I encountered the issue, I dug into my DB to find that the table thatupdbwas creating was already in existence, but empty. Being that I was working from a development instance when discovering this issue, I took a snapshot of my DB, then deleted the following empty tables: menu_link_content_field_revision, menu_link_content_revision, taxonomy_term_revision, taxonomy_term_field_revision, taxonomy_term_revision__parent. At that point, I re-ran myupdbcommand and the process completed successfully. I'm wondering if this is just an order-of-operations issue that is causing the problem. Just my thoughts...Comment #25
jini osaka commentedI have tried the steps in #14
and #19
But i still get an error after
> drush updb
I can post the full error output - but its pretty long, and I'm not sure if that's rude to do so.
Comment #26
jini osaka commentedAdditionally:
it seems there are 2 declarations:
Date::buildOptionsForm(&$form, Drupal\datetime\Plugin\views\argument\FormStateInterface $form_state)
ArgumentPluginBase::buildOptionsForm(&$form, Drupal\Core\Form\FormStateInterface $form_state)
buildOptionsForm() function is using different parameters and during an upgrade, it causes a fatal error.
https://api.drupal.org/api/drupal/core%21modules%21views%21src%21Plugin%...
https://api.drupal.org/api/drupal/core%21modules%21views%21src%21Plugin%...
... both functions should have same arguments.
it looks like some component has a version mismatch, causing a fatal error during update.
can i use backtrace to find the mismatch? or change my php settings maybe?
Comment #27
ravimane23 commentedI have applied a patch given in issue "https://www.drupal.org/project/drupal/issues/3052318"
When I perform "Drush updb", menu_link_content issue gets resolved.
But I got another error in taxonomy revision table.
Comment #28
nishantkumar155 commentedHi ravimane23 ,
Did you find solutions for your problem , even i am getting same issue
Comment #29
ravimane23 commentedHi nishantkumar155,
I have written an update hook in a custom module as below -
After adding these lines my database update runs successfully.
Comment #30
aperedos commentedHi ravimane23
To which version are you updating? 8.7...?
After appling the patch: https://www.drupal.org/project/drupal/issues/3052318 i still have other issue: Base table or view not found: 1146 Table 'xxxxx.menu_link_content_revision' doesn't exist: SELECT t.revision_id AS revision_id
Cheers,
Comment #31
jenifertucker commented#7 didn't fix so followed davidalan at #24.
This did the trick, so thanks for sharing.
Comment #32
ravimane23 commentedHello,
I applied below changes in my update hook & successfully gets updated to 8.7.8.
Thanks
Comment #33
bryanb229 commentedconfirming #24 worked also, thank you!
Comment #34
obr44 commentedThis worked for me, after having
/update.phpwith an error (8.6 to 8.7):1. Delete (PostgreSQL) database tables
menu_link_content_revisionandmenu_link_content_field_revisionIIRC.2. Comment line 202
$view->trustData()->save();indrupal/web/core/modules/views/src/EventSubscriber/ViewsEntitySchemaSubscriber.php3. Run
/update.phpagain.Comment #35
rwilson0429 commented#24 worked for me using the following Drush commands:
drush sql-query "DROP TABLE menu_link_content_revision";drush sql-query "DROP TABLE menu_link_content_field_revision";drush sql-query "DROP TABLE taxonomy_term_revision";drush sql-query "DROP TABLE taxonomy_term_field_revision";drush sql-query "DROP TABLE taxonomy_term_revision__parent";drush sql-query "DROP TABLE taxonomy_term_revision__field_link_address";drush sql-query "DROP TABLE taxonomy_term_revision__field_display_title";drush sql-query "DROP TABLE taxonomy_term_revision__field_post_url";Comment #36
rhiss commentedHello @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()