ha_innobase::check() table api was using stale reference of table to check if table is corrupted.
Here is more easier way to understand it.
a. Truncate needs at-least 2 undo-slots to work. Anything less than it may cause truncate to fail. Truncate being ddl operation failure is non-recoverable (unless we do smart technique out-of-scope for now). This causes the table to mark as corrupt.
b. insert/dml operation post this will cause table to re-open which will invalidate the share->ib_table reference.
c. check table followed by this dml will have share->ib_table as invalid and so use of it will result in error.
Well failure of open should also invalidate the old handler instance that MySQL Server Layer is using for executing check table but that is different issue and may need to be fixed at generic level.
ha_innobase: :check( ) table api was using stale reference of table to check if table is corrupted.
Here is more easier way to understand it.
a. Truncate needs at-least 2 undo-slots to work. Anything less than it may cause truncate to fail. Truncate being ddl operation failure is non-recoverable (unless we do smart technique out-of-scope for now). This causes the table to mark as corrupt.
b. insert/dml operation post this will cause table to re-open which will invalidate the share->ib_table reference.
c. check table followed by this dml will have share->ib_table as invalid and so use of it will result in error.
Well failure of open should also invalidate the old handler instance that MySQL Server Layer is using for executing check table but that is different issue and may need to be fixed at generic level.
----------
Patch for this bug has been committed.
Pull Request: pr#144 ae67afd8a806a0e d581530f7e (pr merge 5b15dc40cf96671 f77ca0cd7ed81b9 67646e647d)
Commit: 14d5d9a94f2cac1