Avoid spamming the duplicate key fetch log in BagOStuff::merge()
authorAaron Schulz <aschulz@wikimedia.org>
Fri, 29 Apr 2016 19:03:50 +0000 (12:03 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Fri, 29 Apr 2016 19:03:50 +0000 (12:03 -0700)
Change-Id: I68b10208f222f81f173f6e282c9ecf0bfcdde1fc

includes/libs/objectcache/BagOStuff.php

index 8e3c0a5..bf46ce1 100644 (file)
@@ -285,8 +285,12 @@ abstract class BagOStuff implements IExpiringStore, LoggerAwareInterface {
        protected function mergeViaCas( $key, $callback, $exptime = 0, $attempts = 10 ) {
                do {
                        $this->clearLastError();
+                       $reportDupes = $this->reportDupes;
+                       $this->reportDupes = false;
                        $casToken = null; // passed by reference
                        $currentValue = $this->getWithToken( $key, $casToken, self::READ_LATEST );
+                       $this->reportDupes = $reportDupes;
+
                        if ( $this->getLastError() ) {
                                return false; // don't spam retries (retry only on races)
                        }
@@ -342,7 +346,11 @@ abstract class BagOStuff implements IExpiringStore, LoggerAwareInterface {
                }
 
                $this->clearLastError();
+               $reportDupes = $this->reportDupes;
+               $this->reportDupes = false;
                $currentValue = $this->get( $key, self::READ_LATEST );
+               $this->reportDupes = $reportDupes;
+
                if ( $this->getLastError() ) {
                        $success = false;
                } else {