Problem/Motivation

Right now, the relationships between taxonomy terms and nodes are migrated in their own migrations - the d6_term_node and d6_term_node_revision templates are instantiated once for each vocabulary (or is it each vocabulry/node type combination?). This means that during a migration process, any given node is saved not only by the node migration, but is again saved for each vocabulary it references, which is... inefficient. It's also illogical - the node migration should be complete in itself and not require additional migrations to "finish" it. The node migrations should pull in and map the term_node relationships directly.

Proposed resolution

Do it.

Remaining tasks

Add tests for new solution
Add deprecation notices to old
Remove old term node migration (but keep the source for BC)
Make sure there are BC tests for term node migrations

User interface changes

n/a

API changes

n/a

Data model changes

n/a

Comments

mikeryan created an issue. See original summary.

phenaproxima’s picture

+1. This will require changes to the d6_node builder and the d6_node source plugin, but those should be fairly straightforward.

svendecabooter’s picture

Isn't it strange to move this logic into the node migration logic, since D6 sites can be set up without the Taxonomy module enabled?
In that case, the node migration would attempt to migrate D6 {term_node} data, which doesn't exist in the source.
Feels weird to me to have taxonomy-related migration logic in the node module.

Maybe I'm missing the point totally, but shouldn't the d6_term_node migration be reworked like this:
* Make sure to depend on node & taxonomy term migrations
* Source plugin gets the nid / tid combination from D6 {term_node}
* Process plugin uses "migration" plugins to process these source values
* Destination plugin doesn't save the node entity, but is just a custom destination plugin that adds the data to D8 {taxonomy_index} through the proper APIs
Or is that overly simplified? Haven't look into this very deeply, so I could be totally wrong :)

Would like to give this a shot if this can be clarified a bit more.

quietone’s picture

Issue tags: +migrate-d6-d8
foxtrotcharlie’s picture

I just ran a D6-D8 migration and was wondering why my node's 'changed' (updated date) was set to the time of the migration, and not to the source field's value. Haven't done any detailed testing but it seems like the d6 term node migration actually sets the node's changed field when it runs and doesn't respect the actual source's 'changed' value which is set correctly during the d6_node__content_type migration. Need to investigate further and test but was searching and came across this issue so thought I'd mention it here in case it's relevant. Happy to create a new issue if necessary, and after being able to verify.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mikeryan’s picture

mikeryan’s picture

Version: 8.1.x-dev » 8.2.x-dev
mikeryan’s picture

@foxtrotcharlie: Yes, the separate d6_term_node migration is what's rewriting node changed timestamps. The proposal in this issue would prevent that from happening. While I'm tempted to upgrade this issue to Major on behalf of that problem, though, it can probably be fixed much more simply on its own: #2754787: d6_term_node migration overwrites node changed timestamps.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

heddn’s picture

Issue tags: -Migrate BC break

We discussed this in the weekly migrate meeting and think this can be resolved in a non-BC breaking manner.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mikeryan’s picture

Priority: Normal » Major
Issue tags: +Performance

This also has significant performance issues - the d6_term_node migration will (on top of the original d6_node migration) save each node N times where N is the number of vocabularies attached to the node type. Bumping to Major.

heddn’s picture

Cross-posting. Fixing this would help with performance. Given a scenario where there are 10 vocabularies related to a node type, and there are 1000 nodes, we've set ourselves up for 1000 node saves for the initial node migration, plus an additional 10,000 node saves. A thousand for each vocabulary.

heddn’s picture

Issue tags: +Baltimore2017
heddn’s picture

Issue summary: View changes
Status: Active » Needs review
Issue tags: +Needs change record
StatusFileSize
new2.63 KB

Needs tests, but here's a start. Marking NR to see what fails.

Next steps:
Add tests for new solution
Add deprecation notices to old
Remove old term node migration (but keep the source for BC)
Make sure there are BC tests for term node migrations

Status: Needs review » Needs work

The last submitted patch, 16: 2597650-16.patch, failed testing.

heddn’s picture

Status: Needs work » Needs review
StatusFileSize
new2.65 KB
new4.12 KB

Hopefully fixes the test failures. With #2873395: [meta] Add @internal to core classes, methods, properties recently opened, I think we should mark D6NodeDeriver as @internal. If I don't hear any objections, I'm going to do that in my next patch.

heddn’s picture

I'm looking specifically at https://www.drupal.org/core/d8-bc-policy#classes to make my judgment call about marking @internal.

Status: Needs review » Needs work

The last submitted patch, 18: 2597650-18.patch, failed testing.

heddn’s picture

Status: Needs work » Needs review
StatusFileSize
new4.84 KB
new1019 bytes

Status: Needs review » Needs work

The last submitted patch, 21: 2597650-21.patch, failed testing.

heddn’s picture

Status: Needs work » Needs review
StatusFileSize
new5.06 KB
new1.29 KB

Let's hope that catching requirements will grab a bubbled up PNFE.

Status: Needs review » Needs work

The last submitted patch, 23: 2597650-23.patch, failed testing.

heddn’s picture

Status: Needs work » Needs review
StatusFileSize
new5.53 KB
new3.56 KB
heddn’s picture

Updating credits to reflect sponsored work.

Status: Needs review » Needs work

The last submitted patch, 25: 2597650-25.patch, failed testing.

vomitHatSteve’s picture

I don't know if it should be in a separate issue or not, but aren't there a number of migrations that are susceptible to this same issue?

