Page MenuHomePhabricator

database query syntax error on course history
Closed, ResolvedPublic

Description

On test2.wikipedia, the previous PHP fatal error on viewing course page history has been replaced with a database error:

(SQL query hidden)

from within function "IndexPager::buildQueryInfo (EducationProgram\RevisionPager)". Database returned error "1176: Key 'rev_time' doesn't exist in table 'ep_revisions' (10.64.0.14)".


Version: unspecified
Severity: critical

Details

Reference
bz50740

Event Timeline

bzimport raised the priority of this task from to Unbreak Now!.Nov 22 2014, 1:43 AM
bzimport set Reference to bz50740.

(In reply to comment #0)

On test2.wikipedia, the previous PHP fatal error on viewing course page
history
has been replaced with a database error:

(SQL query hidden)

from within function "IndexPager::buildQueryInfo
(EducationProgram\RevisionPager)". Database returned error "1176: Key
'rev_time' doesn't exist in table 'ep_revisions' (10.64.0.14)".

That would look like there's been a schema update internally, but not applied to the site..

It seems to exist/be up to date..

mysql:wikiadmin@db1019 [test2wiki]> explain ep_revisions\G

  • 1. row ******* Field: rev_id Type: int(10) unsigned Null: NO Key: PRI

Default: NULL

Extra: auto_increment
  • 2. row ******* Field: rev_object_id Type: int(10) unsigned Null: NO Key: MUL

Default: NULL

Extra:
  • 3. row ******* Field: rev_object_identifier Type: varbinary(255) Null: YES Key: MUL

Default: NULL

Extra:
  • 4. row ******* Field: rev_type Type: varbinary(32) Null: NO Key: MUL

Default: NULL

Extra:
  • 5. row ******* Field: rev_comment Type: tinyblob Null: NO Key:

Default: NULL

Extra:
  • 6. row ******* Field: rev_user_id Type: int(10) unsigned Null: NO Key: MUL

Default: 0

Extra:
  • 7. row ******* Field: rev_user_text Type: varbinary(255) Null: NO Key: MUL

Default: NULL

Extra:
  • 8. row ******* Field: rev_time Type: varbinary(14) Null: NO Key: MUL

Default: NULL

Extra:
  • 9. row ******* Field: rev_minor_edit Type: tinyint(3) unsigned Null: NO Key: MUL

Default: 0

Extra:
  • 10. row ******* Field: rev_deleted Type: tinyint(3) unsigned Null: NO Key: MUL

Default: 0

Extra:
  • 11. row ******* Field: rev_data Type: blob Null: NO Key:

Default: NULL

Extra:

11 rows in set (0.00 sec)

mysql:wikiadmin@db1019 [test2wiki]> show indexes from ep_revisions\G

  • 1. row ******* Table: ep_revisions Non_unique: 0 Key_name: PRIMARY

Seq_in_index: 1
Column_name: rev_id

Collation: A

Cardinality: 80

  Sub_part: NULL
    Packed: NULL
      Null:
Index_type: BTREE
   Comment:
  • 2. row ******* Table: ep_revisions Non_unique: 1 Key_name: ep_revision_object_id

Seq_in_index: 1
Column_name: rev_object_id

Collation: A

Cardinality: 80

  Sub_part: NULL
    Packed: NULL
      Null:
Index_type: BTREE
   Comment:
  • 3. row ******* Table: ep_revisions Non_unique: 1 Key_name: ep_revision_type

Seq_in_index: 1
Column_name: rev_type

Collation: A

Cardinality: 5

  Sub_part: NULL
    Packed: NULL
      Null:
Index_type: BTREE
   Comment:
  • 4. row ******* Table: ep_revisions Non_unique: 1 Key_name: ep_revision_user_id

Seq_in_index: 1
Column_name: rev_user_id

Collation: A

Cardinality: 26

  Sub_part: NULL
    Packed: NULL
      Null:
Index_type: BTREE
   Comment:
  • 5. row ******* Table: ep_revisions Non_unique: 1 Key_name: ep_revision_user_text

Seq_in_index: 1
Column_name: rev_user_text

Collation: A

Cardinality: 26

  Sub_part: NULL
    Packed: NULL
      Null:
Index_type: BTREE
   Comment:
  • 6. row ******* Table: ep_revisions Non_unique: 1 Key_name: ep_revision_time

Seq_in_index: 1
Column_name: rev_time

Collation: A

Cardinality: 80

  Sub_part: NULL
    Packed: NULL
      Null:
Index_type: BTREE
   Comment:
  • 7. row ******* Table: ep_revisions Non_unique: 1 Key_name: ep_revision_minor_edit

Seq_in_index: 1
Column_name: rev_minor_edit

Collation: A

Cardinality: 5

  Sub_part: NULL
    Packed: NULL
      Null:
Index_type: BTREE
   Comment:
  • 8. row ******* Table: ep_revisions Non_unique: 1 Key_name: ep_revision_deleted

Seq_in_index: 1
Column_name: rev_deleted

Collation: A

Cardinality: 5

  Sub_part: NULL
    Packed: NULL
      Null:
Index_type: BTREE
   Comment:
  • 9. row ******* Table: ep_revisions Non_unique: 1 Key_name: ep_revision_object_identifier

Seq_in_index: 1
Column_name: rev_object_identifier

Collation: A

Cardinality: 80

  Sub_part: NULL
    Packed: NULL
      Null: YES
Index_type: BTREE
   Comment:

9 rows in set (0.00 sec)

mysql:wikiadmin@db1019 [test2wiki]>

Yeah. It's trying to use the index 'rev_time' when it's actually called 'ep_revision_time'

reedy@fluorine:/a/mw-log$ grep rev_time dberror.log
Thu Jul 4 11:41:44 UTC 2013 mw1043 test2wiki IndexPager::buildQueryInfo (EducationProgram\RevisionPager) 10.64.0.14 1176 Key 'rev_time' doesn't exist in table 'ep_revisions' (10.64.0.14) SELECT rev_id,rev_object_id,rev_object_identifier,rev_user_id,rev_type,rev_comment,rev_user_text,rev_minor_edit,rev_time,rev_deleted,rev_data FROM ep_revisions FORCE INDEX (rev_time) WHERE rev_type = 'EPCourses' AND rev_object_id = '7' ORDER BY rev_time DESC LIMIT 51

Just seen this on en.wp, looking at the page history for

https://en.wikipedia.org/wiki/Education_Program:Peer_to_Peer_University/Writing_Wikipedia_Articles_(2013_Q2)

i.e.

https://en.wikipedia.org/w/index.php?title=Education_Program:Peer_to_Peer_University/Writing_Wikipedia_Articles_(2013_Q2)&action=history

generates

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 ‘IndexPager::buildQueryInfo (EducationProgram\RevisionPager).’ Database returned error ‘1176: Key 'rev_time' doesn't exist in table 'ep_revisions' (10.64.32.22).’

Sage:
As this ticket has "highest priority" for six weeks now:
Is anything blocking this, or is more information required (what, and by who)?

Andre: The blocker is that we don't currently have anyone working on the extension.

Change 80076 had a related patch set uploaded by Ragesoss:
Fix course page history SQL error

https://gerrit.wikimedia.org/r/80076

Change 80076 merged by jenkins-bot:
Fix course page history SQL error

https://gerrit.wikimedia.org/r/80076

  • Bug 53170 has been marked as a duplicate of this bug. ***