Aaron Schulz has uploaded a new change for review.
https://gerrit.wikimedia.org/r/248583
Change subject: Batch the updates done for page delete/restore handling
......................................................................
Batch the updates done for page delete/restore handling
If a user had few deleted edits but many live ones, then the
archive ranges will be huge. If any edits by the user are
restored mid-rename, then the logic will update all live
edits for the user in the huge range, which will make
high slave lag.
Bug: T116425
Change-Id: I4995190a1f91c85d10e0496a4ccd11e7ee5c627a
---
M RenameUserJob.php
1 file changed, 10 insertions(+), 4 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Renameuser
refs/changes/83/248583/1
diff --git a/RenameUserJob.php b/RenameUserJob.php
index 516e281..b4051c4 100644
--- a/RenameUserJob.php
+++ b/RenameUserJob.php
@@ -118,11 +118,14 @@
),
__METHOD__
);
- if ( $ids ) {
+ foreach ( array_chunk( $ids, $wgUpdateRowsPerQuery ) as
$batch ) {
+ $dbw->commit( __METHOD__, 'flush' );
+ wfWaitForSlaves();
+
$dbw->update(
'archive',
array( 'ar_user_text' => $newname ),
- array( 'ar_user_text' => $oldname,
'ar_id' => $ids ),
+ array( 'ar_user_text' => $oldname,
'ar_id' => $batch ),
__METHOD__
);
}
@@ -144,11 +147,14 @@
),
__METHOD__
);
- if ( $ids ) {
+ foreach ( array_chunk( $ids, $wgUpdateRowsPerQuery ) as
$batch ) {
+ $dbw->commit( __METHOD__, 'flush' );
+ wfWaitForSlaves();
+
$dbw->update(
'revision',
array( 'rev_user_text' => $newname ),
- array( 'rev_user_text' => $oldname,
'rev_id' => $ids ),
+ array( 'rev_user_text' => $oldname,
'rev_id' => $batch ),
__METHOD__
);
}
--
To view, visit https://gerrit.wikimedia.org/r/248583
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4995190a1f91c85d10e0496a4ccd11e7ee5c627a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Renameuser
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits