Problem/Motivation
@todo
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #48 | 3122649.patch | 32.77 KB | pcambra |
| #41 | core-derive_path_alias_migrations-3122649-41.patch | 32.19 KB | wim leers |
| #41 | interdiff.txt | 1.12 KB | wim leers |
| #40 | 3122649-40.patch | 31.61 KB | ravi.shankar |
| #38 | core-derive_path_alias_migrations-3122649-38.patch | 31.6 KB | wim leers |
Comments
Comment #2
huzookaComment #3
huzookaComment #4
wim leers🤔 I was really confused by what
$optional_migration_dependencieswas for.But I think I get it now!
It's about the optional migration dependencies for the
d*_url_aliasmigration's "catch-all" derivative.I think a variable name like
$other_entity_destination_migrationswould have made this a lot clearer.🤔 This comment talks about required dependencies, but then the code it comments does not do anything with required dependencies?
🤔 I find this pretty difficult to understand.
Why only
entityandentity_complete? Why notnodeandnode_complete? And isn't itd7_node_completefor examle?The first comment belongs on the second if-statement.
The first if-statement needs a comment like
// Only modify migrations with an entity destination.👍🤣 Imagine, aliases for aliases!
👍 I was gonna ask:
But this is much more robust! 👏
Rather than this comment, I think you could write
🐛
d6_url_migration→d6_url_alias migration👍 This matches the logic of
\Drupal\jsonapi\ResourceType\ResourceTypeRepository::isLocatableResourceType().When can this happen?
Why is it okay to return early?
This needs some documentation :)
🤓 Let's make this a class constant.
This comment is pointing out something pretty obvious — this can be removed?
😍👏 Very elegant!
s/that's/whose/
80 cols 🤓
😍👏
🤔 Couldn't this result in hundreds or even tens of thousands of values in that
INexpression in the SQL query? That query would fail.I did not expect this would change the number of
path_aliasentities. This sounds like a bug? 🤔Comment #5
wim leersEverything in #4 is superficial, except for points 17 and 18. I wonder if point 18 is caused by point 3.
Comment #6
wim leersI think a label like
Non-entity path aliaseswould make more sense.Comment #7
huzookaRe #6:
Marginal note: If the taxonomy module is not installed on the destination site, we won't create term specific derivatives, but the Other derivative will try to migrate the term aliases from the source site.
Comment #8
wim leersI found and fixed a dependency problem. :)
Comment #10
huzookaAddressed most of the feedbacks in #4; except of #4.18.
#4.1: variable renamed 🙂
#4.2: I hope that the new comment is clearer now.
#4.3: Well, we don't have migration source plugins like
nodeornode_complete. I check the destination plugin here.d7_node_completeis a migration plugin ID.#4.4: Fixed.
#4.5, #4.6: 😊
#4.7, #4.8: Fixed
#4.10: Hoping that the new line makes more sense...
#4.11: I made a new trait where this is a protected property. May it work?
#4.12: Removed.
#4.13: Thanks! 🙂
#4.14, #4.15: Fixed
#4.16: 😊
#4.17: I fixed this by the help of a new trait that provides the base for both the Deriver class and the migration source plugin.
#4.18: I don't know why this is happening, we have to check this. The Drupal 7 database fixture contains only 6 rows...
Comment #11
wim leers👏
Comment #12
huzookaOnly one failing test expected...
Comment #13
huzookaComment #15
wim leersThis rebases the patch on latest
9.0.xand massively improves query performance.For a site with 28K nodes, 50K path aliases and 7 node types, this makes the computing of the per-node-bundle derivatives
d7_url_alias:node:*go down from 61 seconds to 20 milliseconds — or about 3000 times faster!Comment #17
wim leersWith #15 solved,
\Drupal\path\Plugin\migrate\source\d7\UrlAlias::count()was still super slow. And in the project I'm working on, we're hitting that all the time.But …
public function count($refresh = FALSE)is the signature. The refresh is optional. And if the source DB doesn't change after discovery time, then the counts stay the same. Clearing all caches after refreshing the source DB is no big deal obviously.So … YAY, rather than doing expensive queries and trying to optimize those (which I first did: I was bringing the same more efficient query pattern from #15 to
\Drupal\path\Plugin\migrate\source\d7\UrlAlias::query()), we can just use the numbers at query time! Much faster!Comment #19
wim leersOops.
Comment #21
wim leersWell, #17 made
::count()run in constant time, but we still need to speed up::query()since that's actively used by the migration system also.Applying a similar query optimization as in #17.
Comment #23
wim leers@huzooka queued PostgreSQL & SQLite test runs of #21, those show that the migrations are now failing on those databases. This is due to the use of
SUBSTRING_INDEX(), which is MySQL-specific. Figuring out an alternative query … 🤔Comment #24
wim leersThis should make the patch also work on SQLite.
Comment #25
wim leers😬 Forgot to
git adda few bits 🙈Comment #28
wim leers@huzooka rightfully pointed out in chat to me just now that it's wrong to assume the first link template is the canonical one.
However, for the currently supported entity types (
NodeandTerm), this assumption holds true 🙈🤓Whenever we expand this to support more entity types (or before this patch gets committed to Drupal core), we'd need to fix this.
Comment #29
huzookaNitpick: We are actively using the patches here, but it seems that no one has any idea what "Non-entity URL aliases" are. So I'll change the label of the remaining aliases' migration to 'URL aliases (remaining)' (as requested).
Comment #30
huzookaComment #32
wim leersThis introduced a regression.
It only counts the unique number of terms of a vocabulary that have an URL alias.
That means it fails to count every URL alias for terms in a given vocabulary.
In other words: it always counts a single URL alias per term, even if a term has lots of historical path aliases.
The consequence when combined with the
__count_at_discovery_timeoptimization is that the reported total count can be lower than the imported count! 🙃🙈This interdiff fixes that, and reverts a bunch of the now obsolete changes that I introduced in #15.
Comment #34
wim leersWe should also skip
redirectmigrations (for https://www.drupal.org/project/redirect).Comment #37
wim leers#17 was true at the time but now with #3190815: Source count caching broken: impossible to enable source count caching for SqlBase-based source plugins (plus, unneeded cache I/O), a better/simpler approach is possible: let the migration system's built-in source count caching take care of this!
Comment #38
wim leersOops. That included a
*.origfile 🙈The patch in #37 is incorrect. The interdiff is correct though.
Comment #39
wim leersAh, apparently this conflicts with #3096951: d7_node migration should have dependency on d7_node_title_label migration 😬Which the migration maintainers have shot down. Ah well, then there won't be a patch that applies.
Comment #40
ravi.shankar commentedAdded reroll of patch #38.
Comment #41
wim leersThe patches so far generate optional dependencies on
d7_shortcut,d7_custom_block, et cetera. This does not make sense, because they only have admin-facing URLs.Comment #47
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 #48
pcambraAdding a rebased patch with oop hooks, in case someone is migrating from D7 to D11 and needs this
Comment #49
quietone commentedThe Migrate Drupal and Migrate Drupal UI modules are deprecated and will be removed from Drupal 12. Since these are deprecated feature requests and some tasks will not be fixed.