Page MenuHomePhabricator

Importing fails when using SQLite
Closed, ResolvedPublic

Description

Author: mediawiki

Description:
When using the current svn verison (svn42593) you are unable to import pages exported from an MediaWiki system. When importing on a SQLite system is tried, the following error is received.

A database query syntax error has occurred. This may indicate a bug in the software. The last attempted database query was:

(SQL query hidden)

from within function "doQuery". MySQL returned error "HY000: database is locked".


Version: 1.14.x
Severity: major
OS: Linux
Platform: PC

Details

Reference
bz16123

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:21 PM
bzimport set Reference to bz16123.
bzimport added a subscriber: Unknown Object (MLST).

azhrael wrote:

A bit more information from using the importDump.php tool:

A database query syntax error has occurred.
The last attempted database query was:
"DELETE /* MediaWikiBagOStuff::_doquery 127.0.0.1 */ FROM objectcache WHERE keyname='foodb:pcache:idhash:2-0!1!0!!en!2'"
from within function "doQuery".
MySQL returned error "HY000: database is locked"

Additionally, attempting the same with the latest stable 
branch (1.13.2) causes a long (~3 minute) delay, followed
by a stack trace, as follows:

MediaWiki internal error.
Original exception: exception 'DBQueryError' with message 'A database error has occurred
Query: DELETE /* MediaWikiBagOStuff::_doquery 127.0.0.1 */ FROM objectcache WHERE keyname='foodb:messages:en:status'
Function: doQuery
Error: HY000 database is locked
' in /usr/home/mwiki/includes/db/Database.php:606
Stack trace:
#0 /usr/home/mwiki/includes/db/DatabaseSqlite.php(77): Database->reportQueryError('database is loc...', 'HY000', 'DELETE /* Media...', 'doQuery')
#1 /usr/home/mwiki/includes/db/Database.php(540): DatabaseSqlite->doQuery('DELETE /* Media...')
#2 /usr/home/mwiki/includes/BagOStuff.php(454): Database->query('DELETE FROM obj...', 'MediaWikiBagOSt...')
#3 /usr/home/mwiki/includes/BagOStuff.php(324): MediaWikiBagOStuff->_doquery('DELETE FROM obj...')
#4 /usr/home/mwiki/includes/BagOStuff.php(276): SqlBagOStuff->_query('DELETE FROM $0 ...', 'foodb:mess...')
#5 /usr/home/mwiki/includes/BagOStuff.php(100): SqlBagOStuff->set('yuribawiki:mess...', 'loading', 60)
#6 /usr/home/mwiki/includes/MessageCache.php(419): BagOStuff->add('yuribawiki:mess...', 'loading', 60)
#7 /usr/home/mwiki/includes/MessageCache.php(250): MessageCache->saveToCaches(Array, false, 'en')
#8 /usr/home/mwiki/includes/MessageCache.php(606): MessageCache->load('en')
#9 /usr/home/mwiki/includes/MessageCache.php(543): MessageCache->getMsgFromNamespace('Timezone-utc', 'en')
#10 [internal function]: MessageCache->get('timezone-utc', true, true)
#11 /usr/home/mwiki/includes/StubObject.php(58): call_user_func_array(Array, Array)
#12 /usr/home/mwiki/includes/StubObject.php(76): StubObject->_call('get', Array)
#13 [internal function]: StubObject->call('get', Array)
#14 /usr/home/mwiki/includes/GlobalFunctions.php(467): StubObject->get('timezone-utc', true, true)
#15 /usr/home/mwiki/includes/GlobalFunctions.php(432): wfMsgGetKey('timezone-utc', true, true, true)
#16 /usr/home/mwiki/includes/GlobalFunctions.php(380): wfMsgReal('timezone-utc', Array, true, true)
#17 /usr/home/mwiki/includes/parser/Parser.php(3709): wfMsgForContent('timezone-utc')
#18 /usr/home/mwiki/includes/parser/Parser.php(3689): Parser->pstPass2('<div id="wikia-...', Object(StubUser))
#19 [internal function]: Parser->preSaveTransform('<div id="wikia-...', Object(Title), Object(StubUser), Object(ParserOptions))
#20 /usr/home/mwiki/includes/StubObject.php(58): call_user_func_array(Array, Array)
#21 /usr/home/mwiki/includes/StubObject.php(76): StubObject->_call('preSaveTransfor...', Array)
#22 [internal function]: StubObject->
call('preSaveTransfor...', Array)
#23 /usr/home/mwiki/includes/Article.php(2872): StubObject->preSaveTransform('<div id="wikia-...', Object(Title), Object(StubUser), Object(ParserOptions))
#24 /usr/home/mwiki/includes/Article.php(2671): Article->preSaveTransform('<div id="wikia-...')
#25 /usr/home/mwiki/includes/Article.php(2703): Article->prepareTextForEdit('<div id="wikia-...', '39')
#26 /usr/home/mwiki/includes/Article.php(2785): Article->editUpdates('<div id="wikia-...', '', false, 1225355712, '39', true)
#27 /usr/home/mwiki/includes/specials/SpecialImport.php(409): Article->createUpdates(Object(Revision))
#28 [internal function]: WikiRevision->importOldRevision()
#29 /usr/home/mwiki/includes/db/Database.php(1813): call_user_func_array(Array, Array)
#30 /usr/home/mwiki/includes/specials/SpecialImport.php(664): Database->deadlockLoop(Array)
#31 [internal function]: WikiImporter->importRevision(Object(WikiRevision))
#32 /usr/home/mwiki/maintenance/importDump.php(63): call_user_func(Array, Object(WikiRevision))
#33 [internal function]: BackupReader->handleRevision(Object(WikiRevision), Object(WikiImporter))
#34 /usr/home/mwiki/includes/specials/SpecialImport.php(955): call_user_func_array(Array, Array)
#35 [internal function]: WikiImporter->out_revision(Resource id #35, 'revision')
#36 /usr/home/mwiki/includes/specials/SpecialImport.php(560): xml_parse(Resource id #35, '<mediawiki xmln...', 0)
#37 /usr/home/mwiki/maintenance/importDump.php(133): WikiImporter->doImport()
#38 /usr/home/mwiki/maintenance/importDump.php(112): BackupReader->importFromHandle(Resource id #33)
#39 /usr/home/mwiki/maintenance/importDump.php(159): BackupReader->importFromFile('pages_current.x...')
#40 {main}

