Problem/Motivation
See #2748609: [meta] Preserving auto-increment IDs on migration is fragile and #2818155: Add comments to d6_file stating the conflicts with d6_user_picture_file. 6.x user pictures didn't have a record in file_managed - they were just on disk with magic naming. In 8.x they become managed files, but this means they need a new fid assigned.
Other file migrations try to preserve existing fids, which means there can be conflicts. This is a specific data-integrity issue that can happen without the involvement of incremental migrations at all.
Proposed resolution
Don't preserve file IDs when migrating from Drupal 6 to Drupal 7, since user pictures not having file IDs means it's not possible to map 1-1 anyway, and fids generally aren't referenced as URLs or similar.
(Old suggestion, not implemented):
1. Make sure the user picture migration runs last of all (pretty sure this already happens)
2. Set the autoincrement ID to a high number before the user picture migration runs, to give some space for other migrations to add existing IDs in the gap left.
Remaining tasks
User interface changes
API changes
Data model changes
Comment | File | Size | Author |
---|---|---|---|
#21 | 6_8_user_picture-2826047-21.patch | 7.81 KB | jofitz |
#21 | interdiff-16-21.txt | 2.4 KB | jofitz |
#16 | 6_8_user_picture-2826047-16.patch | 6.47 KB | jofitz |
#16 | interdiff-10-16.txt | 1.12 KB | jofitz |
#10 | 6_8_user_picture-2826047-10.patch | 6.19 KB | heddn |
Comments
Comment #2
catchComment #3
mikeryanIn this instance, perhaps we could more simply set explicit fids as $max_existing_fid + SOME_FAIRLY_LARGE_CONSTANT?
Comment #4
quietone CreditAttribution: quietone as a volunteer commentedComment #5
heddnDiscussed in the migrate weekly meeting. The proposed solution:
This should catch 98% of sites that don't really care what the FID is. In the rare condition that FIDs are important, then the site could easily turn on migration of the fids and figure out a solution for user pictures.
Assigning to myself to work on this.
Comment #6
catchBumping this to independently critical since it's one of the last known data integrity issues with migrate.
Comment #7
heddnStill needs tests. But this gets the ball rolling.
Comment #9
heddnHere's some tests.
Comment #10
heddnComment #12
alexpottDiscussed with @catch, @cilefen, @effulgentsia and @xjm. We agreed that this should be a critical issue since regardless of the experimental nature of migrate this is a data integrity issue that can result in data loss.
Comment #13
jofitz CreditAttribution: jofitz at ComputerMinds commentedAssuming the migration is working as it should (i.e. each file is migrated twice due to having a different uri the second time the d6_file migration is executed) and assuming I understand what should be happening (!), then I have adjusted MigrateFileTest to pass correctly. I have added comments to try and explain what is happening and why.
Comment #14
heddnUnassigning.
Comment #15
heddnre #13 it looks like your patch and interdiff are the same thing. I'm pretty sure you intended something different.
Comment #16
jofitz CreditAttribution: jofitz at ComputerMinds commentedSorry, my git-fu was a little off yesterday. Here is what I meant to upload. :#
Comment #17
alexpottI think we should also test the map here. To should the before 2 maps to 2 and now 2 maps to 6.
This test looks brittle - perhaps it is best test would be to count the number of files before and after the second migration run. Not sure.
Comment #18
heddnIf we fix the general problem, then we don't need one for these files. But I think we can get this in quick and dirty, while auto-increment could take longer.
Comment #19
heddnComment #21
jofitz CreditAttribution: jofitz at ComputerMinds commentedComment #22
heddnLooks good with these last changes. Unfortunately, I cannot mark RTBC. Hopefully someone else will jump in.
Comment #23
mikeryanComment #24
arunkumarkHi,
The patch #21 seems to be look good. Working as expected.
Comment #25
xjm@arunkumark, please provide a more specific review than that when RTBCing a patch. "Working as expected" does not actually contain any information. Please document what you reviewed and how you tested it. Otherwise, you will not receive issue credit for your review. Thanks for helping review patches!
Comment #26
mikeryanLooks good to me, thanks!
Comment #27
mikeryan@alexpott points out my RTBC was even terser than @arunkumark's... I did test this locally and it worked as expected. I also reviewed the code in and of itself and in the context of previous replies here, and I feel the previous points have been addressed.
Comment #28
catchUpdated the issue summary to add the current resolution and committed/pushed to 8.4.x and cherry-picked to 8.3.x, thanks!