Better handle InnoDB corrupted tables

Registered by Vadim Tkachenko

##########
This is much more dangerous function than you think.
If the transaction to modify the table at the same time to the corrupt detection of the same table,
even if the transaction may be allowed to commit, but the change to the corrupt table may be lost.

It needs to re-write the whole of InnoDB to allows the existing of the corrupt pages in buffer_pool.
So, sometimes it may crash when it meets the corrupt pages with unusual usage/state of InnoDB.
##########

We should implement better handling of corrupted tables in InnoDB. Current behaviour is just crash with error in error.log

Current beta implementation is:

add InnoDB startup and dynamic global variable:

static variable:
innodb_pass_corrupt_table=0 | 1 ( 0 by default: *The default must be "DISABLED").

When it is 0 - current behaviour, crash.
When it is 1 - InnoDB table should be marked as "corrupted" and query return error similar to error with MyISAM corrupted table. There also should be ERROR message into error.log
All further queries to table also returns "Table TABLENAME is corrupted" error.

Also when InnoDB starts
with innodb_pass_corrupt_table=1
it should not crash during startup / recovery phase, just throw error message to error.log and contunie work.

=====================
2010/02/24: Beta implementation

If the corrupt block is read,
- The table is marked as corrupt for mysqld
- The file space marked as corrupt for IO operation
   (write IO is ignored, read blocks are marked as corrupt (but nothing to do for now) and ignore the corruption)
- Insert buffer to the space are ignored and deleted after.

The current problem is
the read IO from the concurrent threads at the same time
may cause another assertion failures.
(All of InnoDB source don't allow to exist corrupt data at all
 If you want perfect, we should rewrite almost all of InnoDB....)

2010/02/26: push the tree
treating page->is_corrupt is added to the main routes from the ordinarily operations.
change the variable dynamic.

Blueprint information

Status:
Complete
Approver:
None
Priority:
Undefined
Drafter:
Vadim Tkachenko
Direction:
Needs approval
Assignee:
None
Definition:
New
Series goal:
Accepted for 5.1
Implementation:
Implemented
Milestone target:
None
Started by
Yasufumi Kinoshita
Completed by
Laurynas Biveinis

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.