Commit graph

30 commits

Author SHA1 Message Date
Bartosz Dziewoński
485f66f174 Use PHP 7 '??' operator instead of '?:' with 'isset()' where convenient
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
2018-05-30 18:06:13 -07:00
Aaron Schulz
e9d42c0e7e rdbms: add $flags argument to ILoadBalancer::getAnyOpenConnection
Make LoadMonitor use this flag for getting a connection.

Change-Id: I32ea9aadc0223c86db5979d6579d781a6af0ff53
2018-04-16 14:17:52 -07:00
Aaron Schulz
24353a60d2 rdbms: avoid lag estimates in getLagFromPtHeartbeat ruined by snapshots
Bug: T190960
Change-Id: I57dd8d3d0ca96d6fb2f9e83f062f29b1d53224dd
2018-03-31 01:39:57 +00:00
Aaron Schulz
1e5b413259 rdbms: fix bogus $fname parameter in LoadMonitorMySQL
Change-Id: Ib8862532362da148ddd6296646fba7483c6463d5
2018-03-20 07:46:16 -07:00
Aaron Schulz
da4e15e219 rdbms: tweak var names in LoadMonitor::scaleLoads()/getLagTimes()
Also mark the methods as "final" due to their delegation

Change-Id: Ie32f53445f749d9a00e77fce43d75830e260c039
2018-02-18 20:52:50 +00:00
Aaron Schulz
bea3a7c88e Use parent function in mysql DB class in getWeightScale()
May as well keep this case in sync with the base class

Change-Id: I4c62c3247ec3372c6a274b889fac1b7a883f5cf5
2017-11-30 14:10:29 -08:00
Aaron Schulz
2874b0fbb7 Reduce replication log spam from LoadBalancer
Set the logging level there to INFO. Move the ERROR level
logging to LoadMonitor, where it will trigger only on cache
regenerations, rather than every DB connection attempt.

Change-Id: I96fd513a01601544ea30a562746c49c88f84d96d
2017-11-23 05:21:49 +00:00
Umherirrender
86463f3df6 build: Updating mediawiki/mediawiki-codesniffer to 0.12.0
Change-Id: Iefaae5043fa77d5d556c31079549dab8f61bd3ef
2017-09-10 21:11:37 +02:00
jenkins-bot
f0bfc9ff60 Merge "rdbms: Avoid selectDB() call in LoadMonitor new connections" 2017-08-22 16:52:45 +00:00
Aaron Schulz
97fd60fdba rdbms: Avoid selectDB() call in LoadMonitor new connections
This is not really necessary and can cause problems if the local
wiki has no tables on the given database.

Bug: T172559
Change-Id: I77c1238bb59b9c060bdec22aa2f7f758e07b748c
2017-08-22 16:42:32 +00:00
Umherirrender
3f1a52805e Use short type bool/int in param documentation
Enable the phpcs sniffs for this and used phpcbf

Change-Id: Iaa36687154ddd2bf663b9dd519f5c99409d37925
2017-08-20 13:20:59 +02:00
Aaron Schulz
62fcaecee3 Remove "memCache" field from LoadBalancer
The only user was LoadMonitor, which is converted to only use
the WAN and server caches. Previously, the lock() calls there
were useless since LBFactory never injected "memcCache" to
LoadBalancer, ergo making it EmptyBagOStuff in LoadMonitor.

Change-Id: I0c7793d47b93b763dee478d16fb87ec637dc6cab
2017-08-17 16:58:56 +00:00
Chad Horohoe
f7d66d4067 LoadMonitor: Group some logging parameters
Change-Id: Iefd59db547d799a02edc9f733cadb7668176d4cd
2017-06-13 22:27:00 +00:00
Paladox
54c56da85a Fix php code style
Preparation change for updating mediawiki code sniffer to 0.8.0

Change-Id: Ib0b3fe4afea9096ffa3a1347b4f7e07d3398b0b2
2017-05-05 12:03:54 +00:00
Aaron Schulz
488a647831 Move IDatabase/IMaintainableDatabase to Rdbms namespace
Change-Id: If7e8a8ff574661fd827de8bcec11d2c39a687300
2017-03-28 15:32:38 -07:00
Aaron Schulz
6494ea0ba0 Move ILoadBalancer to Rdbms namespace
All callers are in core and have been updated.
Other callers can now be switched from LoadBalancer type hints to
ILoadBalancer type hints. Once that migration is done, the classes
implementing it can be moved too.

