Commit graph

499 commits

Author SHA1 Message Date
Alangi Derick
feb9456bbc jobqueue: Add PHPDoc param annotation for __construct() method
Document $parserCache, $title and $params for the constructor method
and minor typo fix newSpec() method.

Change-Id: I5968ee5bfe614da6f6dc8d7e0405799aa00b6127
2018-12-07 18:56:36 +00:00
Jakub Vrana
547312ae39 Do not pass unused parameter
Found by PHPStan.

Change-Id: I48a613d94624ef4f8c533b98b8c128b4cc9c47f5
2018-12-01 18:08:04 +01:00
jenkins-bot
366f5d69c1 Merge "Use ParserCache in CategoryMembershipChangeJob" 2018-11-29 01:15:01 +00:00
daniel
4268545b4d Use ParserCache in CategoryMembershipChangeJob
Note that we will still be re-parsing either the old or the new
revision. Keeping the rendered version of the old revision cached
for a bit would be nice, but ParserCache currently does not
support this.

Bug: T205369
Change-Id: I86d26e494924eec24e7b1fb32c424ac1284be478
2018-11-27 15:46:14 -08:00
Brad Jorsch
0cc80f63c4 JobQueue: Actually return the value from getRootJobCacheKey()
I8d94a650e accidentally left out the 'return' keyword, so the function
returns null.

Bug: T209429
Change-Id: Ie29c1ea5eab6ddedd0fe58010fc9cf8e3a6e2f12
2018-11-14 13:41:04 -05:00
jenkins-bot
8a5d98c10e Merge "Use DB domain in JobQueueGroup and make WikiMap domain ID methods stricter" 2018-11-07 05:06:29 +00:00
Aaron Schulz
51945dbca3 Use DB domain in JobQueueGroup and make WikiMap domain ID methods stricter
Using domains means thats JobQueueDB has the right value to use for calls
like LoadBalancer::getConnection(). The full domain includes the schema in
the case of Postgres. This makes calls to getConnection() less awkward by
not relying on the fallback logic in reallyOpenConnection() for null schemas.

Make getWikiIdFromDomain/isCurrentWikiDomain account for the schema if it
is both defined and is not simply the generic "mediawiki" schema MediaWiki
uses by default. If all wikis use the default schema, the wiki IDs can get
by with DB/prefix alone, which various config and methods may be built around.
Otherwise, the config callbacks must account for schema and the config must
include it in various wiki domain ID lists to properly disambiguate wikis.

Also, clean up SiteConfiguration::siteFromDB() since it is not meant
to handle schemas unless the callback method was taylored to do so.

Finally, add more comments to DefaultSettings.php about already existing
limitations of wiki domain IDs and their components.

Change-Id: I8d94a650e5c99a19ee50551c5be9544318eb05b1
2018-11-07 04:46:56 +00:00
Aaron Schulz
b4290a6b6b Improve handling of invalid titles in RefreshLinksJob
Run updates for as many titles as possible and mark the job as failed
if a title is invalid. Set the error message used by the job executer.

Bug: T208147
Change-Id: I7f5fafe9439d8a7b45166515532075202af7d013
2018-11-06 11:53:37 -08:00
jenkins-bot
c6ad2554f4 Merge "Add isCurrentWikiId()/isCurrentWikiDomain()/getCurrentWikiDomain() to WikiMap" 2018-10-29 22:27:15 +00:00
Aaron Schulz
dcd0a3d534 Add isCurrentWikiId()/isCurrentWikiDomain()/getCurrentWikiDomain() to WikiMap
Use these in place of various wfWikiID() calls.

Also cleanup UserRightsProxy wiki ID variable names and removed unused
and poorly named getDBname() method.

Change-Id: Ib28889663989382d845511f8d34712b08317f60e
2018-10-29 14:53:37 -07:00
jenkins-bot
dea8f5344b Merge "Create JobQueueEnqueueUpdate class to call JobQueueGroup::pushLazyJobs()" 2018-10-28 23:10:53 +00:00
Aaron Schulz
6030e9cf2c Create JobQueueEnqueueUpdate class to call JobQueueGroup::pushLazyJobs()
This assures that MergeableUpdate tasks that lazy push job will actually
have those jobs run instead of being added after the lone callback update
to call JobQueueGroup::pushLazyJobs() already ran.

This also makes it more obvious that push will happen, since a mergeable
update is added each time lazyPush() is called and a job is buffered,
rather than rely on some magic callback enqueued into DeferredUpdates at
just the right point in multiple entry points.

