Bug #72868 DQL is not working when index is corrupted
Submitted: 4 Jun 2014 9:30 Modified: 7 Aug 2014 9:32
Reporter: Susanne Ebrecht Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S1 (Critical)
Version:5.5 OS:Linux (Debian)
Assigned to: CPU Architecture:Any
Tags: DQL, INDEX, innodb, Optimizer, SELECT, SQL

[4 Jun 2014 9:30] Susanne Ebrecht
Description:
CREATE TABLE mytable (
  id bigint(20) NOT NULL AUTO_INCREMENT,
  _name varchar(20) COLLATE utf8_bin NOT NULL,
  c_id int(11) NOT NULL,
  istart datetime NOT NULL,
  i int(11) NOT NULL,
  ts timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (id),
  UNIQUE KEY `n_name` (`_name`,`c_id`,`istart`)
) ENGINE=InnoDB AUTO_INCREMENT=52583340 DEFAULT CHARSET=utf8 COLLATE=utf8_bin

mysql> select count(*) from mytable;
ERROR 1712 (HY000): Index mytable is corrupted

mysql> select id from mytable;
ERROR 1712 (HY000): Index mytable is corrupted

Looking into the error log file:

InnoDB: Flagged corruption of index "n_name" of table "myschema"."mytable"
[ERROR] Got error 179 when reading table './myschema/mytable'

perror 179
MySQL error code 179: Index corrupted

Just because of a corrupted Index the functionality of the table should not break. You should be able to select data even without index. When index is corrupted the optimizer just shoud take seq scan.

How to repeat:
This is hard to repeat - you need to corrupt an index. Sorry guys, I not relly have a test case here.

Suggested fix:
When index is corrupted the optimizer just should do seq scan or take another index if senseful.
[7 Jul 2014 9:32] Sveta Smirnova
Thank you for the report.

I cannot repeat described behavior with current development versions. Please try in your environment with current version 5.5.38 and send us your option file if the problem still exists.
[8 Aug 2014 1:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".