In #2609310: Add highwater/track_changes examples to beer migrations, adding track_changes to the beer_term migration does not work as expected (changed source data does not get reimported). I've recently used track_changes with XML and JSON feeds successfully, so I was a bit perplexed, but I figured it out - with a SQL source, if possible (and ignore_map is not set), the source query is joined directly with the map query, so any previously-imported rows are not retrieved from the database. For track_changes to work, all source rows must be retrieved and hashed to check for changes, so the track_changes setting needs to disable the map join.
Easy to fix, just needs a test...
Comment | File | Size | Author |
---|---|---|---|
#26 | interdiff.2787185.25-26.txt | 2.1 KB | mikelutz |
#26 | 2787185-26.drupal.trackchanges-does-not-work-when-the-map-is-joinable.patch | 10.81 KB | mikelutz |
#25 | interdiff.2787185.24-25.txt | 2.15 KB | mikelutz |
#25 | 2787185-25.drupal.TEST-ONLY.patch | 8.71 KB | mikelutz |
Comments
Comment #3
kekkisRerolling on top of 8.2.x
Comment #4
kekkisComment #5
svendecabooterI can confirm the patch above works.
Comment #9
mvbaalen CreditAttribution: mvbaalen commentedUpdated the patch #3 for version 8.5.1.
Comment #10
mikeryanLet's run this through the testbot just to be sure (then set back to Needs work for tests).
Comment #11
borisson_Back to needs work for those tests, per #10.
Comment #12
quietone CreditAttribution: quietone at Acro Commerce commentedAlso, the comment is > 80 characters. And it would be better if the comment explicitly states what happens when track_changes is set instead of somewhat burying it in a phrase in parenthesis.
Comment #13
mpotter CreditAttribution: mpotter at Phase2 commentedI ran into this problem today and I confirm that the patch in #9 fixes this. I am raising the priority here because this problem essentially breaks the D7 -> D8 migration when using track_changes to update changed content. Without this patch none of the changes to fields on the content type were detected as changes. So, before the patch I had:
But after the patch I got:
As far as I can tell, this affects all D7-> D8 migrations that need to track changes for incremental migrations...only new content gets created.
Comment #15
lemuelsantos CreditAttribution: lemuelsantos commentedUpdated the patch #3 for version 8.6.2.
Comment #16
quietone CreditAttribution: quietone at Acro Commerce commentedTesting on 8.6.x
Comment #17
jcisio CreditAttribution: jcisio as a volunteer and at Axess Open Web Services for Institut français commented@lemuelsantos I don't see any difference between your patch (#15) and the previous one (#9). Still needs test.
Comment #19
botrisAttached a new version of #9 (15 is identical) with tests.
Comment #21
botrisRemoving hierarchy from test, as is not relevant. And test against 8.7
Comment #22
botrisComment #23
mikelutzResetting Version to 8.8
Comment #24
botrisAdding missing comma for code style.
Comment #25
mikelutzThese tests look really good. I'm uploading a patch with just the test now, and I'm going to upload a tweak to the fix to improve readability shortly.
Comment #26
mikelutzNew fix. We have logic for determining joinability spread into the constructor, the iterator initialization and the dedicated mapJoinable() method. This moves all the joinability logic into the mapJoinable() method for clarity.
Comment #28
mikelutzComment #29
botrisI've retest a migration with
track_changes: true
, without the patch changes in the source are ignored, with the patch changes in the source are picked up and migrations are updated.Comment #30
mikelutzThanks, but because your code is in the patch, you aren't eligible to rtbc, and neither am I. We will need heddn or someone else to rtbc now.
Comment #31
BenStallings CreditAttribution: BenStallings as a volunteer commentedI was able to replicate the problem and the solution! The term whose details I modified updated when I ran `drush mim` a second time without the update flag.
However, the other two terms that I had not modified also updated, so I think a test somewhere in this code is giving false positives. Sorry!
Comment #32
botris@BenStallings I'm unable to reproduce your findings. But if I understand correct, all your items get updated every time you run a migration if you have
track_changes: true
?Could you maybe provide more information on how to reproduce this?
Comment #33
BenStallings CreditAttribution: BenStallings as a volunteer commentedSorry to be unclear. Here is what I did:
Thanks!
Comment #34
botrisI've done everything again from scratch and I can't reproduce.
This is what I've done, fresh D8.8 install and added contrib modules migrate_tools and migrate_plus.
track_changes: true
to sourcedrush mim beer_term
, result: 3 terms createsmigrate_example_beer_topic
drush mim beer_term
, result: 1 term updatedPlease note that if you edit the style column you will get a new term as that's the primairy key.
As far as I can tell this is good for "Needs review".
Comment #35
heddnThis looks good. Tests cover things. Mentally debated the vocab being created in the test module's config but it isn't that big of a deal. Onward.
Comment #36
alexpottCommitted and pushed fc11a4f5c1 to 8.8.x and 2c7fde88e2 to 8.7.x. Thanks!
This is a nice thing to get fixed! Backported to 8.7.x because this is a major bug fix.
Comment #40
xjmJust to document here: We don't use "needs backport" tags for minor versions. Issues are backported (or not) according to release allowed changes policy. The branch field should be set to the earliest minor branch that is eligible for the fix based on this policy. Thanks!