Problem/Motivation
With drush migrate:rollback --feedback=N, every Nth deleted row prints the import progress message instead of a rollback message:
[notice] Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - continuing with 'my_migration'
The counters are then reset, so the closing Rolled back X items - done with '…' line only counts the rows since the last feedback point. A rollback of 975 rows with --feedback=500 prints Processed 0 items … followed by Rolled back 475 items - done, and the first 500 rows are not reported anywhere.
MigrateExecutable::onPostRowDelete() calls progressMessageEmit(FALSE), which reads the save counters. Nothing is saved during a rollback, so those counters are always zero there. rollbackMessage($done) already has a continuing with variant for this case.
The call was changed from rollbackMessage(FALSE) to progressMessageEmit(FALSE) in #3067165 (commit bf849bf5, first released in 6.1.4). The change is listed in comment #45's MR 7 → MR 19 comparison, but the thread does not give a reason for it. onPostRowDelete() only runs during a rollback, and MigrateBatchExecutable, which the progressMessage()/progressMessageEmit() split was made for, has no rollback path. 6.0.x and 6.1.0–6.1.3 print Rolled back N items - continuing with '…'.
#3590774 reverted another side effect of the same commit.
Steps to reproduce
- Enable
migrate_tools_test. drush migrate:import fruit_terms(3 rows)drush migrate:rollback fruit_terms --feedback=2
Actual:
[notice] Processed 0 items (0 created, 0 updated, 0 failed, 0 ignored) - continuing with 'fruit_terms' [notice] Rolled back 1 item - done with 'fruit_terms'
Expected (6.1.3 behaviour):
[notice] Rolled back 2 items - continuing with 'fruit_terms' [notice] Rolled back 1 item - done with 'fruit_terms'
Proposed resolution
Restore the rollbackMessage(FALSE) call in MigrateExecutable::onPostRowDelete(), and add a functional test (DrushCommandsTest::testRollbackFeedback()) next to the existing import testFeedback().
Remaining tasks
- Review the MR.
User interface changes
None.
API changes
None.
Data model changes
None.
Issue fork migrate_tools-3630664
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
segi commented