| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
| |
Change-Id: I9a74c316b87ae35597ce846a830a55542d9aa14c
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Remove the "lb" option from __construct(). Instead, just automatically
make an instance of LoadBalancerDisabled if "connection" is null. Update
newDisabled(), the only caller using "lb", to pass a null connection.
Explicitly specify the extra LoadBalancer parameters in __construct().
Rename "lb" field to "mainLB" for consistency with other subclasses.
Tweak documentation for LBFactory subclasses to use more consistent
language about LoadBalancer and clusters.
Change-Id: Ia81f1a9eb00e682e9a223770573d21f92857a698
|
|
|
|
|
|
|
|
| |
When the value of the associated array is not used, there is no need to
use array_keys and create internal a copy of the array, just omit the
value with $_ to tell static analyzer that the var is unused.
Change-Id: I5c6d667e98c0167c0573c683f0d617bc1d4ca619
|
|
|
|
|
| |
Bug: T326274
Change-Id: I7ad07ee3385c1a862ecc0188d07b2252a7f518aa
|
|
|
|
|
|
| |
New feature from PHP 7.4
Change-Id: Ifa7a9bc7b2ec415ad7ecb23f4c1776f51f58fd6b
|
|
|
|
|
| |
Bug: T316299
Change-Id: Ia87b8ec274db462e527a9a05cdf189922ec3ad94
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Document what the LBFactory/LoadBalancer (sub)classes do.
* Move useful descriptions from file doc to class doc so that we don't
pointlessly maintain it in two places, and to allow for the file
block to be consistently visually ignored instead of sometimes
containing useful information.
This patch removes various non-applicable or unrelated descriptions
from the file block that were blindly copy-pasted, thus proving my
point. It also removes two duplicate/clashing definition of the
'Database' defgroup. Keeping only the primary one in IDatabase.php.
* Move ingroup tag to class block, as indexing the source file
in Doxygen creates noise in the navigation sidebar and does not
add add any benefit.
* Fix dead-end reference to a sqlite/README. I'll rework this
in a later patch.
Change-Id: Iad0e67d766f4a7d5b97e7a471b49f2d8e60c506b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Callback style iteration made sense before generators existed, but
generators make for simpler code. The "call method" variants made
sense before closures existed but defeat static analysis.
So, in LBFactory:
* Add ILBFactory::getAllLBs()
* Deprecate ILBFactory::forEachLB()
* Remove LBFactory::forEachLBCallMethod(), was protected.
* Add LBFactory::getLBsForOwner(), which is protected and has the
internal interface in @return. Adding a new abstract method breaks
Wikibase tests despite LBFactory not being stable to extend.
* Migrate callers. Generators allow you to return/break from the middle
of the loop, which implies a little rearrangement for some callers.
In LoadBalancer, connections supposedly of type IDatabase were
routinely type-hinted as Database in closure parameters so that methods
could be called that were not in the interface. So it's convenient to
get rid of public iteration methods entirely in favour of private
methods returning Database[].
* Hard-deprecate ILoadBalancerForOwner::forEachOpenConnection()
and replace it with a private generator method since nothing called
it externally except for core tests.
* Hard-deprecate ILoadBalancerForOwner::forEachOpenPrimaryConnection()
and replace it with a private generator. DeferredUpdates needed it for
iterating over IDatabase::explicitTrxActive(), so add
ILoadBalancer::explicitTrxActive() as a replacement.
* Replace private method LoadBalancer::forEachOpenReplicaConnection()
with a generator.
Depends-On: If0b382231e27d6d1197fb7b6aef6ab50335df4e5
Change-Id: I64514e77b9bfe737be5b12e1d3c9c49976bb522f
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Instance ownership is supposed to protect LoadBalancer and Database
against unauthorized calls to internal methods other than by the owning
LoadBalancer/LBFactory. This seems like unnecessary complexity. It was
introduced for T231443 and T217819, but the link was speculative and in
the end it didn't help to fix or isolate those bugs. Since then it has
caused a production error (T303885) and an intermittent CI failure
(T292239).
Instead, split the ILoadBalancer interface, introducing
ILoadBalancerForOwner, which contains the methods which are only safe
to call by LBFactory or by the caller of LBFactory::newMainLB(). This
allows phan to statically detect inappropriate calls to internal
methods.
Ownership was used for convenience for two things unrelated to its
original purpose:
* Suppressing calls to ScopedCallback::newScopedIgnoreUserAbort() when
the caller has already called it. But nested calls are apparently
harmless, so I just called it unconditionally.
* Suppressing exceptions from Database::close(). I extended the
behaviour for owned instances to apply to all instances, so even
unowned instances will no longer throw on close.
CodeSearch suggests nothing in extensions is calling these methods with
an owner parameter. One extension (Wikibase) overrides a method with an
owner parameter in a test mock class and so needs to be simultaneously
updated.
Depends-On: Ib03aba9d8f5f05b875a321d00b14483633a636a8
Change-Id: I27ba4973d24d759c88b3868c95e7db875801ca0c
|
|
|
|
|
| |
Bug: T254646
Change-Id: I5379dc79be60c99f0a30f74e5d624f81fe6f921b
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
These not only make the code more robust, but also help a lot when
writing unit tests: if a method is return-typehinted and its class is
mocked, the mock method will automatically return a mock of its declared
return type. Otherwise it will return null, and developers are forced to
manually mock the method if the return value is used by the SUT in a way
that doesn't accept null.
Depends-On: I628fcb1807133390c7b9b47984f512f5b1ae58d0
Depends-On: I7080bc505f5838b2f51a368da562104e206063b0
Change-Id: I59068cfed10aabf6c6002f9e9312a6ef6e7e9441
|
|
|
|
|
|
|
|
| |
In all these cases the property is unconditionally set in
the constructor. The extra initialisation is effectively
dead code and an extra source of errors and confusion.
Change-Id: Icae13390d5ca5c14e2754f3be4eb956dd7f54ac4
|
|
|
|
|
|
|
|
|
|
| |
Also:
* Add LBFactoryMulti sanity check to avoid section/cluster collisions.
Since sections are just a type of cluster, using the same name can
cause confusion. WMF config already treats them as overall unique.
* Rename 'externalLoads' field in LoadBalancer for clarity.
Change-Id: I748db691b4918b797b82d75cfd8722453ccd9d7f
|
|
|
|
|
|
|
|
|
|
| |
This allows full configuration of the LoadMonitor, not just setting
the class name like loadMonitorClass allows. Deprecate the later.
Also fix obsolete LoadBalancer constructor documentation and
standardize the style of LBFactoryMulti::__construct() comments.
Change-Id: Icfdc0d6bbf227dce56e65ad679b93ce3f604e9f7
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Move the DBO_TRX init logic out of Database::__construct() and into
LoadBalancer since the later already handles setting and clearing this
flag based on transaction rounds starting and ending.
Add 'lazyMasterHandle', 'topologyRole', and 'topologicalMaster' parameters
to Database::factory() and inject them via LoadBalancer all at once in order
to avoid worrying about call order. Move some type casting code to
Database::__construct().
Add IDatabase::getTopologyRole()/getTopologicalMaster().
Use constants for getLBInfo()/setLBInfo() for better usage tracking and
typo resistance.
Change-Id: I437ce434326601e6ba36d9aedc55db396dfe4452
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Enforce this pattern for the remaining LoadBalancer methods.
Carry this over into Database::close() to decide how loud the
error handling should be.
In LBFactory, clean up ownership of newMainLB()/newExternalLB().
The should have a null owner if called from outside the class
since the LBFactory does not track nor care about them anymore
in that case. Disable newMainLB() for LBFactorySingle as it
makes no sense and was broken.
Also remove some redundant abstract LBFactory methods that
just duplciate ILBFactory.
Bug: T231443
Bug: T217819
Depends-On: I7ed5c799320430c196a9a8e81af901999e2de7d0
Change-Id: I90b30a79754cfcc290277d302052e60df4fbc649
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Ignore "groupLoads" in "serverTemplate" for consistency with "load".
These server config map values should come from "groupLoadsBySection"
and "sectionLoads" only.
Simplify LBFactoryMulti::makeServerArray() to not bother setting values
that LoadBalancer already sets ('flags', 'master', 'replica').
Move down private methods and clean up a various code comments.
Change-Id: I0fe7f913a37236380127bef8d02768a9d1209596
|
|
|
|
|
|
|
|
|
| |
This reverts commit 45831e619c5e667ae1201bcdacfb8d4dcce10b41.
Reason for revert: Caused beta not work at all.
Bug: T231162
Change-Id: Icc5c1fa0dc01082a622641ad96c22c939cd56d48
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Make LoadBalancer::reallyOpenConnection() handle initializing DBO_TRX
instead of Database::__construct().
Also:
* Avoid having the "catch" block appear like it returns a
half-constructed Database.
* Use the variable name $conn instead of $db to be consistent
throughout the class. Only send Database::__construct() parameters
that it recognizes instead of mixing in setLBInfo() data.
Change-Id: Iffc3d1d0713051a164adb51a4c4ee12e4ac887c3
|
|
|
|
| |
Change-Id: I43812537e52b7a815e918512e2585e4858c06888
|
|
|
|
|
|
| |
Also make the default value constant be define in only one place
Change-Id: I1abd2b4569910031853b25f92d7cb69a1614d05b
|
|
|
|
|
|
| |
Also cleaned up nearby code in a couple places.
Change-Id: Ibf44ee7c0ceb739d7e79406e4ff39303c316e285
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Find: /isset\(\s*([^()]+?)\s*\)\s*\?\s*\1\s*:\s*/
Replace with: '\1 ?? '
(Everywhere except includes/PHPVersionCheck.php)
(Then, manually fix some line length and indentation issues)
Then manually reviewed the replacements for cases where confusing
operator precedence would result in incorrect results
(fixing those in I478db046a1cc162c6767003ce45c9b56270f3372).
Change-Id: I33b421c8cb11cdd4ce896488c9ff5313f03a38cf
|
|
|
|
| |
Change-Id: I2559e81a4a67036a899fec10582ac1ccb3818cf1
|
|
|
|
|
| |
Bug: T160678
Change-Id: Id51c2854f38d9e4697e52776168b16996e9152e4
|
|
|
|
|
|
| |
The old names are left as aliases.
Change-Id: I52a327f2463a2ba7437324047b5b00d28cd1d758
|
|
|
|
| |
Change-Id: I5ae10783228d0252284807c9562bc8e328d4becb
|
|
|
|
|
|
|
|
|
|
|
|
| |
* The script now lists all DBs in the LBFactory,
not just those of the current wiki cluster.
* Add a --report option to send the metrics
to statsD so that the MediaWiki view of lag can
be measured, rather than just the DB-level view.
This avoids some noise with depooled servers.
Bug: T149210
Change-Id: I6eae25e29aecf21251ad0eec53c56a86f35007f5
|
|
|
|
| |
Change-Id: I17b409a71e263ff5e0175f6a35fb9c5288f00c11
|
|
|
|
|
|
|
|
|
|
|
| |
* Recently pooled servers will get more traffic as
their internal caches warm up by getting queries
* Also let LoadMonitor support options for flexibility
The "loadMonitor" config field now takes in array in
LoadBalancer.
* Make LoadMonitor the default instead of LoadMonitorNull.
Change-Id: I53b89b0c25bdcc30deec3f8b502fb14479c53ae8
|
|
|
|
| |
Change-Id: I7e46c947882c5de6e4d25a7110c2a2558df7ad76
|
|
|
|
| |
Change-Id: If5353af7c4ec3781597159c12481444159c463f3
|
|
|
|
|
|
|
|
|
|
| |
* Document various parameter arrays.
* Fix $user = false loophole in Database::__construct().
* Set the Postgres port *before* calling super, as it is
needed by open().
* Remove 'chronProt' parameter as it is lazy-loaded.
Change-Id: Icc1037efa1eee7ae6fdd2919f60001e6e29ae55c
|
|
|
|
|
|
| |
Fixes regression from d175b391ae2a
Change-Id: I4bbc875e2fcd021e342959a37475ec356cb58cce
|
|
* Refactored LBFactory a bit to make this possible.
* Move newChronologyProtector() up to LBFactory and
make a lazy-loading method instead.
* Move appendPreShutdownTimeAsQuery() up to LBFactory.
* Inject the web request values for LBFactory from Setup.php.
* Remove unused laggedSlaveUsed() method.
Change-Id: Ie8a38a6f4d6359680eb6a5be24a34e30b9816479
|