Ori.livneh has uploaded a new change for review.
https://gerrit.wikimedia.org/r/250720
Change subject: Make makeKeyInternal() limit more conservative
......................................................................
Make makeKeyInternal() limit more conservative
This should avoid error log entries for long WAN cache keys
Change-Id: I401482d25dd5bf47052a3c6729c5f8bc9fd68770
(cherry picked from commit d2d935483fd57798aedce43629229aab887c5b2a)
---
M includes/libs/objectcache/MemcachedBagOStuff.php
M tests/phpunit/includes/objectcache/MemcachedBagOStuffTest.php
2 files changed, 4 insertions(+), 3 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/core
refs/changes/20/250720/1
diff --git a/includes/libs/objectcache/MemcachedBagOStuff.php
b/includes/libs/objectcache/MemcachedBagOStuff.php
index ef6b3c7..162a531 100644
--- a/includes/libs/objectcache/MemcachedBagOStuff.php
+++ b/includes/libs/objectcache/MemcachedBagOStuff.php
@@ -103,8 +103,9 @@
public function makeKeyInternal( $keyspace, $args ) {
// Memcached keys have a maximum length of 255 characters. From
that,
// subtract the number of characters we need for the keyspace
and for
- // the separator character needed for each argument.
- $charsLeft = 255 - strlen( $keyspace ) - count( $args );
+ // the separator character needed for each argument. To handle
some
+ // custom prefixes used by thing like WANObjectCache, limit to
205.
+ $charsLeft = 205 - strlen( $keyspace ) - count( $args );
$args = array_map(
function ( $arg ) use ( &$charsLeft ) {
diff --git a/tests/phpunit/includes/objectcache/MemcachedBagOStuffTest.php
b/tests/phpunit/includes/objectcache/MemcachedBagOStuffTest.php
index b0c9e4f..6e3b44a 100644
--- a/tests/phpunit/includes/objectcache/MemcachedBagOStuffTest.php
+++ b/tests/phpunit/includes/objectcache/MemcachedBagOStuffTest.php
@@ -42,7 +42,7 @@
);
$this->assertEquals(
- 'test:##5820ad1d105aa4dc698585c39df73e19',
+ 'test:##dc89dcb43b28614da27660240af478b5',
$this->cache->makeKey( '𝕖𝕧𝕖𝕟', '𝕚𝕗', '𝕨𝕖', '𝕄𝔻𝟝',
'𝕖𝕒𝕔𝕙',
'𝕒𝕣𝕘𝕦𝕞𝕖𝕟𝕥', '𝕥𝕙𝕚𝕤', '𝕜𝕖𝕪', '𝕨𝕠𝕦𝕝𝕕', '𝕤𝕥𝕚𝕝𝕝',
'𝕓𝕖', '𝕥𝕠𝕠', '𝕝𝕠𝕟𝕘' )
);
--
To view, visit https://gerrit.wikimedia.org/r/250720
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I401482d25dd5bf47052a3c6729c5f8bc9fd68770
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: wmf/1.27.0-wmf.4
Gerrit-Owner: Ori.livneh <[email protected]>
Gerrit-Reviewer: Aaron Schulz <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits