]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix: Check for wrapped retriable exceptions 38238/head
authorJulius Härtl <jus@bitgrid.net>
Thu, 13 Apr 2023 10:53:40 +0000 (12:53 +0200)
committerbackportbot-nextcloud[bot] <backportbot-nextcloud[bot]@users.noreply.github.com>
Sat, 13 May 2023 22:23:04 +0000 (22:23 +0000)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
lib/private/DB/Exceptions/DbalException.php
lib/private/Files/Cache/Propagator.php

index f9610c5bf2597bef32cec2feefe3e1c734f90f61..2b860a50ff36b28266f0740f7ac39f4a5f6b9533 100644 (file)
@@ -37,6 +37,7 @@ use Doctrine\DBAL\Exception\InvalidArgumentException;
 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;
@@ -74,6 +75,10 @@ class DbalException extends Exception {
                );
        }
 
+       public function isRetryable(): bool {
+               return $this->original instanceof RetryableException;
+       }
+
        public function getReason(): ?int {
                /**
                 * Constraint errors
index 4bf88a60843539179dbed54a970f72d9ecadbc57..70fc238d9bed35ba89b139aa1c441362650450c2 100644 (file)
@@ -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 @@ class Propagator implements IPropagator {
                        try {
                                $builder->executeStatement();
                                break;
-                       } catch (RetryableException $e) {
+                       } catch (DbalException $e) {
+                               if (!$e->isRetryable()) {
+                                       throw $e;
+                               }
+
                                /** @var LoggerInterface $loggerInterface */
                                $loggerInterface = \OCP\Server::get(LoggerInterface::class);
                                $loggerInterface->warning('Retrying propagation query after retryable exception.', [ 'exception' => $e ]);