| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
In MediaWiki/Exception, to follow PSR-4 per plural vs. singular (this can be
changed later if people really care). Also, move the couple of exceptions in
here that were already namespaced in the MW-top-level into the new space.
Bug: T353458
Change-Id: I12ed850ae99effb699a6d7ada173f54e72f0570e
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I assume these are all either auto-generated by an IDE or the
language-level type declarations have been added later. In any case
the comments don't add any new information to what the code already
says. This is just extra clutter that makes the code harder to read,
I would argue.
There are many, many more comments like this. In this patch I
intentionally focus on the most trivial 1-line comments.
Change-Id: Ia294bf4ce0d8a77036842fe25884bc175c2b0e7d
|
|
|
|
|
| |
Bug: T340552
Change-Id: I7896f6ebee151d7da1d88e04bb4d05dc007d67e8
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make the Maintenance transaction wrapper methods directly invoke
DeferredUpdates::tryOpportunisticExecute() and flush stats data.
This includes the following methods:
* Maintenance::commitTransaction()
* Maintenance::commitTransactionRound()
* Maintenance::waitForReplication()
Add explicit DeferredUpdates::tryOpportunisticExecute() calls to
integration tests as needed.
Deprecate the now-unused IDatabase::setTransactionListener() and
ILBFactory::setWaitForReplicationListener().
Bug: T373057
Change-Id: I06488d1826ee97de460cf52117b5d691fa5945ad
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Merge Interwiki extension into core, with some changes:
* Always register 'interwiki' user right and 'interwiki' log type, and
remove $wgInterwikiViewOnly
* Remove nonstandard 'intro' and 'body' CSS classes on Special:Interwiki
* Make interlanguage special cases be conditional on $wgInterwikiMagic
* Other cleanups
* Add SpecialInterwikiTest
* Add a constant MW_HAS_SPECIAL_INTERWIKI which can be used in config to
suppress loading of the extension.
After merging Interwiki extension into core we can remove
InterwikiLoadPrefix hook, which is incompatible with Parsoid.
Bug: T33951
Bug: T270444
Bug: T312425
Bug: T315759
Bug: T357247
Depends-On: I0d02d93f49c746a7ce86b72b456f13c4af9b6c34
Change-Id: I05049e7c2e056928977245367583d027b80ef613
|
|
|
|
|
|
|
|
|
|
|
|
| |
This centralizes the action of emitting stats to a single
static function to be used by web and maintenance jobs alike.
* Rename emitBufferedStatsdData to emitBufferedStats
* Move StatsFactory->flush() call into emitBufferedStats
* Update call signature where used
Bug: T380609
Change-Id: I63e8832a170bfaa0e14e977f0852c4ef49f232bb
|
|
|
|
|
| |
Bug: T353458
Change-Id: If0137003ab625017d322d57870448a02569668c3
|
|
|
|
|
| |
Bug: T353458
Change-Id: I3b736346550953e3b2977c14dc3eb10edc07cf97
|
|
|
|
|
|
| |
Add type declarations to properties and methods (except "never" for now) to improve type safety.
Change-Id: Ibfa6f71713642de55c35b7eb6175d2c6165bcc03
|
|
|
|
|
|
|
|
|
| |
And deprecated aliases for the the no namespaced classes.
ReplicatedBagOStuff that already is deprecated isn't moved.
Bug: T353458
Change-Id: Ie01962517e5b53e59b9721e9996d4f1ea95abb51
|
|
|
|
|
| |
Bug: T353458
Change-Id: I99d728bd111ff882220cd175ff09d4da20b81eae
|
|
|
|
|
|
|
|
|
|
|
| |
For certain configuration validation issues, MWLBFactory writes a
message and exits, instead of throwing an exception. This always fails
with an uncaught exception error because MWExceptionRenderer::output
with AS_PRETTY tries to re-enter MWLBFactory.
So instead, use AS_RAW.
Change-Id: I4ab5ad9672d545b272e173e0e6170e769016df0a
|
|
|
|
|
| |
Bug: T351559
Change-Id: I645f1e4a4517b9177286e834236b0c047bef928c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
INSERT IGNORE when inserting NULL into a non-nullable field will succeed
with a warning on MySQL but fail on PostgreSQL. In any case, it's
probably harmful and unintended. But to check the error code of MySQL
warnings, you need to query the server with SHOW WARNINGS, so there is a
performance cost.
So, add a configuration variable which, when enabled, checks warnings
after INSERT to see if there were any null type constraint errors. Set
it to true in DevelopmentSettings.php and TestSetup.php.
Change-Id: I5e47e2d3cc7e0f804036e11b512b1e3b76804432
|
|
|
|
|
|
|
|
| |
I'm not sure if there's a good way to split this up into
logical chunks.
Bug: T313841
Change-Id: I3b35a2e475b5143f383d4085fbc6a0ed3bbc32b8
|
|
|
|
|
| |
Bug: T166010
Change-Id: Ibd40734b96fd2900e3ce12239d09becfb4150059
|
|
|
|
| |
Change-Id: I94c8d20e6d506afefeb5b5a956d5ff207c4d5890
|
|
|
|
|
|
|
| |
This would simplify any caller that's trying to use extension1 cluster
Bug: T330590
Change-Id: Icccde8e10070686870601cae74b21ca9bed71ece
|
|
|
|
|
| |
Bug: T166010
Change-Id: I4066885a7ea071d22497abcdb3f95e73e154d08c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This appears to be redundant. Considering the following maintenance
script scenarios:
* A maintenance script that performs batch writes and periodically
calls commitAndWaitForReplication. DeferedUpdates is notified
by the commit and thus will have run before the lag wait starts.
* A maintenance script that performs each write directly and
calls waitForReplication after every batch (e.g. no atomic sections
or batch commits, on CLI IDatabase defaults to autocommit mode
for each write query).
In this case, DeferredUpdates::addUpdate() runs each update
immediately as it is queued. When waitForReplication is called,
the queue is naturally empty.
* A maintenance script that does have some (indirect) manual commits
or atomic sections. refreshLinks.php is an example of this. It is
generally in auto-commit mode at the top-level with direct calls
to waitForReplication (not commitAndWaitForReplication).
It also runs lots of LinksUpdate's that internally do call
commitAndWaitForReplication. Each of those "commit" and "wait"
listeners notify DeferredUpdates, but result in no-ops since we're
already inside an update and thus have nothing to do. Once the
current update ends, DeferredUpdates naturally keeps running
until the queue is empty. If any new updates are queued from
top-level code after that, they'd run immediately given no open
transaction.
By the time refreshLinks.php's top-level waitForReplication is
reached the queue is once again naturally empty.
Change-Id: Ia997064ce91a84b1037e5026fc813a369fad2712
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Building blocks of CP don't really need to depend on LBF. Even the
config value for CP stash type is also different. But it's being passed
around along the rest of LB/LBF config and possibly down to the DB
object.
This is making the code much harder to understand, adds more coupling
than it needs to, and it's making pieces that don't need to rely on LFB
(like load.php) actually depend on LBF just to disable CP.
This clean up also helps improving DI of LB/LBF and building of DB
objects down the road.
Bug: T275713
Change-Id: Ic27269a1f1190ee7a03c6a422ada7ff293c3cab1
|
|
|
|
|
|
|
| |
None are used
Bug: T275713
Change-Id: I17e450bd307e226f5f819997049180032b4a675c
|
|
|
|
|
|
|
|
| |
This clearly has nothing to do with LBF but is more related to CP. It's
not used outside of core anywhere, all usages fixed.
Bug: T326274
Change-Id: I6d07337fc2a9144c960073100d6078001283ace3
|
|
|
|
|
|
|
|
|
|
|
|
| |
The db/ directory does not have an owner and it's a mess in general.
These classes don't depend on anything in core except the rdbms library.
Let's simply move it there. In other words, Krinkle made me do it.
Since the class was moved in I6202e52ba73 merged less than a week ago,
no need to alias anything.
Bug: T321882
Change-Id: I24ceeb8bf765a50f441270136acd612359d50aa2
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, it runs very expensive regexes uncondtionally on every
query in production leading to 0.34% of all CPU resources of appservers
being spent on this.
Let's simply avoid passing a stub profiler that will throw away the
hard-work right after.
Bug: T326181
Change-Id: Ifdc526daf33e248ee2203756ab826179e63044e6
|
|
|
|
|
|
|
|
| |
They are not suitable to go to rdbms library as they depend on mediawiki
pieces, the second best place is the db/ directory.
Bug: T321882
Change-Id: I6202e52ba7306d74261206c2ba7930c5f1a0a18e
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This is part of LB doing wearing way too many hats. LB's job is to take
an index out of a hat, not to init the db object. We have a factory for
that already.
Also completely get rid of injecting DBFactory as a parameter in config
of LB and LBF, It doesn't make any sense to pass this around as a
configuration option, it's a php class, so can't even be properly set in
many systems (code should not be a configuration). On top of that it's
making multiple ways to override configurations with non-obvious
priority that can easily lead to outages.
Bug: T326274
Change-Id: I1e0c38cd3b378669d0940b9f243b61cb64c193b7
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Notable changes:
* In SqlBagOStuff::getConnectionFromServerInfo, only two loggers were
injected. The rest implicitly got a NullLogger due to being absent.
These are now effectively unsilenced.
* Database::__construct() required almost all parameters, even the
loggers. I've wanted to move some of DatabaseFactory into the ctor
here for a while. In order to make this change not a breaking
change, the new 'logger' parameter is optional with NullLogger as
default. This allowed some of the test cases, which were simply
passing NullLogger, to be fixed by passing nothing instead of
passing the new option name.
The Database class is behind a dozen layers of indirection for
real use, so this will still be injected just fine (DBF, LB, LBF,
MWLBF, etc.).
* In LegacyLogger, the handling for $wgDBerrorLog was previously
limited to DBConnection and DBQuery. This now includes errors
from other (generally, newer) parts of Rdbms as well, which were
previously missing.
This only affects sites (typically CI and dev setup) where
$wgDBerrorLog is used, as opposed to the more common
$wgDebugLogGroups by-channel configuration.
* TransactionProfiler gets its logger injected in a rather odd way,
via entrypoints (MediaWiki.php, ApiMain.php, and MaintenanceRunner)
as opposed to service wiring. This is kept as-is for now.
* In LBFactoryTest, in particular testInvalidSelectDBIndependent2,
there are cases that intentionally produce failures of which
the result is then observed. In CI we assert that dberror.log is
empty so instead of adding the missing logger fields to that
LBFactory instance, the only one set (replLogger) is removed.
The alternative is to set 'logger' now, which would naturally
cause CI failures due to unexpected entries coming through to
non-mocked error log.
Bug: T320873
Change-Id: I7ca996618e41b93f488cb5c4de82000bb36e0dd3
|
|
|
|
|
|
|
|
|
| |
This reverts commit 2bdc0b2b7209441a42a784157633a8a01b321922.
Reason for revert: T166010#8349431
Bug: T166010
Change-Id: Idcd3025647aec99532f5d69b9c1718c531761283
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Moving:
- DerivativeRequest
- FauxRequest
- FauxRequestUpload
- PathRouter
- WebRequest
- WebRequestUpload
Bug: T166010
Change-Id: I5ea70120d745f2876ae31d039f3f8a51e49e9ad8
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We also bring along Database::attributesFromType(), which relied on the
private ::getClass(). This requires us to inject DatabaseFactory through
the LBFactory/LoadBalancer hierarchy.
Database::factory() is now soft deprecated. All callers outside of
includes/installer/ still need migration.
Bug: T299691
Bug: T315270
Change-Id: I7d057a9438f1b097554679975e4e9b2fc99e7c2b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This introduces $wgLBFactoryConf['configCallback'] which can be set to a
function that returns updates to be applied to $wgLBFactoryConf. The new
method LBFactory::autoreConfigure() can be called to check the callabck
and, if the config changed, reconfigure all existing LoadBalancers.
Reconfiguring the LoadBalancers causes all open connections to be
invalidated; however, any DBConnRef instances will remain valid and will
acquire a fresh connection from the LoadBalancer automatically when
appropriate.
As a proof of concept, this patch adds support for config reloding
into WikiExporter.
Bug: T298485
Change-Id: I6c3ffde62f6e038730736abe980befd90ec43e1a
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Export the LoadMonitor weight metric to statsd on each global cache
miss.
* Export the replication lag at the same time. This can replace the
getLagTimes.php cron job and should eliminate the sawtooth effect seen
in the cron job exports, which is presumably due to the offset
between cron job start time and heartbeat time. It should also work
around the bug which causes s3 to be missing.
Also:
* Fix a log message in TransactionProfiler. actualSeconds -> actual
since this log message is used for counts as well as time.
Bug: T313004
Change-Id: I61e45870d750019ed2c92f45b2f8b9c33a7e7d65
|
|
|
|
|
|
| |
Has not been used for a while.
Change-Id: I0089fa01524924a092a616ebfa190a360ff957b3
|
|
|
|
|
|
|
|
|
|
|
|
| |
Using a bitfield breaks server array template merging in LBFactoryMulti.
The only nice thing about flags compared to boolean constructor
parameters is the existence of setFlag(), clearFlag() and
restoreFlags(). But that is not useful for parameters that are used
during connect.
Bug: T134809
Change-Id: I088ef4a0e4c11a2cfe17415b325b455164004c1e
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This edition brought to you by:
grep -ERIn $(grep -o "'[A-Za-z0-9_]*'" includes/MainConfigNames.php | tr
"\n" '|' | sed 's/|$/\n/') includes/
I only corrected a fraction of the results provided by that command. I'm
submitting the partial patch now so it doesn't bitrot.
Bug: T305805
Change-Id: If1918c0b3d88cdf90403921e4310740e206d6962
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Calling the service locator in code used in the service wiring is
asking for trouble.
I found this using some arcane hack that calls applyDefaultConfig
in its own, pre-setup, service locator.
A perfectly good ServiceOptions is available, with much less
indirection. Makes the thing more testable too.
Follow-up to I1a691f01cd82e60bf41207d32501edb4b9835e37.
Change-Id: I38d4db2b7d897ebbceac8e773bb0512a8fc484d3
|
|
|
|
|
|
|
|
|
|
|
|
| |
Automatically refactors wg prefixed globals to use MediaWikiServices config using Rector. Doesn't include files that set globals or files that fail CI.
Rector Gist: https://gist.github.com/tchin25/7cc54f6d23aedef010b22e4dfbead228
* This patch uses a modified source code rector library for our specific use case and the rector will have different effects without it.
A writeup for future reference is here: https://meta.wikimedia.org/wiki/User:TChin_(WMF)/Using_Rector_On_MediaWiki
Change-Id: I1a691f01cd82e60bf41207d32501edb4b9835e37
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
For web requests, this was attempting to inject the current client's
session user name or XFF-resolved IP address to the SQL query.
However, this has been broken for five years (since around
commit 16b4e3a9f1 / Ibb4f1c0dafea071a) because the relevant objects
are already constructed by the time MediaWiki::main() runs, and so
MediaWiki::setDBProfilingAgent isn't doing much other then changing
the LBFactory state, which rarely gets another chance to pass it down
after that.
This breakage is actually a good thing as otherwise Tendril and
performance_schema tools would not have been able to aggregate slow
queries very well due to being too dynamic/variable (these tools
can't ignore comments per T291420 and T291419, and the comments we
do have for fname are actually useful to aggregate.)
As of I6e9939e34287d27430, this lack of dynamic variability (apart
from standard SQL syntax conditions that can vary) is now documented
as desirable for wikimedia/rdbms. To avoid confusion or from this
code accidentally becoming undead, let's remove it.
While at it, remove it for CLI in MWLBFactory as well. This one did
work currently, but as I understand it was not very useful on its
own but rather filling in data to keep a consistant shape with the
web format, which is broken. In particular, afaik dbuser and
sender webserver hostname are already known to MySQL for all queries
and present in processlist and other tooling.
Bug: T193050
Change-Id: I033140ddbb04df97de3391a247d1ca937b3bc918
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Document that Maintenance::shutdown is the CLI equivalent of
MediaWiki::restInPeace.
* Centrally document in the emitStats method why we flush stats
regularly, and clarify that these OOM concerns are specific to
CLI processes there. That isn't to say it could never happen on a
web request, but all our early flush handling (even DB trx hooks)
are explicitly limited to command-line mode today and always have
been.
* Ref T253547. It is now clear why --profiler=text doesn't work on
the CLI (it is missing the non-external profiler output handling),
which I'll fix in a follow-up.
* Ref T292269. The WebRequest-dependency in Profiler is now much more
clearly problematic. Previously this was masked by wfLogProfilingData
effectively silencing the warning on the CLI without it being so
obviously wrong. I'll fix that in a follow-up.
* Ref T292253. All this is already post-send, and flame graphs confirm
that we don't have any calls to emitBufferedStatsdData nor
StatsdClient::send apart from the post-send one via restInPeace.
Bug: T253547
Bug: T292269
Bug: T292253
Change-Id: If78c37046cf8651c7a8d6690e01d38c3ca29d8d8
|
|
|
|
|
|
|
|
|
|
| |
This helps phan to detect unreachable code and also impossible types
after the functions.
It helps phan to avoid false positives for array keys
when the keys are checked before
Bug: T240141
Change-Id: I895f70e82b3053a46cd44135b15437e6f82a07b2
|
|
|
|
|
| |
Bug: T254646
Change-Id: I5379dc79be60c99f0a30f74e5d624f81fe6f921b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
composer:
* mediawiki/mediawiki-codesniffer: 36.0.0 → 37.0.0
The following sniffs now pass and were enabled:
* Generic.ControlStructures.InlineControlStructure
* MediaWiki.PHPUnit.AssertCount.NotUsed
npm:
* svgo: 2.3.0 → 2.3.1
* https://npmjs.com/advisories/1754 (CVE-2021-33587)
Change-Id: I2a9bbee2fecbf7259876d335f565ece4b3622426
|
|
|
|
|
|
|
|
|
| |
MWLBFactory tries to determine the current user's name using
posix_getpwuid(). This will however fail if the current user has no
name, which is the case when running in our standard docker environment.
Bug: T283191
Change-Id: If814d791ee7061d8632ae04602cf489b06422eee
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This means we'll consider a slightly more ChronologyProtector cookies
that are near their expiry. This is perhaps not so useful since that's
also near the time where max replication lag kicks in, and the storing
of the CP data itself is going to be evicted.
But, this may be a more predictable and stable reference point than
"current" time, considering that as of I3140922cec130cad, this
computation now happens lazily at the first call to LBFactory, instead
of during Setup.php, so in a way this change just brings it back to be
closer to the start of the request (except even earlier than it was
before I3140922cec130cad, since before that commit we did wait until
after the first few ~ milliseconds of multiversion, autoloader,
composer, etc.).
Bug: T228895
Change-Id: I76e2130431ab44344eea93ce8f4f8b2322840819
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This logic is not needed to run on every PHP process and was making
it difficult to run offline maintenance scripts without additional
complexity based on Maintenance::getDbType and DB_NONE.
Instead of skipping this only for DB_NONE, and establishing a pattern
that may spread to other ad-hoc places throughout the codebase, instead
remove this entirely from the eager set up code for all PHP processes
and move it to the service wiring and dependency injection.
That way, it naturally doesn't happen until and unless the DB service
is actually called upon. Scripts and entry point that need to disable
the DB service, can continue to use
MediaWikiServices::disableStorageBackend.
== Impact on SiteStatsUpdate ==
With wgCommandLineMode no longer being read at run-time from a global,
but in service wiring, this means SiteStatsUpdateTest can't change
the behaviour between CLI-like and Web-like, unless it e.g. resets
the 'DBLoadBalancerFactory' service first. Unfortunately, while most
any reset is supported, a reset of the 'DBLoadBalancerFactory' would
be unsupported as that would lose the temporary db clone context and
such, bringing us to either the developer's live db, or a broken set
up altogether. If there is a strong need for toggling oppertunistic
updates off and on at run-time, this could be supported in the
DeferredUpdates class perhaps, but we already have numerous methods
there (incl db begin/commit being a good proxy already), which this
test already used, so for now I've just removed the extra assertion
for this as it wasn't essential to that test.
Bug: T228895
Bug: T238436
Change-Id: Icf29bc484c155f52b6d8f61e5902233a15ba0c6d
|
|\| |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Avoid costly and unconditional set up of LBFactory early on in
Setup.php. Instead, inject this information lazily if and when the
service is contructed by something that actually needs a database
connection.
This removes the cost of LBFactory service + dependencies for requests
to load.php, api.php, and rest.php requests that involve no (other)
calls to the database service.
Bug: T228895
Change-Id: I3140922cec130cad84eb89b2b34520c0988027dc
|