Exception caught inside exception handler: exception 'PDOException' with message 'There is already an active transaction' in /usr/home/mwiki/includes/db/DatabaseSqlite.php:267
Stack trace:
#0 /usr/home/mwiki/includes/db/DatabaseSqlite.php(267): PDO->beginTransaction()
#1 /usr/home/mwiki/includes/BagOStuff.php(448): DatabaseSqlite->begin()
#2 /usr/home/mwiki/includes/BagOStuff.php(290): MediaWikiBagOStuff->_begin()
#3 /usr/home/mwiki/includes/MessageCache.php(451): SqlBagOStuff->delete('foodb:mess...')
#4 /usr/home/mwiki/includes/MessageCache.php(250): MessageCache->saveToCaches(Array, false, 'en')
#5 /usr/home/mwiki/includes/MessageCache.php(606): MessageCache->load('en')
#6 /usr/home/mwiki/includes/MessageCache.php(543): MessageCache->getMsgFromNamespace('Dberrortextcl', 'en')
#7 /usr/home/mwiki/includes/GlobalFunctions.php(467): MessageCache->get('dberrortextcl', true, false)
#8 /usr/home/mwiki/includes/GlobalFunctions.php(432): wfMsgGetKey('dberrortextcl', true, false, true)
#9 /usr/home/mwiki/includes/GlobalFunctions.php(338): wfMsgReal('dberrortextcl', Array, true)
#10 /usr/home/mwiki/includes/db/Database.php(2544): wfMsg('dberrortextcl', 'DELETE /* Media...', 'doQuery', 'HY000', 'database is loc...')
#11 /usr/home/mwiki/includes/Exception.php(172): DBQueryError->getText()
#12 /usr/home/mwiki/includes/Exception.php(260): MWException->report()
#13 /usr/home/mwiki/includes/Exception.php(294): wfReportException(Object(DBQueryError))
#14 [internal function]: wfExceptionHandler(Object(DBQueryError))
#15 {main}

Fixed in r45592, will be backported to 1.14.