Project

General

Profile

Actions

Bug #102104

closed

Migration of sys_log entries to a JSON formatted value failes

Added by Stefan Berger 10 months ago. Updated 9 days ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
Install Tool
Target version:
-
Start date:
2023-10-06
Due date:
% Done:

100%

Estimated time:
TYPO3 Version:
12
PHP Version:
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

Hi,

when the sys_log table has a lot records, the migration of sys_log entries to a JSON formatted value failes due to memory limitations.

The process has to be converted using rather the result object than the result array list.

The following will solve the issue in TYPO3\CMS\Install\Updates\SysLogSerializationUpdate

$queryBuilder = $this->getPreparedQueryBuilder();
$result = $queryBuilder
    ->select('uid', 'log_data')
    ->where(
        $queryBuilder->expr()->like('log_data', $queryBuilder->createNamedParameter('a:%'))
    )
    ->executeQuery();

while ($record = $result->fetchAssociative()) {
    $logData = $this->unserializeLogData($record['log_data'] ?? '');
    $connection->update(
        self::TABLE_NAME,
        ['log_data' => json_encode($logData)],
        ['uid' => (int)$record['uid']]
    );
}
// foreach ($this->getRecordsToUpdate() as $record) {
//     $logData = $this->unserializeLogData($record['log_data'] ?? '');
//     $connection->update(
//         self::TABLE_NAME,
//         ['log_data' => json_encode($logData)],
//         ['uid' => (int)$record['uid']]
//     );
// }

Thanks for fixing the issue.

Actions #1

Updated by Christian Kuhn 10 months ago

Good catch and solution suggestion. I'll try to come up with something.

Actions #2

Updated by Gerrit Code Review 10 months ago

  • Status changed from New to Under Review

Patch set 1 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81363

Actions #3

Updated by Gerrit Code Review 10 months ago

Patch set 2 for branch main of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81363

Actions #4

Updated by Gerrit Code Review 10 months ago

Patch set 1 for branch 12.4 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/81364

Actions #5

Updated by Christian Kuhn 10 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100
Actions #6

Updated by Benni Mack 9 days ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF