Problem/Motivation

See #2746541-400: Migrate D6 and D7 node revision translations to D8
#2746541-403: Migrate D6 and D7 node revision translations to D8
#2746541-405: Migrate D6 and D7 node revision translations to D8

This happened with a content type is using entity translation. The field types are simple text fields. In our system there are fields that were translatable in D7 and are no longer translatable in D8. See #6

It is possible that this happens with draft revisions, for example when workbench moderation is used. See #6

Proposed resolution

Remaining tasks

Needs steps to reproduce

User interface changes

API changes

Data model changes

Release notes snippet

Comments

catch created an issue. See original summary.

catch’s picture

gábor hojtsy’s picture

Title: Some older revisions do not get revision_translation_affected marked by migration » Some older revisions do not get revision_translation_affected marked by migration when Workbench Moderation is used
wim leers’s picture

quietone’s picture

Issue tags: +i18n-migrate
firewaller’s picture

This issue is misdiagnosed as being related to Workbench Moderation since it was an unknown factor when I commented in the related issue above.

The issue is actually related to how D7 to D8 node translation revisions are handled when a D7 translation node (i.e. "de") has a different field value from their source translation node (i.e. "en") in fields that are now considered "untranslatable" in D8. When this is the case during migration, \Drupal\Core\Entity\ContentEntityBase::hasTranslationChanges will set "revision_translation_affected" to "1" for "en" incorrectly when it should only assign it for "de". Conversely also during migration, it will sometime skip setting "revision_translation_affected" to "1" for "de" (and all other languages).

So the solution was extending Drupal\node\NodeStorage::populateAffectedRevisionTranslations during migrations to enforce the "revision_translation_affected" value:

// Double-check to prevent migrated source from getting mis-assigned.
if ($new_affected && $langcode != $entity->get('langcode')->value) {
  $new_affected = NULL;
}
elseif (!$new_affected && $langcode == $entity->get('langcode')->value) {
  $new_affected = TRUE;
}
catch’s picture

Title: Some older revisions do not get revision_translation_affected marked by migration when Workbench Moderation is used » Some older revisions do not get revision_translation_affected marked correctly by migration when different language co-exist in un-translatable fields

@firewaller thanks for following up with the extra information, tried to retitle although hard to encapsulate in one sentence.

catch’s picture

Title: Some older revisions do not get revision_translation_affected marked correctly by migration when different language co-exist in un-translatable fields » Migrate sets revision_translation_affected incorrectly when different languages co-exist for 8.x un-translatable fields
quietone’s picture

Component: node system » migration system
Priority: Critical » Major
Status: Active » Postponed (maintainer needs more info)

@firewaller, thanks for the update. Can you provide some detail about the source site so I can replicate that for testing? In this case, replicate means updating the source db fixture. Is the content type using entity translation? What is the field type and any relevant settings?

I am intrigued by "in fields that are now considered "untranslatable" in D8." Are you saying that the fields were translatable on D7 and were changed during migration? Or something else?

Thx

I'm not sure why this is Critical, there is no data loss, there is no indication that the site is not usable and there is workaround. Changing to major. I'm sure someone will correct that if I am wrong.

Also, changing to migration_system because that is what is reviewed at migrate meetings.

franz’s picture

I came across this issue when investigating something similar happening with Scheduler. It helped a lot to identify the problem pointed out in #6 so I am sharing this issue #3080979-19: Schedule does not work for forward pending revisions after published as it could shed some light here.

firewaller’s picture

@quietone sorry for the late response, but thank you for looking into this and relabeling it.

Yes, the content type is using entity translation. The field types are simple text fields.

Yes, in our system there are fields that were translatable in D7 and are no longer translatable in D8.

I am happy to provide further context if necessary.

quietone’s picture

@firewaller, thank you. It would help to know more about the fields that 'were translatable in D7 and are no longer translatable in D8'. Is there any difference between the fields that were translatable on D7 and are still translatable on D8 versus those that are no longer translatable on d8? Oh, when responding to issues marked Postponed (maintainer needs more info) please change the issue status. Thanks.

Version: 9.0.x-dev » 9.1.x-dev

Drupal 9.0.10 was released on December 3, 2020 and is the final full bugfix release for the Drupal 9.0.x series. Drupal 9.0.x will not receive any further development aside from security fixes. Sites should update to Drupal 9.1.0 to continue receiving regular bugfixes.

Drupal-9-only bug reports should be targeted for the 9.1.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.2.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.1.x-dev » 9.3.x-dev

Drupal 9.1.10 (June 4, 2021) and Drupal 9.2.10 (November 24, 2021) were the last bugfix releases of those minor version series. Drupal 9 bug reports should be targeted for the 9.3.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Closed (outdated)
Issue tags: -Workbench Moderation +Bug Smash Initiative

First, I should point out that migration does not alter revision_translation_affected.

I am removing the workbench moderation tag based on #6

The issue is actually related to how D7 to D8 node translation revisions are handled when a D7 translation node (i.e. "de") has a different field value from their source translation node (i.e. "en") in fields that are now considered "untranslatable" in D8. When this is the case during migration, \Drupal\Core\Entity.

As I understand this the source is using entity translation with a field. That field has value A in the source language node and value B in the translated node. And when that is migrated the field in no longer translatable.

I tested that with a clean standard install of Drupal 7 and added Italian as the second language. I then added a content type that uses entity translation with a translatable text field. I created two node, one with English as the source language and the other with Italian as the source language and added data in the text field. I translated each node and changed the data in the text field for the translation.

I then migrated that to a Drupal 10.1.x site using the UI. After the migration the two nodes and the translates were present, the text fields were translatable and the data was correct. Revision_translation_affected was set to 1. I then tested with the classic migrations using drush and again everything migrated as expected.

Unless I am missing something, I can't reproduce the problem.

More details were asked for 2 years and no extra information has been provided. There have been no further reports of this problem. Based on that and my own testing I am closing this as cannot reproduce. Reopen and leave a comment if I am mistaken.

kunalkursija’s picture

I faced this today for doing paragraph_items to block_content migration, From Drupal 7 to Drupal 9. In my case, The block_content(of XYZ type) in D9 is translatable and paragraph_items in D7 were not translatable, But the nodes to which they are attached are translatable in D7.

I had to migrate all the revisions of the paragraphs[Not going into the details of work around paragraph's item-id/revision-id and node's nid/tnid to create revisions/translations of block_content].

When I ran the migration I faced a problem where the 'revisions' tab of the source translation showed more revisions than the actual count.

After looking into the tables, I sensed something was wrong with the 'revision_translation_affected' flag in tha DB table block_content_field_revision. And, Then I came across this issue and #6 by @firewaller. I used that solution by overriding the block_content entity's storage handler and it solved the problem and revisions tab started showing correct data.