Skip to content
  • Christian Kuhn's avatar
    [TASK] Deferred reference index updating · c333efe9
    Christian Kuhn authored and Georg Ringer's avatar Georg Ringer committed
    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: default avatarOliver Bartsch <bo@cedev.de>
    Tested-by: default avatarTYPO3com <noreply@typo3.com>
    Tested-by: default avatarBenni Mack <benni@typo3.org>
    Tested-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
    Reviewed-by: default avatarOliver Bartsch <bo@cedev.de>
    Reviewed-by: default avatarBenni Mack <benni@typo3.org>
    Reviewed-by: default avatarGeorg Ringer <georg.ringer@gmail.com>
    c333efe9