From 7c66328381dd0e2ce5e7ab1e4477593bc79ed3ad Mon Sep 17 00:00:00 2001 From: Robin Appelman Date: Wed, 16 Sep 2015 17:29:34 +0200 Subject: [PATCH] Remove the need for the transaction in the database locking backend --- lib/private/lock/dblockingprovider.php | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/lib/private/lock/dblockingprovider.php b/lib/private/lock/dblockingprovider.php index f3e684d0b4d..6f14b7806ea 100644 --- a/lib/private/lock/dblockingprovider.php +++ b/lib/private/lock/dblockingprovider.php @@ -76,11 +76,10 @@ class DBLockingProvider extends AbstractLockingProvider { * @throws \OCP\Lock\LockedException */ public function acquireLock($path, $type) { - if ($this->connection->inTransaction()){ + if ($this->connection->inTransaction()) { $this->logger->warning("Trying to acquire a lock for '$path' while inside a transition"); } - $this->connection->beginTransaction(); $this->initLockField($path); if ($type === self::LOCK_SHARED) { $result = $this->connection->executeUpdate( @@ -93,7 +92,6 @@ class DBLockingProvider extends AbstractLockingProvider { [$path] ); } - $this->connection->commit(); if ($result !== 1) { throw new LockedException($path); } @@ -146,17 +144,4 @@ class DBLockingProvider extends AbstractLockingProvider { } $this->markChange($path, $targetType); } - - /** - * cleanup empty locks - */ - public function cleanEmptyLocks() { - $this->connection->executeUpdate( - 'DELETE FROM `*PREFIX*file_locks` WHERE `lock` = 0' - ); - } - - public function __destruct() { - $this->cleanEmptyLocks(); - } }