From 0f43b5c8ac6d582fe6ad08d1783ebf97d3cf5b12 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 85c6a72dfdbd5..a285e03967694 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); } /**