Make sure getScopedLockAndFlush() commits before unlocking
authorAaron Schulz <aschulz@wikimedia.org>
Sat, 30 Jan 2016 16:52:06 +0000 (08:52 -0800)
committerAaron Schulz <aschulz@wikimedia.org>
Sat, 30 Jan 2016 16:52:06 +0000 (08:52 -0800)
This is necessary for callers to see changes from prior callers

Change-Id: I5e05215541e641b5b5a4bc55c91d6ec8ef774ca1

includes/db/Database.php
includes/db/IDatabase.php

index dc1570e..1836feb 100644 (file)
@@ -3174,6 +3174,7 @@ abstract class DatabaseBase implements IDatabase {
 
                $that = $this;
                $unlocker = new ScopedCallback( function () use ( $that, $lockKey, $fname ) {
+                       $that->commit( __METHOD__, 'flush' );
                        $that->unlock( $lockKey, $fname );
                } );
 
index 1a6e779..1e728d8 100644 (file)
@@ -1519,7 +1519,7 @@ interface IDatabase {
         * This is suitiable for transactions that need to be serialized using cooperative locks,
         * where each transaction can see each others' changes. Any transaction is flushed to clear
         * out stale REPEATABLE-READ snapshot data. Once the returned object falls out of PHP scope,
-        * the lock will be released.
+        * any transaction will be committed and the lock will be released.
         *
         * If the lock acquisition failed, then no transaction flush happens, and null is returned.
         *