Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-51304

Tablelib creating thousands of "emptyrow" rows...

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.8.7, 2.9.1, 3.0
    • Fix Version/s: None
    • Component/s: Libraries
    • Labels:
    • Affected Branches:
      MOODLE_28_STABLE, MOODLE_29_STABLE, MOODLE_30_STABLE

      Description

      Hi,

      while looking @ MDL-50919, it was detected that tablelib blindly creates a table with $perpage rows, no matter the total is smaller or any other consideration.

      So if you call to pagesize(50000, 1, it still creates a table with 49999 hidden rows.

      As a temporal fix, in the linked issue I've applied a quick fix in the caller, only for master:

      -            $this->pagesize($pagesize, $total);
      +            $this->pagesize(min($pagesize, $total), $total);
      

      As references, looking in the tracker about information justifying current/weird behavior, I've found MDL-41534, but not much else.

      So this is about to consider if we could always "optimize" the number of rows created within tablelib or that's not possible (for some unknown reason) and it's a caller responsibility to adjust it.

      Also, note that this behavior is 100% reproducible in 28 and 29 manage tags page... and in any other page using tablelib and having a big "SHOW_ALL_PAGE_SIZE" (or similar) defined.

      Ciao

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                stronk7 Eloy Lafuente (stronk7)
                Participants:
                Component watchers:
                Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Sara Arjona (@sarjona), Víctor Déniz Falcón
              • Votes:
                1 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated: