Problem/Motivation
The media_migration plugins are some of the slowest, due to the complexity of their queries. It is crucial that they are allowed to be made cacheable.
See \Drupal\migrate\Plugin\migrate\source\SourcePluginBase::count() + \Drupal\migrate\Plugin\migrate\source\SourcePluginBase::$cacheCounts.
Steps to reproduce
Proposed resolution
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #30 | media_migration-cacheable_source_counts-3190800-24-fu-30.patch | 5.93 KB | huzooka |
| #24 | media_migration-cacheable_source_counts-3190800-24.patch | 5.29 KB | huzooka |
Comments
Comment #2
wim leersComment #3
wim leersComment #5
wim leersAh, right, this requires #3190815: Source count caching broken: impossible to enable source count caching for SqlBase-based source plugins (plus, unneeded cache I/O) 😬
Comment #6
wim leersComment #7
wim leersNit: should be
protected.Comment #8
huzookaThis is not a Media Migration bug – from Media Migration's perspective, this is a task.
Comment #9
wim leers#3190815: Source count caching broken: impossible to enable source count caching for SqlBase-based source plugins (plus, unneeded cache I/O) landed! 🥳
Comment #10
damienmckennaAFAICS this would break compatibility with D8.9, right?
Comment #11
damienmckennaCould we retain the old method and wrap the new one?
Comment #12
huzooka@DamienMcKenna, that's the plan.
But imho, don't migrate into 8.9.x :)
Comment #13
huzookaComment #14
huzookaComment #15
huzookaComment #16
huzookaComment #17
huzookaComment #18
wim leersÜbernit: s/out of support/unsupported/ 🤓
This does: "When cacheable, do not call our override, but instead call the parent implementation, which is what will call ::doCount() on 9.1 & 9.2, but not 8.9 & 9.0." 👍
🤓 Nit: I think the name is a bit misleading here.
I think
public static function cacheableSourceCountSupportedByCore()would be clearer.👏 This is next-level BC — even includes consideration for alpha releases!
This is copied from the core test coverage that I worked on.
👍 I think this is to be 100% certain that source count caching works as expected — and that's fine of course!
Comment #19
huzookaA new approach, without interdiff.
Comment #21
huzookaPlain file config source plugins also need the trait
Comment #22
huzookaComment #23
huzookaCannot test the trait-based approach with PhpUnit 6/7, let's go back to an abstract class.
Comment #24
huzookaCoding standards. Seems that this is not my day 😞
Comment #26
huzookaLet's see how this works without the
DummyQueryTrait::countmethod aliasing inMediaViewMode.Comment #27
huzooka#26 was still wrong.
If we are on a Drupal core version which supports cacheable source plugin item counts, then
DummyQueryTraithas adoCount()method.Comment #28
huzooka...aaaaaand: Coding standard!
Comment #29
huzooka#27 is wrong,
DummyQueryTrait::doCountcomes from one of our core patches.Comment #30
huzooka...but it's worth supporting that core patch as well.
And imho this is the right time to add a source plugin test for MediaViewModes.
Comment #32
huzooka