Commit graph

81 commits

Author SHA1 Message Date
Ori Livneh
b0a79e9245 Rename WikiPage::isParserCacheUsed to WikiPage::shouldCheckParserCache
'isParserCachedUsed' implies that the parser cache usage has already occurred,
and obscures the true purpose of this method, which is to determine whether or
not the requested page *should* be looked up in the parser cache.

Only usage in extensions is in TextExtracts, which I changed to be both
backward- and forward-compatible in If5d5da8eab13.

Change-Id: I7de67937f0e57b1dffb466319192e4d400b867de
2015-06-22 20:55:34 -07:00
Ori Livneh
0586f3a44a WikiPage::isParserCacheUsed: change 'oldid' to 'oldId'
Change-Id: Ic68206a1f276c9e5a5b09ed5e2b0422589dfa161
2015-06-23 03:29:08 +00:00
Aaron Schulz
6fb0b31d2f Moved patrol code in commitRollback() down to reduce contention
* It still happens if the edit fails as before
* Also, women...they exist...

Change-Id: If8cc4c55d4edcfb083b7018b2645167c8220ec81
2015-06-13 12:49:33 -07:00
Aaron Schulz
6b0163391b Avoid parser cache miss that often occurs post-save
* This should not happen as doEditContent() saves the parser cache,
  so only the rare casing if incompatible options should have misses
* The bug could also cause post-save misses with edit stashing
* Avoid the second page parse post-redirect by making sure cache
  timestamps match up instead of calling time() at several points
* Likewise for null edits, which used a different code path
* Removed redundant purge in onArticleCreate() as the new row sets _touched
* Removed pointless purge in onArticleDelete() as there is no row to update
  (the method no-ops in that case to avoid contention already)

Change-Id: I178fe334a3f8691ffd9452bec30561a0c5d37c6c
2015-06-09 01:01:03 +00:00
jenkins-bot
5d0a9bb42d Merge "Deprecate $wgEnableParserCache" 2015-06-04 18:33:29 +00:00
Aaron Schulz
8194b2014b Deprecate $wgEnableParserCache
* There is little reason to disable it and one can set $wgParserCacheType
  if truly needed

Change-Id: Iec5fc7729d0f9de67ec2aa6c0e9c2c1e3e0d57ad
2015-06-04 19:23:03 +01:00
Ori Livneh
b31e567b78 hierarchicalize(!) stat names
Graphite expects name components to be dot-separated, so our habit of using
dashes doesn't really make sense. Change metric names to be more compatible
with Graphite, except the job queue's, since that will require a gdash
dashboard definition migration.

Change-Id: I77d0ff7606a8fc88434e4352d23415a9a8f4725a
2015-06-03 16:27:13 -07:00
jenkins-bot
9127d9ea9d Merge "Reduce page deletion lock contention" 2015-06-02 13:20:27 +00:00
Aaron Schulz
771252c8d4 Moved addAutopromoteOnceGroups() call to a deferred update
Change-Id: If7941465889c1848ccf1be4ff5505c5eb53a14f1
2015-05-30 04:47:46 +00:00
Aaron Schulz
7b59841f43 Reduce page deletion lock contention
Bug: T98706
Change-Id: Ib37e74c4737de9d705af28ac2eac06e716dd5f10
2015-05-29 12:35:16 -07:00
Aaron Schulz
97b2a1dfda Made RecentChange defer the save() method via DeferredUpdates
* Also made it handle calling PatrolLog::record() itself

Bug: T100042
Change-Id: I58ef060e02b89a5f9dadc0dbc4edba667932beda
2015-05-22 21:00:29 +01:00
Aaron Schulz
072e3666d3 Defer some updates in doEditUpdates()
* These updates add to editing time and can be done
  after sending the HTTP response for performance
* Also improved the active users job insertion logic

Change-Id: I5b25217c4f08db7fa9a05eac046283f02d45865e
2015-05-21 19:38:25 +00:00
Aaron Schulz
14c87fc976 Simplified doEditContent exception handling
* Callers should not catch errors and fail to rollback
  changes as much here as anywhere else

