Page MenuHomePhabricator

SQLite syntax error: LOCK IN SHARE MODE when running Category::refreshCounts
Closed, ResolvedPublic

Description

Author: liamzebedee

Description:
I've recently had to recover an SQLite database after I did some crazy stuff to it (I have no idea what I did). Long story short, I ended up dumping the DB into XML, reinstalling, then reimporting it. I then ran maintenance/update.php and now I am in a situation where I receive the following error when trying to access the page "Category:Maths":

Function: Category::refreshCounts
Error: 1 near "LOCK": syntax error

I also receive this error when running maintenance/populateCategory.php, in more detail:

Query: SELECT COUNT(*) AS pages,COUNT( (CASE WHEN page_namespace = '14' THEN 1 ELSE NULL END) ) AS subcats,COUNT( (CASE WHEN page_namespace = '6' THEN 1 ELSE NULL END) ) AS files FROM categorylinks,page WHERE cl_to = 'Biological_Level_of_Analysis' AND (page_id = cl_from) LIMIT 1 LOCK IN SHARE MODE

Function: Category::refreshCounts
Error: 1 near "LOCK": syntax error

I'm unsure as how to reproduce the error, but I think it may lie in the XML dump. I dumped the XML as of an earlier 1.21-git revision, and imported it later at a newer 1.21-git revision.


Version: 1.21.x
Severity: major
See Also:
https://bugzilla.wikimedia.org/show_bug.cgi?id=39635

Details

Reference
bz45650

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 1:14 AM
bzimport set Reference to bz45650.
bzimport added a subscriber: Unknown Object (MLST).

What's probably happening is the dump doesnt import category counts so update.php adds them, which runs some not often executed code which doesnt properly use the sql abstraction layer.

liamzebedee wrote:

Hm. Steps to reproduction would probably follow:

  1. Install newest MediaWiki software using an SQLite database
  2. Create (?one or more?) category pages (?with some more subpages of the categories?)
  3. Dump the database into XML
  4. Reinstall newest MediaWiki using an SQLite database again
  5. Run maintenance/update.php, should return without error
  6. Run maintenance/populateCategory.php, which should return with the SQL syntax error

Steps to reproduce should be (assuming my guess about issue is correct):
*install on sqlite
*run populateCategory.php --force

liamzebedee wrote:

Resolved by Gerrit change I74af28e3f7bb0c37ea1cc9cd087a688ba7621e57 - https://gerrit.wikimedia.org/r/#q,I74af28e3f7bb0c37ea1cc9cd087a688ba7621e57,n,z