Hoo man has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/192212

Change subject: Use onTransactionPreCommitOrIdle in GlobalRenameUserStatus
......................................................................

Use onTransactionPreCommitOrIdle in GlobalRenameUserStatus

Keeps causing deadlocks if a lot of wikis start/finish
at the same time.
As far as I see no one uses the return values or the state
from the DB in the same transaction, so this should be fine.

Bug: T87523
Change-Id: If82b742cc8b19e15a888c70b8fd4272f50656d4f
---
M includes/GlobalRename/GlobalRenameUserStatus.php
1 file changed, 17 insertions(+), 17 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CentralAuth 
refs/changes/12/192212/1

diff --git a/includes/GlobalRename/GlobalRenameUserStatus.php 
b/includes/GlobalRename/GlobalRenameUserStatus.php
index 12aa7a7..64c70a3 100644
--- a/includes/GlobalRename/GlobalRenameUserStatus.php
+++ b/includes/GlobalRename/GlobalRenameUserStatus.php
@@ -121,20 +121,20 @@
         *
         * @param string $wiki
         * @param string $status
-        *
-        * @return bool
         */
        public function setStatus( $wiki, $status ) {
                $dbw = $this->getDB( DB_MASTER );
 
-               $dbw->update(
-                       'renameuser_status',
-                       array( 'ru_status' => $status ),
-                       array( $this->getNameWhereClause( $dbw ), 'ru_wiki' => 
$wiki ),
-                       __METHOD__
+               $dbw->onTransactionPreCommitOrIdle(
+                       function() use( $dbw, $status, $wiki ) {
+                               $dbw->update(
+                                       'renameuser_status',
+                                       array( 'ru_status' => $status ),
+                                       array( $this->getNameWhereClause( $dbw 
), 'ru_wiki' => $wiki ),
+                                       __METHOD__
+                               );
+                       }
                );
-
-               return $dbw->affectedRows() === 1;
        }
 
        /**
@@ -166,18 +166,18 @@
         * Mark the process as done for a wiki (=> delete the renameuser_status 
row)
         *
         * @param string $wiki
-        *
-        * @return bool
         */
        public function done( $wiki ) {
                $dbw = $this->getDB( DB_MASTER );
 
-               $dbw->delete(
-                       'renameuser_status',
-                       array( $this->getNameWhereClause( $dbw ), 'ru_wiki' => 
$wiki ),
-                       __METHOD__
+               $dbw->onTransactionPreCommitOrIdle(
+                       function() use( $dbw, $wiki ) {
+                               $dbw->delete(
+                                       'renameuser_status',
+                                       array( $this->getNameWhereClause( $dbw 
), 'ru_wiki' => $wiki ),
+                                       __METHOD__
+                               );
+                       }
                );
-
-               return $dbw->affectedRows() === 1;
        }
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/192212
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If82b742cc8b19e15a888c70b8fd4272f50656d4f
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CentralAuth
Gerrit-Branch: master
Gerrit-Owner: Hoo man <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to