Ошибка обновления Drual 8.7.x - [error] Update failed: taxonomy_post_update_make_taxonomy_term_revisionable

Главные вкладки

Аватар пользователя listman listman 9 мая 2019 в 10:45

Здравствуйте.
Помогите выявить проблему при обновлении на версии 8.7.x

Вчера пришла новая версия - https://www.drupal.org/project/webform_views/releases/8.x-5.0-alpha7[/mo...

composer update успешно обновил модуль и другие зависимости.

drush updb --entity-updates, Drupal потребовал обновить следующие таблицы

 
  taxonomy   make_taxonomy_term_revisionable       post-update   Update taxonomy terms to be revisionable.
  taxonomy   remove_hierarchy_from_vocabularies    post-update   Remove the 'hierarchy' property from vocabularies.
  views      exposed_filter_blocks_label_display   post-update   Update exposed filter blocks label display to be disabled.
  views      make_placeholders_translatable        post-update   Rebuild cache to allow placeholder texts to be translatable.

После длительного обновления, получаю ошибку

>  [error]  Exception thrown while performing a schema update. Cannot rename tmp_744a50taxonomy_term_revision to taxonomy_term_revision: table taxonomy_term_revision already exists.
>  [error]  Update failed: taxonomy_post_update_make_taxonomy_term_revisionable

При запуске скрипта обновления update.php, получаю

taxonomy module
Update make_taxonomy_term_revisionable
Taxonomy terms have been converted to be revisionable.
Failed: Drupal\Core\Entity\EntityStorageException: Exception thrown while performing a schema update. Cannot rename tmp_30f55ataxonomy_term_revision to taxonomy_term_revision: table taxonomy_term_revision already exists. in Drupal\Core\Entity\Sql\SqlContentEntityStorage->wrapSchemaException() (line 1611 of \some-dir\web\core\lib\Drupal\Core\Entity\Sql\SqlContentEntityStorage.php).

После чего, при попытке создать новый термин посредством добавления нового тега, получаю:

SQLSTATE[HY000]: General error: 1364 Field "revision_id" doesn't have a default value: INSERT INTO {taxonomy_term_field_data}

При попытке войти в словарь, получаю ошибку

На сайте произошла непредвиденная ошибка. Пожалуйста, повторите попытку позже.</br></br><em class="placeholder">Drupal\Core\Database\DatabaseExceptionWrapper</em>: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near &#039;) AS expression
FROM
 tfr
