From 421d2d2a4a7b2831d8cfc1e0458245f5df80f731 Mon Sep 17 00:00:00 2001
From: "antony@pcg5ppc.xiphis.org" <>
Date: Wed, 12 Sep 2007 13:35:39 -0700
Subject: [PATCH] undo unneccessary change to ha_innodb.cc remove 'drop
 database' from new tests.

---
 mysql-test/suite/rpl/r/rpl_innodb_bug28430.result | 10 ++++------
 mysql-test/suite/rpl/r/rpl_innodb_bug30888.result |  2 --
 mysql-test/suite/rpl/r/rpl_innodb_bug30919.result |  2 --
 mysql-test/suite/rpl/t/rpl_innodb_bug28430.test   |  8 ++------
 mysql-test/suite/rpl/t/rpl_innodb_bug30888.test   |  8 ++------
 mysql-test/suite/rpl/t/rpl_innodb_bug30919.test   |  6 ++----
 storage/innobase/handler/ha_innodb.cc             |  9 ++-------
 7 files changed, 12 insertions(+), 33 deletions(-)

diff --git a/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result b/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result
index 12b90c5feda..1d92a729059 100644
--- a/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result
+++ b/mysql-test/suite/rpl/r/rpl_innodb_bug28430.result
@@ -4,8 +4,6 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
-DROP DATABASE IF EXISTS test;
-CREATE DATABASE test;
 use test;
 CREATE TABLE test.regular_tbl(id MEDIUMINT NOT NULL AUTO_INCREMENT,
 dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
@@ -123,9 +121,9 @@ Master_User	root
 Master_Port	12000
 Connect_Retry	1
 Master_Log_File	master-bin.000001
-Read_Master_Log_Pos	945644
+Read_Master_Log_Pos	945470
 Relay_Log_File	slave-relay-bin.000003
-Relay_Log_Pos	945790
+Relay_Log_Pos	945616
 Relay_Master_Log_File	master-bin.000001
 Slave_IO_Running	Yes
 Slave_SQL_Running	Yes
@@ -138,8 +136,8 @@ Replicate_Wild_Ignore_Table
 Last_Errno	0
 Last_Error	
 Skip_Counter	0
-Exec_Master_Log_Pos	945644
-Relay_Log_Space	945945
+Exec_Master_Log_Pos	945470
+Relay_Log_Space	945771
 Until_Condition	None
 Until_Log_File	
 Until_Log_Pos	0
diff --git a/mysql-test/suite/rpl/r/rpl_innodb_bug30888.result b/mysql-test/suite/rpl/r/rpl_innodb_bug30888.result
index a6f1628a30a..abff02b4b07 100644
--- a/mysql-test/suite/rpl/r/rpl_innodb_bug30888.result
+++ b/mysql-test/suite/rpl/r/rpl_innodb_bug30888.result
@@ -4,8 +4,6 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
-DROP DATABASE IF EXISTS test;
-CREATE DATABASE test;
 use test;
 CREATE TABLE test.regular_tbl(id MEDIUMINT NOT NULL AUTO_INCREMENT,
 dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
diff --git a/mysql-test/suite/rpl/r/rpl_innodb_bug30919.result b/mysql-test/suite/rpl/r/rpl_innodb_bug30919.result
index 853e98350a6..42aa4ff302b 100644
--- a/mysql-test/suite/rpl/r/rpl_innodb_bug30919.result
+++ b/mysql-test/suite/rpl/r/rpl_innodb_bug30919.result
@@ -1,5 +1,3 @@
-DROP DATABASE IF EXISTS test;
-CREATE DATABASE test;
 use test;
 CREATE TABLE test.part_tbl(id MEDIUMINT NOT NULL AUTO_INCREMENT,
 dt TIMESTAMP, user CHAR(255), uuidf LONGBLOB,
diff --git a/mysql-test/suite/rpl/t/rpl_innodb_bug28430.test b/mysql-test/suite/rpl/t/rpl_innodb_bug28430.test
index 903b21f95fc..10e4ed33321 100644
--- a/mysql-test/suite/rpl/t/rpl_innodb_bug28430.test
+++ b/mysql-test/suite/rpl/t/rpl_innodb_bug28430.test
@@ -7,12 +7,6 @@
 
 let $engine_type= 'innodb';
 
-###### CLEAN UP SECTION ##############
-
-DROP DATABASE IF EXISTS test;
-CREATE DATABASE test;
-
-
 ######## Creat Table Section #########
 use test;
 
@@ -145,6 +139,8 @@ SELECT count(*) "Slave norm" FROM test.regular_tbl;
 SELECT count(*) "Slave bykey" FROM test.bykey_tbl;
 SELECT count(*) "Slave byrange" FROM test.byrange_tbl;
 
+###### CLEAN UP SECTION ##############
+
 connection master;
 DROP PROCEDURE test.proc_norm;
 DROP PROCEDURE test.proc_bykey;
diff --git a/mysql-test/suite/rpl/t/rpl_innodb_bug30888.test b/mysql-test/suite/rpl/t/rpl_innodb_bug30888.test
index 848d3fa7f1a..617888aedb7 100644
--- a/mysql-test/suite/rpl/t/rpl_innodb_bug30888.test
+++ b/mysql-test/suite/rpl/t/rpl_innodb_bug30888.test
@@ -8,12 +8,6 @@
 #let $engine_type= 'myisam';
 let $engine_type= 'innodb';
 
-###### CLEAN UP SECTION ##############
-
-DROP DATABASE IF EXISTS test;
-CREATE DATABASE test;
-
-
 ######## Creat Table Section #########
 use test;
 
@@ -61,6 +55,8 @@ CALL test.proc_norm();
 
 --sync_slave_with_master
 
+###### CLEAN UP SECTION ##############
+
 connection master;
 DROP PROCEDURE test.proc_norm;
 DROP TABLE test.regular_tbl;
diff --git a/mysql-test/suite/rpl/t/rpl_innodb_bug30919.test b/mysql-test/suite/rpl/t/rpl_innodb_bug30919.test
index a81c0a4e8b6..a3779c68021 100644
--- a/mysql-test/suite/rpl/t/rpl_innodb_bug30919.test
+++ b/mysql-test/suite/rpl/t/rpl_innodb_bug30919.test
@@ -2,10 +2,6 @@
 --vertical_results
 let $engine_type= 'innodb';
 
-###### CLEAN UP SECTION ##############
-DROP DATABASE IF EXISTS test;
-CREATE DATABASE test;
-
 ######## Creat Table Section #########
 use test;
 
@@ -64,6 +60,8 @@ CALL test.proc_part();
 
 select count(*) as Part from test.part_tbl;
 
+###### CLEAN UP SECTION ##############
+
 DROP PROCEDURE test.proc_part;
 DROP TABLE test.part_tbl;
 
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 2129bf61818..494f6ff233b 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -7130,7 +7130,6 @@ ha_innobase::innobase_read_and_init_auto_inc(
 	int		mysql_error = 0;
 	dict_table_t*	innodb_table = prebuilt->table;
 	ibool		trx_was_not_started	= FALSE;
-	ulint		error;
 
 	ut_a(prebuilt);
 	ut_a(prebuilt->table);
@@ -7151,11 +7150,7 @@ ha_innobase::innobase_read_and_init_auto_inc(
 
 	trx_search_latch_release_if_reserved(prebuilt->trx);
 
-	error = innobase_autoinc_lock();
-	if (error != DB_SUCCESS) {
-		mysql_error = 1;
-		goto err;
-	}
+	dict_table_autoinc_lock(prebuilt->table);
 
 	auto_inc = dict_table_autoinc_read(prebuilt->table);
 
@@ -7168,6 +7163,7 @@ ha_innobase::innobase_read_and_init_auto_inc(
 
 	if (auto_inc == 0) {
 		dict_index_t* index;
+		ulint error;
 		const char* autoinc_col_name;
 
 		ut_a(!innodb_table->autoinc_inited);
@@ -7195,7 +7191,6 @@ ha_innobase::innobase_read_and_init_auto_inc(
 
 	dict_table_autoinc_unlock(prebuilt->table);
 
-err:
 	/* Since MySQL does not seem to call autocommit after SHOW TABLE
 	STATUS (even if we would register the trx here), we commit our
 	transaction here if it was started here. This is to eliminate a
-- 
2.30.9