Problem/Motivation
Hey everybody,
i just wanted to update my dev-site to 8.7.0 from 8.6.15 but received and error while running the updates:
...
[notice] Update started: taxonomy_post_update_make_taxonomy_term_revisionable
[notice] Taxonomy terms have been converted to be revisionable.
[ok] Update completed: taxonomy_post_update_make_taxonomy_term_revisionable
[notice] Update started: taxonomy_post_update_make_taxonomy_term_revisionable
[error] SQLSTATE[42S02]: Base table or view not found: 1146 Table 'lawioDB.taxonomy_term_data' doesn't exist: SELECT revision.langcode AS langcode, base.tid AS tid, base.vid AS vid, base.uuid AS uuid, CASE base.revision_id WHEN revision.revision_id THEN 1 ELSE 0 END AS isDefaultRevision
FROM
{taxonomy_term_data} base
INNER JOIN {taxonomy_term_revision} revision ON revision.revision_id = base.revision_id
WHERE base.tid IN (:db_condition_placeholder_0, :db_condition_placeholder_1, :db_condition_placeholder_2, :db_condition_placeholder_3, :db_condition_placeholder_4, :db_condition_placeholder_5, :db_condition_placeholder_6); Array
(
[:db_condition_placeholder_0] => 93189
[:db_condition_placeholder_1] => 93190
[:db_condition_placeholder_2] => 93191
[:db_condition_placeholder_3] => 93192
[:db_condition_placeholder_4] => 93193
[:db_condition_placeholder_5] => 93194
[:db_condition_placeholder_6] => 93195
)
[error] Update failed: taxonomy_post_update_make_taxonomy_term_revisionable
[error] Update aborted by: taxonomy_post_update_make_taxonomy_term_revisionable
[error] Finished performing updates.
After that error i checked my db, because i was sure to have this table. But every table of the format taxonomy_* got deleted, except of taxonomy_index.
I didn't looked further into it yet and just wanted to inform. It seems that the user from comment #10 in this report got the same error.
Best Regards
FirstSanny
Steps to reproduce
Aside from running the update, it also happens (only with the s3fs tables), when i use the cache clearing action from the S3FS Module. See #24.
Proposed resolution
The work around used in in #19.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Comments
Comment #2
FirstSanny commentedComment #3
xjmComment #4
larowlanCan you confirm that the taxonomy_term_data table exists before the update?
Comment #5
amateescu commentedAlso, this update function creates backup tables with the prefix
old_[6-random-chars], can you confirm that they exist after the failed update process?Comment #6
FirstSanny commented@larowlan
I can confirm, that the tables existed at the last backup. That was made approx. 12h before the update and there were no big actions on the side which could have deleted the tables or changed any important content. That's why i didn't made a fresh backup right before. But i will test the update again with the restored backup soon, so i can confirm that the deletion came from the update.
Also there were no tables with the name old_* created.
EDIT: I can now cofirm, that the tables were deleted when the update is executed.
Comment #7
amateescu commented@FirstSanny, see my comment from #3039586-28: Cannot rename tmp_2362aemenu_link_content_revision to menu_link_content_revision for a possible explanation for this failed update. It's really good that you have a backup available, it will be very helpful for trying to figure out the root cause :)
Comment #8
FirstSanny commented@amateescu After reading your comment i recognized that the tables menu_link_* were also deleted. I restored all the deleted tables.
If i am understanding your comment correctly you suggest, that i have to delete all my views and try the update again?
Comment #9
amateescu commented@FirstSanny, that depends on how much time you have available to try and debug this issue :)
If you can do a "test only" update after deleting all the views from the backup, it would help at least to establish that the problem is within
\Drupal\views\EventSubscriber\ViewsEntitySchemaSubscriber.In any case, the most important thing is to only try these test updates on the non-live environment/database!
Comment #10
FirstSanny commented@amateescu Of corse i'm not doing this on a live site. ;)
And i'll retry the update with deleted views. I don't know if i have the time to do it on the next hours, but today i'm quite sure i can rerun it.
Comment #11
FirstSanny commented@amateescu After deleting most of the views the update ran into the same error as in this post.
Comment #12
amateescu commented@FirstSanny, ok, I've posted a patch at #3052492: ViewsEntitySchemaSubscriber should not make an entity update fail if a view cannot be resaved that should help a bit in the cases where these updates fail because of an unrelated View can not be saved anymore. Can you please try the update again without removing any view and with that patch applied?
Comment #13
FirstSanny commented@amateescu i'll retry soon, but i think that won't happen today.
Comment #14
FirstSanny commented@amateescu
ran the update. it dosen't deleted the taxonomy tables this time, but the menu_link* tables again.
here is the log:
the error roughly translated: couldn't rename old_***menu_link_content to menu_link_content because old_***menu_link_content dosen't exist. In my database there are only the tmp_*** tables and no sign of an old_*** table.
I hope this can help.
Comment #15
amateescu commentedI'm afraid I'm out of quick tips here.. can you try to debug the update manually, maybe by putting some breakpoints and going through it with a debugger? The first place to look is in
\Drupal\Core\Entity\Sql\SqlContentEntityStorageSchema::postUpdateEntityTypeSchema(), specifically the firsttry / catchblock from that method.Comment #16
FirstSanny commented@amateescu
I'll block some time to debug this in the following days.
Thanks for your fast answers and quick help. :)
Comment #17
pameeela commented@FirstSanny: Thanks for taking part in this issue. If you'd like to help us make sure the 8.8.0 update is as smooth as possible, please consider signing up for the beta testing program at https://goo.gl/forms/bMBTMRSY3sKEscUJ3
Comment #18
FirstSanny commented@amateescu
I found something really interesting. That was not exactly while debuging, but when i checked that comment. I ran these SQL-Statements and got a little bit confused, because it said, that i have a lot of these old_* tables. After double-checking my table i can garantee, they were not there. So i ran
SELECT * FROM information_schema.tables where table_name like "old%";to find these tables.
And it appears i had a lot of them. But i another scheme. There was a new scheme called 'website' with the following tables:
So here are the tables that could'nt be renamed or deleted, because they were not in my normal scheme. And after deleting all the tables from this sheme the update ran successfully. Most likely because the tables from the old attempts in this scheme were blocking the new updates.
I think there is some point in the code, where the update is ignoring my scheme. Because even after updating successfully, all the revision and old_* tables went to the website scheme.
After a clean update with a cleaned website-scheme before updating, it got blown up again:
EDIT: So the tables actually weren't deleted, like i said in the previous comments. They just got moved to a different scheme.
Comment #19
FirstSanny commentedLittle workaround (it worked for me ;) ) for a successfull update:
1. clear website-scheme
2. reset normal scheme at pre-update version
3. run updates with latest drupal version
4. dump website-scheme
5. import dump into your main scheme
6. clear website-scheme
Comment #20
plachTentatively demoting this to major since it seems it's very uncommon and environment-specific and there's not actual data loss involved.
Comment #21
plachComment #22
hchonov:)
Comment #23
amateescu commented@FirstSanny, the DB schema change during the update is an interesting case, I haven't seen that in any other bug report about 8.7.x updates. What database driver are you using? And are you using some non-default/generic database configuration?
Comment #24
FirstSanny commented@amateescu
This is our DB-Config. Hope, this helps. If you want to know whats behind this variables, just ask. :)
And we are using the mysql driver for a normal mysql on Amazon RDS.
Edit: I don't know if this helps, but it also happens (only with the s3fs tables), when i use the cache clearing action from the S3FS Modul.
Comment #29
quietone commentedAs pointed on in #20, this seems it's very uncommon.
It has been three years and there has been this one report of this particular problem.
Is anyone else experiencing this problem? Is so, add a comment including the database and version being used. If we don't receive additional report, this may be closed after three months.
Thanks!
Comment #30
quietone commentedAdding tag
Comment #32
quietone commented@FirstSanny, thanks for you help working to solve this and posting a workaround in #19.
There have been no further reports of this particular problem, so I am closing this as outdated. If you have encountered this problem, open a new issue and refer to this one.
Thanks.