e.g. the d6_upload migration also re-saves an existing d6_node causing the same performance problems and erroneously updating the timestamp.

The more of these things we run into, the more this will exacerbate the concern that svendecabooter highlighted above about including taxonomy (and file, etc.) migration data in the node migration, right?

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

anpolimus’s picture

Issue tags: +CSKyiv18

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

heddn’s picture

rakesh.gectcr’s picture

Status: Needs work » Needs review

Rerolled the #25

 d8migrate.local git:(8.6.x) ✗ git apply -v 2597650-25.patch
Checking patch core/modules/node/src/Plugin/migrate/D6NodeDeriver.php...
Checking patch core/modules/node/src/Plugin/migrate/source/d6/Node.php...
Hunk #2 succeeded at 23 (offset 2 lines).
Hunk #3 succeeded at 182 (offset 2 lines).
Checking patch core/modules/node/src/Plugin/migrate/source/d6/NodeRevision.php...
Hunk #1 succeeded at 15 (offset 2 lines).
Applied patch core/modules/node/src/Plugin/migrate/D6NodeDeriver.php cleanly.
Applied patch core/modules/node/src/Plugin/migrate/source/d6/Node.php cleanly.
Applied patch core/modules/node/src/Plugin/migrate/source/d6/NodeRevision.php cleanly.</a>
rakesh.gectcr’s picture

StatusFileSize
new5.37 KB

Status: Needs review » Needs work

The last submitted patch, 34: 2597650-33.patch, failed testing. View results

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

heddn’s picture

StatusFileSize
new5.53 KB
new3.37 KB

Here's a re-roll and a small tweak to hopefully get fewer failures.

heddn’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 37: 2597650-37.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

heddn’s picture

Status: Needs work » Needs review
StatusFileSize
new5.25 KB
new1.95 KB

Status: Needs review » Needs work

The last submitted patch, 40: 2597650-40.patch, failed testing. View results

heddn’s picture

Status: Needs work » Needs review
StatusFileSize
new5.73 KB
new2.06 KB

Status: Needs review » Needs work

The last submitted patch, 42: 2597650-42.patch, failed testing. View results

heddn’s picture

Status: Needs work » Needs review
StatusFileSize
new5.73 KB
new539 bytes
heddn’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

OK, now that it is green, it means we didn't break anything. So we need to add tests and figure out a way to deprecate the old migrations.

heddn’s picture

A few thoughts from working on this today. This is going to be tricky. Right now we don't break anything with this patch. But we don't fix anything yet either. To map the final field names in the d6 node deriver, we need the output of d6_vocabulary_field migration. But derivers run during plugin discovery. So we cannot derive the field names until later. But at that point, then we cannot inject the field names because derivers have already run. We could duplicate the logic that is being done inside of that migration. But that seems wrong.

  # This value is only used in the 'field_name' process pipeline below.
  raw_field_name:
    -
      plugin: migration_lookup
      migration: d6_taxonomy_vocabulary
      source: vid
    -
      plugin: skip_on_empty
      method: row
  field_name:
    # Prepend field_ to avoid conflicts with base fields, and make sure the
    # result is no longer than 32 characters.
    -
      plugin: concat
      source:
        - constants/field_prefix
        - '@raw_field_name'
    -
      plugin: substr
      length: 32
    -
      # This plugin checks if the vocabulary being migrated is the one used by
      # Forum. If so, we use the machine name that Forum expects. Otherwise, we
      # leave it unchanged.
      plugin: forum_vocabulary
      machine_name: taxonomy_forums

Perhaps better we encapsulate all the above into a new process plugin that can be called from both places. So we can call the same logic in both places using the same inputs. Which result in the same field name getting generated. And we can map things.

heddn’s picture

I just discovered migrate_drupal_migration_plugins_alter. And opened #3020329: [policy, no patch] declare the migration ymls in core subject to change per minor version.

The current plan here is to continue with the work and deprecate the term_node migrations. And in migrate_upgrade (contrib) filter them out. This let's us keep maximum BC because anyone using the core UI will still get the same result. But anyone using drush tooling can remove the extra step of term node migrations.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

quietone’s picture

This needs a reroll to use the field discovery service, migrate_drupal.field_discovery.

shubham.prakash’s picture

Assigned: Unassigned » shubham.prakash
shubham.prakash’s picture

Assigned: shubham.prakash » Unassigned
Status: Needs work » Needs review
StatusFileSize
new5.63 KB

This patch should fix the issue.

Status: Needs review » Needs work

The last submitted patch, 51: 2597650-51.patch, failed testing. View results

ajits’s picture

Issue tags: -Needs reroll

@shubham.prakash - Thank you for the reroll. It is adviced that once you reroll the patch you remove the "Needs reroll" tag.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

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

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

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

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

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

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.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.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now 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.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now 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.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now 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.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Status: Needs work » Postponed

The Migrate Drupal Module was approved for removal in #3371229: [Policy] Migrate Drupal and Migrate Drupal UI after Drupal 7 EOL.

This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.

The deprecation work is in #3522602: [meta] Tasks to remove Migrate Drupal module and the removal work in #3522602: [meta] Tasks to remove Migrate Drupal module.

Migrate Drupal will not be moved to a contributed project. It will be removed from core after the Drupal 12.x branch is open.

quietone’s picture

Status: Postponed » Closed (won't fix)

Now that Migrate Drupal is deprecated this will not be fixed. Therefore, this task is closed as won't fix.

Thanks to all for working on this!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.