From f57822ccfd0315e081f72799c2b6213ccab617fa Mon Sep 17 00:00:00 2001
From: unknown <heikki@hundin.mysql.fi>
Date: Thu, 7 Nov 2002 21:04:26 +0200
Subject: [PATCH] btr0btr.c, buf0buf.c:   Fix a glitch: under heavy ibuf
 activity InnoDB could print the whole contents of ibuf tree to the error log

innobase/buf/buf0buf.c:
  Fix a glitch: under heavy ibuf activity InnoDB could print the whole contents of ibuf tree to the error log
innobase/btr/btr0btr.c:
  Fix a glitch: under heavy ibuf activity InnoDB could print the whole contents of ibuf tree to the error log
---
 innobase/btr/btr0btr.c |  8 ++++++++
 innobase/buf/buf0buf.c | 10 +++++-----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/innobase/btr/btr0btr.c b/innobase/btr/btr0btr.c
index 62a86d342a2..e4cfdf80fc6 100644
--- a/innobase/btr/btr0btr.c
+++ b/innobase/btr/btr0btr.c
@@ -2310,6 +2310,14 @@ btr_index_rec_validate(
 	ulint	i;
 	char	err_buf[1000];
 	
+	if (index->type & DICT_UNIVERSAL) {
+	        /* The insert buffer index tree can contain records from any
+	        other index: we cannot check the number of fields or
+	        their length */
+
+	        return(TRUE);
+	}
+
 	n = dict_index_get_n_fields(index);
 
 	if (rec_get_n_fields(rec) != n) {
diff --git a/innobase/buf/buf0buf.c b/innobase/buf/buf0buf.c
index 4524fa1a4f9..c9a5ec5307f 100644
--- a/innobase/buf/buf0buf.c
+++ b/innobase/buf/buf0buf.c
@@ -1357,11 +1357,6 @@ buf_page_create(
 	ut_ad(mtr);
 
 	free_block = buf_LRU_get_free_block();
-
-	/* Delete possible entries for the page from the insert buffer:
-	such can exist if the page belonged to an index which was dropped */
-
-	ibuf_merge_or_delete_for_page(NULL, space, offset);	
 	
 	mutex_enter(&(buf_pool->mutex));
 
@@ -1410,6 +1405,11 @@ buf_page_create(
 
 	mutex_exit(&(buf_pool->mutex));
 
+	/* Delete possible entries for the page from the insert buffer:
+	such can exist if the page belonged to an index which was dropped */
+
+	ibuf_merge_or_delete_for_page(NULL, space, offset);	
+
 	/* Flush pages from the end of the LRU list if necessary */
 	buf_flush_free_margin();