Change-Id: I65cbeb8d0895223b7ad60c9081d703d14197cb4a
2015-05-19 14:40:53 -07:00
Aaron Schulz
a17cdcbf5b Use lazyPush() instead of push() in a few places for jobs
Change-Id: I56661ea29988e4ee217a63f4c3ffcb78333cc454
2015-05-18 10:31:24 -07:00
Aaron Schulz
7e97ce6a44 Added JobQueueGroup::lazyPush method
* Made use of this in triggerOpportunisticLinksUpdate()
* This will defer and better batch job insertion
* Lazy job insertion and other deferred updates
  make use of register_postsend_function if present
* Also cleaned up some return types and exceptions
  in JobQueueGroup

Bug: T99302
Change-Id: I3a3968d75cb37563f970be08e63f31a090e0e037
2015-05-18 16:26:59 +00:00
jenkins-bot
03ca1f6912 Merge "Reduced the rate of RecentChangesUpdateJob insertion" 2015-05-18 06:02:46 +00:00
Aaron Schulz
317e8e8e12 Removed extra return in triggerOpportunisticLinksUpdate
Change-Id: Ifbce1ce6e940e4e7afbd1267283a4d0568713f6b
2015-05-16 15:20:25 +00:00
Aaron Schulz
93d3373edc Reduced the rate of RecentChangesUpdateJob insertion
Change-Id: Ic7db658f45365ca8ddf7f9dc807a30bc707fe517
2015-05-15 16:00:00 -07:00
Aaron Schulz
187fd64723 Made triggerOpportunisticLinksUpdate() jobs make use of parser cache
* On Wikipedia, for example, these jobs are good percent of
  all refreshLinks jobs; skipping the parse step should avoid
  runner CPU overhead
* Also fixed bad TS_MW/TS_UNIX comparison
* Moved the fudge factor to a constant and raised it a bit

Bug: T98621
Change-Id: Id6d64972739df4b26847e4374f30ddcc7f93b54a
2015-05-11 22:26:44 +02:00
Aaron Schulz
c6ea60543b Removed duplicated jobs in triggerOpportunisticLinksUpdate()
* They get deduplicated on final insertion, but de-duplication them
  on initial insertion (EnqueueJob) to avoid any build-up there.

Change-Id: Ia06f2bdf59a7e57fddb22890aa0b39420c0bfa7d
2015-05-05 20:54:47 -07:00
Mark A. Hershberger
12c370c68b Create PageViewUpdates hook
Bug: T97622
Change-Id: I0f2dedf84a540b6f87623792c7b4f8b8ad8f8059
2015-04-30 09:17:33 -04:00
Aaron Schulz
d834197821 Moved ActiveUsers updates to recent changes jobs
* This avoids writes on view and is more reliable
* Also made the wfWaitForSlaves() there actually work

Bug: T95501
Bug: T92357
Bug: T89027
Change-Id: I0a006fc92a9268feb185c9d88aa04002ea51ecd3
2015-04-22 19:13:37 +00:00
jenkins-bot
9b40fc9086 Merge "Reduce outages due to master DB problems in doViewUpdates" 2015-04-15 00:41:05 +00:00
jenkins-bot
dd7df34a22 Merge "Clean up handling of 'infinity'" 2015-04-14 18:57:16 +00:00
Aaron Schulz
f96bc2eb6f Reduce outages due to master DB problems in doViewUpdates
Change-Id: Ie28e8dcfc3bc402b3119d9cf43612acab2af1004
2015-04-14 17:19:50 +00:00
Aaron Schulz
d43b2e824c Avoid edit stash log spam for bots
Change-Id: I2f9cc86794f8eee282c5efdbe96d4ff981b1977b
2015-04-10 21:06:26 -07:00
Aaron Schulz
8065f52996 Made WikiPage::doPurge() avoid calling commit()
* Calling commit() can cause imbalanced begin/commit problems

Change-Id: I55fec065de20653b216c8dfac7c361124c8fe10a
2015-04-08 10:33:58 -07:00
jenkins-bot
5bfbff2670 Merge "Removed "page-lastedit" cache key trick from WikiPage" 2015-04-07 09:54:14 +00:00
jenkins-bot
051e1abaef Merge "Made replaceSectionContent try to use DB_SLAVE" 2015-04-07 09:29:54 +00:00
Aaron Schulz
a9aadaff39 Removed "page-lastedit" cache key trick from WikiPage
* Just rely on chronology protected and edit conflict handling.
  The time a user spends looking at and editing pages is larger
  than any normal slave lag anyway.
