Issue #3620377: Count queries on the paths an audit actually finds them on, not only on the hold path

The hold path has PlaceHoldCostTest, which measures every read against the size of the party. The screens had nothing, and that is where the audit in #3620326 found its reads: a section read per area on the seat map's fill, an entity load per option in the venue-scoped widget, a grade read per row in the area table.

ScreenReadCountTest covers those three. Each case runs the same work at two sizes and asserts the count is the same, rather than under a number: a number goes stale as the fixture changes, and passes a loop that grew.

It found a fourth of the same kind. A row of the area table names its area by asking its setting, and the setting loaded its own section, so the table read 9 times at eight rows against 3 at two. The sections now go into the storage's cache in one go, next to the grades that already did. The test-only changes: [PHPUnit-Kernel] job proves the case bites: with the fix reverted it fails on this assertion, 2 listed took 3 read(s), 8 listed took 9 read(s).

Two things the cases need in order to mean anything, both of which the first pass got wrong:

  • A cold cache. The fixture has just saved the entities the screen is about, so they sit in each storage's static cache and a per-row load runs without touching the database. Every case empties this project's entity caches before measuring. The types are asked from the definitions rather than named one by one, so a case cannot warm a cache by forgetting one.
  • A table matched where it is read. The project had eight copies of "filter a query log by table", each matching the bare name, and this added a ninth. None of the eight is wrong for the table it names, but this one counts yoyaku_configuration, which every read of yoyaku_configuration_section contains. CountsTableReadsTrait carries the matcher that was already right, from AvailablePlaceReadCountTest: whatever the site prefixes, after FROM or JOIN, nothing appended, quoting and whitespace normalized first. Every count is unchanged under it, so no figure was ever inflated by a statement that merely mentioned a table.

PERFORMANCE.md refreshes from a named list of cost classes and this one was not in it, so a refresh would have skipped it silently. It is in that list now, in the register with its eight figures, and in the ceilings list. While in that file, eight places said "session" where they meant a slot; the one that does mean the web session is left alone.

Edited by Frank Mably

Merge request reports

Loading
Loading