[TASK] Deferred reference index updating
Within DataHandler processing, updating the reference index is an expensive task since it needs tons of queries to do the job. With DataHandler instances and it's sub instances created for relations and localizations, the code tends to update the reference index for the same table/uid combination multiple times: As example, core test IRRE/ForeignField/Modify copyParentContent() copies a content element with one hotel, one offer and one price around. This leads to 3 update reference index calls for the tt_content element, 4 for the hotel, 4 for the offer and 3 for the price. Of course, the situation is worse in workspaces. There have been various attempts over the years to reduce the query load, usually by adding runtime caches everywhere. With proper sys_refindex functional test coverage in place, we can however finally solve the root problem: The patch adds the helper object ReferenceIndexUpdater to fill a registry with to-update workspace/table/uid combinations. The object is carried around within DataHandler and RelationHandler to DataHandler sub instances. Only the outer most instance of a DataHandler then finally executes the update() operations in one go and only once per combination. The patch tries to be rather conservative to allow a 10.4 backport. For master, there should be further mess-reducing cleanup patches to streamline related parts of the ReferenceIndex update process. Result: The DataHandler query load is reduced significantly. It heavily depends on the structure that is changed, to get an idea, the above test goes down from 448 queries to 346 queries! Change-Id: I49f5ed73114ca5d6e2cb75fa43846bde5ea72d26 Resolves: #92356 Related: #88134 Releases: master, 10.4 Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65796 Tested-by:Oliver Bartsch <bo@cedev.de> Tested-by:
TYPO3com <noreply@typo3.com> Tested-by:
Benni Mack <benni@typo3.org> Tested-by:
Georg Ringer <georg.ringer@gmail.com> Reviewed-by:
Oliver Bartsch <bo@cedev.de> Reviewed-by:
Benni Mack <benni@typo3.org> Reviewed-by:
Georg Ringer <georg.ringer@gmail.com>
Showing
- typo3/sysext/core/Classes/DataHandling/DataHandler.php 30 additions, 41 deletionstypo3/sysext/core/Classes/DataHandling/DataHandler.php
- typo3/sysext/core/Classes/DataHandling/Localization/DataMapProcessor.php 27 additions, 6 deletions...re/Classes/DataHandling/Localization/DataMapProcessor.php
- typo3/sysext/core/Classes/DataHandling/ReferenceIndexUpdater.php 81 additions, 0 deletions...ysext/core/Classes/DataHandling/ReferenceIndexUpdater.php
- typo3/sysext/core/Classes/Database/RelationHandler.php 42 additions, 15 deletionstypo3/sysext/core/Classes/Database/RelationHandler.php
- typo3/sysext/core/Documentation/Changelog/10.4.x/Important-92356-DataHandlerPerformanceImprovements.rst 22 additions, 0 deletions....x/Important-92356-DataHandlerPerformanceImprovements.rst
- typo3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php 0 additions, 73 deletions...3/sysext/core/Tests/Unit/DataHandling/DataHandlerTest.php
Please register or sign in to comment