Bug: T207809
Change-Id: I13382ef4a17a9ba0fd3f9964b8c62f564e47e42d
2018-10-28 22:19:06 +00:00
Fomafix
43244db9a2 Use PHP 7 '??' operator instead of if-then-else
Change-Id: If9d4be5d88c8927f63cbb84dfc8181baf62ea3eb
2018-10-21 21:46:46 +02:00
Aaron Schulz
ebbccf1845 Migrate some wfWikiId() callers to getLocalDomainID()
Change-Id: I33fe222b7ca66babd61610febaebcf52d3806a7d
2018-10-15 23:58:49 -07:00
Aaron Schulz
c947f3288d jobqueue: clean up JobQueueDB::getCacheKey() to use makeGlobalKey()
Change-Id: I341720fda0d242c7822f78048cb49f63538d08bc
2018-10-13 00:14:38 -07:00
Petr Pchelko
f57b3902ba Do not retry the ThumbnailRenderJob.
The job is a warmup for the thumbnail cache, so loosing it is not
an issue. Most of the times thumbnail rendering fails because of
non-renderable or broken images, or because the thumbnail was
already created by a request. These conditions will not be fixed
by retrying, will only create more load on Thumbor.

Bug: T203135
Change-Id: Ib4640eb13ca93f7350ff0671fc559a76ebbbb1e9
2018-10-11 08:26:03 -07:00
jenkins-bot
cf6fb41666 Merge "Re-namespace RevisionStore and RevisionRecord classes" 2018-10-10 05:16:45 +00:00
jenkins-bot
95bb2a6f0b Merge "Use job queue for deletion of pages with many revisions" 2018-10-10 04:55:53 +00:00
Brad Jorsch
dff469a408 Re-namespace RevisionStore and RevisionRecord classes
During development a lot of classes were placed in MediaWiki\Storage\.
The precedent set would mean that every class relating to something
stored in a database table, plus all related value classes and such,
would go into that namespace.

Let's put them into MediaWiki\Revision\ instead. Then future classes
related to the 'page' table can go into MediaWiki\Page\, future classes
related to the 'user' table can go into MediaWiki\User\, and so on.

Note I didn't move DerivedPageDataUpdater, PageUpdateException,
PageUpdater, or RevisionSlotsUpdate in this patch. If these are kept
long-term, they probably belong in MediaWiki\Page\ or MediaWiki\Edit\
instead.

Bug: T204158
Change-Id: I16bea8927566a3c73c07e4f4afb3537e05aa04a5
2018-10-09 10:22:48 -04:00
daniel
6248556b5e Make RefreshLinksJob MCR compliant.
So far, RefreshLinksJob re-generated the ParserOutput ba calling
Content::getParserOutput. This only works for the main slot. It
needs to instead get the parser output for all slots combiend,
by using RevisionRenderer and RenderedRevision.

Bug: T174035
Change-Id: I253dda26bfa5aefa15f8b1dcc59e69fc7e9d0cb7
2018-10-08 19:20:13 +02:00
Bill Pirkle
ca9f1dabf3 Use job queue for deletion of pages with many revisions
Pages with many revisions experience transaction size exceptions,
due to archiving revisions.  Use the job queue to split the work
into batches and avoid exceptions.

Bug: T198176
Change-Id: Ie800fb5a46be837ac91b24b9402ee90b0355d6cd
2018-10-03 19:16:14 -05:00
Umherirrender
ff95c7a4ba Fix caller name in JobRunner::commitMasterChanges
Use the given fname for all places.
The __METHOD__ inside the unlock closure would be shown as {closure} in
logs

Change-Id: I87ef26e893af858f58d1a77dcb2d8ee192456f5c
2018-10-01 18:48:36 +00:00
Umherirrender
ed95a3e6d9 Fix caller name in PurgeJobUtils::invalidatePages
Seeing {closure} in the logs as caller is not helpful

Change-Id: I252b23e46983b359cbad32323c3a063e7a7afcb5
2018-09-30 16:59:56 +02:00
Umherirrender
a4caa4d0c6 build: Updating mediawiki/mediawiki-codesniffer to 22.0.0
Added spaces around .
Removed empty return statement which are not required
Removed return after phpunit markTestIncomplete,
which is throwing to exit the test, no need for a return

Change-Id: I2c80b965ee52ba09949e70ea9e7adfc58a1d89ce
2018-09-16 15:51:11 +00:00
daniel
4835a75ec5 Use RevisionRenderer for rendering ParserOutput
Bug: T174035
Bug: T174036
Change-Id: I1085b05d635dd954c143c8a398fae909632ba0a9
2018-09-11 15:25:39 +00:00
jenkins-bot
da0e763e57 Merge "Don't wait for thumbnails that take long to render" 2018-09-05 19:34:05 +00:00
Gilles Dubuc
2954003a95 Don't wait for thumbnails that take long to render
The prerendering job is an optimization, should
thumbnails fail to prerender, they will be reattempted
when a user views them again.

