Commit graph

467 commits

Author SHA1 Message Date
Sergio Santoro
10dcbd6794 DatabaseBase::tableName() fix limit while invoking explode()
Limit for explode() needs to be set to 3 to allow entering
branch at line 2350.

Change-Id: Idc2ba81a4bafa3e5511982db73a5c1549f1f9ef0
2014-10-15 23:14:11 +02:00
Aaron Schulz
958a13b025 Created DatabaseBase::trxTimestamp method and added usage in ActiveUsers query
Change-Id: Iba3c83ce8010583908f9dbaa8348f7226f524793
2014-09-24 22:38:36 +00:00
Aaron Schulz
fe029f8777 Added DatabaseBase::selectRowCount() method
* Useful for doing COUNT(*) with a LIMIT for performance
* Made MergeHistory use it

Change-Id: If1cfc52ea22fd09d34915c29b45d0b487d28d15a
2014-09-05 13:11:58 -07:00
Aaron Schulz
60b6dd6ffe Fixed wrong comment in DatabaseBase::getFlag
Change-Id: Ic299f538b322a07c0ee66786bbe70cb48de3b22e
2014-08-28 23:13:42 -07:00
rillke
9665a657b0 Add "chemical" major MIME type to the image tables
The American Chemical Society suggested a new major MIME type for files
containing chemical data in 1998: http://dx.doi.org/10.1021/ci9803233
This suggestion got widely adopted and is now a de-facto-standard despite
not registered with IANA.

Applying this patch will allow us to continue with extension MolHandler
and PDBHandler.
http://fab.wmflabs.org/T352

- Fixes bug 66412 by creating a logic that will prevent running unneeded
  updates.

Bug: 66412
Change-Id: Ic45dc1bce796a0406ed8a84e6274df1c4bda4967
2014-08-25 19:13:35 -03:00
umherirrender
7c6a25856c Add missing @return to function docs
Change-Id: I45b9d02f94ecc58372268ec5e6a0b572a0b7e2a9
2014-08-23 23:14:57 +02:00
Aaron Schulz
9d03f95894 Fixed bogus mysql error code 0 on mid-transaction disconnect
* Now the proper error (e.g. "server has gone away") and code is shown.

Change-Id: If0255101151441c7d05141ffc7cb416ad79e6bd8
2014-08-21 09:58:03 -07:00
jenkins-bot
25b73462a1 Merge "Separate select() parameter summary from detail" 2014-08-01 22:49:36 +00:00
Aaron Schulz
cafcb6b225 Vastly increase how long wfWaitForSlaves() can block in CLI mode
* All maintenance scripts pretty much assumed this behavior, but it
  was not actually the case. This can avoid some massive lag problems.

Change-Id: I5894409d6abade16afd8144f6689c2aff3fa7327
2014-07-31 23:28:11 -07:00
Aaron Schulz
5e0ac5814d Log errors when several callbacks give exceptions in onTransaction* methods
Change-Id: I055f46d98c255749dd64b30bfa2db190ddc73d6b
2014-07-28 17:53:34 -07:00
umherirrender
02dc9da399 Cleanup some docs (includes/[a-d])
- Swap "$variable type" to "type $variable"
- Added missing types
- Fixed spacing inside docs
- Makes beginning of @param/@return/@var/@throws in capital
- Changed some types to match the more common spelling

Change-Id: I7b65fe04db431342cc58b469dc48f41a50c4e891
2014-07-24 19:42:45 +02:00
Brad Jorsch
053c3c5fd4 Add $wgDebugDumpSqlLength
When $wgDebugDumpSql is set, the logged queries are truncated to 500
bytes. This is often not enough if you're wanting to actually debug
the queries instead of just seeing that queries were executed.

Change-Id: Iad3abd20c11d647834aa5546a1a9c82916c6519f
2014-07-23 11:15:49 +00:00
jenkins-bot
4c0f5ab1da Merge "Leave table names with numbers untouched in DatabaseBase::generalizeSQL" 2014-07-21 14:47:35 +00:00
Aaron Schulz
2979f0b6f1 Avoid useless delay and master connections in wfWaitForSlaves() in runJobs.php
* Some jobs, like Parsoid ones, do not actually do master DB updates

Change-Id: I1a8830eafd7760d081df966bb423030dcdc96408
2014-07-19 15:19:40 -07:00
Rohan
c4a3cd4988 Leave table names with numbers untouched in DatabaseBase::generalizeSQL
The function converts numbers to general forms
Eg. 10 => N
but creates a problem for tables whose names have digits in them
Eg. l10n_cache => lNn_cache

This was fixed using regex lookarounds

Bug: 67925
Change-Id: I0e97e211f6d60ba0d639b91d3a68c5e42bfb3f78
2014-07-19 20:40:17 +05:30
tisane
4ea66fdd4b Separate select() parameter summary from detail
The heading of select()'s $table parameter details
appears as part of the select() parameter summary
in doxygen; this fixes that (I think). See
http://tinyurl.com/nddrk9y

