Commit 7390d81f authored by heikki@hundin.mysql.fi's avatar heikki@hundin.mysql.fi
Browse files

Many files:

  Merge InnoDB-3.23.52b
parent 31359247
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -2076,8 +2076,7 @@ btr_discard_page(

	btr_search_drop_page_hash_index(page);
	
	if ((left_page_no == FIL_NULL)
				&& (btr_page_get_level(page, mtr) > 0)) {
	if (left_page_no == FIL_NULL && btr_page_get_level(page, mtr) > 0) {

		/* We have to mark the leftmost node pointer on the right
		side page as the predefined minimum record */
+2 −0
Original line number Diff line number Diff line
@@ -44,6 +44,8 @@ ulint btr_cur_rnd = 0;

ulint	btr_cur_n_non_sea	= 0;
ulint	btr_cur_n_sea		= 0;
ulint	btr_cur_n_non_sea_old	= 0;
ulint	btr_cur_n_sea_old	= 0;

/* In the optimistic insert, if the insert does not fit, but this much space
can be released by page reorganize, then it is reorganized */
+77 −8
Original line number Diff line number Diff line
@@ -452,6 +452,8 @@ btr_search_info_update_slow(
	}

	if (build_index) {
		ut_a(block->n_fields + block->n_bytes > 0);	

		btr_search_build_page_hash_index(block->frame,
						block->n_fields,
						block->n_bytes,
@@ -676,6 +678,9 @@ btr_search_guess_on_hash(
		rw_lock_s_lock(&btr_search_latch);
	}

	ut_a(btr_search_latch.writer != RW_LOCK_EX);
	ut_a(btr_search_latch.reader_count > 0);

	rec = ha_search_and_get_data(btr_search_sys->hash_index, fold);

	if (!rec) {
@@ -902,7 +907,7 @@ btr_search_drop_page_hash_index(
		
		fold = rec_fold(rec, n_fields, n_bytes, tree_id);

		if ((fold == prev_fold) && (prev_fold != 0)) {
		if (fold == prev_fold && prev_fold != 0) {

			goto next_rec;
		}
@@ -914,6 +919,7 @@ btr_search_drop_page_hash_index(
		n_cached++;
next_rec:
		rec = page_rec_get_next(rec);
		prev_fold = fold;
	}

	rw_lock_x_lock(&btr_search_latch);
@@ -954,7 +960,7 @@ btr_search_drop_page_hash_when_freed(
	mtr_start(&mtr);

	/* We assume that if the caller has a latch on the page,
	then the caller has already drooped the hash index for the page,
	then the caller has already dropped the hash index for the page,
	and we never get here. Therefore we can acquire the s-latch to
	the page without fearing a deadlock. */
	
@@ -1177,6 +1183,8 @@ btr_search_move_or_delete_hash_entries(

		rw_lock_s_unlock(&btr_search_latch);

		ut_a(n_fields + n_bytes > 0);
		
		btr_search_build_page_hash_index(new_page, n_fields, n_bytes,
									side);
		ut_a(n_fields == block->curr_n_fields);
@@ -1217,9 +1225,11 @@ btr_search_update_hash_on_delete(
		return;
	}

	ut_a(block->curr_n_fields + block->curr_n_bytes > 0);

	table = btr_search_sys->hash_index;

	tree_id = ((cursor->index)->tree)->id;		
	tree_id = cursor->index->tree->id;

	fold = rec_fold(rec, block->curr_n_fields, block->curr_n_bytes,
								tree_id);
@@ -1336,7 +1346,6 @@ btr_search_update_hash_on_insert(

	if (rec != page_get_infimum_rec(page)) {
		fold = rec_fold(rec, n_fields, n_bytes, tree_id);

	} else {
		if (side == BTR_SEARCH_LEFT_SIDE) {

@@ -1421,7 +1430,7 @@ btr_search_print_info(void)

	rw_lock_x_lock(&btr_search_latch);

	ha_print_info(btr_search_sys->hash_index);
/*	ha_print_info(btr_search_sys->hash_index); */

	rw_lock_x_unlock(&btr_search_latch);
}
@@ -1487,11 +1496,71 @@ btr_search_validate(void)
/*=====================*/
				/* out: TRUE if ok */
{
	buf_block_t*	block;
	page_t*		page;
	ha_node_t*	node;
	ulint		n_page_dumps	= 0;
	ibool		ok		= TRUE;
	ulint		i;
	char		rec_str[500];
	
	rw_lock_x_lock(&btr_search_latch);

	ut_a(ha_validate(btr_search_sys->hash_index));
	for (i = 0; i < hash_get_n_cells(btr_search_sys->hash_index); i++) {
		node = hash_get_nth_cell(btr_search_sys->hash_index, i)->node;

		while (node != NULL) {
			block = buf_block_align(node->data);
			page = buf_frame_align(node->data);

			if (!block->is_hashed
			    || node->fold != rec_fold((rec_t*)(node->data),
						block->curr_n_fields,
						block->curr_n_bytes,
						btr_page_get_index_id(page))) {
				ok = FALSE;
				ut_print_timestamp(stderr);

				fprintf(stderr,
"  InnoDB: Error in an adaptive hash index pointer to page %lu\n"
"ptr mem address %lu index id %lu %lu, node fold %lu, rec fold %lu\n",
				buf_frame_get_page_no(page),
				(ulint)(node->data),
			ut_dulint_get_high(btr_page_get_index_id(page)),
			ut_dulint_get_low(btr_page_get_index_id(page)),
			node->fold, rec_fold((rec_t*)(node->data),
					block->curr_n_fields,
					block->curr_n_bytes,
					btr_page_get_index_id(page)));

				rec_sprintf(rec_str, 450, (rec_t*)(node->data));

	  			fprintf(stderr,
					"InnoDB: Record %s\n"
					"InnoDB: on that page.", rec_str);

				fprintf(stderr,
"Page mem address %lu, is hashed %lu, n fields %lu, n bytes %lu\n"
"side %lu\n",
			(ulint)page, block->is_hashed, block->curr_n_fields,
			block->curr_n_bytes, block->curr_side);

				if (n_page_dumps < 20) {	
					buf_page_print(page);
					n_page_dumps++;
				}
			}

			node = node->next;
		}
	}
	
	if (!ha_validate(btr_search_sys->hash_index)) {

		ok = FALSE;
	}

	rw_lock_x_unlock(&btr_search_latch);

	return(TRUE);
	return(ok);
}
+24 −12
Original line number Diff line number Diff line
@@ -1798,8 +1798,10 @@ buf_get_n_pending_ios(void)
Prints info of the buffer i/o. */

void
buf_print_io(void)
/*==============*/
buf_print_io(
/*=========*/
	char*	buf,	/* in/out: buffer where to print */
	char*	buf_end)/* in: buffer end */
{
	time_t	current_time;
	double	time_elapsed;
@@ -1807,19 +1809,28 @@ buf_print_io(void)
	
	ut_ad(buf_pool);

	if (buf_end - buf < 400) {

		return;
	}

	size = buf_pool_get_curr_size() / UNIV_PAGE_SIZE;

	mutex_enter(&(buf_pool->mutex));
	
	printf("Free list length  %lu \n", UT_LIST_GET_LEN(buf_pool->free));
	printf("LRU list length   %lu \n", UT_LIST_GET_LEN(buf_pool->LRU));
	printf("Flush list length %lu \n",
	buf += sprintf(buf,
		"Free list length  %lu \n", UT_LIST_GET_LEN(buf_pool->free));
	buf += sprintf(buf,
		"LRU list length   %lu \n", UT_LIST_GET_LEN(buf_pool->LRU));
	buf += sprintf(buf,
		"Flush list length %lu \n",
				UT_LIST_GET_LEN(buf_pool->flush_list));
	printf("Buffer pool size  %lu\n", size);
	buf += sprintf(buf, "Buffer pool size  %lu\n", size);

	printf("Pending reads %lu \n", buf_pool->n_pend_reads);
	buf += sprintf(buf, "Pending reads %lu \n", buf_pool->n_pend_reads);

	printf("Pending writes: LRU %lu, flush list %lu, single page %lu\n",
	buf += sprintf(buf,
		"Pending writes: LRU %lu, flush list %lu, single page %lu\n",
		buf_pool->n_flush[BUF_FLUSH_LRU],
		buf_pool->n_flush[BUF_FLUSH_LIST],
		buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]);
@@ -1829,10 +1840,10 @@ buf_print_io(void)

	buf_pool->last_printout_time = current_time;

	printf("Pages read %lu, created %lu, written %lu\n",
	buf += sprintf(buf, "Pages read %lu, created %lu, written %lu\n",
			buf_pool->n_pages_read, buf_pool->n_pages_created,
						buf_pool->n_pages_written);
	printf("%.2f reads/s, %.2f creates/s, %.2f writes/s\n",
	buf += sprintf(buf, "%.2f reads/s, %.2f creates/s, %.2f writes/s\n",
		(buf_pool->n_pages_read - buf_pool->n_pages_read_old)
		/ time_elapsed,
		(buf_pool->n_pages_created - buf_pool->n_pages_created_old)
@@ -1841,13 +1852,14 @@ buf_print_io(void)
		/ time_elapsed);

	if (buf_pool->n_page_gets > buf_pool->n_page_gets_old) {
		printf("Buffer pool hit rate %lu / 1000\n",
		buf += sprintf(buf, "Buffer pool hit rate %lu / 1000\n",
		1000
		- ((1000 *
		    (buf_pool->n_pages_read - buf_pool->n_pages_read_old))
		/ (buf_pool->n_page_gets - buf_pool->n_page_gets_old)));
	} else {
		printf("No buffer pool activity since the last printout\n");
		buf += sprintf(buf,
			"No buffer pool activity since the last printout\n");
	}

	buf_pool->n_page_gets_old = buf_pool->n_page_gets;
+33 −10
Original line number Diff line number Diff line
@@ -194,7 +194,7 @@ ha_delete(

	node = ha_search_with_data(table, fold, data);

	ut_ad(node);
	ut_a(node);

	ha_delete_hash_node(table, node);
}	
@@ -232,6 +232,16 @@ ha_remove_all_nodes_to_page(
			node = ha_chain_get_next(table, node);
		}
	}

	/* Check that all nodes really got deleted */
	
	node = ha_chain_get_first(table, fold);

	while (node) {
		ut_a(buf_frame_align(ha_node_get_data(node)) != page);

		node = ha_chain_get_next(table, node);
	}
}

/*****************************************************************
@@ -245,6 +255,7 @@ ha_validate(
{
	hash_cell_t*	cell;
	ha_node_t*	node;
	ibool		ok	= TRUE;
	ulint		i;

	for (i = 0; i < hash_get_n_cells(table); i++) {
@@ -254,13 +265,21 @@ ha_validate(
		node = cell->node;

		while (node) {
			ut_a(hash_calc_hash(node->fold, table) == i);
			if (hash_calc_hash(node->fold, table) != i) {
				ut_print_timestamp(stderr);
				fprintf(stderr,
"InnoDB: Error: hash table node fold value %lu does not\n"
"InnoDB: match with the cell number %lu.\n",
					node->fold, i);

				ok = FALSE;
			}

			node = node->next;
		}
	}

	return(TRUE);
	return(ok);
}	

/*****************************************************************
@@ -269,16 +288,22 @@ Prints info of a hash table. */
void
ha_print_info(
/*==========*/
	char*		buf,	/* in/out: buffer where to print */
	char*		buf_end,/* in: buffer end */
	hash_table_t*	table)	/* in: hash table */
{
	hash_cell_t*	cell;
	ha_node_t*	node;
/*	ha_node_t*	node; */
	ulint		nodes	= 0;
	ulint		cells	= 0;
	ulint		len	= 0;
	ulint		max_len	= 0;
	ulint		i;
	
	if (buf_end - buf < 200) {
		return;
	}

	for (i = 0; i < hash_get_n_cells(table); i++) {

		cell = hash_get_nth_cell(table, i);
@@ -286,7 +311,7 @@ ha_print_info(
		if (cell->node) {

			cells++;

/*
			len = 0;

			node = cell->node;
@@ -306,12 +331,10 @@ ha_print_info(
			if (len > max_len) {
				max_len = len;
			}
*/
		}
	}

	printf("Hash table size %lu, used cells %lu, nodes %lu\n",
				hash_get_n_cells(table), cells, nodes);
	printf("max chain length %lu\n", max_len);

	ut_a(ha_validate(table));
	buf += sprintf(buf, "Hash table size %lu, used cells %lu\n",
					hash_get_n_cells(table), cells);
}	
Loading