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
| Comment | File | Size | Author |
|---|---|---|---|
| #51 | 2597650-51.patch | 5.63 KB | shubham.prakash |
| #44 | interdiff_42-44.txt | 539 bytes | heddn |
| #44 | 2597650-44.patch | 5.73 KB | heddn |
Comments
Comment #2
phenaproxima+1. This will require changes to the d6_node builder and the d6_node source plugin, but those should be fairly straightforward.
Comment #3
svendecabooterIsn'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.
Comment #4
quietone commentedComment #5
foxtrotcharlie commentedI 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.
Comment #7
mikeryanComment #8
mikeryanComment #9
mikeryan@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.
Comment #11
heddnWe discussed this in the weekly migrate meeting and think this can be resolved in a non-BC breaking manner.
Comment #13
mikeryanThis 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.
Comment #14
heddnCross-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.
Comment #15
heddnComment #16
heddnNeeds 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
Comment #18
heddnHopefully 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.
Comment #19
heddnI'm looking specifically at https://www.drupal.org/core/d8-bc-policy#classes to make my judgment call about marking @internal.
Comment #21
heddnComment #23
heddnLet's hope that catching requirements will grab a bubbled up PNFE.
Comment #25
heddnComment #26
heddnUpdating credits to reflect sponsored work.
Comment #28
vomitHatSteve commentedI 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?
Comment #30
anpolimusComment #32
heddn#2934799: d6_term_node_revision migration ignores a lot of items that it shouldn't might give some ideas for test coverage here.
Comment #33
rakesh.gectcrRerolled the #25
Comment #34
rakesh.gectcrComment #37
heddnHere's a re-roll and a small tweak to hopefully get fewer failures.
Comment #38
heddnComment #40
heddnComment #42
heddnComment #44
heddnComment #45
heddnOK, 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.
Comment #46
heddnA 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.
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.
Comment #47
heddnI 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.
Comment #49
quietone commentedThis needs a reroll to use the field discovery service, migrate_drupal.field_discovery.
Comment #50
shubham.prakash commentedComment #51
shubham.prakash commentedThis patch should fix the issue.
Comment #53
ajits@shubham.prakash - Thank you for the reroll. It is adviced that once you reroll the patch you remove the "Needs reroll" tag.
Comment #62
quietone commentedThe 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.
Comment #63
quietone commentedNow 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!