aboutsummaryrefslogtreecommitdiffstats
path: root/includes/deferred
Commit message (Collapse)AuthorAgeFilesLines
* Remove empty lines from PHP and JavaScript comment blocksThiemo Mättig2016-12-091-1/+1
| | | | | | | | | This is a pure documentation change. It mostly removes empty lines from comments (and entirely empty comments), as well as adds a few missing documentation blocks and fixes a minor mistake. I hope it's ok to have this in one patch. I can split it, please tell me. Change-Id: I9668338602ac77b903ab6b02ff56bd52743c37c4
* Remove empty lines at end of functionsumherirrender2016-11-051-1/+0
| | | | | | | | It looks like there is something missing after the last statement Also remove some other empty lines at begin of functions, ifs or loops while at these files Change-Id: Ib00b5cfd31ca4dcd0c32ce33754d3c80bae70641
* Make updateCategoryCounts() have better lag checksAaron Schulz2016-10-201-41/+76
| | | | | | | | | | | | | | | * Add the lag checks to LinksUpdate. Previously, only LinksDeletionUpdate had any such checks. * Remove the transaction hook usage, since the only two callers are already lag/contention aware. Deferring them just makes the wait checks pointless and they might end up happening all at once. * Also set the visibility on some neigboring methods. * Clean up LinksUpdate $existing variables in passing. Instead of overriding the same variable, use a differently named variable to avoid mistakes. Bug: T95501 Change-Id: I43e3af17399417cbf0ab4e5e7d1f2bd518fa7e90
* Use namespaced ScopedCallbackKunal Mehta2016-10-172-0/+2
| | | | | | The un-namespaced \ScopedCallback is deprecated. Change-Id: Ie014d5a775ead66335a24acac9d339915884d1a4
* Make SessionBackend::save() update the user post-sendAaron Schulz2016-10-121-0/+16
| | | | | Bug: T92357 Change-Id: Id4f4991aca1ceeb74b59e980f09863041246a4fc
* Merge "Add transaction ticket to LinksUpdateComplete hook"jenkins-bot2016-09-231-1/+1
|\
| * Add transaction ticket to LinksUpdateComplete hookAaron Schulz2016-09-231-1/+1
| | | | | | | | | | | | This lets callers use commitAndWaitForReplication() more easily. Change-Id: I743bd1f989b8fb3b7ba3e5cc8ce1bb44c00f99af
* | Call setTransactionTicket() on DeferredUpdates sub-queue items tooAaron Schulz2016-09-221-0/+4
|/ | | | | | | | | This should lower the rate of "does not have outer scope" log warnings in DBPerformance. Also add traces to such logs. Change-Id: I7d21ea745cae07e0fbbe4cd8de82e93f1d10e0a5
* Avoid using cascadingDeletes()/cleanupTriggers()Aaron Schulz2016-09-181-79/+73
| | | | | | | Simplify DB callers by just having one code path. All but some very old code paths bothered with these. Change-Id: Iaf7a2f83146a0ed15995f9cfc74edcf16ae5a448
* Remove wfGetCaller() dependency from DatabaseBaseAaron Schulz2016-09-154-6/+9
| | | | Change-Id: I3e240b2eb5c1f6a21f1bc974c3d28f5755c7451a
* Make SiteStatsUpdate implement MergeableUpdateAaron Schulz2016-09-141-7/+14
| | | | Change-Id: I53c9bf133f0707f2fa203ddd1a7fcb65be8b1329
* Make DeferredUpdates call setTransactionTicket() on all DataUpdate tasksAaron Schulz2016-09-121-1/+9
| | | | | | | This assues that things like LinksUpdate/LinksDeletionUpdate will have a proper ticket for commitAndWaitForReplication() Change-Id: I8234510efb706394c39c4027ddf54ace76983aa9
* Make DeferredUpdates::execute() protectedAaron Schulz2016-09-132-4/+7
| | | | | | | | Update the only caller, which is a deprecated wrapper method. Locking down this internal method makes it secure against misuse with regards to recursion checks. Change-Id: I3ed52dbe4c0ad52c7b5de92e81bfdc98a1737bcf
* Merge "Clarify and update DeferredUpdates docs"jenkins-bot2016-09-071-3/+10
|\
| * Clarify and update DeferredUpdates docsAaron Schulz2016-09-071-3/+10
| | | | | | | | | | | | Follows-up dc0cdc8a4d Change-Id: Ib70585d9d10f6f6493a625697243e0a67796c272
* | Merge "Make deferred updates fully own their transaction rounds"jenkins-bot2016-09-061-2/+3
|\ \
| * | Make deferred updates fully own their transaction roundsAaron Schulz2016-09-031-2/+3
| |/ | | | | | | | | | | | | This will matter when commitMasterChanges() enforcement is tighter. For now, any thing can still call that method anytime. Change-Id: I0b08e9e9118a6c6118c117e3856d0a8e0ca3d457
* / Rename DB_SLAVE constant to DB_REPLICAAaron Schulz2016-09-051-1/+1
|/ | | | | | | | | This is more consistent with LoadBalancer, modern, and inclusive of master/master mysql, NDB cluster, and MariaDB galera cluster. The old constant is an alias now. Change-Id: I0b37299ecb439cc446ffbe8c341365d1eef45849
* Make DeferredUpdates able to run DataUpdatesAaron Schulz2016-09-024-123/+136
| | | | | | | | | | | | | | | | | | | | | | | * Also make ErrorPageError exceptions display themselves in PRESEND mode. Before they were always suppressed. * Make DataUpdate::runUpdates() simply wrap DeferredUpdates::execute(). * Remove unused installDBListener() method, which was basically moved to Maintenance. * Enable DBO_TRX for DeferredUpdates::execute() in CLI mode * Also perform sub-DeferrableUpdate jobs right after their parent for better transaction locality. * Made rollbackMasterChangesAndLog() clear all master transactions/rounds, even if there are no changes yet. This keeps the state cleaner for continuing. * For sanity, avoid calling acquirePageLock() in link updates unless the transaction ticket is set. These locks are already redundant and weaker in range than the locks the Job classes that run them get. This helps guard against DBTransactionError. * Renamed $type to $stage to be more clear about the order. Change-Id: I1e90b56cc80041d70fb9158ac4f027285ad0f2c9
* Move run-on-add logic in DeferredUpdates to addUpdate()Aaron Schulz2016-09-021-22/+11
| | | | Change-Id: I1b3ec21e07549f7250fa497f352fe1c131ddc88a
* Remove $recursionGuard var from tryOpportunisticExecute()Aaron Schulz2016-09-011-20/+10
| | | | | | | | | | | Aside from there being no idle callback setting here, the old addUpdate() code that runs updates allows nesting updates. Make this support that for a few transitional commits. It will be changed later to simply order the sub-updates after their parent updates, keeping both outer scope for all updates and locality of related updates. Change-Id: I0ad4e9713a7893b981b7bb013e9db803eed663b2
* Remove unused custom transaction logic from DataUpdateAaron Schulz2016-09-014-132/+7
| | | | Change-Id: Ife65e4e90a35395e87f4f487f1cb871b67d92aa1
* Merge "Use transaction listener to run DeferredUpdates in CLI mode"jenkins-bot2016-09-011-0/+108
|\
| * Use transaction listener to run DeferredUpdates in CLI modeAaron Schulz2016-09-011-0/+108
| | | | | | | | | | | | | | This sets triggers on master position waits typically called after commitMasterChanges() or in commitAndWaitForReplication(). Change-Id: I127a8fe3cfc319abfa84fcd221ee2dae191c6d3b
* | Deprecate SqlDataUpdateAaron Schulz2016-09-011-0/+2
|/ | | | | | Core subclasses have been updated. Change-Id: Ic1beebeb7aec2b40d89c75637968e57e71a6c1a2
* Links update class cleanupsAaron Schulz2016-08-312-66/+95
| | | | | | | | | * Avoid using deprecated functions. * Switch to DataUpdate as the direct parent class as no benefit was provided from SqlDataUpdate (which should be deprecated soon). Change-Id: I0f1c77128f3df658e6a0eaf4471ca48ac536c643
* LinksUpdate: Add functions returning changed page propertiescenarium2016-08-291-3/+34
| | | | | | | | | | | | | This adds getAddedProperties and getRemovedProperties functions to LinksUpdate. They are available only after the update, so for extensions in the LinksUpdateComplete hook. This is useful for example if an extension caches a page property; if the property gets changed it may want to purge the cache. This is similar to the getAddedLinks and getRemovedLinks functions. Change-Id: I0c73b3d181f32502da75687857ae9aeff731f559
* Clear SiteStats process cache after DB updateTim Starling2016-08-251-0/+6
| | | | | | | | | This fixes a phpunit test error, wherein {{NUMBEROFFILES}} would give the number of files in the host wiki, not in the temporary database, when Scribunto was installed, due to a Scribunto phpunit data provider calling SiteStats::pages(). Change-Id: Ic0d021a72addaa2a13a6b94fd34dccc423de3a8f
* Move EnqueueableDataUpdate to a separate fileAaron Schulz2016-08-222-15/+15
| | | | Change-Id: Iabc291cd1f3c5390ca8bcc5da64a0ff01a082575
* Move invalidatePages() to new PurgeJobUtils classAaron Schulz2016-08-232-51/+2
| | | | | | This does not really belong in SqlDataUpdate. Change-Id: I7166e50696483371f95db3a8b6bce44b0f866ccd
* Add convenience commitAndWaitForReplication() methodAaron Schulz2016-08-163-10/+26
| | | | | | This also does sanity checks to avoid breaking transactions Change-Id: I7453c245eee25a26243e606970ef5f79b21a8141
* Merge "Database transaction flushing cleanups"jenkins-bot2016-08-162-10/+13
|\
| * Database transaction flushing cleanupsAaron Schulz2016-08-162-10/+13
| | | | | | | | | | | | | | | | | | | | | | | | * Do not commit() inside masterPosWait(). This could happen inside JobRunner::commitMasterChanges, resulting in one DB committing while the others may or may not later commit. * Migrate some commit() callers to commitMasterChanges(). * Removed unsafe upload class commit() which could break outer transactions. * Also cleaned up the "flush" flag to make it harder to misuse. Change-Id: I75193baaed979100c5338abe0c0899abba3444cb
* | Make various MWCallableUpdate usages rollback-safeAaron Schulz2016-08-154-7/+23
|/ | | | | | | | Support for this added to MWCallableUpdate and its helper method in DeferredUpdates. Bug: T141988 Change-Id: Ief150ea655036e2708557dd8ae847379edf21933
* Canonicalise '@deprecated since' doc commentsBartosz Dziewoński2016-08-021-1/+1
| | | | Change-Id: I440041512feb47a998efb45e76e3fd00e0655752
* Renamed MWCallableUpdate class file to match the classAaron Schulz2016-07-261-0/+0
| | | | Change-Id: Ia595cee94a696b83b00fe9f2a91b49bce51c08dd
* Make statsd counts for MWCallableUpdate actually usefulAaron Schulz2016-07-215-12/+41
| | | | | | Include the method that made the callback in the key. Change-Id: Ifc7c486ee5c8d57b2516456569bb724cf7dc2b99
* Add AutoCommitUpdate class and replace some onTransactionIdle callersAaron Schulz2016-07-212-7/+71
| | | | | | | | | | | * This puts the complex logic here after the commit step for all DBs, making the main multi-DB transaction more likely to be atomic. * Made some cleanups to AtomicSectionUpdate and made it cancel if the transaction is rolled back as it should. * Also cleaned up some closures for PHP 5.4. Change-Id: If2f7bb6b1ba6daf1cfdc934f27c32b0b10431a3d
* Merge "Simplify lock release in LinksDeletionUpdate"jenkins-bot2016-07-201-4/+2
|\
| * Simplify lock release in LinksDeletionUpdateAaron Schulz2016-07-191-4/+2
| | | | | | | | | | | | The callback already flushes/commits the transaction. Change-Id: I4875fef1434788ee0c689d9fcae6817863a1ba81
* | Merge "Convert SiteStatsUpdate to using newer addCallableUpdate method"jenkins-bot2016-07-201-1/+1
|\ \
| * | Convert SiteStatsUpdate to using newer addCallableUpdate methodAaron Schulz2016-07-191-1/+1
| |/ | | | | | | Change-Id: Ic6037b90edecc936432e997c504e81b3ae8732ad
* | Merge "Improvements to RefreshLinksJob/DeleteLinksJob locking"jenkins-bot2016-07-191-8/+6
|\ \ | |/ |/|
| * Improvements to RefreshLinksJob/DeleteLinksJob lockingAaron Schulz2016-07-191-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Removed the lockAndGetLatest() call which caused contention problems. Previously, job #2 could block on job #1 in that method, then job #1 yields the row lock to job #2 in LinksUpdate::acquirePageLock() by committing, then job #1 blocks on job #2 in updateLinksTimestamp(). This caused timeout errors. It also is not fully safe ever since batching and acquirePageLock() was added. * Add an outer getScopedLockAndFlush() call to runForTitle() which avoids this contention (as well as contention with page edits) but still prevents older jobs from clobbering newer jobs. Edits can happen concurrently, since they will enqueue a job post-commit that will block on the lock. * Use the same lock in DeleteLinksJob to edit/deletion races. Change-Id: I9e2d1eefd7cbb3d2f333c595361d070527d6f0c5
* | Only store currently-existing categories in the categories tableBrad Jorsch2016-07-181-1/+16
|/ | | | | | | | | | | | | | | | | | | | | | A "currently-existing category" is defined as a category that either contains any pages or has a description page. Thus: * Category::initialize() now schedules an update to insert a row if the title exits but the row is missing. * Category::refreshCounts() now removes the row if the title doesn't exist and the category is empty. * WikiPage::onArticleCreate() loads the Category object, to trigger bullet #1. * WikiPage::updateCategoryCounts() refreshes the counts if it results in the row showing 0 pages, to trigger bullet #2. * LinksDeletionUpdate refreshes the counts if the row shows 0 pages, to trigger bullet #2. A maintenance script is provided to update the category table for this new definition. Bug: T28411 Bug: T50824 Change-Id: I0f0adf124c181ae5d3c7c95b3b5fb275a725794c
* Merge "Add statsd logging of DeferredUpdates"jenkins-bot2016-06-201-1/+4
|\
| * Add statsd logging of DeferredUpdatesAaron Schulz2016-06-181-1/+4
| | | | | | | | | | Bug: T137326 Change-Id: Icce439210c6412c1824d8d5c411880825bb05643
* | Provide CategoryAfterPageRemoved hook handlers with deleted page IDsAaron Schulz2016-06-201-1/+1
|/ | | | | | | Since this updates happens post-send or via the job queue, the page object will be for a non-existing or newer page/redirect. Change-Id: I20b583948157dccceca6eb1fbd25121822bf1b2f
* Merge "Use the specified page ID for LinksDeletionUpdate"jenkins-bot2016-06-141-3/+3
|\
| * Use the specified page ID for LinksDeletionUpdateAaron Schulz2016-06-131-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | This makes LinksDeleteJob use the correct page ID when a new page was later created at the title. The links and protection rows to clear should always be for the ID of the actual page being deleted. This fixes a bug when pages are moved over redirects. Bug: T128624 Change-Id: Id67a021539b97020e8dd32d56dba1b77c806f31c