jenkins-bot has submitted this change and it was merged.
Change subject: Improve MultiWriteBagOStuff::merge() cross-DC performance
......................................................................
Improve MultiWriteBagOStuff::merge() cross-DC performance
Implement merge() by getting a lock on the tier 1
cache, getting it's value, generating the new one,
writing to all tiers, and then unlocking tier 1.
This is done by just using the stock mergeViaLock().
This means that if tier 1 is in the same DC, the
other tiers only need 1 request each, just for set().
Change-Id: I4b0c303ef3b86b63e7630032ed0b010e79706324
---
M includes/objectcache/MultiWriteBagOStuff.php
1 file changed, 7 insertions(+), 11 deletions(-)
Approvals:
Krinkle: Looks good to me, approved
jenkins-bot: Verified
diff --git a/includes/objectcache/MultiWriteBagOStuff.php
b/includes/objectcache/MultiWriteBagOStuff.php
index 50dd215..98380d9 100644
--- a/includes/objectcache/MultiWriteBagOStuff.php
+++ b/includes/objectcache/MultiWriteBagOStuff.php
@@ -106,6 +106,13 @@
}
protected function doGet( $key, $flags = 0 ) {
+ if ( ( $flags & self::READ_LATEST ) == self::READ_LATEST ) {
+ // If the latest write was a delete(), we do NOT want
to fallback
+ // to the other tiers and possibly see the old value.
Also, this
+ // is used by mergeViaLock(), which only needs to hit
the primary.
+ return $this->caches[0]->get( $key, $flags );
+ }
+
$misses = 0; // number backends checked
$value = false;
foreach ( $this->caches as $cache ) {
@@ -190,17 +197,6 @@
*/
public function unlock( $key ) {
return $this->caches[0]->unlock( $key );
- }
-
- /**
- * @param string $key
- * @param callable $callback Callback method to be executed
- * @param int $exptime Either an interval in seconds or a unix
timestamp for expiry
- * @param int $attempts The amount of times to attempt a merge in case
of failure
- * @return bool Success
- */
- public function merge( $key, $callback, $exptime = 0, $attempts = 10 ) {
- return $this->doWrite( self::ALL, 'merge', $key, $callback,
$exptime );
}
public function getLastError() {
--
To view, visit https://gerrit.wikimedia.org/r/247781
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I4b0c303ef3b86b63e7630032ed0b010e79706324
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Krinkle <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits