Add a multi-primary mode option that supports MySQL DB setups
that use circular replication with STATEMENT formatted binlogs.
The `modtoken` column is only used when multi-primary mode is
explicitly enabled in configuration. The column is used by write
queries to determine the "winning" version of keys, with the goal
of approximating "Last-Write-Wins" eventual consistency.
Writes with different timestamps can be handled by picking the
one with the highest timestamp as the "winner". Writes with the
same timestamp, from different primary DBs, can be handled by
picking the one from the primary DB with the highest server_id.
Writes with the same token timestamp from the same primary DB can
be handled by picking the last write to appear in the binlog.
The delete() operation uses tombstones in multi-primary mode,
since there must be a key version to actually compare with the
versions from other operations.
Also:
* Remove "LOCK IN SHARE MODE" that was made obsolete by the
CONN_TRX_AUTOCOMMIT flag. For the SQLite transaction case,
it is serializable anyway.
* Simplified handleWriteError() to match handleReadError()
and merged them into handleDBError().
Changes from d56a686f83:
* Keep using replace() for set() in non-multi-primary mode.
* Fix old encoding issues when incrementing keys with postgres.
Bug: T274174
Change-Id: I25b1278586f99fdace8f2a081f6f460f734e5d83
Empty leading components should still be colon separated. Although the
keyspace and collection should never be empty strings, it does not hurt
to handle that case anyway for safety.
Change-Id: Ic89acaf1fe5c34e58323b2913a9a26f973868590
Add a multi-primary mode option that supports MySQL DB setups
that use circular replication with STATEMENT formatted binlogs.
The `modtoken` column is only used when multi-primary mode is
explicitly enabled in configuration. The column is used by write
queries to determine the "winning" version of keys, with the goal
of approximating "Last-Write-Wins" eventual consistency.
Writes with different timestamps can be handled by picking the
one with the highest timestamp as the "winner". Writes with the
same timestamp, from different primary DBs, can be handled by
picking the one from the primary DB with the highest server_id.
Writes with the same token timestamp from the same primary DB can
be handled by picking the last write to appear in the binlog.
The delete() operation uses tombstones in multi-primary mode,
since there must be a key version to actually compare with the
versions from other operations.
Also:
* Remove "LOCK IN SHARE MODE" that was made obsolete by the
CONN_TRX_AUTOCOMMIT flag. For the SQLite transaction case,
it is serializable anyway.
* Simplified handleWriteError() to match handleReadError()
and merged them into handleDBError().
Bug: T274174
Change-Id: Icc5eff9a032dd3403b5718058f20e38f8ea84af5
Ended up using
grep -Prl '\->setMethods\(' . | xargs sed -r -i 's/setMethods\(/onlyMethods\(/g'
special-casing setMethods( null ) -> onlyMethods( [] )
and then manual fix of failing test (from PS2 onwards).
Bug: T278010
Change-Id: I012dca7ae774bb430c1c44d50991ba0b633353f1
No integration needed, except for maybe in
the tests for the UploadedFile* classes, which
are left where they are for now - those tests
deal with the file system.
Change-Id: I4f38557d524b2d36dea36a926d0f31e1afed5c7a
Discovered in another patch that while integration
tests automatically reset fake timestamps afterwards,
unit tests don't. Add a shared method to MediaWikiTestCaseTrait
to reset for both integration tests and unit tests
Do the same for TypeDefTestCase
Change-Id: I677aec4e60894053fc554f2e13b069fb599858f2
- JavaScriptMinifier: The public interface for this internal class is
ResourceLoader::filter which, except for one caller (minify.php)
is indeed consistently used already, no other callers need replacing.
- CSSMin: Idem for minification, however, this class has some other
method as well, which have a number of internal users, but none
outside core. These have all been replaced in this commit.
- Remove pear/net_url2 as own dependency as this was only used by CSSMin
and recently added there. This is now a dependency of wikimedia/minify
instead. This was not part of the public API and no longer mentioned
here in composer.json or RELEASE-NOTES. (It remains pinned in
mediawiki-vendor, however.)
Bug: T273247
Depends-On: Iadff8c2112d5e53bd994ab4882006e8c644a2379
Depends-On: Id3c6dcc0b952a9efe34b3a9ed88b716101a51f87
Depends-On: I589be910f57289fd908b22db87241b0e52da60d4
Change-Id: I8d71fc64aeecdb31db218b02e361ae9bb0d19b48
Move ConvertibleTimestamp::getTimestamp call into try-block to catch
its exception.
While constructor of ConvertibleTimestamp does throw exception for
most invalid timestamps, it does not verify MediaWiki timestamp
length requirement as done by ::getTimestamp() method
Bug: T272637
Change-Id: Ia2c1887fba62870a5eafa28ec49ab5e631ca1d53
Required to be overriden by every subclass via direct override
or the indirect static property, which is used only for this
purpose.
The benefit of that is this automatically allow us to remove the
custom Logic exception/property null handling. It also obsoletes
the property itself, which is already a form of redundancy.
Additionaly it removes duplication in classes that are providing
the property and duplicating the base class method code, like
StringDefTest.php
It's better if every child class provide the needed instance via
consistent way and that which is not redundant with another.
Change-Id: Ibe10c2c01b381190cc92e7ee2e1e0888c16e5bf4
My personal best practice is to not document @params when there
is a @dataProvider. I mean, these test…() functions are not
meant to be called from anywhere. They do not really need
documentation. @param tags don't do much but duplicate what the
@dataProvider does. This is error-prone, as demonstrated by the
examples in this patch.
This patch also removes @throws tags from tests. A test…() can
never throw an exception. Otherwise the test would fail.
Most of these are found by the not yet released I10559d8.
Change-Id: I3782bca43f875687cd2be972144a7ab6b298454e
These are not only 100% identical to the actual code, but also:
* It's error-prone. Some are already wrong.
* These test…() functions are not meant to be called from
anywhere. What is the target audience for this documentation?
* There is a @dataProvider. What such @param tags actually do is
document the provider, but in an odd place. Just looking at
the provider should give the same information.
* The MediaWiki CodeSniffer allows to skip @param when there is
a @dataProvider, for the reasone listed.
Change-Id: I0f6f42f9a15776df944a0da48a50f9d5a2fb6349
Only caller in 1 Gerrit-hosted extension (BlueSpiceUEModuleTable2Excel),
which is fixed in Iadfed3b5c5b249b00eb61f03296d6e223e422de8.
Change-Id: I0d3de862d592ae6ca3cbeeeb8d3f667a848273c2
* parent::setUp() should be first, and ::tearDown()
should be last
* Move tests that directly extend PHPUnit\Framework\TestCase
to /unit
Change-Id: I1172855c58f4f52a8f624e6d596ec43beb8c93ff
Some irritating breaking changes, including dropping PHP 7.2 support
and renaming the classes we care about. For now, hack in via || and
some back-compatibility class aliases.
Bug: T270732
Change-Id: I685f099584d2f0e5fa17f1f4275eab5289c7bfee
Add "generic" key methods for quickly deriving keys from
key component lists in a bijective manor. This is useful
for BagOStuff classes that wrap other BagOStuff instances
or for parsing keys to get stats.
Make the proxy BagOStuff classes (ReplicatedBagOStuff,
MultiWriteBagOStuff, CachedBagOStuff) use "generic" keys
so that they can convert to appropriate keys when making
backing cache instance method calls.
Make EmptyBagOStuff, HashBagOStuff, APCUBagOStuff,
RedisBagOStuff, and RESTBagOStuff use "generic" keys rather
than those of MediumSpecificBagOStuff::makeKeyInternal().
This lets proxy BagOStuff classes bypass key conversions
when used with instances of these classes as backing stores.
Also:
* Fix missing incr(), incrWithInit(), and decr() return
values in MultiWriteBagOStuff.
* Make MultiWriteBagOfStuff, ReplicatedBagOStuff, and
CachedBagOStuff use similar backend method forwarding
styles by using a new BagOStuff method.
* Improved various related bits of documentation.
Bug: T250239
Bug: T235705
Change-Id: I1eb897c2cea3f5b756dd1e3c457b7cbd817599f5
Follows-up cd54c03e86, in which I forgot a call to setScheme()
in the `isServerLess` branch.
For "server-less" URLs, we mock both schema and host, but only
strip the host. This left something I did not think was allowed
in the Net_URL2 class, which is to produce a URL that has a full
protocol and scheme, no host, and then a full path.
Moreoever, not only is this allowed by the Net_URL2 class in PHP,
modern browsers Firefox and Chrome also actually support this
and interpret it as a "domain relative" (?) URL.
Bug: T268308
Change-Id: I26ed3e5e9a6922badd979bbe6f5588e319ec3ebb
Add "joins" as an alias for join_conds in queryInfo(). Make the name
configurable in getQueryInfo().
It's actually a very common convention, used in CommentStore, LocalFile,
RevisionStore, etc.
join_conds is still needed, since it's used in ApiQueryBase, QueryPage
and IndexPager. Also it's the name of the IDatabase::select() parameter.
Change-Id: I4034ba70e9651d7ff12c72d7d75f3f9e78ffe67a
Methods called in @dataProvider are not counted in code coverage,
making an impression we are not covering serialization code.
Move calling the serializer/deserializer into some of the tests
to fix coverage reporting.
Change-Id: I014bdee94b7297f6d298a3fea91482674c666fe3