summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-08-10 14:39:34 +0200
committerRobin Appelman <icewind@owncloud.com>2015-08-10 14:39:34 +0200
commitd979e54030b0069572affe173c06680597cc831d (patch)
tree63d72d28ae9aaaffe841aaa0274cd47263a67232 /lib
parent58e96e53b039365751eb8c4a2d511fcfcf507891 (diff)
downloadnextcloud-server-d979e54030b0069572affe173c06680597cc831d.tar.gz
nextcloud-server-d979e54030b0069572affe173c06680597cc831d.zip
log a warning while trying to acquire a db lock from within a transaction
Diffstat (limited to 'lib')
-rw-r--r--lib/private/lock/dblockingprovider.php14
-rw-r--r--lib/private/server.php8
2 files changed, 17 insertions, 5 deletions
diff --git a/lib/private/lock/dblockingprovider.php b/lib/private/lock/dblockingprovider.php
index 5480a6e53af..5241a0440b3 100644
--- a/lib/private/lock/dblockingprovider.php
+++ b/lib/private/lock/dblockingprovider.php
@@ -22,6 +22,7 @@
namespace OC\Lock;
use OCP\IDBConnection;
+use OCP\ILogger;
use OCP\Lock\LockedException;
/**
@@ -34,10 +35,17 @@ class DBLockingProvider extends AbstractLockingProvider {
private $connection;
/**
+ * @var \OCP\ILogger
+ */
+ private $logger;
+
+ /**
* @param \OCP\IDBConnection $connection
+ * @param \OCP\ILogger $logger
*/
- public function __construct(IDBConnection $connection) {
+ public function __construct(IDBConnection $connection, ILogger $logger) {
$this->connection = $connection;
+ $this->logger = $logger;
}
protected function initLockField($path) {
@@ -68,6 +76,10 @@ class DBLockingProvider extends AbstractLockingProvider {
* @throws \OCP\Lock\LockedException
*/
public function acquireLock($path, $type) {
+ if ($this->connection->inTransaction()){
+ $this->logger->warning('Trying to acquire a lock while inside a transition');
+ }
+
$this->connection->beginTransaction();
$this->initLockField($path);
if ($type === self::LOCK_SHARED) {
diff --git a/lib/private/server.php b/lib/private/server.php
index 51e70405432..be2cfc2cf88 100644
--- a/lib/private/server.php
+++ b/lib/private/server.php
@@ -432,10 +432,10 @@ class Server extends SimpleContainer implements IServerContainer {
/** @var \OC\Memcache\Factory $memcacheFactory */
$memcacheFactory = $c->getMemCacheFactory();
$memcache = $memcacheFactory->createLocking('lock');
- if (!($memcache instanceof \OC\Memcache\NullCache)) {
- return new MemcacheLockingProvider($memcache);
- }
- return new DBLockingProvider($c->getDatabaseConnection());
+// if (!($memcache instanceof \OC\Memcache\NullCache)) {
+// return new MemcacheLockingProvider($memcache);
+// }
+ return new DBLockingProvider($c->getDatabaseConnection(), $c->getLogger());
}
return new NoopLockingProvider();
});