* However make sure that pages just made in the request are visible.
* In "master" datacenters, the slave lag will low anyway, and 
  callers make use of $flags when needed. In other datacenters,
  the cache will itself be subject to lag anyway.
* Logging (DBPerformance log) shows this case is very rarely
  hit anyway.

Change-Id: If34d67c02f9a7bf0a506ee8f3990697eb403a710
2015-04-07 07:22:32 +00:00
Aaron Schulz
ea21dc244e Made replaceSectionContent try to use DB_SLAVE
Bug: T92357
Change-Id: I1626280c863a46d49215cc384e207458b2f8ec39
2015-04-06 16:22:10 -07:00
Aaron Schulz
befcc82eef Avoid DB_MASTER in replaceSectionAtRev()
Bug: T92357
Change-Id: Iac4511176b5c70e9deaf71302bc1866b8b1a241a
2015-04-06 16:07:08 -07:00
jenkins-bot
edca0d035c Merge "Add checks to try to catch T92046" 2015-04-02 23:41:06 +00:00
daniel
c95ec07359 New hook: OpportunisticLinksUpdate
Change-Id: I8b9238cd6b0010ad91fae24d4eb1e7cd0c201931
2015-04-01 11:17:57 +00:00
Brad Jorsch
58dba7d8b2 Add checks to try to catch T92046
Somehow, revisions are getting added to the database without issue but
page_latest is being set to 0 rather than the newly-added revision ID.
Grepping through the code, the only places page_latest gets set are
WikiPage::insertOn() (which isn't relevant for an edit of an existing
page) and WikiPage::updateRevisionOn(). And the only relevant-looking
place WikiPage::updateRevisionOn() gets called seems to be
WikiPage::doEditContent(), which calls Revision::insertOn() just before
which *should* be setting the mId on the revision object.

Since there's no obvious bug in the code, let's add some checks to make
sure that the revision ID isn't 0. If we see exceptions being thrown, at
least we'll have narrowed down the places we need to look more deeply.
And if not (and the bug continues to be reported), we'll at least know
this part is working right.

Bug: T92046
Change-Id: I8cc60593fafb5702e29186ec14cb9d87f1767ef4
2015-03-31 13:33:50 -04:00
Aaron Schulz
4582b738ee Removed view event from $wgAutopromoteOnce
* This avoids master queries on view. It could use local jobs, but nothing
  was using this by default anyway.

Bug: T92357
Change-Id: Id6353942215a3c704848d3bcc31c2b76225c78be
2015-03-26 15:47:33 -07:00
Aaron Schulz
f2bd01aae6 Fixed the usage of $flags in loadLastEdit()
Bug: T93976
Change-Id: I57eb41b463116ea27c0fc8dac8fff07db593499a
2015-03-25 20:39:39 -07:00
jenkins-bot
badc035712 Merge "Drop outdated "documentation reviewed" tags" 2015-03-18 16:56:58 +00:00
Thiemo Mättig
40342aba58 Drop outdated "documentation reviewed" tags
We review documentation all the time. Even if this was a big, notable
review, it was 5 years ago. It's probably outdated again, e.g. because
methods changed but the corresponting documentaion did not. In my
opinion the fact that a review happened 5 years ago is not useful any
more.

Change-Id: I6f4fb88ea790520bf2443aae4144cdde394b5e78
2015-03-18 17:43:01 +01:00
Brad Jorsch
ac6f81d9ad Clean up handling of 'infinity'
There's a bunch of stuff that probably only works because the database
representation of infinity is actually 'infinity' on all databases
besides Oracle, and Oracle in general isn't maintained.

Generally, we should probably use 'infinity' everywhere except where
directly dealing with the database.

* Many extension callers of Language::formatExpiry() with $format !==
  true are assuming it'll return 'infinity', none are checking for
  $db->getInfinity().
* And Language::formatExpiry() would choke if passed 'infinity', despite
  callers doing this.
* And Language::formatExpiry() could be more useful for the API if we
  can override the string returned for infinity.
* As for core, Title is using Language::formatExpiry() with TS_MW which
  is going to be changing anyway. Extension callers mostly don't exist.