INNER JOIN  tr ON tfr. = tr. AND tr. = 0
INNER JOIN (S&#039; at line 1: SELECT tfr.tid AS tid, MAX(tfr.) AS expression
FROM
{} tfr
INNER JOIN {} tr ON tfr. = tr. AND tr. = 0
INNER JOIN (SELECT t.tid AS tid, t.langcode AS langcode, MAX(t.) AS expression

FROM
{} t
WHERE t. = :db_condition_placeholder_0
GROUP BY t.tid, t.langcode) mr ON tfr. = mr. AND tfr.langcode = mr.langcode
GROUP BY tfr.tid; Array
(
    [:db_condition_placeholder_0] =&gt; 1
)
 in <em class="placeholder">Drupal\taxonomy\TermStorage-&gt;getTermIdsWithPendingRevisions()</em> (line <em class="placeholder">404</em> of <em class="placeholder">core\modules\taxonomy\src\TermStorage.php</em>). <pre class="backtrace">Drupal\Core\Database\Statement-&gt;execute(Array, Array) (Line: 631)

Прошу Вашей помощи в решении данной проблемы.
Возможно кто-то сталкивался ?

Лучший ответ

Аватар пользователя listman listman 10 мая 2019 в 12:19

Не один из патчей на д.орге не помог.
Решил проблему загрузкой дампа БД до обновления и повторным обновлением.

Комментарии

Аватар пользователя Semantics Semantics 9 мая 2019 в 11:15

У меня обнова затыкалась на обновлении Layout Builder, там тоже цепляло таксономию.

У вас же, судя по всему, обнова схемы БД произошла, но не до конца.

Аватар пользователя Semantics Semantics 9 мая 2019 в 12:40

Да тоже не проходили апдейты связанные с таксономией, такое ощущение, что там какая-то перекрёстная зависимость была.
Решилось экспортом конфигов LB, отключением LB, апдейтом на 8.7, включением и импортом конфигов

Аватар пользователя listman listman 9 мая 2019 в 11:55

При удалении Webform views появляется возможность создания терминов через автокомплит при создании ноды. Но обновление все равно не проходит. Подозреваю, что апдейт (8.7.х) криво установился. Очень странно, что сразу после апдейта, система работала хорошо и не предлагала никаких обновлений.

Проблема возникла только после недавнего обновления - Webform views

Аватар пользователя listman listman 9 мая 2019 в 13:35

2х недельный бекап обновился без шаманства. Поэтому вероятней всего, ошибка возникла при каком то из апдейтов в этот период.

UPD: Список изменений

 -------------------- ------------------------------------------------------- --------------- ------------------------------------------------------------------------------
  Module               Update ID                                               Type            Description
 -------------------- ------------------------------------------------------- --------------- ------------------------------------------------------------------------------
  system               8701                                                    hook_update_n   Remove the unused 'system.theme.data' from state.
  system               8702                                                    hook_update_n   Add the 'revision_translation_affected' entity key.
  comment              8700                                                    hook_update_n   Set the 'owner' entity key and update the field.
  comment              8701                                                    hook_update_n   Make the 'entity_type' and 'field_name' comment fields required.
  content_moderation   8700                                                    hook_update_n   Set the 'owner' entity key and update the field.
  file                 8700                                                    hook_update_n   Set the 'owner' entity key and update the field.
  media                8700                                                    hook_update_n   Set the 'owner' entity key and update the field.
  node                 8700                                                    hook_update_n   Set the 'owner' entity key and update the field.
  taxonomy             8701                                                    hook_update_n   Add an index on the 'taxonomy_term__parent' field table.
  comment              add_ip_address_setting                                  post-update     Add comment settings.
  content_moderation   entity_display_dependencies                             post-update     Update the dependencies of entity displays to include associated workflow.
  content_moderation   set_default_moderation_state                            post-update     Set the default moderation state for new content to 'draft'.
  content_moderation   set_views_filter_latest_translation_affected_revision   post-update     Set the filter on the moderation view to be the latest translation affected.
  layout_discovery     recalculate_entity_form_display_dependencies            post-update     Recalculate dependencies for the entity_form_display entity.
  layout_discovery     recalculate_entity_view_display_dependencies            post-update     Recalculate dependencies for the entity_view_display entity.
  media                enable_standalone_url                                   post-update     Keep media items viewable at media{id}.
  menu_link_content    make_menu_link_content_revisionable                     post-update     Update custom menu links to be revisionable.
  system               add_expand_all_items_key_in_system_menu_block           post-update     Initialize 'expand_all_items' values to system_menu_block.
  system               clear_menu_cache                                        post-update     Clear the menu cache.   @see https:www.drupal.orgprojectdrupalissues3044364
  taxonomy             make_taxonomy_term_revisionable                         post-update     Update taxonomy terms to be revisionable.
  taxonomy             remove_hierarchy_from_vocabularies                      post-update     Remove the 'hierarchy' property from vocabularies.
  views                exposed_filter_blocks_label_display                     post-update     Update exposed filter blocks label display to be disabled.
  views                make_placeholders_translatable                          post-update     Rebuild cache to allow placeholder texts to be translatable.
 -------------------- ------------------------------------------------------- --------------- ------------------------------------------------------------------------------
Аватар пользователя listman listman 10 мая 2019 в 12:19

Не один из патчей на д.орге не помог.
Решил проблему загрузкой дампа БД до обновления и повторным обновлением.

Аватар пользователя Murz Murz 10 июня 2019 в 13:55

Словил такую же проблему после обновления на 8.7, причём все апдейты нормально прошли без ошибок. Но обнаружил проблму слишком поздно, что уже старый дамп накатить слишком проблемно - очень много всего наменяли поверх. Можете скинуть ссылки на патчи д.орга по этой теме? Может они мне помогут хоть как-нибудь...

Аватар пользователя Murz Murz 11 июня 2019 в 19:17

Для своей уже обновлённой на 8.7 базы рабочего сайта запилил вот такие костыли, чтобы повторить неудачное обновление таблиц таксономии:
1. Увеличить таймауты у mysql - в mysql.conf:

[mysqld]
wait_timeout = 600
connect_timeout = 600

2. Удалить вручную таблицы (если уже создались) из sql-базы:

taxonomy_term_revision
taxonomy_term_field_revision
taxonomy_term_revision__parent
taxonomy_term_revision__*

3. Убрать информацию об успешном обновлении в базе Друпала через drush и заново повторить установку обновлений:

drush eval "drupal_set_installed_schema_version('taxonomy', 8701);"

drush eval '$updates = \Drupal::keyValue("post_update")->get("existing_updates");
if (($key = array_search("taxonomy_post_update_make_taxonomy_term_revisionable", $updates)) !== false) {
   unset($updates[$key]);
}
\Drupal::keyValue("post_update")->set("existing_updates", $updates);'

drush updb

После этого все ошибки пропали и вроде как всё работает нормально.