Bug: T203135
Change-Id: I2907bf10a2d22af9beffc530856f458a6adbfe45
2018-09-05 21:13:54 +02:00
Gergő Tisza
51602a436c
[MCR] Move getSecondaryDataUpdates to the page level
Replaces Content::getSecondaryDataUpdates with
WikiPage::getSecondaryDataUpdates so that aggregation of
data updates from multiple page slots can be handled without
the caller having to care about it.
Also adds a WikiPage::updateParserCache method for convenience.

This is a temporary measure until DerivedPageDataUpdater
(or its replacement) can be exposed directly, at which point
the WikiPage methods will be deprecated.

Also fixes a parameter handling bug in DerivedPageDataUpdater.

Bug: T194043
Change-Id: Idbe7d582b49fcb7c90aea813773b7610ad44b1a8
2018-09-04 21:50:58 +02:00
jenkins-bot
2f86f8dbb9 Merge "Don't throw an exception when waiting for replication times out" 2018-09-04 02:20:12 +00:00
Tim Starling
e8df0fbab1 Don't throw an exception when waiting for replication times out
For maintenance scripts it is usually harmful to throw an exception.
For jobs the exception was already caught and handled appropriately,
so this can continue as before. For DeferredUpdates it was extremely
harmful to throw an exception. So in the web case, reduce the timeout to
1s and continue as normal if the 1s timeout is reached. This allows the
DeferredUpdate to be throttled without being killed.

In the updater, increase the replication wait timeout to 5 minutes.
ALTER TABLE could indeed cause replication lag, but exiting the update
script with an exception will probably ruin your day. Update actions are
not necessarily efficiently restartable.

Do not call JobQueue::waitForBackups() when jobs are popped. Maybe it
makes sense to call a queue-specific replication wait function for
bulk inserts, like copyJobQueue.php, but doing it when jobs are popped
just makes no sense. Surely the worst that could happen is that the
queue would become locally empty? Removing this waitForBackups() call
avoids waiting for replication twice when JobQueueDB is used.

Bug: T201482
Change-Id: Ia820196caccf9c95007aea12175faf809800f084
2018-09-03 12:29:35 +10:00
Timo Tijhof
3d758d7495 jobqueue: Use explicit retry when refreshLinks can't get a lock
While RefreshLinksJob is de-duplicated by page-id, it is possible
for two jobs to run for the same page ID if the second one was queued
after the first one started running. In that case they the newer
one must not be skipped or ignored because it will have newer
information to record to the database, but it also has no way
to stop the old one, and we can't run them concurrently.

Instead of letting the lock exception mark the job as error,
making it implicitly retry, do this more explicitly, which avoids
logspam.

Bug: T170596
Co-Authored-By: Aaron Schulz <aschulz@wikimedia.org>
Change-Id: Id2852d73d00daf83f72cf5ff778c638083f5fc73
2018-08-28 22:39:01 +01:00
jenkins-bot
bfc3d64695 Merge "ThumbnailRenderJob: normalize parameters before generating thumb URL" 2018-08-10 11:16:19 +00:00
Gergő Tisza
f358c115a3
ThumbnailRenderJob: normalize parameters before generating thumb URL
PagedTiffHandler in particular will fail the generate a param string
for non-normalized parameters.

Also improve logging while we are at it.

Bug: T201305
Change-Id: I40e188f6525187303b6773990b887838b80630e0
2018-08-10 00:42:17 +02:00
Aaron Schulz
5938a6efdc rdbms: add more comments and sanity checks for CONN_TRX_AUTOCOMMIT
Change-Id: I69992cf2e2ae3ef62125b0bc733a0cb7274f814e
2018-08-09 01:39:07 +00:00
Aryeh Gregor
4bdae1c9d2 Convert remaining MagicWord:: calls to MagicWordFactory
Bug: T200247
Depends-On: Ie061fe90f9b9eca0cbf7e8199d9ca325c464867a
Change-Id: I49c507f3875e46a8e15fd2c28d61c17188aabffc
2018-08-01 10:47:43 +03:00
jenkins-bot
276d84229b Merge "JobQueueGroup: Allow readOnlyReason to be specified per JQ type" 2018-07-20 10:30:37 +00:00
Marko Obrovac
a5aa44567b JobQueueGroup: Allow readOnlyReason to be specified per JQ type
We use $wgReadOnly for various reasons, one of which is to disallow
writes in the currently-non-active DC. However, we should allow the
readOnlyReason configuration variable to be available per JobQueue type
and have it the code respect that.

In our current set-up, we use JobQueueEventBus which ever only uses the
enqueue execution path and does not depend upon which DC it is executed
in, so this will allow us to enqueue jobs in both DCs.

