Mattflaschen has uploaded a new change for review.

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

Change subject: Fix non-deterministic behavior in FeatureIndex
......................................................................

Fix non-deterministic behavior in FeatureIndex

Links could fail to be updated properly due to different key orders.

This was supposed to be taken into account by the sort, but
sort() has useless behavior when strings and numbers are mixed:

Instead, sort by the key.

$input = array( 'ref_src_wiki' => 'wiki', 'ref_src_namespace' => 191, 
'ref_src_title' => '2015-10-29_missing_link_retest' ); sort( $input ); echo 
wfForeignMemcKey( 'wiki', '', 'flow_ref:wiki:by-source:v3', md5( implode( ':', 
$input ) ), '4.7' )
$input = array( 'ref_src_namespace' => 191, 'ref_src_title' => 
'2015-10-29_missing_link_retest', 'ref_src_wiki' => 'wiki' ); sort( $input ); 
echo wfForeignMemcKey( 'wiki', '', 'flow_ref:wiki:by-source:v3', md5( implode( 
':', $input ) ), '4.7' )

This might have caused issues other places too.

Bug: T117138
Change-Id: Id3cb1a3704752ca06fc09cefd463d3cc276c04e1
---
M Flow.php
M includes/Data/Index/FeatureIndex.php
2 files changed, 2 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Flow 
refs/changes/34/249934/1

diff --git a/Flow.php b/Flow.php
index fb58c03..1e8164a 100644
--- a/Flow.php
+++ b/Flow.php
@@ -347,7 +347,7 @@
 // A version string appended to cache keys. Bump this if cache format or logic 
changes.
 // Flow can be a cross-wiki database accessed by wikis running different 
versions of the
 // Flow code; WMF sometimes overrides this globally in 
wmf-config/CommonSettings.php
-$wgFlowCacheVersion = '4.7';
+$wgFlowCacheVersion = '4.8';
 
 // ElasticSearch servers
 $wgFlowSearchServers = array( 'localhost' );
diff --git a/includes/Data/Index/FeatureIndex.php 
b/includes/Data/Index/FeatureIndex.php
index 6e6c7bd..2375688 100644
--- a/includes/Data/Index/FeatureIndex.php
+++ b/includes/Data/Index/FeatureIndex.php
@@ -663,7 +663,7 @@
 
                // values in $attributes may not always be in the exact same 
order,
                // which would lead to differences in cache key if we don't 
force that
-               sort( $attributes );
+               ksort( $attributes );
 
                return wfForeignMemcKey( self::cachedDbId(), '', $this->prefix, 
md5( implode( ':', $attributes ) ), Container::get( 'cache.version' ) );
        }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Id3cb1a3704752ca06fc09cefd463d3cc276c04e1
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: Mattflaschen <[email protected]>

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

Reply via email to