When using the options separately (with 'drush migrate-import'), this works fine. Together however, feedback is given but the import operation does not stop after the requested number of items.
I have not tested this, but suspect this is due to the feedback logic resetting internal counters, http://cgit.drupalcode.org/migrate_tools/tree/src/MigrateExecutable.php?h=8.x-3.x#n356.

Comments

woutgg created an issue. See original summary.

heddn’s picture

Priority: Normal » Major

Triaging the issue queue. This seems more major.

mbovan’s picture

Version: 8.x-3.x-dev » 8.x-4.x-dev

I can confirm that bug happens in 4.x as well.

deviantintegral’s picture

Status: Active » Needs review
StatusFileSize
new517 bytes

Removing the call to resetCounters() fixes this for me.

  • heddn committed 6b30418 on 8.x-4.x authored by deviantintegral
    Issue #2919108 by deviantintegral, woutgg, heddn: Using '--limit' with...
heddn’s picture

Status: Needs review » Fixed

Thanks for your contributions!

woutgg’s picture

Would this not change the behaviour of the progress messages?
If the counters are not reset anymore, each message will show accumulated progress instead of a delta since the last message.

Note: while looking at the code, I suspect this issue would also surface when rolling back (in onPostRowDelete()), although limiting that is a less common scenario of course.

heddn’s picture

Status: Fixed » Needs review
StatusFileSize
new1.6 KB

Would this fix that concern?

woutgg’s picture

StatusFileSize
new588 bytes

Not completely, as that would not fix the feedback stats when combining feedback and limit.
I had already started adding a separate counter when I noticed $this->counter is never reset, so using that for the limiting check should be fine (see patch).

About the deletion counter: I was mistaken...there is no --limit option for rollback.

Status: Needs review » Needs work

The last submitted patch, 9: 2919108.9-fix-limit-condition.patch, failed testing. View results

woutgg’s picture

StatusFileSize
new517 bytes

Oops, invalid patch; this one should work.

woutgg’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 11: 2919108.11-fix-limit-condition.patch, failed testing. View results

woutgg’s picture

Status: Needs work » Needs review
StatusFileSize
new1.46 KB

Sigh, sometimes...
That patch would not have worked anyway (since $this->counter also counts already-processed records).
This one uses a separate counter. Third time's a charm (have tested locally this time).

  • heddn committed 753d8ba on 8.x-4.x authored by woutgg
    Issue #2919108 by woutgg, heddn, deviantintegral: Using '--limit' with...
heddn’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.