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

Jan Lindström jan.lindstrom at mariadb.com
Mon Oct 24 09:26:40 EEST 2016


revision-id: d4b2db3e1b3fabcea3b0df3dad046e5b1f05362c (mariadb-10.1.18-10-gd4b2db3)
parent(s): ee1d08c115819e7111ddeccb01ec0534d15fd871
author: Jan Lindström
committer: Jan Lindström
timestamp: 2016-10-24 09:25:36 +0300
message:

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.

---
 extra/innochecksum.cc | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc
index 1ebcbf1..e128271 100644
--- a/extra/innochecksum.cc
+++ b/extra/innochecksum.cc
@@ -639,10 +639,18 @@ print_stats()
                "\t#bytes_per_page\n");
        for (std::map<unsigned long long, per_index_stats>::const_iterator it = index_ids.begin(); it != index_ids.end(); it++) {
          const per_index_stats& index = it->second;
+	 longlong recs_per_page = index.total_n_recs;
+	 longlong bytes_per_page = index.total_data_bytes;
+	 if (index.total_n_recs && index.pages) {
+		 recs_per_page = index.total_n_recs / index.pages;
+	 }
+	 if (index.total_data_bytes && index.pages) {
+		 bytes_per_page = index.total_data_bytes / index.pages;
+	 }
          printf("%lld\t\t%lld\t\t%lld\t\t%lld\t\t%lld\n",
                 it->first, index.pages, index.leaf_pages,
-                index.total_n_recs / index.pages,
-                index.total_data_bytes / index.pages);
+		recs_per_page,
+                bytes_per_page);
        }
        printf("\n");
        printf("index_id\tpage_data_bytes_histgram(empty,...,oversized)\n");


More information about the commits mailing list