Commit ccea97fa authored by tsmith@sita.local's avatar tsmith@sita.local
Browse files

NULL MERGE UP to 5.1.

Apply innodb-5.0-* snapshots:  ss1489 and ss1547.

Fixes:
Bug#9709:  InnoDB inconsistensy causes "Operating System Error 32/33"
Bug#22819: SHOW INNODB STATUS crashes the server with an assertion failure under high load
Bug#25645: Assertion failure in file srv0srv.c
Bug#27294: insert into ... select ... causes crash with innodb_locks_unsafe_for_binlog=1
Bug#28138: indexing column prefixes produces corruption in InnoDB
parent 06c80870
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -2542,8 +2542,11 @@ btr_index_rec_validate(

		rec_get_nth_field(rec, offsets, i, &len);

		/* Note that prefix indexes are not fixed size even when
		their type is CHAR. */
		/* Note that if fixed_size != 0, it equals the
		length of a fixed-size column in the clustered index.
		A prefix index of the column is of fixed, but different
		length.  When fixed_size == 0, prefix_len is the maximum
		length of the prefix index column. */

		if ((dict_index_get_nth_field(index, i)->prefix_len == 0
		    && len != UNIV_SQL_NULL && fixed_size
+100 −8
Original line number Diff line number Diff line
@@ -1220,7 +1220,8 @@ buf_page_get_gen(
		ut_ad(buf_validate());
	}
#endif
	ut_ad(block->buf_fix_count > 0);
	/* This debug code has been upgraded to narrow down Bug# 26081 */
	ut_a(block->buf_fix_count > 0);
	ut_ad(block->state == BUF_BLOCK_FILE_PAGE);

	if (mode == BUF_GET_NOWAIT) {
@@ -1238,6 +1239,13 @@ buf_page_get_gen(
		if (!success) {
			mutex_enter(&block->mutex);

			/* This debug code has been added to narrow
			down Bug# 26081 */
			if (UNIV_UNLIKELY(block->buf_fix_count == 0)) {
				buf_print_diagnostic(mtr, block);
				ut_error;
			}

			block->buf_fix_count--;

			mutex_exit(&block->mutex);
@@ -1363,6 +1371,13 @@ buf_page_optimistic_get_func(
	if (UNIV_UNLIKELY(!success)) {
		mutex_enter(&block->mutex);

		/* This debug code has been added to narrow
		down Bug# 26081 */
		if (UNIV_UNLIKELY(block->buf_fix_count == 0)) {
			buf_print_diagnostic(mtr, block);
			ut_error;
		}

		block->buf_fix_count--;

		mutex_exit(&block->mutex);
@@ -1385,6 +1400,13 @@ buf_page_optimistic_get_func(

		mutex_enter(&block->mutex);

		/* This debug code has been added to narrow
		down Bug# 26081 */
		if (UNIV_UNLIKELY(block->buf_fix_count == 0)) {
			buf_print_diagnostic(mtr, block);
			ut_error;
		}

		block->buf_fix_count--;

		mutex_exit(&block->mutex);
@@ -1404,7 +1426,10 @@ buf_page_optimistic_get_func(
		ut_ad(buf_validate());
	}
#endif
	ut_ad(block->buf_fix_count > 0);
	/* This debug code has been upgraded from ut_ad() to narrow
	down Bug# 26081 */
	ut_a(block->buf_fix_count > 0);

	ut_ad(block->state == BUF_BLOCK_FILE_PAGE);

#ifdef UNIV_DEBUG_FILE_ACCESSES
@@ -1494,6 +1519,13 @@ buf_page_get_known_nowait(
	if (!success) {
		mutex_enter(&block->mutex);

		/* This debug code has been added to narrow
		down Bug# 26081 */
		if (UNIV_UNLIKELY(block->buf_fix_count == 0)) {
			buf_print_diagnostic(mtr, block);
			ut_error;
		}

		block->buf_fix_count--;

		mutex_exit(&block->mutex);
@@ -1514,7 +1546,8 @@ buf_page_get_known_nowait(
		ut_ad(buf_validate());
	}
#endif
	ut_ad(block->buf_fix_count > 0);
	/* This debug code has been upgraded to narrow down Bug# 26081 */
	ut_a(block->buf_fix_count > 0);
	ut_ad(block->state == BUF_BLOCK_FILE_PAGE);
#ifdef UNIV_DEBUG_FILE_ACCESSES
	ut_a(block->file_page_was_freed == FALSE);
@@ -2027,7 +2060,6 @@ buf_pool_invalidate(void)
	mutex_exit(&(buf_pool->mutex));
}

#ifdef UNIV_DEBUG
/*************************************************************************
Validates the buffer buf_pool data structure. */

@@ -2227,7 +2259,6 @@ buf_print(void)

	ut_a(buf_validate());
}	
#endif /* UNIV_DEBUG */

/*************************************************************************
Returns the number of latched pages in the buffer pool. */
@@ -2483,3 +2514,64 @@ buf_get_free_list_len(void)

	return(len);
}

/*************************************************************************
Print the block fields. */

void
buf_block_print(
/*============*/
	const buf_block_t*	block)		/* in: block to print */
{
	fprintf(stderr,
		"BLOCK fields\nmagic_n: 0x%lx\n"
		"state: %lu frame: 0x%lx space:offset: 0x%lx:0x%lx\n"
		"hash value: 0x%lx  check_index_page_at_flush: %ld\n"
		"newest_modification %lu:%lu oldest_modification %lu:%lu\n"
		"flush_type: %lu in_free_list: %ld in_LRU_list: %ld\n"
		"LRU_position: %ld freed_page_clock: %lu old: %ld\n"
		"accessed: %ld buf_fix_count: %lu io_fix: %ld "
		"modify_clock: %lu:%lu\n"
		"n_hash_helps: %lu n_fields: %ld n_bytes: %lu side: %lu\n"
		"is_hashed: %lu n_pointers: %lu curr_n_fields: %lu\n"
		"curr_n_bytes: %lu curr_side: %lu index name: %s\n"
		"file_page_was_freed: %lu\n",
		block->magic_n, block->state, (ulint) block->frame,
		block->space, block->offset, block->lock_hash_val,
		block->check_index_page_at_flush,
		ut_dulint_get_high(block->newest_modification),
		ut_dulint_get_low(block->newest_modification),
		ut_dulint_get_high(block->oldest_modification),
		ut_dulint_get_low(block->oldest_modification),
		block->flush_type, block->in_free_list, block->in_LRU_list,
		block->LRU_position, block->freed_page_clock,
		block->old, block->accessed, block->buf_fix_count,
		block->io_fix,
		ut_dulint_get_high(block->modify_clock),
		ut_dulint_get_low(block->modify_clock),
		block->n_hash_helps, block->n_fields, block->n_bytes,
		block->side, block->is_hashed, block->n_pointers,
		block->curr_n_fields, block->curr_n_bytes,
		block->curr_side, block->index->name,
		block->file_page_was_freed);
}

/************************************************************************
Print some diagnostics related to the buffer pool.*/

void
buf_print_diagnostic(
/*=================*/
	mtr_t*			mtr,	/* in: mtr to print */
	const buf_block_t*	block)	/* in: block to print */
{
	fprintf(stderr, "=== MTR ===\n");
	mtr_print(mtr);
	buf_LRU_print();
	buf_print();
	buf_LRU_validate();
	buf_print_io(stderr);
	fprintf(stderr, "=== BLOCK ===\n");
	buf_block_print(block);
}
+0 −2
Original line number Diff line number Diff line
@@ -945,7 +945,6 @@ buf_LRU_block_free_hashed_page(
	buf_LRU_block_free_non_file_page(block);
}

#ifdef UNIV_DEBUG
/**************************************************************************
Validates the LRU list. */

@@ -1076,4 +1075,3 @@ buf_LRU_print(void)

	mutex_exit(&(buf_pool->mutex));
}
#endif /* UNIV_DEBUG */
+26 −4
Original line number Diff line number Diff line
@@ -1436,6 +1436,9 @@ ibuf_entry_build(
		*buf2++ = 0; /* write the compact format indicator */
	}
	for (i = 0; i < n_fields; i++) {
		ulint			fixed_len;
		const dict_field_t*	ifield;

		/* We add 4 below because we have the 4 extra fields at the
		start of an ibuf record */

@@ -1443,11 +1446,30 @@ ibuf_entry_build(
		entry_field = dtuple_get_nth_field(entry, i);
		dfield_copy(field, entry_field);

		ifield = dict_index_get_nth_field(index, i);
		/* Prefix index columns of fixed-length columns are of
		fixed length.  However, in the function call below,
		dfield_get_type(entry_field) contains the fixed length
		of the column in the clustered index.  Replace it with
		the fixed length of the secondary index column. */
		fixed_len = ifield->fixed_len;

#ifdef UNIV_DEBUG
		if (fixed_len) {
			/* dict_index_add_col() should guarantee these */
			ut_ad(fixed_len <= (ulint) entry_field->type.len);
			if (ifield->prefix_len) {
				ut_ad(ifield->prefix_len == fixed_len);
			} else {
				ut_ad(fixed_len
				      == (ulint) entry_field->type.len);
			}
		}
#endif /* UNIV_DEBUG */

		dtype_new_store_for_order_and_null_size(
			buf2 + i * DATA_NEW_ORDER_NULL_TYPE_BUF_SIZE,
				dfield_get_type(entry_field),
				dict_index_get_nth_field(index, i)
				->prefix_len);
			dfield_get_type(entry_field), fixed_len);
	}

	/* Store the type info in buf2 to field 3 of tuple */
+16 −5
Original line number Diff line number Diff line
@@ -11,6 +11,15 @@ Created 11/5/1995 Heikki Tuuri
#include "buf0rea.h"
#include "mtr0mtr.h"

/*************************************************************************
Print the mtr and block fields. */

void
buf_print_diagnostic(
/*=================*/
	mtr_t*			mtr,		/* in: mtr to print */
	const buf_block_t*	block);		/* in: block to print */

#ifdef UNIV_DEBUG
extern ulint		buf_dbg_counter; /* This is used to insert validation
					operations in execution in the
@@ -618,12 +627,9 @@ buf_page_release(
					RW_NO_LATCH */
	mtr_t*		mtr)		/* in: mtr */
{
	ulint	buf_fix_count;
	
	ut_ad(block);

	ut_a(block->state == BUF_BLOCK_FILE_PAGE);
	ut_a(block->buf_fix_count > 0);

	if (rw_latch == RW_X_LATCH && mtr->modifications) {
		mutex_enter(&buf_pool->mutex);
@@ -633,11 +639,16 @@ buf_page_release(

	mutex_enter(&block->mutex);

	/* This debug code has been added to narrow down Bug# 26081 */
	if (UNIV_UNLIKELY(block->buf_fix_count == 0)) {
		buf_print_diagnostic(mtr, block);
		ut_error;
	}

#ifdef UNIV_SYNC_DEBUG
	rw_lock_s_unlock(&(block->debug_latch));
#endif
	buf_fix_count = block->buf_fix_count;
	block->buf_fix_count = buf_fix_count - 1;
	--block->buf_fix_count;

	mutex_exit(&block->mutex);

Loading