Change-Id: I6409d3359ad9d33fce1100326f55bc000b5939e0
2014-07-18 15:40:36 -04:00
Timo Tijhof
cbeda77bd3 Database: Generalise SQL before writing to debug log
The log often contains stuff like the following, where the trimmed
snippet can span many many lines:

* DatabaseBase::query: Writes done: INSERT IGNORE INTO `msg_resource`
   (mr_lang,mr_resource,mr_blob,mr_timestamp) VALUES ('۶?2x?ptt?`0<snip>?`0??O?')
* DatabaseBase::query: Writes done: REPLACE INTO `objectcache`
   (keyname,value,exptime) VALUES ('۶?2x?ptt?`0<snip>?`0??O ?`???`0??O ?`???`0?')

Bug: 67382
Change-Id: I76ca042f166fed56d86df15f788702384d48064c
2014-07-01 21:38:53 +02:00
jenkins-bot
1bf9ea5143 Merge "Made DB commit() method properly bail out if no trx is active" 2014-06-26 03:52:02 +00:00
jenkins-bot
5f5d4e1c06 Merge "Made DB rollback() method properly bail out if no trx is active" 2014-06-26 03:51:26 +00:00
Aaron Schulz
a1bc02ec8b Include trx state in query profiling (and DBPerformance log)
* Replaced use of spl hash with random transaction IDs.
  These can be correlated better and make the DBPerformance
  log easier to make sense of. They are also shorter.

Change-Id: I5f49c0d0c26e37807341bbc83b1b41b124164419
2014-06-25 14:13:25 -07:00
Aaron Schulz
3de2a4022e Made DB rollback() method properly bail out if no trx is active
Change-Id: I157b3c9e7a869866c08d127cb7f9277582e1bc9e
2014-06-25 10:17:21 -07:00
Aaron Schulz
1045fdf312 Made DB commit() method properly bail out if no trx is active
* Also flipped conditional to avoid being in the negative

Change-Id: I30bce9a015bea5909322bba93493500b5b418d18
2014-06-25 10:12:44 -07:00
Kevin Israel
f2f49c0f21 Remove use of strencode() in buildLike()
This may cause unnecessary backslashes (in the case of a literal
% or _) to end up in the query when the DBMS uses C-style string
escaping; however, the query should still work.

Change-Id: I82681f83dd45fcbecf4bfd672f550cd4dba30949
2014-06-10 15:51:33 -04:00
jenkins-bot
de1f04ace1 Merge "Cleaned up database reconnection logic" 2014-05-27 18:17:02 +00:00
jenkins-bot
638478158a Merge "Avoid fatals in begin/commit/rollback if close() was called" 2014-05-19 04:20:00 +00:00
Aaron Schulz
7868e80b77 Minor fix to DatabaseBase::close() logic
* Only set mOpened to false if closeConnection() was called (or mConn was unset)

bug: 65100
Change-Id: I1ba6b765cfc647a47f21048d993047c0fe0cfe19
2014-05-16 18:34:17 +00:00
Aaron Schulz
3f495e4519 Avoid fatals in begin/commit/rollback if close() was called
Change-Id: I3c555ece5c1e16c6ffcdbec6645d659531400a1b
2014-05-16 10:50:05 -07:00
Aaron Schulz
1cf1450330 Cleaned up database reconnection logic
* If callbacks are pending, just throw the normal query error
  exception for the failed query and clear the callbacks. This
  way an error is still reported, but the handle can be reused
  if desired, instead of being left broken. Also the reported
  error makes more sense.

bug: 65263
Change-Id: Icb2d372e65e6c62b5d5b90a442ea7b7a7f853adc
2014-05-13 14:34:23 -07:00
Siebrand Mazeland
5bc1cf4093 Remove underscore from classes WebInstaller_*
Part of program to remove underscores from class names. Checked core and
675 extensions for occurrences. All uses are in core in core are updated
in this patch. There are no uses in Gerrit extensions.

Change-Id: I6150c2d3f5a18496da5bcdcadc5d8982b70bec7a
2014-05-12 18:36:55 +02:00
Aaron Schulz
28bed62ae6 Made TransactionProfiler handle nested transactions to the same server/DB
Change-Id: Ie4dfd4af88a9da76c76b21053bbd125c6ad3b193
2014-05-01 19:38:39 +00:00
Aaron Schulz
ac8c53583c Avoid fatal error if doing a DB query after close()
Change-Id: I606a3ec5a45136abf396f86f5a65db209128d5c9
2014-04-30 17:04:06 -07:00
umherirrender
f5f1e38b9a Fixed some @params documentation (includes/[db|installer])
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: I3595e9aac69ac42fbb74b0783fae0ad9bcc831aa
2014-04-19 13:55:27 +02:00
Sergio Santoro
8117ab63f4 Fixing bug #63738: Debug msg not showing correctly
Change-Id: I49d826f63810d99aefa5b842cd3d6b88989ef086
2014-04-12 15:12:38 +02:00
Brad Jorsch
dc7d342d93 Improve handling of uncommitted DB txns with "uncaught" exceptions
One of the causes (if not the cause) of bug 56269 is if something
manages to throw an exception that makes it to MediaWiki::run's
last-resort exception catcher while having an open database transaction:
the transaction never gets committed or rolled back, so it gets
implicitly rolled back and a warning is raised.

