Review main Abandoned

76820[WIP][TASK] FileProcessor: Prevent unnecessary SQL queries

Christoph Lehmann CR 0 V 0 Easy +26 −17 updated 01/06/23, 20:19

Commit message

The relationField contains the number of file references. When it's 0,
then the queries are not needed.

Note: typo3/cms-styleguide must be raised after merging PR in styleguide

Used command(s): (may change to a simply update if PR is merged)

> composer config repositories.lehmann \
    vcs https://github.com/christophlehmann/styleguide.git
> composer req --dev typo3/cms-styleguide:dev-patch-1

Review

  • Code review CR 0
  • Verified V 0

Issues 1

Files 3

Review log 1012

  1. Christoph Lehmann uploaded patch set 1 11/25/22, 12:02

  2. core-ci voted on patch set 1 V -1 11/25/22, 12:17 Core CI is not happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/34208

  3. Christoph Lehmann marked it work in progress 11/25/22, 12:34

  4. Christoph Lehmann marked it ready for review 11/25/22, 17:58

  5. Christoph Lehmann commented on patch set 1 11/25/22, 17:59

  6. Stefan Bürk uploaded patch set 2 V -1 11/27/22, 23:58

  7. core-ci voted on patch set 2 V +1 11/28/22, 00:06 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/34293

  8. Stefan Bürk commented on patch set 2 11/28/22, 00:13

    Reply

    You also provided the ext:styleguide backport for 11 with https://github.com/TYPO3/styleguide/pull/365 Thanks for that. * I approved CI runs in ext:styleguide * Reviewed and cross-linked them in ext:styleguide * Approved both of them in ext:styleguide, but want to have lolli look at them. Mainly, because we need for the backport than a version tag and release of the styleguide, so it can be raised in 11.5 - otherwise backport of this patch would not be possible. * added your fork for the time beeing as validation that the PR's would help with this patch * _NOT_ reviewed/verified this patch yet.
  9. Christian Kuhn commented on patch set 2 CR -1 12/07/22, 18:26

    FilesProcessor.php:74

    I see what you're trying to do here, and I understand the fix: Inline foreign-child releations using foreign_tables / foreign_fields (not "csv") as done with FAL, use the "parent" table field to store the number of currently connected records. What you're doing here, is saying: "if this is 0, then don't fetch the relations to save some queries". This however is problematic. First, especially extbase tends to not update the number in the parent field properly, so the "count" can be misleading. Furthermore, DataHandler has a pretty hard time to update this field, making DH pretty slow in this area, codewise this part is a nightmare in DH. Additionally, this "count" field tends to not behave correctly in workspaces. As such: The "count" field is "just" a persisted cache field that is not always updated. The core should strive to get rid of this entirely, inline foreign-field should in the end not have such a field in the parent table at all. I think we should work on getting rid of this "count" field altogether, one relatively quick-win within v12 DataHandler would be to not update it at all anymore, to then make the field optional in v13. With this in mind, we should not bind new functionality to the "count" field anymore. There are various options - for instance, the records could be retrieved using sys_refindex mid-term, maybe even for multiple records at once with only one query. Or we may need a bigger refactoring in this area. In the end, I'd not bind further functionality to the 'count' field of inline-parent relation to no make a transition away from it even more complicated. I hope it's ok to -1 this patch for this reason.
  10. Stefan Bürk commented on patch set 2 CR -1 01/06/23, 20:18

    Reply

    Oh ... and set it to [WIP] for now.

    FilesProcessor.php:74 Reply

    Ack with lolli here. This does not make much sense, and another solution is needed here. Let's close this change.
  11. Stefan Bürk commented on patch set 2 01/06/23, 20:19

    Reply

    Done
  12. Stefan Bürk abandoned the change 01/06/23, 20:19

    This does not make much sense, and another solution is needed here. Let's close this change.