Commit graph

1796 commits

Author SHA1 Message Date
jenkins-bot
bd78869618 Merge "No yoda conditions" 2018-12-09 01:34:23 +00:00
jenkins-bot
d0081b3504 Merge "RedisBagOStuff: Do not pass unused parameter" 2018-12-02 00:20:08 +00:00
jenkins-bot
d3ab48b673 Merge "rdbms: Pass required parameter" 2018-12-02 00:11:35 +00:00
jenkins-bot
97b467d8ac Merge "Remove unused use in anonymous function" 2018-12-02 00:00:53 +00:00
jenkins-bot
448386e304 Merge "Change typehint callback to callable" 2018-12-02 00:00:32 +00:00
jenkins-bot
d1acbc18b2 Merge "Change typehint callback to callable" 2018-12-02 00:00:27 +00:00
Jakub Vrana
ff09f00b6a RedisBagOStuff: Do not pass unused parameter
Found by PHPStan.

Change-Id: I20fe8ca713362d115d620a22e04c5dc984ae279e
2018-12-01 23:54:48 +00:00
Jakub Vrana
9e8a747233 rdbms: Pass required parameter
Found by PHPStan.

Change-Id: I8fbb64f7b5058b36381bccd5bc6a9d095b9ace15
2018-12-01 23:46:10 +00:00
MarcoAurelio
29d47d4937 Fix typo 'defintion'
Bug: T201491
Change-Id: I2b6b87761e6e01b982feaccd98f08f66a1888a16
2018-12-01 20:23:26 +00:00
Jakub Vrana
ff48659011 Remove unused use in anonymous function
Found by PHPStan.

Change-Id: I88247514703820a6afb7c9861dcf64326aa32d19
2018-12-01 10:17:34 +01:00
Jakub Vrana
45435d05a5 Change typehint callback to callable
Found by PHPStan.

Change-Id: I09f21da69ad9b9357cee85a47717dbe1bca04070
2018-12-01 10:10:41 +01:00
Jakub Vrana
3fc3b9e578 Change typehint callback to callable
Found by PHPStan.

Change-Id: I77877a18131bd69996bad07f2ee1c5f3ba3ba2e7
2018-12-01 10:02:48 +01:00
Aaron Schulz
d2e1734390 rdbms: rename setDomainPrefix to setLocalDomainPrefix in ILoadBalancer
Update CloneDatabase and unit test callers, which are the only things
that are likely to call it.

Change-Id: Idbc6d2965cd3828c2c6d23012319bbf0fc3ffa4a
2018-11-26 10:38:15 -08:00
jenkins-bot
98fd48b57b Merge "rdbms: add ILBFactory::redefineLocalDomain method" 2018-11-26 16:51:39 +00:00
Aaron Schulz
1c205f1822 rdbms: add ILBFactory::redefineLocalDomain method
This is intended for use with scripts like addWiki.php to avoid mismatched domain errors.

Bug: T209483
Change-Id: Ie24f83f4e0fad7b01690d2055e1529a4cb0275b5
2018-11-22 23:51:44 -08:00
Fomafix
3ee1560232 No yoda conditions
Replace
  if ( 42 === $foo )
by
  if ( $foo === 42 )

Change-Id: Ice320ef1ae64a59ed035c20134326b35d454f943
2018-11-21 17:54:39 +01:00
Aaron Schulz
35ebcebdac rdbms: add DBConnRef sanity check to LoadBalancer::closeConnection
Change-Id: I0473ffb1f89301530518f1921fe9d5ca68eb194c
2018-11-20 23:06:22 -08:00
Fomafix
a5a513547f Fix indenting and newlines
Like suggested in https://www.mediawiki.org/wiki/Manual:Coding_conventions#Line_continuation

Change-Id: I86db3c24ffc69737c6917cfc68300ff4695961cd
2018-11-07 17:15:15 +01:00
Alangi Derick
01000b0d48 rdbms: Add @deprecate tag to MaintainableDBConnRef class alias
Added as per when this was aliased to ease removal
in the future. It was there since REL_1.29.

Bug: T195576
Change-Id: Ia9061cb9592b39d0f6bac1c96f87c9b0346c105b
2018-11-05 18:55:20 +00:00
stibba
3ee7eee360 Use new ScopedCallback::newScopedIgnoreUserAbort helper function
Introduced in Ib6e307d76f93.

This patch updates FileBackend, LoadBalancer and LBFactory to use a public
function newScopedIgnoreUserAbort in ScopedCallback instead of all using
the exact same function but duplicated.

Bug: T184044
Change-Id: I27d7dc16abfe4b9447d7f3d8bd89f0de3ddeb662
2018-11-01 17:18:01 -07:00
Marius Hoch
13f1ce8244 DatabaseSqlite::insert: Fix affected row count
Follow up to 633eb437a3

