Review main Merged

67110[BUGFIX] More deterministic mm sorting

Christian Kuhn CR +2 V +2 Easy +2 −0 updated 12/14/20, 17:17

Commit message

A 'true' MM relation (select / group with MM, but not inline
with foreign_field - used in core for pages/tt_content table
to sys_category via sys_category_record_mm) has two sorting
fields: 'sorting' for the local (sys_category) side, and
'sorting_foreign' for the foreign (pages / tt_content) side.

When categories are added to a tt_content element,
'sorting_foreign' is set to the given order of sys_category
elements. 'sorting' is set to 0. When then opening a
sys_category record that has multiple records pointing to
it with 0 as sorting, the returned order of records is
non-deterministic and depends on implicit DB engine fallbacks.

This also confuses the reference index, which checks
refindex integrity always from the 'local' side.

The patch adds 'uid_foreign' as second order-by field to
force deterministic ordering. There is still a possible
collision in multi table relations (more than one foreign
table uses the mm table like pages AND tt_content to
sys_category with foreign records having the same uid) and
if the mm table allows "multi" relations. Those scenarios
however have no explicit TCA configuration (only implicit
via MM_match_fields), need a deeper investigation and
possibly further detail patches later.

The patch should for now fix a functional test that is
flaky with postgres.

Review

  • Code review CR +2 Done
    • Christian Kuhn +2
    • Benni Mack +2
    • Oli Bartsch +1
    • Andreas Kienast +1
  • Verified V +2 Done
    • Christian Kuhn +2
    • Benni Mack +2
    • Oli Bartsch +1
    • TYPO3com +1 CI

Issues 1

Files 2

Review log 1218

  1. Christian Kuhn uploaded patch set 1 12/14/20, 12:34

  2. Christian Kuhn uploaded patch set 2 12/14/20, 12:36

  3. TYPO3com voted on patch set 1 V -1 12/14/20, 12:45 Completed build in 11m 27s on Mon, 14 Dec, 12:45 PM Test Summary: 32321 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8156

  4. TYPO3com voted on patch set 2 V -1 12/14/20, 12:54 Completed build in 15m 17s on Mon, 14 Dec, 12:54 PM Test Summary: 32321 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8157

  5. Christian Kuhn uploaded patch set 3 12/14/20, 14:08

  6. TYPO3com voted on patch set 3 V +1 12/14/20, 14:19 Completed build in 10m 26s on Mon, 14 Dec, 02:19 PM Test Summary: 32415 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8164

  7. Christian Kuhn updated the commit message in patch set 4 12/14/20, 14:42

  8. Christian Kuhn commented on patch set 4 12/14/20, 14:47

    ReferenceIndex.php:930

    this is a drive-by: it forces 'bin/typo3 referenceindex:update' to explicitely order by uid, and not by whatever db engine thinks is good.

    RelationHandler.php:596

    This is the main patch. There should be more fields taken into account - probably 'sorting_foreign', 'tablenames' and 'fieldname', those however have only a partial explicit TCA representation and need a deeper analysis and probably TCA fine tuning ...
  9. Andreas Kienast updated the commit message in patch set 5 12/14/20, 14:51

  10. Andreas Kienast voted on patch set 5 CR +1 12/14/20, 14:51

  11. TYPO3com voted on patch set 4 V -1 12/14/20, 14:53 Completed build in 11m 36s on Mon, 14 Dec, 02:53 PM Test Summary: 1 of 32656 failed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8168

  12. TYPO3com voted on patch set 5 V -1 12/14/20, 15:01 Completed build in 09m 42s on Mon, 14 Dec, 03:01 PM Test Summary: 32415 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8169

  13. TYPO3com voted on patch set 5 V +1 12/14/20, 15:08 Completed build in 26m 24s on Mon, 14 Dec, 03:08 PM Test Summary: 32415 passed Find logs and detail information at https://bamboo.typo3.com/browse/CORE-GTC-8169

  14. Christian Kuhn commented on patch set 5 12/14/20, 16:01

    ReferenceIndex.php:930 Reply

    Ack

    RelationHandler.php:596 Reply

    Ack
  15. Oli Bartsch voted on patch set 5 V +1 CR +1 12/14/20, 16:43

  16. Benni Mack voted on patch set 5 V +2 CR +2 12/14/20, 17:10

  17. Christian Kuhn voted on patch set 5 V +2 CR +2 12/14/20, 17:16

  18. Christian Kuhn merged patch set 6 12/14/20, 17:17