Bug #53248 compressed tables page checksum mismatch after re-enabling innodb_checksums
Submitted: 28 Apr 2010 12:26 Modified: 17 Aug 2010 20:18
Reporter: Shane Bester (Platinum Quality Contributor) Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB Plugin storage engine Severity:S1 (Critical)
Version:1.0.6, 1.0.7 OS:Any (Windows, Mac OS X)
Assigned to: Marko Mäkelä CPU Architecture:Any
Tags: compressed, innodb_checksums

[28 Apr 2010 12:26] Shane Bester
Description:
Version: '5.1.46-enterprise-gpl-advanced'  socket: ''  port: 3306  MySQL Enterprise Server - Advanced Edition (GPL)
100428 14:18:35  InnoDB: compressed page checksum mismatch (space 1 page 3): 3735928559 != 683020721
100428 14:18:35 - mysqld got exception 0xc0000005 ;

180006B65    ha_innodb_plugin.dll!btr_root_block_get()[btr0btr.c:141]
180006D49    ha_innodb_plugin.dll!btr_root_get()[btr0btr.c:166]
18000760E    ha_innodb_plugin.dll!btr_get_size()[btr0btr.c:425]
18003634D    ha_innodb_plugin.dll!dict_update_statistics_low()[dict0dict.c:4158]
180037138    ha_innodb_plugin.dll!dict_table_get()[dict0dict.c:665]
18009CFBE    ha_innodb_plugin.dll!ha_innodb::open()[ha_innodb.cc:3425]
14009A0F5    mysqld.exe!handler::ha_open()[handler.cc:2090]
1401159F9    mysqld.exe!open_table_from_share()[table.cc:1895]
1400792E9    mysqld.exe!open_unireg_entry()[sql_base.cc:3933]
14007C952    mysqld.exe!open_table()[sql_base.cc:2924]
14007D601    mysqld.exe!open_tables()[sql_base.cc:4606]
14007DAF8    mysqld.exe!open_and_lock_tables_derived()[sql_base.cc:5017]
1400ED590    mysqld.exe!mysql_admin_table()[sql_table.cc:4582]
1400EF11F    mysqld.exe!mysql_check_table()[sql_table.cc:5499]
14006D1F4    mysqld.exe!mysql_execute_command()[sql_parse.cc:3006]
1400704FE    mysqld.exe!mysql_parse()[sql_parse.cc:5975]
14007109A    mysqld.exe!dispatch_command()[sql_parse.cc:1235]
140071D07    mysqld.exe!do_command()[sql_parse.cc:874]
140098667    mysqld.exe!handle_one_connection()[sql_connect.cc:1127]
14031BB65    mysqld.exe!pthread_start()[my_winthread.c:85]
1402E5C17    mysqld.exe!_callthreadstart()[thread.c:295]
1402E5CE5    mysqld.exe!_threadstart()[thread.c:275]
077D6B6CA    kernel32.dll!BaseThreadStart()
to get some variables.
inters may be invalid and cause the dump to abort...
ery at 000000000335A8F0=check table t1

How to repeat:
startup plugin with innodb_checksums disabled:

mysqld --console --skip-gr --skip-na --ignore-builtin-innodb 
--plugin-load=innodb=ha_innodb_plugin.dll --innodb_file_per_table 
--innodb_file_format=barracuda --innodb_checksums=0

drop table if exists `t1`;
create table `t1`(`a1` int)engine=innodb row_format=compressed;

Next shutdown mysqld and start it with --innodb_checksums=1
and run:

check table `t1`;

Suggested fix:
dynamic and compact format tables don't have this limitation.  I often disable innodb_checksums for better performance but expect the tables to not get corrupted when it's re-enabled.
[28 Apr 2010 13:57] Valeriy Kravchuk
Thank you for the bug report. Verified just as described, also - with mysql-trunk on Mac OS X:

...
100428 16:53:42 InnoDB Plugin 1.0.6 started; log sequence number 46853
100428 16:53:42 [Note] Event Scheduler: Loaded 0 events
100428 16:53:42 [Note] /Users/openxs/dbs/trunk/libexec/mysqld: ready for connections.
Version: '5.5.5-m3-debug'  socket: '/tmp/mysql.sock'  port: 3306  Source distribution
100428 16:53:49  InnoDB: compressed page checksum mismatch (space 1 page 3): 3735928559 != 683020721
100428 16:53:49 - mysqld got signal 10 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
We will try our best to scrape up some info that will hopefully help diagnose
the problem, but since we have already crashed, something is definitely wrong
and this may fail.

