Skip to content

Commit 8fac473

Browse files
committed
fix(UserMountCache): Set transaction isolation level to REPEATABLE_READ before executing insertIfNotExist without unique index
Signed-off-by: provokateurin <[email protected]>
1 parent 73b02f7 commit 8fac473

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/private/Files/Config/UserMountCache.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88
namespace OC\Files\Config;
99

10+
use Doctrine\DBAL\TransactionIsolationLevel;
1011
use OC\User\LazyUser;
1112
use OCP\Cache\CappedMemoryCache;
1213
use OCP\DB\QueryBuilder\IQueryBuilder;
@@ -99,6 +100,8 @@ public function registerMounts(IUser $user, array $mounts, ?array $mountProvider
99100
$changedMounts = $this->findChangedMounts($newMounts, $cachedMounts);
100101

101102
if ($addedMounts || $removedMounts || $changedMounts) {
103+
$this->connection->setTransactionIsolation(TransactionIsolationLevel::REPEATABLE_READ);
104+
102105
$this->connection->beginTransaction();
103106
$userUID = $user->getUID();
104107
try {
@@ -124,6 +127,8 @@ public function registerMounts(IUser $user, array $mounts, ?array $mountProvider
124127
} catch (\Throwable $e) {
125128
$this->connection->rollBack();
126129
throw $e;
130+
} finally {
131+
$this->connection->setTransactionIsolation(TransactionIsolationLevel::READ_COMMITTED);
127132
}
128133

129134
// Only fire events after all mounts have already been adjusted in the database.

0 commit comments

Comments
 (0)