Bug: T208331
Change-Id: I142bb8c8abd43242d098932da212aa58323a0863
2018-10-31 17:13:45 +01:00
Aaron Schulz
633eb437a3 rdbms: clean up return values of IDatabase write methods
Also improved the atomicity and affected row count logic for
insert/replace with sqlite.

Also remove unused "fileHandle" code from insert().

Change-Id: If7b9148fd44f3a958899885753c7c86ba66bf193
2018-10-30 03:34:52 +00:00
Fomafix
512aa4e551 Use PHP 7 '??' operator instead of if-then-else
Change-Id: Ia86f8433f30a166d38ee63d0d1745b26740767b9
2018-10-27 23:46:13 +02:00
jenkins-bot
8e744f6f48 Merge "rdbms: add transaction comment to IDatabase::masterPosWait()" 2018-10-26 20:20:37 +00:00
jenkins-bot
a14a638d41 Merge "rdbms: fix connection reuse logic in LoadBalancer for postgres" 2018-10-26 20:20:32 +00:00
Aaron Schulz
a58a9d5fce rdbms: add transaction comment to IDatabase::masterPosWait()
Change-Id: I95aa3b678b76cd06439d1feaba7f09a9c13f8931
2018-10-25 22:07:02 +00:00
jenkins-bot
14e0c6af83 Merge "rdbms: remove duplicate @params in IDatabase::select()" 2018-10-25 21:17:19 +00:00
jenkins-bot
d31ec23f2a Merge "rdbms: Use "mixed" type for $profiler field in LoadBalancer" 2018-10-25 21:16:59 +00:00
Aaron Schulz
5ad3a32361 rdbms: Use "mixed" type for $profiler field in LoadBalancer
Change-Id: I8d110d0420a155bb62f4212933d9de2562dc7661
2018-10-25 20:47:28 +00:00
Aaron Schulz
59573879f1 rdbms: avoid transaction status errors from ping() in rollback()
Change-Id: I38658cbf90518d9818824674da371637db15e156
2018-10-25 08:34:39 -07:00
jenkins-bot
0d2dd9cf37 Merge "Hard deprecate functionality replaced with random_bytes()" 2018-10-24 22:13:06 +00:00
jenkins-bot
ecee5cd7c7 Merge "Use PHP 7 '??' operator instead of if-then-else" 2018-10-24 21:58:04 +00:00
jenkins-bot
13dba84b6f Merge "Fix PHPDoc type for instance variables and methods" 2018-10-24 21:17:02 +00:00
C. Scott Ananian
518ddd8121 Remove deprecated "Parsoid v1 API" compatibility thunks
These have been deprecated since MW 1.26, and were hard deprecated
in MW 1.32.

Bug: T205029
Change-Id: I387794ecceec8aec1bd01923a71673aa2ddf4282
2018-10-24 09:48:12 -07:00
Aaron Schulz
7f1a2fcd6b rdbms: fix connection reuse logic in LoadBalancer for postgres
Change-Id: Ic4b7af156fbed54aae0a34a0bbba76490cd505e0
2018-10-24 04:35:14 -07:00
Aaron Schulz
96ec2453f8 rdbms: remove duplicate @params in IDatabase::select()
Change-Id: I1b374cabb00d934d9203229c82a93197f03e9b05
2018-10-23 04:09:08 +00:00
Fomafix
43244db9a2 Use PHP 7 '??' operator instead of if-then-else
Change-Id: If9d4be5d88c8927f63cbb84dfc8181baf62ea3eb
2018-10-21 21:46:46 +02:00
Alangi Derick
b4ecf374fe Fix PHPDoc type for instance variables and methods
Should be "string" not "String" and "array" not "Array" in
@param, @return and @var use cases. Also, minor typo fixes.

Change-Id: I9d5ebc5b741c6560907b95f7c0c4039da2861f4a
2018-10-21 13:00:25 +01:00
Aaron Schulz
d2c2bf6553 objectcache: avoid using heavily time-drifted microtime() values in WAN cache
Change-Id: Ifcb9e4b4a1d5adfdaaa6ea505e34956516b871de
2018-10-18 11:42:27 -07:00
Max Semenik
ff2804804f Hard deprecate functionality replaced with random_bytes()
Deprecated in 1.32, no callers.

Change-Id: Id2d59c303fd60fab2b323af6cab137fdf74b5377
2018-10-17 19:57:52 -07:00
Brad Jorsch
c5a5b02240 Database: Allow selectFieldValues() to accept SQL fragments
The documentation says "This must be a valid SQL fragment", but as
written it breaks if given anything other than a field name. It's easy
enough to fix by adding an alias to the internal select() call.

Bug: T201781
Change-Id: I76428af6d3aadc266254fdb24109a0ac2db3761f
2018-10-17 22:21:40 +00:00
Aaron Schulz
08a68482a4 rdbms: do not treat SAVEPOINT and RELEASE SAVEPOINT as write queries
Change-Id: Ib5d15d90260f30d08f3641a7fb36d82d363b012c
2018-10-16 22:36:06 -07:00
Aaron Schulz
b06f020217 rdbms: re-add DB domain sanity checks to LoadBalancer
Also clean up empty schema handling in DatabaseDomain