* Block already normalizes its mExpiry field (and ->getExpiry()),
  but some stuff is comparing it with $db->getInfinity() anyway. A few
  external users set mExpiry to $db->getInfinity(), but this is mostly
  because SpecialBlock::parseExpiryInput() returns $db->getInfinity()
  while most callers (including all extensions) are assuming 'infinity'.
* And for that matter, Block should use $db->decodeExpiry() instead of
  manually doing it, once we make that safe to call with 'infinity' for
  all the extensions passing $db->getInfinity() to Block's contructor.
* WikiPage::doUpdateRestrictions() and some of its callers are using
  $db->getInfinity(), when all the inserts using that value are using
  $db->encodeExpiry() which will convert 'infinity'.

This also cleans up a slave-lag issue I noticed in ApiBlock while
testing.

Bug: T92550
Change-Id: I5eb68c1fb6029da8289276ecf7c81330575029ef
2015-03-13 11:19:53 -04:00
jenkins-bot
2acd18dd57 Merge "Updated Revision::newFromId() callers to use READ_LATEST as needed" 2015-03-13 00:28:54 +00:00
Aaron Schulz
2db9b2a145 Updated Revision::newFromId() callers to use READ_LATEST as needed
Change-Id: Idcc071e99a712cf3208c10059d476dafe95044cf
2015-03-12 16:47:21 -07:00
Adam Roses Wight
9f2f2f92dc Clean up oldid argument to Content::prepareSave()
The prepareSave function expects the latest revision ID of the article
being replaced.  Instead, we were passing an ID only used for rollbacks
and other special effects.

Change-Id: I4647930566b9370052a820ae3a46e10a6bba65ce
2015-03-12 23:14:26 +00:00
Aaron Schulz
fa212ed345 Push enqueue-on-view jobs to the faster "local" queue
* This only matters for multi-DC setups, otherwise everything is local anyway

Bug: T91819
Change-Id: I0756b59ae1ba27a5d24cf7baef6d068b748e6e30
2015-03-06 13:50:17 -08:00
Aaron Schulz
df5ef8b5d7 Removed doCascadeProtectionUpdates method to avoid DB writes on page views
* Use special prioritized refreshLinksJobs instead, which triggers when
  transcluded pages are changed
* Also added a triggerOpportunisticLinksUpdate() method to handle
  dynamic transcludes

bug: T89389
Change-Id: Iea952d4d2e660b7957eafb5f73fc87fab347dbe7
2015-02-22 13:36:13 -08:00
Legoktm
eca35903a2 Merge "Cache countable statistics to prevent multiple counting on import" 2015-02-13 19:54:17 +00:00
jenkins-bot
23650785ef Merge "Moved RecentChange::purgeExpiredChanges to a job" 2015-02-10 21:32:55 +00:00
This, that and the other
341dfa2587 Cache countable statistics to prevent multiple counting on import
At the moment, when $wgArticleCountMethod = 'link' (as it is on the WMF
cluster), we are querying the Slave database before each individual
revision is imported, in order to find out whether the page is countable
at that time. This is not sensible, as (1) the slave lags behind the
master, but (2) even the master may not be up to date, since page link
updates take place through the job queue.

This change sets up a cache to hold countable values for pages where import
activity has already occurred. That way, we aren't hitting the DB on every
revision, only to get an incorrect response back.

Bug: T42009
Change-Id: I99189c82672d7790cda5036b6aa9883ce6e566b0
2015-02-04 18:00:36 +11:00
Jackmcbarn
ba2b224215 Always use the newly-saved revision with vary-revision
When vary-revision is set, use a currentRevisionCallback to ensure that
the newly-saved revision will always be used by the parser. This keeps
slave lag from making vary-revision not do its job.

Bug: T78237
Change-Id: I92ec928203a67f1236c3ecf6dd5002f66a75c38c
2015-01-23 13:13:21 -05:00
Ricordisamoa
4ece7f53aa Revision: mark getRaw*() methods as deprecated
Revision->getRawUser()
=> Revision->getUser( Revision::RAW )

   Revision->getRawUserText()
=> Revision->getUserText( Revision::RAW )

   Revision->getRawComment()
=> Revision->getComment( Revision::RAW )

The body of Revision->getRawUserText() has been moved
into Revision->getUserText().
Every usage has been replaced.

Change-Id: Ic6fbfbc0507dcf88072fcb2a2e2364ae1436dce7
2015-01-18 06:57:56 +01:00