From dd0cd5df93b56e96335f9af3cb4bb87fd6474e02 Mon Sep 17 00:00:00 2001 From: Johannes Hammersen Date: Mon, 11 Jul 2016 14:56:17 +0200 Subject: [PATCH] Added Option to disable MySQL row-level locking Galera Cluster does not support table locking, as they conflict with multi-master replication. If Staticpublishqueue is used in a clustered setup, the lock requests crash the underlying database nodes. This adds a new configuration option (disable_mysql_locks) to control the use of MySQL Locks. By default they are enabled (on MySQL based backends). --- code/model/StaticPagesQueue.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/code/model/StaticPagesQueue.php b/code/model/StaticPagesQueue.php index 6387b47e..f14ffcba 100644 --- a/code/model/StaticPagesQueue.php +++ b/code/model/StaticPagesQueue.php @@ -52,6 +52,12 @@ class StaticPagesQueue extends DataObject { 'freshness_priority_created' => '(Freshness, Priority, Created)', ); + /** + * + * @var boolean + */ + private static $disable_mysql_locks = false; + /** * * @var boolean @@ -166,7 +172,7 @@ protected static function get_queue_object($freshness, $interval = null, $sortOr $filteredQuery = $query->filter($filterQuery)->sort($sortOrder); if ($filteredQuery->Count() > 0) { - if (DB::getConn() instanceof MySQLDatabase) { //locking currently only works on MySQL + if (!self::config()->disable_mysql_locks && DB::getConn() instanceof MySQLDatabase) { //locking currently only works on MySQL do { $queueObject = $filteredQuery->limit(1, $offset)->first(); //get first item