Page MenuHomePhabricator

Deletion of als and mo wikis causes halting errors in https://tools.wmflabs.org/meta/userpages
Closed, ResolvedPublic

Description

It seems some databases were recently dropped (T181923: Delete als.wik(ibooks|iquote|tionary), mo.wik(ipedia|tionary)) and this is complaining:

https://tools.wmflabs.org/meta/userpages/Evolution+and+evolvability

( ! )  Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1049 Unknown database 'alswikibooks_p'' in /mnt/nfs/labstore-secondary-tools-project/meta/git/wikimedia-contrib/tool-labs/backend/modules/Database.php on line 282
( ! ) PDOException: SQLSTATE[42000]: Syntax error or access violation: 1049 Unknown database 'alswikibooks_p' in /mnt/nfs/labstore-secondary-tools-project/meta/git/wikimedia-contrib/tool-labs/backend/modules/Database.php on line 282

@jcrespo also mentions that meta_p tables seems to be wrong.

So, questions are:

  • should the code be updated?
  • should meta_p be updated?
  • both, any?

A github issue exists, some links:

Event Timeline

To do a clean sweep and rebuild of meta_p

/usr/local/sbin/maintain-meta_p --all-databases [--debug]

Tool-wise the database code for this project is also shared (after looking at the individual index.php files) with other tools under the tools.meta project. See github here above. It could be very well possible the oudated meta_p causes for issues, as it probably assumes its still there.

To do a clean sweep and rebuild of meta_p

/usr/local/sbin/maintain-meta_p --all-databases [--debug]

Doing it right now in labsdb1009.eqiad.wmnet, labsdb1010.eqiad.wmnet, labsdb1011.eqiad.wmnet.

@jcrespo , could you check if the meta_p tables looks fine for you? The PHP code is still showing the errors.

labsdb1009:~$ my meta_p -e "SELECT * FROM meta_p.wiki WHERE dbname like 'als%'"
+---------------+------+-----------+------------+----------------------------+------+-----------+-----------+----------+-----------------+------------------+--------------+--------------+
| dbname        | lang | name      | family     | url                        | size | slice     | is_closed | has_echo | has_flaggedrevs | has_visualeditor | has_wikidata | is_sensitive |
+---------------+------+-----------+------------+----------------------------+------+-----------+-----------+----------+-----------------+------------------+--------------+--------------+
| alswiki       | gsw  | Wikipedia | wikipedia  | https://als.wikipedia.org  |    2 | s3.labsdb |         0 |        1 |               1 |                1 |            1 |            0 |
| alswikibooks  | en   | None      | wikibooks  | https://als.wikibooks.org  |    1 | s3.labsdb |         1 |        1 |               0 |                0 |            1 |            0 |
| alswikiquote  | en   | None      | wikiquote  | https://als.wikiquote.org  |    1 | s3.labsdb |         1 |        1 |               0 |                0 |            1 |            0 |
| alswiktionary | en   | None      | wiktionary | https://als.wiktionary.org |    1 | s3.labsdb |         1 |        1 |               0 |                0 |            0 |            1 |
+---------------+------+-----------+------------+----------------------------+------+-----------+-----------+----------+-----------------+------------------+--------------+--------------+

I am not commenting because I don't know if those should be there or not, or if the code should take into account the is_closed. I honestly don't know, but if I had to guess, I would assume they shouln't be if they are deleted?

I ran sudo /usr/local/sbin/maintain-meta_p --all-databases --purge --debug (the --purge part is important) on labsdb1009, labsdb1010 and labsdb1011.

$ sql meta "SELECT * FROM meta_p.wiki WHERE dbname like 'als%'"
+---------+------+-----------+-----------+---------------------------+------+-----------+-----------+----------+-----------------+------------------+--------------+--------------+
| dbname  | lang | name      | family    | url                       | size | slice     | is_closed | has_echo | has_flaggedrevs | has_visualeditor | has_wikidata | is_sensitive |
+---------+------+-----------+-----------+---------------------------+------+-----------+-----------+----------+-----------------+------------------+--------------+--------------+
| alswiki | gsw  | Wikipedia | wikipedia | https://als.wikipedia.org |    2 | s3.labsdb |         0 |        1 |               1 |                1 |            1 |            0 |
+---------+------+-----------+-----------+---------------------------+------+-----------+-----------+----------+-----------------+------------------+--------------+--------------+
$ sql --cluster=web meta "SELECT * FROM meta_p.wiki WHERE dbname like 'als%'"
+---------+------+-----------+-----------+---------------------------+------+-----------+-----------+----------+-----------------+------------------+--------------+--------------+
| dbname  | lang | name      | family    | url                       | size | slice     | is_closed | has_echo | has_flaggedrevs | has_visualeditor | has_wikidata | is_sensitive |
+---------+------+-----------+-----------+---------------------------+------+-----------+-----------+----------+-----------------+------------------+--------------+--------------+
| alswiki | gsw  | Wikipedia | wikipedia | https://als.wikipedia.org |    2 | s3.labsdb |         0 |        1 |               1 |                1 |            1 |            0 |
+---------+------+-----------+-----------+---------------------------+------+-----------+-----------+----------+-----------------+------------------+--------------+--------------+
$ sql --cluster=analytics meta "SELECT * FROM meta_p.wiki WHERE dbname like 'als%'"
+---------+------+-----------+-----------+---------------------------+------+-----------+-----------+----------+-----------------+------------------+--------------+--------------+
| dbname  | lang | name      | family    | url                       | size | slice     | is_closed | has_echo | has_flaggedrevs | has_visualeditor | has_wikidata | is_sensitive |
+---------+------+-----------+-----------+---------------------------+------+-----------+-----------+----------+-----------------+------------------+--------------+--------------+
| alswiki | gsw  | Wikipedia | wikipedia | https://als.wikipedia.org |    2 | s3.labsdb |         0 |        1 |               1 |                1 |            1 |            0 |
+---------+------+-----------+-----------+---------------------------+------+-----------+-----------+----------+-----------------+------------------+--------------+--------------+

