Closed (fixed)
Project:
Drupal core
Version:
8.8.x-dev
Component:
migration system
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
28 Nov 2019 at 11:48 UTC
Updated:
4 Jan 2020 at 01:54 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
wim leersThis appears to work fine. Notes:
D7NodeTitleDeriveris strongly inspired by\Drupal\node\Plugin\migrate\D7NodeDeriver.D7NodeDeriverrefines the dependency that #3096951: d7_node migration should have dependency on d7_node_title_label migration adds to use the more specific one instead.Comment #3
wim leersD'oh, this is the correct patch.
Comment #4
wim leersI also realized something more problematic still: right now, a
base_field_overrideconfig entity is being created in Drupal 8 for every node type. Even if the title label was not customized in Drupal 7!See https://git.drupalcode.org/project/drupal/blob/7.67/modules/node/node.mo... — the title label is set to

Titleby default. Onwimleers.com, it's customized for only one node type, yet it was resulting in many config entities being created. Look at thetitle_labelcolumn in this screenshot ofwimleers.com'snode_typetable:The migration should be smarter; it should not create pointless configuration on the Drupal 8 destination site.
Comment #5
quietone commentedI understand the intention here, but let's not limit the source plugin like this. Normally, a source plugin gets all the data and the process plugin does the filtering. Yes, there are exceptions and prepareRows() do a lot of work in some cases. Instead, lets remove this and modify the pipeline in d7_node_title_label as needed.
Comment #6
wim leersThanks so much for the review! 😊
That's also what I thought first. But then I realized that if I do filtering in the process stage, that the "total count" (which is based on the source count) will always be inaccurate. We'd just end up skipping a lot of rows. I'd love to be told that I misunderstood the code though! Could you point me in the right direction? 🙏
The reason I believe this matters: it's very confusing to have N rows (or even N migrations) for this if we know for a fact that only 1 row (or 1 migration) actually contains data to be migrated, because only one Node Type has had its title label customized. (If this explanation isn't clear enough, I'm happy to explain in more detail, with annotated screenshots.)
Comment #7
wim leersI just noticed that #3069776: SQL source plugins: allow defining conditions and join in migration yml is related to #6.
Comment #8
quietone commentedRereading this again and it seems that the problem is that base_field_overrides are created for every content type when it only needs to be created when the title field is, in fact, overridden. (If I understood that correctly then the IS needs an updated.) And that can be tested if the field label is not 'Title'. A deriver is not needed to do that, as the attached patch shows.
The total rows returned by the source plugin will be equal to the number of content types. We want the source plugin to make available all the data to the pipeline, which is where decisions are made. I understand the desire to change the source plugin to get 'just the data we want' as I have done that on several occasions for some of the i18n source plugins and each time I get feedback that the source plugin needs to get all the data. Plus, in this case we are not changing a source plugin which would then require changing the test.
Changing to NR to run tests.
Comment #10
meenakshig commentedComment #11
wim leersComment #12
quietone commentedI don't think this needs to be postponed. And the test has been updated to test the change to the migration.
Comment #13
wim leersSince this patch now looks completely different than the one I posted in #3, and it still solves the problem … I'm gonna be bold and RTBC this :)
Comment #17
heddnMinor point, but an update IS and title would be appropriate at this point. Let's go back to NW for those small fixes.
Comment #18
wim leersComment #19
heddn+1 on RTBC. IS and title make a lot more sense now given what is in the patch.
Comment #20
wim leersGreat! :) Thanks for the guidance, @heddn and especially @quietone! Much appreciated 🙏
Comment #21
webchickThese comments might be out of step with The Way In Which Things Are Done™ in the migrate system, so only setting down to "Needs review" vs. "needs work"... nevertheless, these were my impressions:
What's the significance of this change? Could we maybe leave a comment behind, so this doesn't accidentally get reordered in the future, which breaks this behaviour again?
Nitpick: "types"
This does not seem to be reflective though of the use case brought by Wim. Wim had one content type in the database which was doing a title override. The remainder were not. Could we expand the comments here, like:
...or something like that?
Comment #22
wim leersThat's in
\Drupal\Tests\migrate_drupal_ui\Functional\d7\Upgrade7Test::getEntityCounts(). The documentation for that method says it all:+1 to the other remarks @webchick posted :)
Comment #23
quietone commentedNW to update the comments.
Comment #24
quietone commentedUpdating comments. Oddly, the patch didn't apply for me so there is a diff not interdiff. The patch failed on /core/modules/migrate_drupal_ui/tests/src/Functional/d7/Upgrade7Test.php.
Comment #25
wim leersThanks!
Comment #29
webchickI ideally wanted a bit more "why" there but quietone out-voted me, so we'll go with this, which is certainly better than the status quo. :)
Committed and pushed to 9.0.x; 8.9.x; 8.8.x. Thanks!