Commit 42c3fa73 authored by unknown's avatar unknown
Browse files

Merge tnurnberg@maint1:/data/localhome/tnurnberg/i51

into  salvation.intern.azundris.com:/home/tnurnberg/work/mysql-5.1-maint-i51

parents 3be8b9a3 2606cb93
Loading
Loading
Loading
Loading
+4 −12
Original line number Diff line number Diff line
@@ -1295,24 +1295,16 @@ insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
select count(*) from t1;
count(*)
29267
623
explain select * from t1 where c between 1 and 2500;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	range	c	c	5	NULL	#	Using where
update t1 set c=a;
explain select * from t1 where c between 1 and 2500;
id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
1	SIMPLE	t1	range	c	c	5	NULL	#	Using where
1	SIMPLE	t1	ALL	c	NULL	NULL	NULL	#	Using where
drop table t1,t2;
create table t1 (id int primary key auto_increment, fk int, index index_fk (fk)) engine=innodb;
insert into t1 (id) values (null),(null),(null),(null),(null);
@@ -1786,10 +1778,10 @@ Variable_name Value
Innodb_rows_deleted	2070
show status like "Innodb_rows_inserted";
Variable_name	Value
Innodb_rows_inserted	31727
Innodb_rows_inserted	3083
show status like "Innodb_rows_updated";
Variable_name	Value
Innodb_rows_updated	29530
Innodb_rows_updated	886
show status like "Innodb_row_lock_waits";
Variable_name	Value
Innodb_row_lock_waits	0
+0 −8
Original line number Diff line number Diff line
@@ -904,14 +904,6 @@ insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
insert into t2 (a) select b from t1;
insert into t1 (a) select b from t2;
select count(*) from t1;
--replace_column 9 #
explain select * from t1 where c between 1 and 2500;
+69 −60
Original line number Diff line number Diff line
@@ -208,6 +208,7 @@ static handler *innobase_create_handler(TABLE_SHARE *table,
                                        MEM_ROOT *mem_root);

static const char innobase_hton_name[]= "InnoDB";

handlerton innobase_hton;

static handler *innobase_create_handler(TABLE_SHARE *table, MEM_ROOT *mem_root)
@@ -2364,8 +2365,7 @@ ha_innobase::open(
				"have forgotten\nto delete the corresponding "
				".frm files of InnoDB tables, or you\n"
				"have moved .frm files to another database?\n"
				"Look from section 15.1 of "
				"http://www.innodb.com/ibman.html\n"
				"See http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
				"how you can resolve the problem.\n",
				norm_name);
		free_share(share);
@@ -2382,8 +2382,7 @@ ha_innobase::open(
				"Have you deleted the .ibd file from the "
				"database directory under\nthe MySQL datadir, "
				"or have you used DISCARD TABLESPACE?\n"
				"Look from section 15.1 of "
				"http://www.innodb.com/ibman.html\n"
				"See http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
				"how you can resolve the problem.\n",
				norm_name);
		free_share(share);
