From fe3859cc9dbe8104732f247ed0335572effb8f6c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= <jplindst@mariadb.org>
Date: Tue, 22 Jul 2014 13:08:32 +0300
Subject: [PATCH] MDEV-6443: Server crashed with assertaion failure in file
 ha_innodb.cc line 8473

If index is not found from InnoDB make sure we print what we
were trying to find and all mysql and InnoDB index names there
is for this table.
---
 storage/innobase/handler/ha_innodb.cc | 8 ++++++++
 storage/xtradb/handler/ha_innodb.cc   | 9 +++++++++
 2 files changed, 17 insertions(+)

diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 54157781460..292958707bf 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -7963,6 +7963,14 @@ ha_innobase::innobase_get_index(
 		index = innobase_index_lookup(share, keynr);
 
 		if (index) {
+			if (!key || ut_strcmp(index->name, key->name) != 0) {
+				fprintf(stderr, "InnoDB: [Error] Index for key no %u"
+					" mysql name %s , InnoDB name %s for table %s\n",
+					keynr, key ? key->name : "NULL",
+					index->name,
+					prebuilt->table->name);
+			}
+
 			ut_a(ut_strcmp(index->name, key->name) == 0);
 		} else {
 			/* Can't find index with keynr in the translation
diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc
index 882857d5804..e7078ccb3f7 100644
--- a/storage/xtradb/handler/ha_innodb.cc
+++ b/storage/xtradb/handler/ha_innodb.cc
@@ -8473,6 +8473,15 @@ ha_innobase::innobase_get_index(
 		index = innobase_index_lookup(share, keynr);
 
 		if (index) {
+
+			if (!key || ut_strcmp(index->name, key->name) != 0) {
+				fprintf(stderr, "InnoDB: [Error] Index for key no %u"
+					" mysql name %s , InnoDB name %s for table %s\n",
+					keynr, key ? key->name : "NULL",
+					index->name,
+					prebuilt->table->name);
+			}
+
 			ut_a(ut_strcmp(index->name, key->name) == 0);
 		} else {
 			/* Can't find index with keynr in the translation
-- 
2.30.9