objectcache: move lag waiting to SqlBagOStuff::doCas() instead of overriding merge()
authorAaron Schulz <aschulz@wikimedia.org>
Thu, 22 Aug 2019 04:10:35 +0000 (21:10 -0700)
committerAaron Schulz <aschulz@wikimedia.org>
Thu, 22 Aug 2019 22:07:14 +0000 (15:07 -0700)
Change-Id: I61b49bc7b00ffa8308d93e76f4bb94cf09ba9936

includes/objectcache/SqlBagOStuff.php

index 84051e0..ae0912e 100644 (file)
@@ -504,7 +504,12 @@ class SqlBagOStuff extends MediumSpecificBagOStuff {
                        return false;
                }
 
-               return (bool)$db->affectedRows();
+               $success = (bool)$db->affectedRows();
+               if ( $this->fieldHasFlags( $flags, self::WRITE_SYNC ) ) {
+                       $success = $this->waitForReplication() && $success;
+               }
+
+               return $success;
        }
 
        protected function doDeleteMulti( array $keys, $flags = 0 ) {
@@ -554,15 +559,6 @@ class SqlBagOStuff extends MediumSpecificBagOStuff {
                return $newCount;
        }
 
-       public function merge( $key, callable $callback, $exptime = 0, $attempts = 10, $flags = 0 ) {
-               $ok = $this->mergeViaCas( $key, $callback, $exptime, $attempts, $flags );
-               if ( $this->fieldHasFlags( $flags, self::WRITE_SYNC ) ) {
-                       $ok = $this->waitForReplication() && $ok;
-               }
-
-               return $ok;
-       }
-
        public function changeTTLMulti( array $keys, $exptime, $flags = 0 ) {
                return $this->modifyMulti(
                        array_fill_keys( $keys, null ),