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
* 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
* There is no php.ini setting for this, and it is unclear how
high the default is. The retry behavior of MediaWiki also
makes little sense without knowing this value.
* Also removed the retry loop which will mostly result in
giving up the position in some FIFO queue only to come
back at the end of the line.
Change-Id: Id24f6635508ba87288a2e40f71d4e8016a1805b0
Due to the way prefixes are handled, this doesn't work properly.
Make it quit early to prevent confusion. I don't think there's
many people who need shared table support, so I don't know if
its worth the effort to actually fix.
Bug: 65654
Change-Id: I6cd701998fc9066d8c7a4fc86d93a4282cc7f9bd
Not only was this global unused, it also caused the LoadBalancer
to look for the wrong array key, which would always set
$mWaitTimeout to 10 in the conditional. There is also
a manual function LoadBalancer::waitTimeout() for this.
Change-Id: I4b409ef890bec5aac7f666a2ed3dff9ea8bc14cc
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
Pulled some code from insertOneRow() to fix the update() function
and prevent the error warnings in bugzilla 64970 from showing up.
Note that since insertOneRow() and update() contains a lot of
duplicate code, they may be candidates for merging, but that is
outside the scope of this request.
Bug: 64970
Change-Id: I9ff9077d68e77f05f878fc541f87e0a5ce86ecc2
SQL errors would issue a rollback, even when it was
not actually in a transactions. Doing so would cause
another error to be reported. This could obscure the
original error, particularly during unit tests.
Fix this by not rolling back when not in a transaction.
Bug: 58095
Change-Id: Ib5220e37dd6c364feee6b7f8e7ecbdae2a2e0ba1
PostgreSQL is usually not used with table name prefixes,
and some of the PostgreSQL-specific code took the
shortcut of not dealing with prefixes. However, the PHPUnit
tests do force a prefix to be used, exposing this limitation.
Make PostgreSQL code add the prefix to table names being used
in FOR UPDATE OF clause.
This fixes 13 of the 17 PostgreSQL unit tests errors against
git HEAD:
EditPageTest::testAutoMerge with data set #1 ('Elmo', 'one
EditPageTest::testAutoMerge with data set #2 ('Elmo', 'Intro
EditPageTest::testAutoMerge with data set #3 ('Adam', 'one
EditPageTest::testAutoMerge with data set #4 ('Adam', 'one
EditPageTest::testAutoMerge with data set #5 ('Adam', 'Intro
EditPageTest::testAutoMerge with data set #6 ('Berta', 'one
EditPageTest::testAutoMerge with data set #7 ('Berta', 'one
EditPageTest::testAutoMerge with data set #8 ('Berta', 'Intro
WikiPageTest::testDoEdit
WikiPageTest::testDoEditContent
WikiPageTest::testDoRollback
WikiPageTest::testDoRollbackFailureSameContent
WikiPageTest::testExists
The change also applies to 1.22.6 and fixes several unit tests
errors there.
Change-Id: I054690f49e250cadd2dc2a6d9e20dea879d896b6
Follows-up 485ff9ead9 by making the same change in DBConnectionError,
which overrides MWException::msg() to not use database messages.
Bug: 58447
Change-Id: Iafa9dd741f1f099a4a6cfb8cf655b7d5f504011a
Currently the first row of the result
is used to return the number of fields.
This fix corrects that calculation, which has returned
twice the number of fields before. The reason for that
was that the resulting data array has the following form:
array() {
[0] => value_0
["field_name0"] =>value_0
[1] => value_1
["field_name1"] =>value_1
...
Furthermore the constant 0 (int) is returned if the result
set is empty. This issue should be corrected in the future,
since the number or fields should be answered in a metadata context
independent of the data stored in the relation.
Bug: 65578
Change-Id: I399c7c857dcbd774cc4eb6102bbfe8a8764b07c9
* 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
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
* Some DB errors are caught while others bubble up to users.
It is useful to log the latter separately and it also provides
more context. The exception logs have a backtrace where as the
regular DB logs do not.
Change-Id: I7ef7693d96e0258119f714e678099e4813ca0c94
- Add in missing schema update for 1.23
- Fix detection of table/field existence
- Fix INSERT IGNORE support for cases where the primary key was being duplicated
Change-Id: Ia15673c869c2cf732ffe96f1608cee884d106ccd
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
Variants included 'in <version>', 'as of <version>' and just the
version number.
Some @deprecated annotations do not have the version number at all,
I want to hunt them down separately.
Change-Id: I8208c6097098f4735d4f51bc42254675f1f27f6d
- In DatabaseMssql, use $this->debug() instead of $wgDebugDumpSql
so that it takes into account the DBO_DEBUG flag
- Use the same construction to set the DBO_DEBUG flag in
LBFactorySimple::newMainLB() as for the other flags so that
it is easier to read the code
Change-Id: Ie775cdb3677739a97e0d64dabbf80fc685149337
Also removed true as second parameter to it from CloneDatabase.php
since it is the default value of that parameter.
Change-Id: I727ebae2bd4df0e26019985ce8c7ce73381c5642
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