Daniel Kinzler has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/383384 )

Change subject: Quick fix for flooding of the RC table.
......................................................................

Quick fix for flooding of the RC table.

Under some conditions, Wikibase can trigger a very large number (millions)
of recentchanges rows to be inserted as the result of a single edit. These
inserts are batched according to the recentChangesBatchSize setting.

This patch aborts the injection after the first batch, to mittigate
the problem if flooding the rc table. This is not a permanent solution,
please refer to T177707 for discussion. ONe possible refinement would be
to inject rc records only for the pages with the most watchers.

Bug: T177707
Change-Id: I0162cbfd6db3ef147745d281a7568313e998f0c3
---
M client/includes/Changes/WikiPageUpdater.php
M client/tests/phpunit/includes/Changes/WikiPageUpdaterTest.php
2 files changed, 6 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Wikibase 
refs/changes/84/383384/1

diff --git a/client/includes/Changes/WikiPageUpdater.php 
b/client/includes/Changes/WikiPageUpdater.php
index f637c25..3bdbe69 100644
--- a/client/includes/Changes/WikiPageUpdater.php
+++ b/client/includes/Changes/WikiPageUpdater.php
@@ -230,6 +230,7 @@
                                . count( $batch ) . " titles" );
 
                        $jobs[] = InjectRCRecordsJob::makeJobSpecification( 
$batch, $change, $rootJobParams );
+                       break; // Quick fix for T177707.
                }
 
                $this->jobQueueGroup->lazyPush( $jobs );
diff --git a/client/tests/phpunit/includes/Changes/WikiPageUpdaterTest.php 
b/client/tests/phpunit/includes/Changes/WikiPageUpdaterTest.php
index 6137192..e07d54c 100644
--- a/client/tests/phpunit/includes/Changes/WikiPageUpdaterTest.php
+++ b/client/tests/phpunit/includes/Changes/WikiPageUpdaterTest.php
@@ -276,7 +276,7 @@
                        $this->getLBFactoryMock(),
                        $this->getRCDupeDetectorMock(),
                        $this->getStatsdDataFactoryMock( [
-                               'InjectRCRecords.jobs' => 2, // 2 batches 
(batch size 2, 3 titles)
+                               'InjectRCRecords.jobs' => 1, // Quick fix for 
T177707: only push first batch!
                                'InjectRCRecords.titles' => 3,
                        ] )
                );
@@ -288,10 +288,12 @@
                        [ 'rootJobTimestamp' => '20202211060708', 
'rootJobSignature' => 'Kittens!', ]
                );
 
-               $this->assertEquals( [ 21, 22, 23 ], array_keys( $pages ) );
+               // Quick fix for T177707: only push first batch!
+               // $this->assertEquals( [ 21, 22, 23 ], array_keys( $pages ) );
+               $this->assertEquals( [ 21, 22 ], array_keys( $pages ) );
                $this->assertEquals( [ 0, 'Foo' ], $pages[21], '$pages[21]' );
                $this->assertEquals( [ 0, 'Bar' ], $pages[22], '$pages[22]' );
-               $this->assertEquals( [ 0, 'Cuzz' ], $pages[23], '$pages[23]' );
+               // $this->assertEquals( [ 0, 'Cuzz' ], $pages[23], '$pages[23]' 
);
 
                $this->assertEquals(
                        [

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0162cbfd6db3ef147745d281a7568313e998f0c3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/Wikibase
Gerrit-Branch: master
Gerrit-Owner: Daniel Kinzler <daniel.kinz...@wikimedia.de>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to