summaryrefslogtreecommitdiff
path: root/extra/innochecksum.cc
diff options
context:
space:
mode:
authorJan Lindström <jan.lindstrom@mariadb.com>2016-10-24 09:25:36 +0300
committerJan Lindström <jan.lindstrom@mariadb.com>2016-10-24 09:27:04 +0300
commitec5bd0d3855aa49afc3e356aa18b7edea3b7a18b (patch)
treed8c3daabfe5a8287a556eccd2d9026499127d3d2 /extra/innochecksum.cc
parentaea1967cc2851c5c24ca115053a5dbef24368fc5 (diff)
downloadmariadb-git-ec5bd0d3855aa49afc3e356aa18b7edea3b7a18b.tar.gz
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.
Diffstat (limited to 'extra/innochecksum.cc')
-rw-r--r--extra/innochecksum.cc12
1 files changed, 10 insertions, 2 deletions
diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc
index 1ebcbf198ef..e128271f4b8 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");