diff --git a/storage/innobase/gis/gis0geo.cc b/storage/innobase/gis/gis0geo.cc
index 4c3ff1881d0..d3c02eb8a59 100644
--- a/storage/innobase/gis/gis0geo.cc
+++ b/storage/innobase/gis/gis0geo.cc
@@ -489,12 +489,17 @@ mark_all_entries(
 	int			n_entries,	/*!< in: entries number. */
 	int			n_group)	/*!< in: group number. */
 {
+	fprintf(stderr, "Mark all entries as group %d\n",
+		n_group);
 	rtr_split_node_t*	cur = node;
 	rtr_split_node_t*	end = node + n_entries;
 	for (; cur < end; ++cur) {
 		if (cur->n_node != 0) {
 			continue;
 		}
+		fprintf(stderr, "Marking %.6f, %.6f, %.6f, %.6f\n",
+			*cur->coords, *(cur->coords + 1),
+			*(cur->coords + 2), *(cur->coords + 3));
 		cur->n_node = n_group;
 	}
 }
@@ -527,6 +532,7 @@ split_rtree_node(
 	int			first_rec_group = 1;
 	rtr_split_node_t*	end = node + n_entries;
 
+	fprintf(stderr, "key_size %d\n", key_size);
 	if (all_size < min_size * 2) {
 		return 1;
 	}
diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc
index 0a7a364be6d..3798a92372d 100644
--- a/storage/innobase/gis/gis0rtree.cc
+++ b/storage/innobase/gis/gis0rtree.cc
@@ -40,6 +40,83 @@ Created 2013/03/27 Allen Lai and Jimmy Yang
 #include "gis0geo.h"
 #include <cmath>
 
+
+static void rtr_page_print_info(const dict_index_t* index,
+                                const buf_block_t* block)
+{
+  rec_t* rec;
+  const byte *field;
+  int rec_count = 0;
+  rtr_mbr_t page_mbr;
+  page_mbr.xmin= DBL_MAX;
+  page_mbr.ymin= DBL_MAX;
+  page_mbr.xmax= -DBL_MAX;
+  page_mbr.ymax= -DBL_MAX;
+  page_t *page= buf_block_get_frame(block);
+
+  fprintf(stderr, "=== R-tree Page MBR Information ===\n");
+  fprintf(stderr, "Page ID: %u\n", block->page.id().page_no());
+  fprintf(stderr, "Page Level: %u\n", btr_page_get_level(page));
+  rec= page_rec_get_next(page_get_infimum_rec(page));
+
+  if (UNIV_UNLIKELY(!rec))
+  {
+    fprintf(stderr, "No records found on page\n");
+    return;
+  }
+
+  do
+  {
+    /* The mbr address is in the first field. */
+    field = static_cast<byte*>(rec);
+    fprintf(stderr, "Record %d MBR: ", ++rec_count);
+    ulint inc = 0;
+    for (unsigned i = 0; i < SPDIMS; i++)
+    {
+      double bmin = mach_double_read(field + inc);
+      double bmax = mach_double_read(field + inc + sizeof(double));
+
+      if (i == 0)
+        fprintf(stderr, "%.6f, %.6f", bmin, bmax);
+      else
+        fprintf(stderr, " : %.6f, %.6f", bmin, bmax);
+
+      if (i == 0)
+      {
+        if (bmin < page_mbr.xmin) page_mbr.xmin = bmin;
+        if (bmax > page_mbr.xmax) page_mbr.xmax = bmax;
+      }
+      else
+      {
+        if (bmin < page_mbr.ymin) page_mbr.ymin = bmin;
+        if (bmax > page_mbr.ymax) page_mbr.ymax = bmax;
+      }
+      inc += 2 * sizeof(double);
+    }
+    fprintf(stderr, "\n");
+
+    rec = page_rec_get_next(rec);
+   } while (rec && !page_rec_is_supremum(rec));
+
+   fprintf(stderr, "Total records: %d\n", rec_count);
+   if (rec_count > 0)
+     fprintf(stderr, "Calculated Page MBR: %.6f, %.6f : %.6f, %.6f\n",
+             page_mbr.xmin, page_mbr.xmax, page_mbr.ymin,
+	     page_mbr.ymax);
+   fprintf(stderr, "=== End Page MBR Information ===\n");
+}
+
+static void rtr_tuple_print_info(const dtuple_t *tuple)
+{
+  byte *source_cur= (byte*)dfield_get_data(
+    dtuple_get_nth_field(tuple, 0));
+  fprintf(stderr, "Incoming tuple MBR: %.6f, %.6f : %.6f, %.6f\n",
+          mach_double_read(source_cur),
+          mach_double_read(source_cur + 8),
+          mach_double_read(source_cur + 16),
+          mach_double_read(source_cur + 24));
+}
+
 /*************************************************************//**
 Initial split nodes info for R-tree split.
 @return initialized split nodes array */
@@ -760,7 +837,7 @@ rtr_split_page_move_rec_list(
 
 	/* Insert the recs in group 2 to new page.  */
 	for (cur_split_node = node_array;
-	     cur_split_node < end_split_node; ++cur_split_node) {
+		cur_split_node < end_split_node; ++cur_split_node) {
 		if (cur_split_node->n_node != first_rec_group) {
 			lock_rec_store_on_page_infimum(
 				block, cur_split_node->key);
@@ -940,15 +1017,21 @@ rtr_page_split_and_insert(
 #ifdef UNIV_GIS_DEBUG
 	fprintf(stderr, "Before split a page:\n");
 	for (cur_split_node = rtr_split_node_array;
-		cur_split_node < end_split_node; ++cur_split_node) {
+	     cur_split_node < end_split_node; ++cur_split_node) {
 		for (int i = 0; i < SPDIMS * 2; i++) {
 			fprintf(stderr, "%.2lf ",
-			        *(cur_split_node->coords + i));
+				*(cur_split_node->coords + i));
 		}
 		fprintf(stderr, "\n");
 	}
 #endif
 
+	fprintf(stderr, "Page to be split\n");
+	rtr_page_print_info(cursor->index(), block);
+
+	fprintf(stderr, "Tuple to be inserted\n");
+	rtr_tuple_print_info(tuple);
+
 	insert_size = rec_get_converted_size(cursor->index(), tuple, n_ext);
 	total_data = page_get_data_size(page) + insert_size;
 	first_rec_group = split_rtree_node(rtr_split_node_array,
@@ -1134,7 +1217,7 @@ rtr_page_split_and_insert(
 	attempted this already. */
 	if (rec == NULL) {
 		if (!is_page_cur_get_page_zip(page_cursor)
-		    && btr_page_reorganize(page_cursor, mtr)) {
+		    && btr_page_reorganize(page_cursor, mtr) == DB_SUCCESS) {
 			rec = page_cur_tuple_insert(page_cursor, tuple,
 						    offsets,
 						    heap, n_ext, mtr);
@@ -1150,6 +1233,11 @@ rtr_page_split_and_insert(
 	original page. */
 	rtr_page_cal_mbr(cursor->index(), block, &mbr, *heap);
 	rtr_page_cal_mbr(cursor->index(), new_block, &new_mbr, *heap);
+
+	fprintf(stderr, "After page split and insert\n");
+	rtr_page_print_info(cursor->index(), block);
+	rtr_page_print_info(cursor->index(), new_block);
+
 	prdt.data = &mbr;
 	new_prdt.data = &new_mbr;
 