The API has the opposite problem in bug 63145: it catches the exception
but then does the normal DB shutdown which *commits* the transaction.
This is certainly the Wrong Thing to do.

Ideally, neither of these would ever happen because any code using
transactions would have its own try-catch that would catch any
exception, rollback the transaction, and then rethrow the exception. But
it happens anyway, so let's have both of these last-resort exception
handlers do the rollback, and also log the exception so the throwing
code has a better chance of being properly fixed.

Bug: 56269
Bug: 63145
Change-Id: I8f1da51187b281fe4afc0d5a0c49f5caf3612e92
2014-03-27 12:46:07 -04:00
jenkins-bot
d1f8fb08d4 Merge "Automatically add a new line at the end of wfLogDBError()" 2014-03-24 18:45:47 +00:00
Alexandre Emsenhuber
2ea04f3a3a Remove double wfDebug() call in Database.php
Fix for I12adfb4fcb (54664be).

Change-Id: I6acfd35aae18af9d6e5ae29e5554ca7d04342af5
2014-03-23 11:24:38 +01:00
Alexandre Emsenhuber
59c42b90d5 Automatically add a new line at the end of wfLogDBError()
I found two calls to wfLogDBError() that do not add a new line
at the end of the message. So instead of adding them to that
entries, I changed wfLogDBError() to automatically put it on
icoming messages; as for wfDebugLog().

Change-Id: Id014b5827a0aeef6873ebf08d78f0a3d7581d63b
2014-03-23 10:30:59 +01:00
Siebrand Mazeland
db7de5f4c1 Fix CodeSniffer and warnings in includes/db
Follow-up with a slightly wider scope to e611604d10.

Change-Id: I9bb5ef0ceef0cd7a9c044e675b953db6d3b35407
2014-03-12 18:29:16 +00:00
aude
e611604d10 Fix IGNORE option for sqlite update
this fixes the issue of the normalized sqlite
IGNORE option being discarded and ignored in
DatabaseBase::makeUpdateOptions.

Change-Id: I01579dee0f939a56c086d13683a60f4400014f62
2014-03-12 17:37:17 +01:00
Skizzerz
f7174057a4 Add preliminary MS SQL support
This likely has outstanding bugs but basic wiki operations work just fine in it.

Change-Id: I25df82065a307b9abc30c694f8c8afff0996d7c1
2014-02-15 10:40:19 -08:00
Siebrand Mazeland
f077c4b1d6 Update formatting
Change-Id: I18aff576262479c9bb1c56eb8e1d1aaae200e4b1
2014-02-06 09:27:05 +01:00
umherirrender
4c95d41c76 Standardize is_array check in Database::upsert
Change-Id: I81c7ff2cf6a1f5fe0a2a6cdad1dd26d746e17c10
2014-02-03 21:42:04 +01:00
Brad Jorsch
d5f52588a2 Move MySQL-specific fakeMaster/fakeSlave stuff to DatabaseMysqlBase
Probably the fakeMaster/fakeSlave stuff was originally intended to be
generic, but the existing code in Database.php is making some very
MySQL-specific assumptions. So let's evict it from Database.php (except
for the minimal support functions) and put it in DatabaseMysqlBase where
it makes more sense.

This also takes care of fixing the breakage described in I5d2a1696 by
reverting Id6268193 and the problematic bit of I364e192e (again).

Change-Id: I3dc6ca216bf2c2f07d3090e86f2539292e1fa86b
2014-01-13 15:00:27 -05:00
Siebrand Mazeland
da32eb2356 Correct return type doc for DatabaseBase::getLBInfo()
This confused PHPStorm's code analyser.

Change-Id: If99abfa6ca9e52a39b6d2621441686ab564781c7
2014-01-11 12:31:28 +01:00
jenkins-bot
4e7ab69708 Merge "Update formatting" 2014-01-10 12:09:48 +00:00
jenkins-bot
af7a22b771 Merge "Ensure variables in database classes are defined, used and correctly cased" 2014-01-10 11:57:32 +00:00
Siebrand Mazeland
c12aafdc92 Remove superfluous spaces and doc tweak
Change-Id: I3755b31a1fc9b9930fc41ef44242d0bd12dc26d8
2014-01-07 11:41:14 +01:00
Siebrand Mazeland
aa4d6e1f2e Update formatting
Change-Id: I27e43c19906edc732b4976b8426ed34bad63622b
2014-01-06 21:04:34 +00:00
Siebrand Mazeland
559cc681d3 Ensure variables in database classes are defined, used and correctly cased
Change-Id: I12065b2c2bae1c000edac3c92d1db0c03fc40f90
2014-01-06 18:46:48 +00:00
Siebrand Mazeland
e22a70a103 Update documentation for database related classes
Change-Id: I364e192e2624f89a91dcb19e371ce3412142a95f
2014-01-06 19:45:40 +01:00