From 4e62537a8b7aa6c74fad4c47afec73eef2417384 Mon Sep 17 00:00:00 2001 From: Aaron Schulz Date: Sat, 30 Jan 2016 08:52:06 -0800 Subject: [PATCH] Make sure getScopedLockAndFlush() commits before unlocking This is necessary for callers to see changes from prior callers Change-Id: I5e05215541e641b5b5a4bc55c91d6ec8ef774ca1 --- includes/db/Database.php | 1 + includes/db/IDatabase.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/db/Database.php b/includes/db/Database.php index dc1570e1a0..1836febf81 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -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 ); } ); diff --git a/includes/db/IDatabase.php b/includes/db/IDatabase.php index 1a6e779329..1e728d80a1 100644 --- a/includes/db/IDatabase.php +++ b/includes/db/IDatabase.php @@ -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. * -- 2.20.1