Problem/Motivation
If you are getting Migration X did not meet the requirements. Missing migrations Y. requirements: Y.
error message and NOT using cache.backend.null use #2797505: Migrations fail due to missing dependency when dependency has skipped rows by the source plugin.
When I try to migrate a migration X that depends on another migration Y, I got the following error
Migration X did not meet the requirements. Missing migrations Y. requirements: Y.
Even if the migration Y has been successfully/totally migrated. I found out that it was because the migration Y was considered as non-existent (and not in failure/incomplete state).
After many tests, I found that removing the following line in my settings.php fixed my problem
$settings['cache']['default'] = 'cache.backend.null';
(only used for development purpose)
What I except migrate to do, is not to search the migration plugins into the cache when "cache.backend.null" is defined.
Steps to reproduce
Proposed resolution
From #12 this could be cause by
- there is no caching
- If the required migration's source plugin's count() function does not return the same number of items that were migrated. For this problem see #16
Comments
Comment #5
jasloe CreditAttribution: jasloe as a volunteer commentedReplicated this issue. With cache.backend.null enabled in settings.php, required migration dependencies are not discovered. Disabling cache.backend.null allows the dependent migrations to be discovered.
Not sure if this is a bug or a feature....in any event it should be documented somewhere.
Comment #8
Bhanu951 CreditAttribution: Bhanu951 as a volunteer commentedCan reproduce the issue when the cache.backend.null enabled in development.services.yml as well .
Comment #9
Anybody#2797505: Migrations fail due to missing dependency when dependency has skipped rows by the source plugin
This might be related?
Comment #10
Grevil CreditAttribution: Grevil as a volunteer and at DROWL.de commentedWe're running into this issue with 9.3.x now... still very problematic!
Patch #61 from #2797505: Migrations fail due to missing dependency when dependency has skipped rows by the source plugin does NOT fix it for us.
Comment #12
danflanagan8I am having trouble reproducing this. I wonder if the situation has been improved at all after #3190815: Source count caching broken: impossible to enable source count caching for SqlBase-based source plugins (plus, unneeded cache I/O)?
It looks to me like the error should happen if 1) there is no caching and 2) if the required migration's source plugin's
count()
function does not return the same number of items that were migrated. I think the issue I referenced cleaned this up for the core source plugins.It would be great to get more details on how to reproduce. What is the exact version of D9? What is the definition of the migration that is failing? What are the definitions of the dependencies that are causing it to fail?
Comment #13
quietone CreditAttribution: quietone at PreviousNext commentedI think @danflanagan8 is right, we need clear steps on how to reproduce the problem. I also tried to reproduce the problem and found that the dependencies were always built correctly.
Adding tag for an Issue Summary update for adding the Steps to Reproduce. Since work can't progress without that changing the status as well.
Comment #14
Grevil CreditAttribution: Grevil as a volunteer and at DROWL.de commentedThanks, @danflanagan8 and @quitone for your replies!
I will create a clean Drupal 9 instance for Migration and document each step of our setup / migration process here, when I get the time.
(Hopefully before the upcoming Holidays)
Comment #15
Grevil CreditAttribution: Grevil as a volunteer and at DROWL.de commentedOk, I am sorry as @danflanagan8 pointed out, the reason, why our migration fails is that the count() function does not return the same number of items that were migrated.
This is because we are skipping a couple of entity_types we don't want to migrate, using "hook_migrate_prepare_row". Still wondering why the patch from #2797505: Migrations fail due to missing dependency when dependency has skipped rows by the source plugin does not work for us, but this is a problem for another thread.
Comment #16
quietone CreditAttribution: quietone at PreviousNext commented@Grevil, thanks, that clears this up a lot.
Although rows can be skipped in prepare_row it also means that the row is not saved in the map table as ignored. This will cause unexpected issues with counts. If you can modify your migration so that the rows are skipped in the process pipeline you should see an improvement. For example, what I have done in the past in prepare_row is to identity the row that needs to be skipped and set a property on the row to signal the skip to FALSE and then in the pipeline do this.
Comment #17
quietone CreditAttribution: quietone at PreviousNext commented@Grevil, any luck with moving the skip to the process pipeline?
Comment #18
Grevil CreditAttribution: Grevil as a volunteer and at DROWL.de commented@quietone, we currently postponed the project, but I will let you know in a couple of weeks, when we are at it again! :)
Comment #20
quietone CreditAttribution: quietone at PreviousNext commented@Grevil, I hope the work on the migration project resumed and went well for you.
The original problem in the IS was researched and tested by @danflanagan8 in #12 and was found that it could not be reproduced. And in #15 @Grevil confirmed that. Following that I made a suggestion to fix the mis-matched counts, which is really a support conversation not a bug. Therefor, I am closing this issue as outdated.
I've updated the IS with the findings.
Comment #21
Grevil CreditAttribution: Grevil as a volunteer and at DROWL.de commentedSorry for the late feedback @quietone! The problem was a duplicate database entry in the source database...
For more information, visit: https://www.drupal.org/project/drupal/issues/3307506
But you already commented that issue anyway. Still thanks everyone!
Comment #22
welly CreditAttribution: welly at manifesto commentedI've found that this issue seems to occur when I use drush to run a migration - drush migrate:import users_migration, which has a required dependency on users_roles_migration, results in this error:
However, if I run the migration through the Migrate Tools UI it executes correctly and runs the required dependencies first. I've got $settings['cache']['default'] = 'cache.backend.null'; commented out.