Note that this is an alternative approach to the one outlined in
Ibbad6063b6b154d7f7d172c79f7be324bf80eb7e

Bug: T199594
Change-Id: I8f1a57a81ea11c1c587c0057fa8bb3454b0e0b56
2018-07-19 18:13:38 +02:00
Petr Pchelko
1fb12414db Remove JobQueueSecondTestQueue class.
After the switchover is completed we do not need this any more.
This class was marked deprecated as soon as it was created, so
removing it should be safe.

Change-Id: I3451a7a9d1e78bb2c7c988aeb1e3aac93bfc1b6f
2018-07-19 11:42:47 +02:00
Aaron Schulz
e5d71f2552 Switch callers from ProcessCacheLRU to MapCacheLRU
Change-Id: Iefe5c25e952079420b3241bc26efe1d2d086e6fb
2018-07-17 23:17:17 +00:00
Brad Jorsch
c6810d74d1 Deprecate ContentHandler::makeParserOptions()
Having a different ParserOptions for each content model isn't feasible
in an MCR world. And the only thing using this was Wikibase, which has
been fixed to do what it needs in a different way.

Bug: T194263
Change-Id: I01373b29ee25fa9346c6b0317155be4ccdc8c515
2018-07-13 14:32:59 -04:00
Umherirrender
130ec2523d Fix PhanTypeMismatchDeclaredParam
Auto fix MediaWiki.Commenting.FunctionComment.DefaultNullTypeParam sniff

Change-Id: I865323fd0295aabd06f3e3c75e0e5043fb31069e
2018-07-07 00:34:30 +00:00
Bartosz Dziewoński
485f66f174 Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenient
Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/
Replace with: '\1 ?? '

(Everywhere except includes/PHPVersionCheck.php)
(Then, manually fix some line length and indentation issues)

Then manually reviewed the replacements for cases where confusing
operator precedence would result in incorrect results
(fixing those in I478db046a1cc162c6767003ce45c9b56270f3372).

Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
2018-05-30 18:06:13 -07:00
James D. Forrester
f8ac266287 Job: Remove insert() and batchInsert(), deprecated since 1.21
Bug: T179624
Change-Id: I0d78a926c8c513fd652a424e8a51ded20e524a4a
2018-05-21 20:10:09 +01:00
Aaron Schulz
b6cd5421b9 rdbms: rename onTransactionIdle() to onTransactionCommitOrIdle()
This is clearer and is consistent with onTransactionPreCommitOrIdle()

Change-Id: I3a34a0e9adea69ec55ed6ddfef47703e31e7c3b5
2018-05-09 21:07:06 +00:00
Aaron Schulz
c8085ad43f rdbms: make IDatabase::onTransaction* methods pass the DB handle for convenience
Change-Id: Ia45a26830d62326b103593268fbf34c907783c90
2018-04-24 16:45:11 -07:00
jenkins-bot
7dcf1c6616 Merge "Migrate PurgeJobUtils callback to AutoCommitUpdate" 2018-04-17 23:12:44 +00:00
Aaron Schulz
c6b668c2ec Do not start explicit transaction rounds for RecentChangesUpdateJob
The replaces the hacky use of onTransactionIdle(), which no longer runs
immediately in explicit transaction rounds since d4c31cf841.

Also clarified TransactionRoundDefiningUpdate comment about rounds.

Change-Id: Ie17eacdcaea4e47019cc94e1c7beed9d7fec5cf2
2018-04-17 12:39:05 +00:00
Aaron Schulz
2e3dcdab2b Migrate PurgeJobUtils callback to AutoCommitUpdate
Since it calls LBFactory::commitAndWaitForReplication, blocking for
an unknown amount of time, it is a bit "heavyweight" to be the sort
of quick update that uses onTransactionIdle().

Change-Id: Ic3476de5b61a7cd5f31ba487b186f9605a3b2774
2018-04-16 17:11:48 -07:00
Aaron Schulz
f8c2486d15 rdbms: rename CONN_TRX_AUTO constant to CONN_TRX_AUTOCOMMIT
The "AUTO" means AUTOCOMMIT, not "automatic transactions"/DBO_TRX,
which is basically the opposite concept. The new name does not
suffer from that ambiguity.

Keep the old constant as an alias for backwards compatibility.

Also remove LoadBalancer comment about non-existing field

Change-Id: I63beeb061fc9be73f320308e4d6393b58628b8c8
2018-04-12 13:01:52 -07:00
Aaron Schulz
4f31afd21b Move most User::clearAllNotifications() logic to WatchedItemStore
Change-Id: Ib1b0c40e408f6fad6fc8257c5073fa1c3c264c3a
2018-03-23 10:26:13 +00:00