(Bug 28611) Don't die in SqlBagOStuff::incr() if there's a race condition.
authorPlatonides <platonides@users.mediawiki.org>
Tue, 19 Apr 2011 17:59:59 +0000 (17:59 +0000)
committerPlatonides <platonides@users.mediawiki.org>
Tue, 19 Apr 2011 17:59:59 +0000 (17:59 +0000)
includes/objectcache/SqlBagOStuff.php

index 10f42cd..6952cdf 100644 (file)
@@ -188,7 +188,12 @@ class SqlBagOStuff extends BagOStuff {
                                        'keyname' => $key,
                                        'value' => $db->encodeBlob( $this->serialize( $newValue ) ),
                                        'exptime' => $row->exptime
-                               ), __METHOD__ );
+                               ), __METHOD__, 'IGNORE' );
+                       
+                       if ( $db->affectedRows() == 0 ) {
+                               // Race condition. See bug 28611
+                               $newValue = null;
+                       }
                        $db->commit();
                } catch ( DBQueryError $e ) {
                        $this->handleWriteError( $e );