The is_closed records are now gone and only the active alswiki remains.

https://tools.wmflabs.org/meta/userpages/Evolution+and+evolvability is now complaining about missing mowiki_p database, but that db has also properly been purged from the meta_p.wiki table:

(u3518@s7.labsdb) [meta_p]> SELECT * FROM meta_p.wiki WHERE dbname like 'mo%';
Empty set (0.01 sec)

(u3518@s7.web.db.svc.eqiad.wmflabs) [meta_p]> SELECT * FROM meta_p.wiki WHERE dbname like 'mo%';
Empty set (0.01 sec)

(u3518@s7.analytics.db.svc.eqiad.wmflabs) [meta_p]> SELECT * FROM meta_p.wiki WHERE dbname like 'mo%';
Empty set (0.00 sec)
bd808 added a subscriber: Pathoschild.
  • should meta_p be updated?

{{done}}

@Pathoschild: remaining issues are possibly in the app itself, but do ping us if you find that there is something about meta_p that is causing this.

bd808 renamed this task from tools: missing databases creates some issues to Deletion of als and mo wikis causes halting errors in https://tools.wmflabs.org/meta/userpages.Jan 8 2018, 7:19 PM
bd808 triaged this task as Medium priority.
bd808 updated the task description. (Show Details)

Bryan ran maintain-meta_p --all-databases --purge command (as documented on https://wikitech.wikimedia.org/wiki/Delete_a_wiki) during the deletion process (sf T181925#3879345), which didn't work, because the deletion of wiki replica views predates the deletion in prod, which means the patch which removed the wikis from various dblists and added it to deleted.dblists wasn't applied yet at the time Bryan ran the command, but maintain-meta_p relies on the dblists files to build the table.

@aborrero ran maintain-meta_p --all-databases above, which didn't work, because it misses the --purge flag. That flag is used to truncate the table before proceeding. By default maintain-meta_p inserts all known database names and their properties into meta_p.wiki. For each wiki one INSERT sql operation is performed (none are performed for the wikis in deleted.dblists though). Hence this command would add new wikis, but not remove any.

tl;dr: Please run maintain-meta_p --all-databases --purge on all replicas.

Or ignore me, Bryan seems to have done this while I wrote my comment ;-)

@bd808 I don't get an error with userpages/Evolution+and+evolvability. It may have been a cache issue; can you retry and post the error text if it still happens?

tl;dr: Please run maintain-meta_p --all-databases --purge on all replicas.

Or ignore me, Bryan seems to have done this while I wrote my comment ;-)

Yes, I ran it again. For folks from the future: we should not drop the Wiki Replica views until after the databases are placed in deleted.dblist. It makes everything easier.

bd808 claimed this task.

@bd808 I don't get an error with userpages/Evolution+and+evolvability. It may have been a cache issue; can you retry and post the error text if it still happens?

Working for me now too as is https://tools.wmflabs.org/meta/userpages/BDavis+%28WMF%29. Both of these were failing at the time I wrote T184433#3883935, so likely it was some meta_p caching related issue.

For folks from the future: we should not drop the Wiki Replica views until after the databases are placed in deleted.dblist. It makes everything easier.

That's what I was thinking, updated the docs: https://wikitech.wikimedia.org/w/index.php?title=Delete_a_wiki&diff=1779772&oldid=1779676

238482n375 lowered the priority of this task from Medium to Lowest.
238482n375 moved this task from Next Up to In Code Review on the Analytics-Kanban board.
238482n375 edited subscribers, added: 238482n375; removed: Aklapper.

SG9tZVBoYWJyaWNhdG9yCk5vIG1lc3NhZ2VzLiBObyBub3RpZmljYXRpb25zLgoKICAgIFNlYXJjaAoKQ3JlYXRlIFRhc2sKTWFuaXBoZXN0ClQxOTcyODEKRml4IGZhaWxpbmcgd2VicmVxdWVzdCBob3VycyAodXBsb2FkIGFuZCB0ZXh0IDIwMTgtMDYtMTQtMTEpCk9wZW4sIE5lZWRzIFRyaWFnZVB1YmxpYwoKICA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ob3VycyAodXBsb2FkIGFuZCB0ZXh0IDIwMTgtMDYtMTQtMTEpCk9wZW4sIE5lZWRzIFRyaWFnZVB1YmxpYwoKICAgIEVkaXQgVGFzawogICAgRWRpdCBSZWxhdGVkIFRhc2tzLi4uCiAgICBFZGl0IFJlbGF0ZWQgT2JqZWN0cy4uLgogICAgUHJvdGVjdCBhcyBzZWN1cml0eSBpc3N1ZQoKICAgIE11dGUgTm90aWZpY2F0aW9ucwogICAgQXdhcmQgVG9rZW4KICAgIEZsYWcgRm9yIExhdGVyCgpFVzZSC3IERpc2NsYWltZXIgtyBDQy1CWS1TQSC3IEdQTApZb3VyIGJyb3dzZXIgdGltZXpvbmUgc2V0dGluZyBkaWZmZXJzIGZyb20gdGhlIHRpbWV6b25lIHNldHRpbmcgaW4geW91ciBwcm9maWxlLCBjbGljayB0byByZWNvbmNpbGUu

Aklapper added a project: Tools.
Aklapper removed a project: acl*security.
Aklapper changed the visibility from "Custom Policy" to "Public (No Login Required)".