From 72e1eecf17322895a648e667135096c2c2359412 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Thu, 27 Jul 2023 11:30:43 +0200 Subject: [PATCH] feat(db): set Doctrine to use nest transactions with savepoints Using nested transactions without savepoints is actually deprecated by Doctrine: https://www.doctrine-project.org/projects/doctrine-dbal/en/current/reference/transactions.html#transaction-nesting Without savepoints, a nested transaction can be rollbacked but not handled properly in the "real" transaction, leading to the following error: Transaction commit failed because the transaction has been marked for rollback only. Ref https://github.com/nextcloud/server/pull/36528#issuecomment-1639913965 (and possibly) https://github.com/nextcloud/server/issues/38902#issuecomment-1598075391 Signed-off-by: Thomas Citharel --- lib/private/DB/Connection.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/private/DB/Connection.php b/lib/private/DB/Connection.php index 2bd1d4c824ac8..1a1e701c7a8b3 100644 --- a/lib/private/DB/Connection.php +++ b/lib/private/DB/Connection.php @@ -115,6 +115,8 @@ public function __construct( $this->dbDataCollector->setDebugStack($debugStack); $this->_config->setSQLLogger($debugStack); } + + $this->setNestTransactionsWithSavepoints(true); } /**