diff --git a/lib/private/DB/Exceptions/DbalException.php b/lib/private/DB/Exceptions/DbalException.php index ca0119a576cb1..3d326a545d363 100644 --- a/lib/private/DB/Exceptions/DbalException.php +++ b/lib/private/DB/Exceptions/DbalException.php @@ -37,6 +37,7 @@ use Doctrine\DBAL\Exception\InvalidFieldNameException; use Doctrine\DBAL\Exception\NonUniqueFieldNameException; use Doctrine\DBAL\Exception\NotNullConstraintViolationException; +use Doctrine\DBAL\Exception\RetryableException; use Doctrine\DBAL\Exception\ServerException; use Doctrine\DBAL\Exception\SyntaxErrorException; use Doctrine\DBAL\Exception\UniqueConstraintViolationException; @@ -75,6 +76,10 @@ public static function wrap(\Doctrine\DBAL\Exception $original, string $message ); } + public function isRetryable(): bool { + return $this->original instanceof RetryableException; + } + public function getReason(): ?int { /** * Constraint errors diff --git a/lib/private/Files/Cache/Propagator.php b/lib/private/Files/Cache/Propagator.php index 3fba8aaaed1b4..60194df74f26b 100644 --- a/lib/private/Files/Cache/Propagator.php +++ b/lib/private/Files/Cache/Propagator.php @@ -24,7 +24,7 @@ namespace OC\Files\Cache; -use Doctrine\DBAL\Exception\RetryableException; +use OC\DB\Exceptions\DbalException; use OC\Files\Storage\Wrapper\Encryption; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\Files\Cache\IPropagator; @@ -136,7 +136,11 @@ public function propagateChange($internalPath, $time, $sizeDifference = 0) { try { $builder->executeStatement(); break; - } catch (RetryableException $e) { + } catch (DbalException $e) { + if (!$e->isRetryable()) { + throw $e; + } + /** @var LoggerInterface $loggerInterface */ $loggerInterface = \OC::$server->get(LoggerInterface::class); $loggerInterface->warning('Retrying propagation query after retryable exception.', [ 'exception' => $e ]);