Problem/Motivation
Noticed that a test is missing that should have been in #3008029: Migrate D7 i18n field option translations. It is the test of the migration of the field option translations for booleans, like checkboxes.
Then the fix caused an error with Postgres and that exposed that the bundle was not included in the source IDs.
Proposed resolution
This adds data to the fixture and a test of the field option translation for a checkbox.
Add 'bundle' to the IDs in the source plugin. Without that only the first row for field_boolean was being processed and that happened to be 'test_content_type' for mysql and sqlite and 'blog' for 'postgres. Now, all bundles will be processed.
Note that adding the bundle as a key resulted in a key that was too long resulting in 'Syntax error or access violation: 1071 Specified key was too long; max key length is 3072' for MySQl. That was fixed in #3098282: [backport] SQL error if migration has too many ID fields and the key can simply be added now.
Comment | File | Size | Author |
---|---|---|---|
#53 | 3103031-53.patch | 15.5 KB | quietone |
#53 | diff-51-53.txt | 2.84 KB | quietone |
#51 | 3103031-51.patch | 15.36 KB | quietone |
#51 | diff-49-51.txt | 2.43 KB | quietone |
#50 | 3103031-49.patch | 15.35 KB | quietone |
Comments
Comment #2
quietone CreditAttribution: quietone as a volunteer commentedComment #4
quietone CreditAttribution: quietone as a volunteer commentedAdd missing field_revision_field_checkbox table.
Comment #6
quietone CreditAttribution: quietone as a volunteer commentedYes, there is another field config so increase the entity count
Comment #8
quietone CreditAttribution: quietone as a volunteer commentedWell, that was a bad patch, it didn't have the changes to the test fixture.
Comment #10
quietone CreditAttribution: quietone as a volunteer commentedAnd update the number of field_storage_config entities.
Comment #11
Wim Leers🔎 Weird indentation going on here.
🤔 I don't think this comment is accurate?
Comment #12
quietone CreditAttribution: quietone as a volunteer commented@Wim Leers, thanks. Should be fixed now.
Comment #13
Wim LeersThis looks good to me now, but I don't know enough about these particular source + destination to RTBC this. Hopefully my review in #11 and the iteration in #12 make it easier for the next person to RTBC this :)
Comment #14
NickDickinsonWildeLooks good to me, but never done any D7 multilingual stuff only D8, so not the highest confidence. But 2 somewhat hesitant +1s is somewhat equal to a RTBC I figure.
Comment #15
alexpottNew test looks good to me.
Committed and pushed 677f9d42d8 to 9.0.x and e4220e5ce6 to 8.9.x. Thanks!
Comment #18
alexpottUnfortunately this broke Postgres so reverting.
Comment #21
xjmJust a reminder that anything interacting directly with the DB layer (including test fixtures) should always be tested on Postgres and SQLite before commit. Thanks!
Comment #22
quietone CreditAttribution: quietone as a volunteer commentedI should be able to get to this this week.
Comment #23
DamienMcKennaComment #24
quietone CreditAttribution: quietone as a volunteer commentedAdded 'bundle' to the IDs in the source plugin. Without that only the first row for field_boolean was being processed and that happened to be 'test_content_type' for mysql and sqlite and 'blog' for 'postgres. Now, all bundles will be processed.
The test is updated to test both 'test_content_type' and 'blog'.
Comment #26
quietone CreditAttribution: quietone as a volunteer commentedHmm. I thought I ran the test with mysql, must have made a mistake. And new errors as well.
OK, here is a fix. The source IDs in FieldOptionTranslation now have a max_length that is the same as that in the d7 schema. This time I am sure I tested locally with Mysql.
Comment #27
quietone CreditAttribution: quietone as a volunteer commentedThe sqlite fail is unrelated it is in, Media_library.Drupal\Tests\media_library\FunctionalJavascript\WidgetUploadTest. See #3066447: [random test failure] Random failures building media library form after uploading image (WidgetUploadTest).
Comment #28
quietone CreditAttribution: quietone as a volunteer commentedReady for review.
Comment #29
NickDickinsonWildeLGTM
Comment #30
alexpottThis is the only place where we've done this. I'm concerned that these might not be correct in some rare instance. How about adding an order by bundle in \Drupal\field\Plugin\migrate\source\d7\FieldOptionTranslation::query()?
Comment #31
quietone CreditAttribution: quietone as a volunteer commentedI'll try to respond to this in a few days.
Comment #32
quietone CreditAttribution: quietone as a volunteer commented@alexpott. Thanks for the review.
The problem here is not about ordering. The source query needs to have 5 sourceIDs so that all the needed rows are processed but with 5 sourceIDs the key length is too long. Without the 5 IDs SourcePluginBase::next() will only process the first row of a set that where the first 4 sourceIDs are the same, because it looks at the map table and sees that a row with these source keys has been processed. The bundle really needs to be a key.
Typically, we just add the ID and use the default length. That is what was done in #24 which results in the error, "SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 3072 bytes: "
Are there any other ways to solve this?
Also, I was getting a duplicate column error so the query is modified for that. I didn't run the test locally (I'm off to bed) but it worked fine with drush.
Comment #33
quietone CreditAttribution: quietone as a volunteer commentedComment #34
heddnAdding a new column into the id map has BC implications for existing migrations. Do we need to handle this gracefully for sites that might be doing incremental migrations?
Comment #35
quietone CreditAttribution: quietone as a volunteer commentedGood point. I think some hands on testing to be sure about incrementals is needed.
Comment #36
heddnAnd this seems to have extended beyond just adding test coverage and seems to be fixing a bug. Needs a better title.
Comment #37
quietone CreditAttribution: quietone as a volunteer commentedYes it does
Comment #38
quietone CreditAttribution: quietone as a volunteer commentedFound another issue reporting the same problem with the key length being greater that 3072bytes, #3098282: [backport] SQL error if migration has too many ID fields
Comment #40
quietone CreditAttribution: quietone as a volunteer commentedComment #42
quietone CreditAttribution: quietone as a volunteer commentedNo longer postponed since #3098282: [backport] SQL error if migration has too many ID fields was committed.
And a reroll.
Comment #44
quietone CreditAttribution: quietone as a volunteer commentedSilly me. Forgot to add these fixes.
Comment #45
quietone CreditAttribution: quietone as a volunteer commentedUpdate MigrateFieldOptionTranslationTest
Comment #46
quietone CreditAttribution: quietone as a volunteer commentedUpdating IS
Comment #47
quietone CreditAttribution: quietone as a volunteer commentedNeeded a reroll.
Comment #49
quietone CreditAttribution: quietone as a volunteer commentedFieldOptionTranslation needs another change, after #3187463: Fix "d7_field_option_translation" process plugin.
Comment #50
quietone CreditAttribution: quietone as a volunteer commentedNaming the patch correctly will definitely help.
Comment #51
quietone CreditAttribution: quietone as a volunteer commentedNeeded a reroll
Comment #53
quietone CreditAttribution: quietone as a volunteer commentedNeeded another reroll.
Comment #54
larowlansurely this would be arrêter 😉
This looks good to me, but can only go into the current branches because #3098282: [backport] SQL error if migration has too many ID fields isn't backported yet
Comment #56
catchCommitted/pushed to 9.3.x and cherry-picked to 9.2.x, thanks!