key_buffer_size=8388608
read_buffer_size=131072
max_used_connections=1
max_threads=151
thread_count=1
connection_count=1
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 337852 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd: 0x101ee18
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
stack_bottom = 0xb06fcf34 thread_stack 0x30000
0   mysqld                              0x005b6161 my_print_stacktrace + 44
1   mysqld                              0x00104982 handle_segfault + 876
2   libSystem.B.dylib                   0x940472bb _sigtramp + 43
3   ???                                 0xffffffff 0x0 + 4294967295
4   mysqld                              0x00398ecf init_heap_psi_keys + 1603
5   mysqld                              0x00399565 init_heap_psi_keys + 3289
6   mysqld                              0x003c5093 init_heap_psi_keys + 182279
7   mysqld                              0x003c5179 init_heap_psi_keys + 182509
8   mysqld                              0x003bf53e init_heap_psi_keys + 158898
9   mysqld                              0x003e2cae init_heap_psi_keys + 304162
10  mysqld                              0x00253ce0 _ZN7handler7ha_openEP5TABLEPKcii + 320
11  mysqld                              0x0017a421 _Z21open_table_from_shareP3THDP11TABLE_SHAREPKcjjjP5TABLEb + 2761
12  mysqld                              0x0016e24f _Z10open_tableP3THDP10TABLE_LISTP11st_mem_rootP18Open_table_contextj + 3393
13  mysqld                              0x0016f04c _Z28open_system_table_for_updateP3THDP10TABLE_LIST + 836
14  mysqld                              0x0016f709 _Z11open_tablesP3THDPP10TABLE_LISTPjjP19Prelocking_strategy + 579
15  mysqld                              0x0000c591 _Z11open_tablesP3THDPP10TABLE_LISTPjj + 57
16  mysqld                              0x0016fb39 _Z30open_normal_and_derived_tablesP3THDP10TABLE_LISTj + 143
17  mysqld                              0x002a3365 _Z18mysqld_list_fieldsP3THDP10TABLE_LISTPKc + 123
18  mysqld                              0x00122719 _Z16dispatch_command19enum_server_commandP3THDPcj + 4069
19  mysqld                              0x001235b9 _Z10do_commandP3THD + 621
20  mysqld                              0x0010fb67 _Z24do_handle_one_connectionP3THD + 425
21  mysqld                              0x0010fc2b handle_one_connection + 37
22  libSystem.B.dylib                   0x9400c095 _pthread_start + 321
23  libSystem.B.dylib                   0x9400bf52 thread_start + 34
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at 0x10a1c40 = 
thd->thread_id=1
thd->killed=NOT_KILLED
...
[3 May 2010 10:47] Marko Mäkelä
The bug is that buf_zip_decompress() forgets to check "&& stamp_checksum != BUF_NO_CHECKSUM_MAGIC" before complaining, like buf_page_is_corrupted() does. Furthermore, the caller is not prepared for buf_page_get_gen() returning NULL. I guess we should trigger an assertion failure on buf_zip_decompress() failure.
[3 May 2010 12:29] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/107196
[3 May 2010 12:29] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/107197
[4 May 2010 8:07] Sunny Bains
OK to commit!
[17 Jun 2010 6:15] Bugs System
Pushed into 5.5.5-m3 (revid:alexey.kopytov@sun.com-20100615145247-8bj0vmuqlotbqsn9) (version source revid:marko.makela@oracle.com-20100503122859-k73bl51re93o0mt4) (merge vers: 5.1.47) (pib:16)
[17 Jun 2010 6:18] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100615150216-cubqoyn1fj9b6a2p) (version source revid:marko.makela@oracle.com-20100503122859-k73bl51re93o0mt4) (pib:16)
[17 Jun 2010 11:46] Bugs System
Pushed into 5.1.47-ndb-7.0.16 (revid:martin.skold@mysql.com-20100617114014-bva0dy24yyd67697) (version source revid:martin.skold@mysql.com-20100616204905-jxjg342w35ks9vfy) (merge vers: 5.1.47-ndb-7.0.16) (pib:16)
[17 Jun 2010 12:24] Bugs System
Pushed into 5.1.47-ndb-6.2.19 (revid:martin.skold@mysql.com-20100617115448-idrbic6gbki37h1c) (version source revid:martin.skold@mysql.com-20100615090726-jotpykke96le59w5) (merge vers: 5.1.47-ndb-6.2.19) (pib:16)
[17 Jun 2010 13:11] Bugs System
Pushed into 5.1.47-ndb-6.3.35 (revid:martin.skold@mysql.com-20100617114611-61aqbb52j752y116) (version source revid:martin.skold@mysql.com-20100616120453-jh7wr05z1vf7r8pm) (merge vers: 5.1.47-ndb-6.3.35) (pib:16)
[17 Aug 2010 20:18] John Russell
Added to 5.1 and 5.5 change log:

Fixed a checksum error reported for compressed tables when the
--innodb_checksums option is enabled. Although the message stated
that the table was corrupted, the table is actually fine after the
fix.