#106563Mitigate not-consumed query buffer in `OptimizeDatabaseTableTask`
Description
Using `pdo_mysql` driver with `MySQL` and `MariaDB` databases
requires that buffered result sets are fully read or explicity
free’d. That means, that queries returning a result seet needs
to consum the full result set by reading all rows and not only
one record and leaving the rest in the buffer.
TYPO3 mitigates this in several places for select queries by
explicitly enforcing `setMaxResults(1)` when reading only one
record and it could be a duplicates, which is not an ideal or
reading the full result set.
The DDL `OPTIMIZE TABLE` for `MariaDB` and `MySQL` databases
returns a result stating the outcome of the operation and is
a buffered query, which requires to use `executeQuery()` and
not `executeStatement()` on the connection and fully consume
the result when using `pdo_mysql`. However, the `mysqli`
driver is more forgiven here.
TYPO3 v12 used the `Connection::query()` method using
`executeQuery()` internally, which means that it has
been replaced with the wrong method while upgrading to
Doctrine DBAL 4 with #102875 in TYPO3 v13.
Reviews 2
Related issues 1
History 410
-
Stefan Bürk changed Related to #102875 <span data-processor="relativetime" data-value="2025-04-12T14:41:10+00:00" > 04/12/25, 14:41 </span>
-
Stefan Bürk changed description <span data-processor="relativetime" data-value="2025-04-12T14:41:36+00:00" > 04/12/25, 14:41 </span>
-
Gerrit Code Review pushed patch set 3 for main to change 89082 status
NewUnder Review <span data-processor="relativetime" data-value="2025-04-12T14:42:26+00:00" > 04/12/25, 14:42 </span> -
Gerrit Code Review pushed patch set 4 for main to change 89082 <span data-processor="relativetime" data-value="2025-04-12T14:42:54+00:00" > 04/12/25, 14:42 </span>
-
Gerrit Code Review pushed patch set 5 for main to change 89082 <span data-processor="relativetime" data-value="2025-04-12T14:43:48+00:00" > 04/12/25, 14:43 </span>
-
Gerrit Code Review pushed patch set 6 for main to change 89082 <span data-processor="relativetime" data-value="2025-04-12T15:17:17+00:00" > 04/12/25, 15:17 </span>
-
Gerrit Code Review pushed patch set 1 for 13.4 to change 89091 <span data-processor="relativetime" data-value="2025-04-12T20:03:36+00:00" > 04/12/25, 20:03 </span>
-
Gerrit Code Review pushed patch set 2 for 13.4 to change 89091 <span data-processor="relativetime" data-value="2025-04-12T20:24:27+00:00" > 04/12/25, 20:24 </span>
-
Stefan Bürk commented and changed status
Under ReviewResolved done0 %100 % <span data-processor="relativetime" data-value="2025-04-12T20:35:08+00:00" > 04/12/25, 20:35 </span> -
Benni Mack changed status
ResolvedClosed <span data-processor="relativetime" data-value="2025-12-02T14:22:36+00:00" > 12/02/25, 14:22 </span>
Applied in changeset commit:9f42bb447d5e6e99afced479601c50e64d386eec.