- πΊπΈUnited States mikelutz Michigan, USA
Hmm, I'm not sure we can/should do anything in core here. Your issue is due to migrate_source ui, because that uses a batched migrate executable. It runs the migration a few rows at a time, and since this isn't a sql source that we can do some magic with the query to remove rows that aren't going to be processed in advance, the batch executable does what you said, each batch has to run through each already processed row to see if it needs to be processed in this batch. That check happens further down
// Check whether the row needs processing. // 1. This row has not been imported yet. // 2. Explicitly set to update. // 3. The row is newer than the current highwater mark. // 4. If no such property exists then try by checking the hash of the row. if (!$row->getIdMap() || $row->needsUpdate() || $this->aboveHighwater($row) || $this->rowChanged($row)) { $this->currentRow = $row->freezeSource(); }
But, before we can run that check, we need to give the source and hooks a chance to act on the row:
// Preparing the row gives source plugins the chance to skip. if ($this->prepareRow($row) === FALSE) { continue; }
But these prepare row functions can also skip rows, and can insert a message as to why they are skipping the row at the same time. So if we were to move the message clear to below the needs_update check, any messages from prepare row on rows that are skipped by prepare row would stack up and never be cleared. Any sort of attempt to save the old messages and re-insert them if no new messages are added in prepare row would be flakey at best, and incorrect from a core standpoint, as the message table is supposed to reflect messages from the most recent migration run only. The problem is in the way that migrate_source_ui works under the hood, by making a migration run only process a few (or one) row at a time. Since we don't natively support batching in core, we have no way of knowing that this isn't a full migration run and we should somehow not clear messages for things we aren't processing.
I hate to, but because this gets triggered on a non-core method of running migrations, I'm going to close it as 'won't fix'