This reverts commit f23ac02f4f.

Bug: T193565
Change-Id: I95fde5c069f180ca888a023fade25ec81b846d44
2018-10-16 23:35:05 +00:00
jenkins-bot
b6fecdf6fe Merge "Log startAtomic()/endAtomic() to the query logger" 2018-10-13 01:45:09 +00:00
Tim Starling
ad32a557fc Log startAtomic()/endAtomic() to the query logger
Change-Id: Ife7e292ef42946ec1c5e9121b7be6a90301b3903
2018-10-13 01:20:32 +00:00
Krinkle
f23ac02f4f Revert "rdbms: add domain sanity checks to LoadBalancer connection methods"
This reverts commit b416e166a3.

Fails on Travis CI / PHP 7.1 / Postgres:

> Creating administrator user account
>
> UnexpectedValueException:
> Got connection to 'traviswiki-mediawiki', but expected 'traviswiki'.
>
> Backtrace:
> #0 includes/libs/rdbms/loadbalancer/LoadBalancer.php(887): Wikimedia\Rdbms\LoadBalancer->openForeignConnection(integer, string, integer)
> #1 includes/libs/rdbms/loadbalancer/LoadBalancer.php(766): Wikimedia\Rdbms\LoadBalancer->openConnection(integer, string, integer)
> #2 includes/libs/rdbms/loadbalancer/LoadBalancer.php(851): Wikimedia\Rdbms\LoadBalancer->getConnection(integer, array, string, integer)
> #3 includes/jobqueue/JobQueueDB.php(780): Wikimedia\Rdbms\LoadBalancer->getConnectionRef(integer, array, string, integer)
> #4 includes/jobqueue/JobQueueDB.php(761): JobQueueDB->getDB(integer)
> #5 includes/jobqueue/JobQueueDB.php(187): JobQueueDB->getMasterDB()
> #6 includes/jobqueue/JobQueue.php(332): JobQueueDB->doBatchPush(array, integer)
> #7 includes/jobqueue/JobQueue.php(302): JobQueue->batchPush(array, integer)
> #8 includes/jobqueue/JobQueueGroup.php(154): JobQueue->push(array)
> #9 includes/user/UserGroupMembership.php(162): JobQueueGroup->push(array)
> #10 includes/user/User.php(3733): UserGroupMembership->insert(boolean)
> #11 includes/installer/Installer.php(1680): User->addGroup(string)
> #12 includes/installer/Installer.php(1601): Installer->createSysop(PostgresInstaller)
> #13 includes/installer/CliInstaller.php(176): Installer->performInstallation(array, array)

Change-Id: I269df89d47cc5a183af630447cd1642d3d4a3deb
2018-10-13 00:35:55 +00:00
Aaron Schulz
b416e166a3 rdbms: add domain sanity checks to LoadBalancer connection methods
Bug: T193565
Change-Id: I94d905277e01b8e30ac3f6532ece07388bb20cce
2018-10-12 02:16:49 +00:00
Aaron Schulz
fe0af6cad5 rdbms: Database::selectDB() update the domain and handle failure better
LoadBalancer uses Database::getDomainId() for deciding which keys to use
in the foreign connection handle arrays. This method should reflect any
changes made to the DB selection.

If the query fails, then do not change domain field. This is the sort of
approach that LoadBalancer is expects in openForeignConnection(). Also,
throw an exception when selectDB() fails.

The db/schema/prefix fields of Database no longer exist in favor of just
using the newer currentDomain field.

Also:
* Add IDatabase::selectDomain() method and made selectDB() wrap it.
* Extract the DB name from sqlite files if not explicitly provided.
* Fix inconsistent open() return values from Database subclasses.
* Make a relationSchemaQualifier() method to handle the concern of
  omitting schema names in queries. The means that getDomainId() can
  still return the right value, rather than confusingly omitt the schema.
* Make RevisionStore::checkDatabaseWikiId() account for the domain schema.
  Unlike d2a4d614fc, this does not incorrectly assume the storage is
  always for the current wiki domain. Also, LBFactorySingle sets the local
  domain so it is defined even in install.php.
* Make RevisionStoreDbTestBase actually set the LoadBalancer local domain.
* Make RevisionTest::testLoadFromTitle() account for the domain schema.

Bug: T193565
Change-Id: I6e51cd54c6da78830b38906b8c46789c79498ab5
2018-10-10 12:03:30 -07:00
jenkins-bot
b54698d680 Merge "Improve exception message in DatabaseDomain" 2018-10-09 18:21:55 +00:00
Gergő Tisza
cebdd50a49 Make unclosed transaction errors more useful
Move unclosed transaction error reporting to Database so it can
include information about the caller that started the transaction.

Change-Id: I834d957f172c03005de522f3029bb634b3c7220e
2018-10-09 17:50:17 +00:00