Chad has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/147178

Change subject: Fix up logic for cleaning up old shard allocations
......................................................................

Fix up logic for cleaning up old shard allocations

Change-Id: Ib9f494578ed85174e555378df08cfab4caf14716
---
M includes/Maintenance/ShardAllocation.php
1 file changed, 8 insertions(+), 7 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch 
refs/changes/78/147178/1

diff --git a/includes/Maintenance/ShardAllocation.php 
b/includes/Maintenance/ShardAllocation.php
index cf3803e..2bfa114 100644
--- a/includes/Maintenance/ShardAllocation.php
+++ b/includes/Maintenance/ShardAllocation.php
@@ -41,16 +41,17 @@
                                $this->out->outputIndented( "\tUpdating '$type' 
allocations..." );
                                $this->set( $type, $desired );
                                $this->out->output( "done\n" );
-                       } elseif( !$desired && isset( $actual[$type] ) ) {
-                               $keys = array_filter( array_keys( 
$actual[$type] ),
-                                       function( $key ) use ( $actual, $type ) 
{
-                                               return $actual[$type][$key] !== 
'';
+                       }
+                       if( isset( $actual[$type] ) ) {
+                               $undesired = array_filter( array_keys( 
$actual[$type] ),
+                                       function( $key ) use ( $actual, $type, 
$desired ) {
+                                               return $actual[$type][$key] !== 
'' && !isset( $desired[$key] );
                                        }
                                );
 
-                               if ( $keys ) {
-                                       $this->out->outputIndented( "\tDeleting 
'$type' allocations..." );
-                                       $this->set( $type, array_fill_keys( 
$keys, '' ) );
+                               if ( $undesired ) {
+                                       $this->out->outputIndented( "\tClearing 
'$type' allocations..." );
+                                       $this->set( $type, array_fill_keys( 
$undesired, '' ) );
                                        $this->out->output( "done\n" );
                                }
                        }

-- 
To view, visit https://gerrit.wikimedia.org/r/147178
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib9f494578ed85174e555378df08cfab4caf14716
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to