@@ -3664,7 +3663,7 @@ ha_innobase::update_row(

	DBUG_ENTER("ha_innobase::update_row");

	ut_ad(prebuilt->trx ==
	ut_a(prebuilt->trx ==
		(trx_t*) current_thd->ha_data[innobase_hton.slot]);

	if (table->timestamp_field_type & TIMESTAMP_AUTO_SET_ON_UPDATE)
@@ -3725,7 +3724,7 @@ ha_innobase::delete_row(

	DBUG_ENTER("ha_innobase::delete_row");

	ut_ad(prebuilt->trx ==
	ut_a(prebuilt->trx ==
		(trx_t*) current_thd->ha_data[innobase_hton.slot]);

	if (last_query_id != user_thd->query_id) {
@@ -3823,6 +3822,9 @@ ha_innobase::try_semi_consistent_read(bool yes)
{
	row_prebuilt_t*	prebuilt = (row_prebuilt_t*) innobase_prebuilt;

	ut_a(prebuilt->trx ==
		(trx_t*) current_thd->ha_data[innobase_hton.slot]);

	/* Row read type is set to semi consistent read if this was
	requested by the MySQL and either innodb_locks_unsafe_for_binlog
	option is used or this session is using READ COMMITTED isolation
@@ -3987,7 +3989,7 @@ ha_innobase::index_read(

	DBUG_ENTER("index_read");

	ut_ad(prebuilt->trx ==
	ut_a(prebuilt->trx ==
		(trx_t*) current_thd->ha_data[innobase_hton.slot]);

	statistic_increment(current_thd->status_var.ha_read_key_count,
@@ -4102,7 +4104,7 @@ ha_innobase::change_active_index(
	DBUG_ENTER("change_active_index");

	ut_ad(user_thd == current_thd);
	ut_ad(prebuilt->trx ==
	ut_a(prebuilt->trx ==
		(trx_t*) current_thd->ha_data[innobase_hton.slot]);

	active_index = keynr;
@@ -4192,7 +4194,7 @@ ha_innobase::general_fetch(

	DBUG_ENTER("general_fetch");

	ut_ad(prebuilt->trx ==
	ut_a(prebuilt->trx ==
		(trx_t*) current_thd->ha_data[innobase_hton.slot]);

	innodb_srv_conc_enter_innodb(prebuilt->trx);
@@ -4428,7 +4430,7 @@ ha_innobase::rnd_pos(
	statistic_increment(current_thd->status_var.ha_read_rnd_count,
		&LOCK_status);

	ut_ad(prebuilt->trx ==
	ut_a(prebuilt->trx ==
		(trx_t*) current_thd->ha_data[innobase_hton.slot]);

	if (prebuilt->clust_index_was_generated) {
@@ -4478,7 +4480,7 @@ ha_innobase::position(
	row_prebuilt_t*	prebuilt = (row_prebuilt_t*) innobase_prebuilt;
	uint		len;

	ut_ad(prebuilt->trx ==
	ut_a(prebuilt->trx ==
		(trx_t*) current_thd->ha_data[innobase_hton.slot]);

	if (prebuilt->clust_index_was_generated) {
@@ -5006,7 +5008,6 @@ ha_innobase::delete_all_rows(void)
{
	row_prebuilt_t*	prebuilt	= (row_prebuilt_t*)innobase_prebuilt;
	int		error;
	trx_t*		trx;
	THD*		thd		= current_thd;

	DBUG_ENTER("ha_innobase::delete_all_rows");
@@ -5019,13 +5020,13 @@ ha_innobase::delete_all_rows(void)
	}

	/* Get the transaction associated with the current thd, or create one
	if not yet created */
	if not yet created, and update prebuilt->trx */

	trx = check_trx_exists(thd);
	update_thd(thd);

	/* Truncate the table in InnoDB */

	error = row_truncate_table_for_mysql(prebuilt->table, trx);
	error = row_truncate_table_for_mysql(prebuilt->table, prebuilt->trx);
	if (error == DB_ERROR) {
		/* Cannot truncate; resort to ha_innobase::delete_row() */
		goto fallback;
@@ -5308,6 +5309,9 @@ ha_innobase::records_in_range(

	DBUG_ENTER("records_in_range");

	ut_a(prebuilt->trx ==
		(trx_t*) current_thd->ha_data[innobase_hton.slot]);

	prebuilt->trx->op_info = (char*)"estimating records in index range";

	/* In case MySQL calls this in the middle of a SELECT query, release
@@ -5604,13 +5608,14 @@ ha_innobase::info(
		for (i = 0; i < table->s->keys; i++) {
			if (index == NULL) {
				ut_print_timestamp(stderr);
				sql_print_error("Table %s contains less "
				sql_print_error("Table %s contains fewer "
						"indexes inside InnoDB than "
						"are defined in the MySQL "
						".frm file. Have you mixed up "
						".frm files from different "
						"installations? See section "
						"15.1 at http://www.innodb.com/ibman.html",
						"installations? See "
"http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n",

						ib_table->name);
				break;
			}
@@ -5619,17 +5624,11 @@ ha_innobase::info(

				if (j + 1 > index->n_uniq) {
					ut_print_timestamp(stderr);
					sql_print_error("Index %s of %s has "
							"%lu columns unique "
							"inside InnoDB, but "
							"MySQL is asking "
							"statistics for %lu "
							"columns. Have you "
							"mixed up .frm files "
							"from different "
							"installations? See "
							"section 15.1 at "
							"http://www.innodb.com/ibman.html",
					sql_print_error(
"Index %s of %s has %lu columns unique inside InnoDB, but MySQL is asking "
"statistics for %lu columns. Have you mixed up .frm files from different "
"installations? "
"See http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n",
							index->name,
							ib_table->name,
							(unsigned long)
@@ -6035,6 +6034,10 @@ ha_innobase::can_switch_engines(void)
	bool	can_switch;

	DBUG_ENTER("ha_innobase::can_switch_engines");

	ut_a(prebuilt->trx ==
		(trx_t*) current_thd->ha_data[innobase_hton.slot]);

	prebuilt->trx->op_info =
			"determining if there are foreign key constraints";
	row_mysql_lock_data_dictionary(prebuilt->trx);
@@ -6172,14 +6175,6 @@ ha_innobase::start_stmt(

	innobase_release_stat_resources(trx);

	if (trx->isolation_level <= TRX_ISO_READ_COMMITTED
						&& trx->global_read_view) {
		/* At low transaction isolation levels we let
		each consistent read set its own snapshot */

		read_view_close_for_mysql(trx);
	}

	prebuilt->sql_stat_start = TRUE;
	prebuilt->hint_need_to_fetch_extra_cols = 0;
	prebuilt->read_just_key = 0;
@@ -6438,7 +6433,7 @@ ha_innobase::transactional_table_lock(
"table %s does not exist.\n"
"Have you deleted the .ibd file from the database directory under\n"
"the MySQL datadir?"
"Look from section 15.1 of http://www.innodb.com/ibman.html\n"
"See http://dev.mysql.com/doc/refman/5.1/en/innodb-troubleshooting.html\n"
"how you can resolve the problem.\n",
				prebuilt->table->name);
		DBUG_RETURN(HA_ERR_CRASHED);
@@ -6792,7 +6787,15 @@ ha_innobase::store_lock(
						TL_IGNORE */
{
	row_prebuilt_t* prebuilt	= (row_prebuilt_t*) innobase_prebuilt;
	trx_t*		trx		= prebuilt->trx;
	trx_t*		trx;

	/* Call update_thd() to update prebuilt->trx to point to the trx
	object of thd! Failure to do this caused a serious memory
	corruption bug in 5.1.11. */

	update_thd(thd);

	trx = prebuilt->trx;

	/* NOTE: MySQL	can call this function with lock 'type' TL_IGNORE!
	Be careful to ignore TL_IGNORE if we are going to do something with
@@ -6916,17 +6919,17 @@ ha_innobase::store_lock(
		&& !thd->tablespace_op
		&& thd->lex->sql_command != SQLCOM_TRUNCATE
		&& thd->lex->sql_command != SQLCOM_OPTIMIZE

#ifdef __WIN__
                /* 
                   for alter table on win32 for succesfull operation 
                /* For alter table on win32 for succesful operation
                completion it is used TL_WRITE(=10) lock instead of
                TL_WRITE_ALLOW_READ(=6), however here in innodb handler
                TL_WRITE is lifted to TL_WRITE_ALLOW_WRITE, which causes
                race condition when several clients do alter table
                   simultaneously (bug #17264). This fix avoids the problem.
                */
                simultaneously (bug #17264). This fix avoids the problem. */
                && thd->lex->sql_command != SQLCOM_ALTER_TABLE
#endif

		&& thd->lex->sql_command != SQLCOM_CREATE_TABLE) {

			lock_type = TL_WRITE_ALLOW_WRITE;
@@ -6977,10 +6980,11 @@ ha_innobase::innobase_read_and_init_auto_inc(
	int		error;

	ut_a(prebuilt);
	ut_a(prebuilt->trx ==
		(trx_t*) current_thd->ha_data[innobase_hton.slot]);
	ut_a(prebuilt->table);

	/* Prepare prebuilt->trx in the table handle */
	update_thd(current_thd);

	if (prebuilt->trx->conc_state == TRX_NOT_STARTED) {
		trx_was_not_started = TRUE;
	}
@@ -7115,6 +7119,9 @@ void ha_innobase::get_auto_increment(
	longlong	nr;
	int		error;

	/* Prepare prebuilt->trx in the table handle */
	update_thd(current_thd);

	error = innobase_read_and_init_auto_inc(&nr);

	if (error) {
@@ -7143,6 +7150,8 @@ ha_innobase::reset_auto_increment(ulonglong value)
	row_prebuilt_t* prebuilt = (row_prebuilt_t*) innobase_prebuilt;
	int		error;

	update_thd(current_thd);

	error = row_lock_table_autoinc_for_mysql(prebuilt);

	if (error != DB_SUCCESS) {
+1 −2
Original line number Diff line number Diff line
@@ -77,8 +77,7 @@ EXTRA_DIST = include/btr0btr.h include/btr0btr.ic include/btr0cur.h include/btr
		include/ut0byte.h include/ut0byte.ic include/ut0dbg.h include/ut0lst.h \
		include/ut0mem.h include/ut0mem.ic include/ut0rnd.h include/ut0rnd.ic \
		include/ut0sort.h include/ut0ut.h include/ut0ut.ic include/ut0vec.h include/ut0vec.ic include/ha_prototypes.h \
		include/ut0list.h include/ut0list.ic \
		include/ut0wqueue.h \
		include/ut0list.h include/ut0list.ic include/ut0wqueue.h \
		CMakeLists.txt

noinst_LIBRARIES =	libinnobase.a
+1 −1
Original line number Diff line number Diff line
@@ -624,7 +624,7 @@ btr_page_get_father_for_rec(
		fputs(
"InnoDB: You should dump + drop + reimport the table to fix the\n"
"InnoDB: corruption. If the crash happens at the database startup, see\n"
"InnoDB: http://dev.mysql.com/doc/mysql/en/Forcing_recovery.html about\n"
"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/forcing-recovery.html about\n"
"InnoDB: forcing recovery. Then dump + drop + reimport.\n", stderr);
	}

Loading