jenkins-bot has submitted this change and it was merged.
Change subject: Fix wrong response from new-topic using redis
......................................................................
Fix wrong response from new-topic using redis
The MemcachedBagOStuff and RedisBagOStuff interfaces do
not match, specifically the getMulti method of memcached
does not return unfound keys, where the redis one returns
the key set to false.
Change-Id: I6d81d4a1bc6745e9894ba525de258a970f3d8d94
---
M includes/Data/BufferedCache.php
M includes/Repository/MultiGetList.php
M includes/Repository/TreeRepository.php
3 files changed, 20 insertions(+), 1 deletion(-)
Approvals:
Jdlrobson: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/Data/BufferedCache.php b/includes/Data/BufferedCache.php
index c46f853..8cc3648 100644
--- a/includes/Data/BufferedCache.php
+++ b/includes/Data/BufferedCache.php
@@ -35,7 +35,14 @@
* @return array
*/
public function getMulti( array $keys ) {
- return $this->cache->getMulti( $keys );
+ // The memcached BagOStuff returns only existing keys,
+ // but the redis BagOStuff puts a false for all keys
+ // it doesn't find. Resolve that inconsistency here
+ // by filtering all false values.
+ return array_filter(
+ $this->cache->getMulti( $keys ),
+ function( $value ) { return $value !== false; }
+ );
}
/**
diff --git a/includes/Repository/MultiGetList.php
b/includes/Repository/MultiGetList.php
index 202029d..c3c4a74 100644
--- a/includes/Repository/MultiGetList.php
+++ b/includes/Repository/MultiGetList.php
@@ -44,6 +44,12 @@
// Falls through to query only backend
wfDebugLog( 'Flow', __METHOD__ . ': Failure querying
memcache' );
} else {
+ // Memcached BagOStuff only returns found keys, but the
redis bag
+ // returns false for found keys.
+ $multiRes = array_filter(
+ $multiRes,
+ function( $val ) { return $val !== false; }
+ );
foreach ( $multiRes as $key => $value ) {
$idx = $cacheKeys[$key];
if ( $idx instanceof UUID ) {
diff --git a/includes/Repository/TreeRepository.php
b/includes/Repository/TreeRepository.php
index f0fc433..9e5fe1f 100644
--- a/includes/Repository/TreeRepository.php
+++ b/includes/Repository/TreeRepository.php
@@ -194,6 +194,12 @@
}
$cacheResult = $this->cache->getMulti( array_values( $cacheKeys
) );
+ // Memcached BagOStuff only returns found keys, but the redis
bag
+ // returns false for found keys.
+ $cacheResult = array_filter(
+ $cacheResult,
+ function( $val ) { return $val !== false; }
+ );
foreach( $descendants as $descendant ) {
if ( isset(
$cacheResult[$cacheKeys[$descendant->getAlphadecimal()]] ) ) {
--
To view, visit https://gerrit.wikimedia.org/r/150011
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I6d81d4a1bc6745e9894ba525de258a970f3d8d94
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/Flow
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <[email protected]>
Gerrit-Reviewer: EBernhardson <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: SG <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits