[MDEV-10969] innochecksum dumps core for some .ibd files due to floating point exception Created: 2016-10-06  Updated: 2016-10-24  Resolved: 2016-10-24

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.1.13, 10.1.18, 10.2.2
Fix Version/s: 10.1.19

Type: Bug Priority: Major
Reporter: Valerii Kravchuk Assignee: Jan Lindström (Inactive)
Resolution: Fixed Votes: 1
Labels: None


 Description   

For some, even small, tables (with .ibd files passed through normal recovery and shutdown) innochecksum from MariaDB versions 10.1,.x and 10.2.x dumps core because of floating point exception, like this:

openxs@ao756:/tmp$ ~/dbs/maria10.2/bin/innochecksum -v table_name.ibd
InnoDB offline file checksum utility.
 
Variables (--variable-name=value)
and boolean options {FALSE|TRUE}  Value (after reading options)
--------------------------------- ----------------------------------------
verbose                           TRUE
debug                             FALSE
skip-corrupt                      FALSE
count                             FALSE
start-page                        0
end-page                          0
page                              0
per-page-details                  FALSE
leaf                              FALSE
merge                             0
Table is uncompressed
Page size is 16384
file table_name.ibd = 147456 bytes (9 pages)...
InnoChecksum; checking pages in range 0 to 8
0       bad checksum
4       FIL_PAGE_INDEX
0       FIL_PAGE_UNDO_LOG
1       FIL_PAGE_INODE
0       FIL_PAGE_IBUF_FREE_LIST
2       FIL_PAGE_TYPE_ALLOCATED
1       FIL_PAGE_IBUF_BITMAP
0       FIL_PAGE_TYPE_SYS
0       FIL_PAGE_TYPE_TRX_SYS
1       FIL_PAGE_TYPE_FSP_HDR
0       FIL_PAGE_TYPE_XDES
0       FIL_PAGE_TYPE_BLOB
0       FIL_PAGE_TYPE_ZBLOB
0       FIL_PAGE_PAGE_COMPRESSED
0       FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED
0       other
0       max index_id
undo type: 0 insert, 0 update, 0 other
undo state: 0 active, 0 cached, 0 to_free, 0 to_purge, 0 prepared, 0 other
index_id        #pages          #leaf_pages     #recs_per_page  #bytes_per_page
787             1               1               45              1350
Floating point exception (core dumped)

If we let it create core file, gdb shows the following:

openxs@ao756:/tmp$ gdb ./innochecksum core.*
GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
...
Core was generated by `innochecksum -v table_name.ibd'.
Program terminated with signal SIGFPE, Arithmetic exception.
#0 print_stats ()
at /home/buildbot/buildbot/build/mariadb-10.1.13/extra/innochecksum.cc:645
645 /home/buildbot/buildbot/build/mariadb-10.1.13/extra/innochecksum.cc: No such file or directory.
(gdb) bt
#0 print_stats ()
at /home/buildbot/buildbot/build/mariadb-10.1.13/extra/innochecksum.cc:645
#1 0x000055555556d8f1 in main (argc=1, argv=0x7fffffffe0e0)
at /home/buildbot/buildbot/build/mariadb-10.1.13/extra/innochecksum.cc:983

innochecksum from MySQL 5.6 or Percona Serrver 5.7.14 works without dumping core on the same .ibd file:

openxs@ao756:/tmp$ ~/dbs/5.6/bin/innochecksum -v table_name.ibd 
InnoDB offline file checksum utility.
 
Variables (--variable-name=value)
and boolean options {FALSE|TRUE}  Value (after reading options)
--------------------------------- ----------------------------------------
verbose                           TRUE
debug                             FALSE
count                             FALSE
start-page                        0
end-page                          0
page                              0
file table_name.ibd = 147456 bytes (9 pages)...
InnoChecksum; checking pages in range 0 to 8



 Comments   
Comment by Jan Lindström (Inactive) [ 2016-10-24 ]

commit ec5bd0d3855aa49afc3e356aa18b7edea3b7a18b
Author: Jan Lindström <jan.lindstrom@mariadb.com>
Date: Mon Oct 24 09:25:36 2016 +0300

MDEV-10969: innochecksum dumps core for some .ibd files due to floating point exception

Check that index has pages before using number of pages in
divide operation.

Generated at Thu Feb 08 07:46:18 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.