From: Aaron Schulz Date: Mon, 16 Feb 2015 09:28:14 +0000 (-0800) Subject: Removed odd "partitionsNoPush" setting to simplify the code X-Git-Tag: 1.31.0-rc.0~12052^2 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=6846ff953f64665231afc3b62ba2f3cfe971b9f7;p=lhc%2Fweb%2Fwiklou.git Removed odd "partitionsNoPush" setting to simplify the code * A maintenance script already exist for copying jobs to other queues Change-Id: Id105e7e60fae4b8a30cda74a45597a2a2e548a91 --- diff --git a/includes/jobqueue/JobQueueFederated.php b/includes/jobqueue/JobQueueFederated.php index a0a4b7b853..7af2d071d0 100644 --- a/includes/jobqueue/JobQueueFederated.php +++ b/includes/jobqueue/JobQueueFederated.php @@ -49,8 +49,6 @@ class JobQueueFederated extends JobQueue { /** @var HashRing */ protected $partitionRing; - /** @var HashRing */ - protected $partitionPushRing; /** @var array (partition name => JobQueue) reverse sorted by weight */ protected $partitionQueues = array(); @@ -68,8 +66,6 @@ class JobQueueFederated extends JobQueue { * These configuration arrays are passed to JobQueue::factory(). * The options set here are overridden by those passed to this * the federated queue itself (e.g. 'order' and 'claimTTL'). - * - partitionsNoPush : List of partition names that can handle pop() but not push(). - * This can be used to migrate away from a certain partition. * - maxPartitionsTry : Maximum number of times to attempt job insertion using * different partition queues. This improves availability * during failure, at the cost of added latency and somewhat @@ -90,17 +86,10 @@ class JobQueueFederated extends JobQueue { // Get the full partition map $partitionMap = $params['partitionsBySection'][$section]; arsort( $partitionMap, SORT_NUMERIC ); - // Get the partitions jobs can actually be pushed to - $partitionPushMap = $partitionMap; - if ( isset( $params['partitionsNoPush'] ) ) { - foreach ( $params['partitionsNoPush'] as $partition ) { - unset( $partitionPushMap[$partition] ); - } - } // Get the config to pass to merge into each partition queue config $baseConfig = $params; foreach ( array( 'class', 'sectionsByWiki', 'maxPartitionsTry', - 'partitionsBySection', 'configByPartition', 'partitionsNoPush' ) as $o + 'partitionsBySection', 'configByPartition', ) as $o ) { unset( $baseConfig[$o] ); // partition queue doesn't care about this } @@ -114,12 +103,6 @@ class JobQueueFederated extends JobQueue { } // Ring of all partitions $this->partitionRing = new HashRing( $partitionMap ); - // Get the ring of partitions to push jobs into - if ( count( $partitionPushMap ) === count( $partitionMap ) ) { - $this->partitionPushRing = clone $this->partitionRing; // faster - } else { - $this->partitionPushRing = new HashRing( $partitionPushMap ); - } } protected function supportedOrders() { @@ -190,7 +173,7 @@ class JobQueueFederated extends JobQueue { protected function doBatchPush( array $jobs, $flags ) { // Local ring variable that may be changed to point to a new ring on failure - $partitionRing = $this->partitionPushRing; + $partitionRing = $this->partitionRing; // Try to insert the jobs and update $partitionsTry on any failures. // Retry to insert any remaning jobs again, ignoring the bad partitions. $jobsLeft = $jobs; @@ -326,12 +309,12 @@ class JobQueueFederated extends JobQueue { protected function doIsRootJobOldDuplicate( Job $job ) { $params = $job->getRootJobParams(); $sigature = $params['rootJobSignature']; - $partition = $this->partitionPushRing->getLiveLocation( $sigature ); + $partition = $this->partitionRing->getLiveLocation( $sigature ); try { return $this->partitionQueues[$partition]->doIsRootJobOldDuplicate( $job ); } catch ( JobQueueError $e ) { - if ( $this->partitionPushRing->ejectFromLiveRing( $partition, 5 ) ) { - $partition = $this->partitionPushRing->getLiveLocation( $sigature ); + if ( $this->partitionRing->ejectFromLiveRing( $partition, 5 ) ) { + $partition = $this->partitionRing->getLiveLocation( $sigature ); return $this->partitionQueues[$partition]->doIsRootJobOldDuplicate( $job ); } } @@ -342,12 +325,12 @@ class JobQueueFederated extends JobQueue { protected function doDeduplicateRootJob( Job $job ) { $params = $job->getRootJobParams(); $sigature = $params['rootJobSignature']; - $partition = $this->partitionPushRing->getLiveLocation( $sigature ); + $partition = $this->partitionRing->getLiveLocation( $sigature ); try { return $this->partitionQueues[$partition]->doDeduplicateRootJob( $job ); } catch ( JobQueueError $e ) { - if ( $this->partitionPushRing->ejectFromLiveRing( $partition, 5 ) ) { - $partition = $this->partitionPushRing->getLiveLocation( $sigature ); + if ( $this->partitionRing->ejectFromLiveRing( $partition, 5 ) ) { + $partition = $this->partitionRing->getLiveLocation( $sigature ); return $this->partitionQueues[$partition]->doDeduplicateRootJob( $job ); } }