Change-Id: I6b34099b5816dd8bf9646ed39f7a2d1960e2ed06
2017-02-07 23:22:36 -08:00
Aaron Schulz
2c7b26c169 Move LoadMonitor to Rdbms namespace
Change-Id: Icc178acb5ba0e21d1a8e857c43724c694c7ebeb1
2017-01-31 19:45:54 -08:00
Aaron Schulz
bccc483cbe Ignore query cache in LoadMonitorMySQL
Change-Id: I0b3c27ca6d2f8805297d91557cc40bd4bbc1a677
2016-12-02 01:09:44 -08:00
jenkins-bot
69ae945e8d Merge "Update weblinks in comments from HTTP to HTTPS" 2016-11-08 21:32:00 +00:00
Fomafix
202f695f67 Update weblinks in comments from HTTP to HTTPS
Use HTTPS instead of HTTP where the HTTP link is a redirect to the HTTPS link.

Also update some defect links.

Change-Id: Ic3a5eac910d098ed5c2a21e9f47c9b6ee06b2643
2016-11-07 15:24:46 +01:00
Kunal Mehta
61adc1e146 Use namespaced ScopedCallback
The un-namespaced \ScopedCallback is deprecated.

Change-Id: Ie014d5a775ead66335a24acac9d339915884d1a4
2016-10-17 15:46:05 -07:00
Aaron Schulz
c2602eaed5 LoadMonitor: Avoid "host not replicating?" log messages by checking "is static"
Change-Id: I59c47038505558b141385ea48cb62461163adb37
2016-10-08 01:46:38 +00:00
Aaron Schulz
4154c688e8 Make LoadMonitor use $serverIndexes in the cache key
* This avoids collisions of generic and custom LB group
  server list keys, which could cause warnings and errors.
* Remove $group param from scaleLoads(), which was unused
  and less robust for making keys anyway.
* Remove clearCaches() method, which only had one caller
  in a script that printed lag times in a loop. Its not
  worth keeping and having to pass in the server index
  list.
* Also guard scaleLoads() against recent server additions.

Bug: T147359
Change-Id: Idd15f0bebb68782fda36f483880cf7fe9673b940
2016-10-05 20:07:03 +00:00
Aaron Schulz
3fa55237b6 Add version to LoadMonitor::getCacheKey()
This avoids undefined index and "servers down" errors when
using Het Deploy since only the version has the new fields.

Bug: T147359
Change-Id: Ic2d0d147df2e1c015ec4a6675294203b2adf5ed9
2016-10-04 21:07:57 +00:00
Aaron Schulz
4a8ddb9d0f Add missing array_keys() call to scaleLoads()
Bug: T147240
Change-Id: I110f43b5990fe42b2d7f1ec960a55a1ae4aa4253
2016-10-04 04:16:21 -07:00
Aaron Schulz
23909318c8 Implement scaleLoads() in LoadMonitorMySQL
* 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
2016-10-03 22:32:33 +00:00
Aaron Schulz
21a9bb06b4 Move LoadMonitorMySQL to LoadMonitor
* The LoadMonitor interface is now ILoadMonitor.
* Nothing in this code was MySQL specific.
  Now any DB type can benefit from a LoadMonitor.

Change-Id: I272a72cd55a70f99a866d518d44cb3bcaca91b9e
2016-09-15 23:56:39 +00:00
Aaron Schulz
0e5cd18b74 Rename LBFactory => LBFactoryMW and make LBFactory in /libs
The former extends the later with MW-specific logic.

Also removed a wf* method call from ChronologyProtector.

Change-Id: I325f59b7467ab9c2137731d1ce69816f5a020f03
2016-09-15 17:14:32 +00:00
Aaron Schulz
b055fbda7e More DB related class cleanups to prepare files for /libs
* Cleaned up some related logging bits.
* Avoid some wf* methods in LoadBalancer.

Change-Id: I5da97174441c086e61ffc120889c068e241ebfd2
2016-09-15 00:07:55 +00:00
Aaron Schulz
9c8d885060 Move LoadMonitor classes to libs/rdbms/loadmonitor
Change-Id: Ib18108f24ff8b9d05dc324bad132f597b3e2ddef
2016-09-14 10:56:52 +00:00