Page MenuHomePhabricator

maintain-views halt with fatal error when dropping a view fails
Closed, ResolvedPublic


Found while working on T211939: Drop several views from srwikinews:

$ sudo /usr/local/sbin/maintain-views --debug --clean --replace-all --database srwikinews
2018-12-13 22:22:28,223 DEBUG Removing 0 dbs as sensitive
2018-12-13 22:22:29,621 INFO cleanup is enabled
2018-12-13 22:22:29,623 INFO cleaning 13 tables
2018-12-13 22:22:29,623 INFO Dropping view srwikinews_p.flaggedrevs_stats2
2018-12-13 22:22:29,623 DEBUG SQL: drop view srwikinews_p.flaggedrevs_stats2
2018-12-13 22:22:29,626 INFO Dropping view srwikinews_p.flaggedpages
2018-12-13 22:22:29,626 DEBUG SQL: drop view srwikinews_p.flaggedpages
2018-12-13 22:22:29,628 INFO Dropping view srwikinews_p.flaggedrevs_stats
2018-12-13 22:22:29,628 DEBUG SQL: drop view srwikinews_p.flaggedrevs_stats
2018-12-13 22:22:29,631 INFO Dropping view srwikinews_p.flaggedpage_config
2018-12-13 22:22:29,631 DEBUG SQL: drop view srwikinews_p.flaggedpage_config
2018-12-13 22:22:29,634 INFO Dropping view srwikinews_p.flaggedimages           2018-12-13 22:22:29,634 DEBUG SQL: drop view srwikinews_p.flaggedimages
2018-12-13 22:22:29,636 INFO Dropping view srwikinews_p.comment_mat
2018-12-13 22:22:29,636 DEBUG SQL: drop view srwikinews_p.comment_mat
Traceback (most recent call last):
  File "/usr/local/sbin/maintain-views", line 594, in <module>
  File "/usr/local/sbin/maintain-views", line 590, in main
  File "/usr/local/sbin/maintain-views", line 61, in drop_view
    self.write_execute("drop view {}.{}".format(self.db_p, view))
  File "/usr/local/sbin/maintain-views", line 54, in write_execute
  File "/usr/lib/python3/dist-packages/pymysql/", line 166, in execute
    result = self._query(query)
  File "/usr/lib/python3/dist-packages/pymysql/", line 322, in _query
  File "/usr/lib/python3/dist-packages/pymysql/", line 852, in que
    self._affected_rows = self._read_query_result(unbuffered=unbuffered)
  File "/usr/lib/python3/dist-packages/pymysql/", line 1053, in _r
  File "/usr/lib/python3/dist-packages/pymysql/", line 1336, in re
    first_packet = self.connection._read_packet()
  File "/usr/lib/python3/dist-packages/pymysql/", line 1010, in _r
  File "/usr/lib/python3/dist-packages/pymysql/", line 393, in che
  File "/usr/lib/python3/dist-packages/pymysql/", line 107, in raise_mysql
    raise errorclass(errno, errval)
pymysql.err.InternalError: (1347, "'srwikinews_p.comment_mat' is not VIEW")

The thing I don't like about this is that the cleanup steps that could have worked beyond the unexpected physical table were skipped. Luckily repeated runs of the script with the same arguments eventually did remove all of the obsolete views, but this seems to have been an accident of the dictionary iteration order changing from run to run.


Related Gerrit Patches:

Event Timeline

bd808 created this task.Dec 13 2018, 10:38 PM
Restricted Application added subscribers: Petar.petkovic, Aklapper. · View Herald TranscriptDec 13 2018, 10:38 PM

Change 479576 had a related patch set uploaded (by BryanDavis; owner: Bryan Davis):
[operations/puppet@production] wmcs: catch and log view drop errors in maintain-views

Change 479576 merged by Bstorm:
[operations/puppet@production] wmcs: catch and log view drop errors in maintain-views

bd808 closed this task as Resolved.Dec 27 2018, 1:13 AM
bd808 claimed this task.