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

  1. there is no caching
  2. 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

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Comments

jmarcou created an issue. See original summary.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

jasloe’s picture

Replicated 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.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Bhanu951’s picture

Can reproduce the issue when the cache.backend.null enabled in development.services.yml as well .

services:
  cache.backend.null:
    class: Drupal\Core\Cache\NullBackendFactory
Anybody’s picture

Grevil’s picture

Version: 8.9.x-dev » 9.3.x-dev

We'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.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

danflanagan8’s picture

Issue tags: -cache, -backend, -null, -migration, -requirement +Needs tests

I 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?

quietone’s picture

Issue summary: View changes
Status: Active » Postponed (maintainer needs more info)
Issue tags: +Needs issue summary update, +Bug Smash Initiative

I 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.

Grevil’s picture

Thanks, @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)

Grevil’s picture

Status: Postponed (maintainer needs more info) » Needs review

Ok, 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.

Migration upgrade_d7_field_instance_label_description_translation does not meet the requirements. Missing migrations upgrade_d7_field_instance. requirements: upgrade_d7_field_instance. 
[error]  upgrade_d7_field_instance_label_description_translation migration failed.

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.

quietone’s picture

@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.

process:
  skip: 
    plugin: skip_on_empty
    method: row
    source: skip_this_row
quietone’s picture

Status: Needs review » Postponed (maintainer needs more info)

@Grevil, any luck with moving the skip to the process pipeline?

Grevil’s picture

@quietone, we currently postponed the project, but I will let you know in a couple of weeks, when we are at it again! :)

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Issue summary: View changes
Status: Postponed (maintainer needs more info) » Closed (outdated)
Issue tags: -Needs tests, -Needs issue summary update

@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.

Grevil’s picture

Sorry 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!

welly’s picture

I'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:

Migration users_migration did not meet the requirements. Missing migrations users_roles_migration. requirements: users_roles_migration.

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.