aboutsummaryrefslogtreecommitdiffstats
path: root/includes/poolcounter
Commit message (Collapse)AuthorAgeFilesLines
* Fix various version mention for class_aliasUmherirrender2024-07-058-8/+8
| | | | | | | | Versions are changed in 8e940c4f214ff7d17b53f51c6a46a5cf7fc2c92e, but that makes the version wrong Follow-Up: I7f85d931d3b79da23e87b4e5692b2e14be8fcaa0 Change-Id: Iae43725b8e0fffc4d44bf57f6227334b41290bd9
* Standardise all our class alias deprecation comments for ease of greppingJames D. Forrester2024-03-198-24/+8
| | | | Change-Id: I7f85d931d3b79da23e87b4e5692b2e14be8fcaa0
* PoolCounter: Adopt PSR logger in PoolCounter objectsTimo Tijhof2024-03-025-10/+33
| | | | | | | | | | | | | | | | * Inject from ServiceWiring via PoolCounterFactory. * In production we use PoolCounterClient (which is backed by our poolcounterd service), we also offer PoolCounterRedis for third parties. Replace the local logger in the Redis variant in favour of the built-in one. * Update PoolCounterWork to adopt this as well. Expose it via getter to here, so that DI works all the way, including for the existing test. Bug: T358901 Change-Id: I5413825a0172b186d58e85bbc3cc93697b174c27
* ParserOutputAccess: only use PoolCounter if the caller asks for it.daniel2024-02-291-14/+5
| | | | | | | | | | | PoolCounterWorkArticleView was not designed for use by all callers of getParserOutput. It provides stampede protection but does not generally prevent duplicate concurrent parsing, and it may result in stale cache entries being returned to the caller. This is acceptable for page views, but not other use cases like editing or updating secondary derived data. Bug: T352837 Change-Id: Ie532c17e5b86e8e1adbb57ecd5c5c6405b83bf8f
* [poolcounter] Remove incomplete workaround for T48014C. Scott Ananian2024-02-071-6/+1
| | | | | | | | | | | | | | | | | | | | In relatively-ancient times, there was an issue with stale content being added to the parser cache when reverts were done very quickly after new content was added. This seemed to be a race condition between two slow parses, and code was added to set the cache time "as soon as possible" so that the render times more closely matched the revision order. However, this still doesn't *guarantee* that render times matched the revision order, and eventually a subsequent patch was added to add the revision ID to the parser cache, which apparently fixed the root cause. I72c5e6f86b7f081ab5ce7a56f5365d2f75067a78 sets the render time early in the ContentRenderer, which does effectively the same thing this patch did, so the workaround added here is no longer necessary. Bug: T48014 Bug: T350538 Change-Id: Ide67527158d0a1e517bbc2c693aae15ca80f5618
* Replace more usages of deprecated MWExceptionDaimona Eaytoy2024-01-191-5/+4
| | | | | Bug: T328220 Change-Id: Ie9b56bcf5e962e275d80570cad98d676da505894
* PoolCounter: Namespace classesAmir Sarabadani2023-12-2010-33/+103
| | | | | | | | Two of the classes in this directory have already namespaced to MediaWiki\PoolCounter. Bug: T353458 Change-Id: Ie41f8d935f7623bb40040a5eb78f99c6d7b7b75e
* Namespace ParserOutputJames D. Forrester2023-12-142-0/+2
| | | | | | | Most used non-namespaced class! Bug: T353458 Change-Id: I4c2cbb0a808b3881a4d6ca489eee5d8c8ebf26cf
* PoolCounterConnectionManager: Add support for ipv6Paladox2023-12-131-4/+19
| | | | | Bug: T350615 Change-Id: Iee6c5506623a370485755e3377b1199dc8ceb0de
* Revert "PoolCounterConnectionManager: Add support for ipv6"Ladsgroup2023-11-301-8/+4
| | | | | | | | | This reverts commit 4344b2fb80727daa44eb461e316421ac803d8df1. Reason for revert: Broke production Bug: T352444 Change-Id: I218ee01632a999261c5ecf2aa32d9282d18b7bdc
* PoolCounterConnectionManager: Add support for ipv6Paladox2023-11-131-4/+8
| | | | | Bug: T350615 Change-Id: I50c9cf17efcb974aa76068814d270c50699865c0
* PoolWorkArticleView: Remove unsatisfiable checkSubramanya Sastry2023-09-291-4/+0
| | | | | | | * RevisionRecord::RAW suppresses audience checks * So, we cannot get a null return value here. Change-Id: I8714caf8fb9a0f665ba5fdedb50e898658d18b96
* PoolWorkArticleView: Separate slow-parsoid and slow-parse logsSubramanya Sastry2023-09-121-1/+2
| | | | | | * Avoids polluting slow-parse logs with Parsoid slow parses. Change-Id: I4fd47a787e09c3bda1956bf7360131a8d7e372eb
* rdbms: Inject CP instead of relying on LBFAmir Sarabadani2023-09-041-1/+6
| | | | | | | | | | | This patch makes two major changes: - In the PoolCounter chain, we simply inject CP and call it directly and as result, there is no need for ILBF::getChronologyProtectorTouched - Instead of injecting CP callback to LB, just pass the object down the chain which leads to simpler and more stable code. Bug: T275713 Change-Id: If78f4498d98e256015e54cc46561cb11b2947058
* Reorg: Move Status to MediaWiki\Status\Amir Sarabadani2023-08-259-2/+12
| | | | | | | | | | This class is used heavily basically everywhere, moving it to Utils wouldn't make much sense. Also with this change, we can move StatusValue to MediaWiki\Status as well. Bug: T321882 Depends-On: I5f89ecf27ce1471a74f31c6018806461781213c3 Change-Id: I04c1dcf5129df437589149f0f3e284974d7c98fa
* Reorg: Move MWTimestamp to MediaWiki\UtilsAmir Sarabadani2023-08-191-0/+1
| | | | | Bug: T321882 Change-Id: I48c10343295c4eb3d9ef8037343b0070e928f040
* ParserCache: add an option to explicitly trigger links updateDavid Causse2023-05-161-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | Triggering an opportunistic LinksUpdate on every cache miss of the current revision might not be appropriate in some cases. Some functions like ContentHandler::getParserOutputForIndexing might be called after all LinksUpdates but if these functions do explicitely disallow populating the parser cache via OPT_NO_UPDATE_CACHE we might enter a case where involved jobs would trigger themselves forever. It is happening in the case of the CirrusSearch extension that listens to LinksUpdate and is relying on ContentHandler::getParserOutputForIndexing to fetch the parser output. Introduce a new option ParserOutputAccess::OPT_LINKS_UPDATE to be more intentional on whether such cascading LinksUpdate might occur or not on cache misses. Change the default to not trigger a LinksUpdate on every cache miss and enable it only when rendering the article view (Article::view). It does not seem ideal that this behavior is owned by the ParserCache and further refactoring might be needed to separate these concerns. Bug: T329842 Change-Id: Ib3c3ca935f316ea880ff6c6b393fa80166e42bd3
* PoolCounterRedis: Fix wrong cast, locks weren't being releasedJesús Martínez Novo2023-02-011-2/+2
| | | | | | | | | | | | | | | The slotTime is generated with the php function microtime( true ). The first argument causes microtime to return a float value instead of an integer value. slotTime is used for CAS-style check. The value was being sent as float for locking, but as integer when releasing. Since both values didn't match, the release was ignored. Follow up to Icb2de32107f43817acc45fe296fb77acf65c1786 Bug: T326886 Change-Id: I47383f9f9441a62fa64827ec50b1e6984c6804cb
* Replace some usages of MWExceptionDaimona Eaytoy2023-01-261-2/+2
| | | | | | | | These exceptions are not documented with @throws and they're really not meant to be caught. Bug: T86704 Change-Id: I07f32e42c6fd4bc8785bac91547858f15a9fc2a8
* poolcounter: Create PoolCounterFactory service classTimo Tijhof2023-01-195-64/+76
| | | | | | | | | | | | | | | * Allow for DI of config and PoolCounterConnectionManager. * Manage the PoolCounterConnectionManager singleton without using a global/static field. * Allow for test overrides (in ParserOutputAccessTest) without needing to bring all of ObjectFactory and 'factory' and thus exposing class constructors to stable interface (except not really since the args are hardcoded in practice). Bug: T201223 Change-Id: I514fee20b388f04f9c85c5a1373845d621c65395
* poolcounter: Merge Client and ConnectionManager from extension repoTimo Tijhof2022-12-145-1/+331
| | | | | | | | | | | | | | Code moved as-is from the extension repo with minor changes: * Adopt PSR-4 namespace. * Keep backward-compatibility with "PoolCounter_Client" in LocalSettings, from before the extension was namespaced recently. * Document how `connect_timeout` actually works, and that it was introduced in MW 1.28 (via extension). * Add stable interface annotations. Bug: T201223 Change-Id: Iadec5b4b5d2fc7e76509c9be0a8fa605d95c64a7
* Use the null coalescing assignment operatorTim Starling2022-10-211-1/+1
| | | | | | | | Available since PHP 7.4. Automated search, manual replacement. Change-Id: Ibb163141526e799bff08cfeb4037b52144bb39fa
* poolcounter: Clean up file headers and `@ingroup`Timo Tijhof2022-09-298-59/+43
| | | | | | | | | | | | | | | | | | | | | Follows similar commits to the objectcache, rdbms, profiler, filerepo components and other areas [1]. * Remove duplicate descriptions from file blocks in favour of class doc blocks. This reduces needless duplication and was often incorrect or outdated, and helps (ironically) to make the file header more consistently visually ignorable. * Remove `ingroup` from file blocks in class files as otherwise the file is indexed twice (e.g. in Doxygen) which makes navigation more messy. * Remove `throws` tag for an undescribed MWException that isn't meant to be caught by callers. [1] https://gerrit.wikimedia.org/r/q/message:ingroup+owner:Krinkle Change-Id: I6cd0d2a4d3179668779813a97bb55142eadf8851
* poolcounter: Avoid calling parent::doWork in PoolWorkArticleView classesThiemo Kreuz2022-05-133-8/+18
| | | | | | | | | | | | | Small, non-functional changes to make the code more readable. * No need to expose the subclassing in newPoolWorkArticleView(). All the user needs to know is that PoolCounterWork::execute() can be called. * The doWork() method exists to be called from PoolCounterWork. Each subclasses should do this independently from the others. Another benefit is that we can have more strict type declarations. Change-Id: I9418169e8937029f61d15ad54a1afeec0b343bb9
* Remove access to config globals from more classesdaniel2022-04-281-3/+6
| | | | | | Bug: T294739 Depends-On: I84056024b0d3a9dcddb1ab4dc8596118bb3fe8ea Change-Id: If005958c76bbfabba74def4215c48fe94f297797
* Inline trivial getter in PoolWorkArticleViewThiemo Kreuz2022-04-262-13/+6
| | | | | | The goal is to reduce the complexity of the classes. Change-Id: I12cca74dd86774f94061ef1eb36df78ba9c554eb
* Remove meaningless conditional from PoolWorkArticleViewOldThiemo Kreuz2022-04-191-1/+1
| | | | | | It's always true in this subclass. Change-Id: I4690352340b7dc05b9c8add611ba65668bba3190
* Untangle dependencies between PoolWorkArticleView subclassesThiemo Kreuz2022-04-113-56/+39
| | | | | | | | | | | | | | The base class should not need to know anything about caching. The motivation for this patch is to loosen the strong dependencies between these subclasses, to possibly turn them into proxies or something with much looser coupling. This patch doesn't change any behavior. The code is just moved to a slightly different place, but executed in the same order. Bug: T304813 Change-Id: Icd68538c85c193c3d17443154bfdf6d5bce7661c
* Change ParserOutputAccess workers to work with Status objectsThiemo Kreuz2022-04-084-70/+30
| | | | | | | | | | | | | | All these methods have been written to return true, but that value was never used for anything other than realizing that the method succeeded. The ParserOutput object we are interested in was stuck in a property. Why not return the ParserOutput object? I wrapped it in a Status object to be able to pass warning messages along with the actual result. There was even more specialized code to do that via dedicated setters and getters. All this can be removed now. Bug: T304813 Change-Id: I6fd3745835dfcaec94695469498a2662f8317c35
* Move "dirty" logic to PoolWorkArticleView subclass that uses itThiemo Kreuz2022-04-082-26/+14
| | | | | | | | | | | | | There is only a single subclass that ever does anything with these two boolean properties. Only 3 states are possible. Pretty much all of this belongs to the subclass. No other code should have to know anything about this. This patch doesn't fully solve the issue but moves code in the described direction. Bug: T304813 Change-Id: I70754546f065b03ff04a73307c10f22fbb040810
* Rearrange PoolWorkArticleViewCurrent::fallback() for clarityThiemo Kreuz2022-04-061-12/+10
| | | | | | | | | | This is done in preparation for possible other changes, split off to have smaller and easier to review patches. This patch carefully rearranges code so that nothing changes in terms of what actually happens, and in which order. Bug: T304813 Change-Id: Id10f1f14ebb079d95836110f3b2c8d8c65e2f96d
* ParserOutputAccess: Allow calling getPO with option of not saving in PCAmir Sarabadani2022-04-011-2/+4
| | | | | | | | | This is needed to make sure CirrusSearch doesn't overwhelm parsercache. Follows-up I23c053df4c (T302620). Bug: T285993 Change-Id: Ia5fc3b063c45cb43fdee16f44da2270847773945
* Merge "Use updated ObjectFactory namespace"jenkins-bot2022-03-121-1/+1
|\
| * Use updated ObjectFactory namespaceAlexander Vorwerk2022-03-091-1/+1
| | | | | | | | | | | | | | Depends-On: I99c5e5664d2401c36a9890f148eba7c25e6e8324 Depends-On: I48ab818b2965da14af15ef370aa83ad9455badd9 Depends-On: I018371e4b77911e56152ca7b2df734afc73f58a5 Change-Id: I04ebdb52102f6191d49a9cc70b1f98308299e72f
* | Merge "Fix various documentation related to null types (part II)"jenkins-bot2022-03-091-3/+3
|\ \
| * | Fix various documentation related to null types (part II)Umherirrender2022-03-081-3/+3
| |/ | | | | | | | | | | | | | | | | The functions returning null or the class property is set explict null. Some function should not accept null or return null. Found by phan strict checks Change-Id: Ie50f23249282cdb18caa332f562a3945a58d86ff
* / Fix various documentation related to scalar typesUmherirrender2022-03-091-1/+1
|/ | | | | | Found by phan strict checks Change-Id: If41d16b473baddd92cc4261cdc2bfbe65fedcb19
* Add explicit casts between scalar typesUmherirrender2022-03-011-2/+2
| | | | | | | | | | | | | | | * Some functions accept only string, cast ints and floats to string * After preg_matches or explode() casts numbers to int to do maths * Cast unix timestamps to int to do maths * Cast return values from timestamp format function to int * Cast bitwise operator to bool when needed as bool * php internal functions like floor/round/ceil documented to return float, most cases the result is used as int, added casts Found by phan strict checks Change-Id: Icb2de32107f43817acc45fe296fb77acf65c1786
* Try not to discard Excimer timeout exceptionsTim Starling2022-02-021-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | Don't catch and discard exceptions from the RequestTimeout library, except when the exception is properly handled and the code seems to be trying to wrap things up. In most cases the exception is rethrown. Ideally it should instead be done by narrowing the catch, and this was feasible in a few cases. But sometimes the exception being caught is an instance of the base class (notably DateTime::__construct()). Often Exception is the root of the hierarchy of exceptions being thrown and so is the obvious catch-all. Notes on specific callers: * In the case of ResourceLoader::respond(), exceptions were caught for API correctness, but processing continued. I added an outer try block for timeout handling so that termination would be more prompt. * In LCStoreCDB the Exception being caught was Cdb\Exception not \Exception. I added an alias to avoid confusion. * In ImageGallery I added a special exception class. * In Message::__toString() the rationale for catching disappears in PHP 7.4.0+, so I added a PHP version check. * In PoolCounterRedis, let the shutdown function do its thing, but rethrow the exception for logging. Change-Id: I4c3770b9efc76a1ce42ed9f59329c36de04d657c
* Remove or replace usages of "sane"Reedy2021-11-221-2/+2
| | | | | Bug: T254646 Change-Id: I096b2cf738a1395a14f1d47bcbed0c2c686c2581
* Remove or replace usages of "sanity"Reedy2021-11-191-4/+4
| | | | | Bug: T254646 Change-Id: I2b120f0b9c9e1dc1a6c216bfefa3f2463efe1001
* doc: Cleanup @param documentationUmherirrender2021-11-041-1/+1
| | | | | | No extra sign needed between variable and description Change-Id: Iaaaf62a3ffba7967aef8c31b121121b2830b74c4
* Add slow-parsoid log channelTim Starling2021-09-151-2/+1
| | | | | | | By analogy with slow-parse.log. Also, I fixed the log message so that it has the full title in it. Change-Id: Icaeb6f002c5c2a676467d4c760f99cb2676ad73b
* Add comment to fall-through cases in switchUmherirrender2021-04-151-1/+1
| | | | | | | | Fix new coming sniff PSR2.ControlStructures.SwitchDeclaration.TerminatingComment Bug: T182546 Change-Id: I3f8d43c730981d8faaa72910d7f3b58a14a8372f
* Convert ParserOutputAccess to PageRecord.Petr Pchelko2021-04-051-6/+15
| | | | | | | | | | | | Still needs to downcast to WikiPage in 2 places: 1. To check get a ContentHandler and check if content model is cacheable. We probably should just make all content models cacheable. 2. To call WikiPage::triggerOpportunisticLinksUpdate. I have an elaborate plan for this one, but it will be done separately. Change-Id: Ifd9ab0155dc1fad0c1608dafea05d16292afd057
* Introduce RevisionOutputCachedaniel2020-12-141-98/+10
| | | | | Bug: T267981 Change-Id: Ib1dc641ed10d786918362b25bd655780d5844ba1
* Make ParserCache respect ParserOptions::isSafeToCachePetr Pchelko2020-12-021-1/+12
| | | | | Bug: T269154 Change-Id: I8e9ecd2787aa8d172e708ba64ea936e63fbc6b36
* PoolWorkArticleViewOld: use WANObjectCachedaniel2020-11-301-3/+3
| | | | | | | Use WANObjectCache instead of the local cluster object cache. Bug: T268278 Change-Id: Ic16feffecaf4b75c284c6ef34de42ac113e625f8
* Introduce JsonCodec to help with serialization/deserializationPetr Pchelko2020-11-191-32/+13
| | | | Change-Id: I5433090ae8e2b3f2a4590cc404baf838025546ce
* PoolWorkArticleView: inject loggerdaniel2020-11-183-25/+55
| | | | | Bug: T267832 Change-Id: I7f4763d0e812d076188bb1a4ca2c333f50dffbee