Skip to content

Commit

Permalink
fixup! fix(db): also chunk MariaDB deletes
Browse files Browse the repository at this point in the history
  • Loading branch information
miaulalala committed Sep 11, 2023
1 parent 57fa337 commit cbda147
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,15 @@

namespace OCA\Activity;

use Doctrine\DBAL\Platforms\AbstractMySQLPlatform;
use Doctrine\DBAL\Platforms\MySQLPlatform;
use OCA\Activity\Filter\AllFilter;
use OCP\Activity\IEvent;
use OCP\Activity\IExtension;
use OCP\Activity\IFilter;
use OCP\Activity\IManager;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\IDBConnection;
use Psr\Log\LoggerInterface;

/**
* @brief Class for managing the data in the activities
Expand Down Expand Up @@ -387,9 +388,11 @@ public function deleteActivities($conditions) {
// Add galera safe delete chunking if using mysql
// Stops us hitting wsrep_max_ws_rows when large row counts are deleted
$platform = $this->connection->getDatabasePlatform();
if ($platform instanceof AbstractMySQLPlatform) {
if ($platform instanceof MySQLPlatform) {
$logger = \OC::$server->get(LoggerInterface::class);
$logger->log('Chunking deletes for MySQLPlatform');
// Then use chunked delete
$max = 100000;
$max = 10000;
$delete->setMaxResults($max);
do {
$deleted = $delete->executeStatement();
Expand Down

0 comments on commit cbda147

Please sign in to comment.