Below is the list of changes that have just been committed into a local
5.1 repository of tsmith. When tsmith does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2008-01-14 22:55:50-07:00, tsmith@stripped +7 -0
Apply innodb-5.1-ss2146 and innodb-5.1-ss2178 snapshots.
Fixes:
Bug #18942: DROP DATABASE does not drop an orphan FOREIGN KEY constraint
Fix Bug#18942 by dropping all foreign key constraints at the end of
DROP DATABASE. Usually, by then, there are no foreign constraints
left because all of them are dropped when the relevant tables are
dropped. This code is to ensure that any orphaned FKs are wiped too.
Bug #29157: UPDATE, changed rows incorrect
Return HA_ERR_RECORD_IS_THE_SAME from ha_innobase::update_row() if no
columns were updated.
Bug #32440: InnoDB free space info does not appear in SHOW TABLE STATUS or I_S
Put information about the free space in a tablespace in
INFORMATION_SCHEMA.TABLES.DATA_FREE. This information was previously
available in INFORMATION_SCHEMA.TABLES.TABLE_COMMENT, but MySQL has
removed it from there recently.
The stored value is in kilobytes.
This can be considered as a permanent workaround to
http://bugs.mysql.com/32440. "Workaround" becasue that bug is about the
data missing from TABLE_COMMENT and this is actually not solved.
mysql-test/r/innodb.result@stripped, 2008-01-14 22:49:28-07:00, tsmith@stripped
+13 -0
New tests for bugs fixed as part of snapshots innodb-5.1-ss2146 and innodb-5.1-ss2178
mysql-test/r/partition_innodb.result@stripped, 2008-01-14 22:49:28-07:00,
tsmith@stripped +6 -6
Update results - InnoDB now sets Data_length (show table status)
mysql-test/t/innodb.test@stripped, 2008-01-14 22:49:28-07:00, tsmith@stripped +21
-0
New tests for bugs fixed as part of snapshots innodb-5.1-ss2146 and innodb-5.1-ss2178
mysql-test/t/partition_innodb.test@stripped, 2008-01-14 22:49:28-07:00,
tsmith@stripped +18 -0
Mask out Data_Free in show table status, because it varies depending on
which tests have been run.
storage/innobase/handler/ha_innodb.cc@stripped, 2008-01-14 22:49:28-07:00,
tsmith@stripped +24 -5
Apply innodb-5.1-ss2146 and innodb-5.1-ss2178 snapshots.
Revision r2178:
branches/5.1:
Merge r2177 from trunk/:
Fix Bug#29157 "UPDATE, changed rows incorrect":
Return HA_ERR_RECORD_IS_THE_SAME from ha_innobase::update_row() if no
columns were updated.
Revision r2169:
branches/5.1:
Bug#32440:
Put information about the free space in a tablespace in
INFORMATION_SCHEMA.TABLES.DATA_FREE. This information was previously
available in INFORMATION_SCHEMA.TABLES.TABLE_COMMENT, but MySQL has
removed it from there recently.
The stored value is in kilobytes.
This can be considered as a permanent workaround to
http://bugs.mysql.com/32440. "Workaround" becasue that bug is about the
data missing from TABLE_COMMENT and this is actually not solved.
storage/innobase/row/row0mysql.c@stripped, 2008-01-14 22:49:29-07:00,
tsmith@stripped +73 -0
Apply innodb-5.1-ss2146 and innodb-5.1-ss2178 snapshots.
Revision r2161:
branches/5.1:
Merge r2160 from trunk/:
Fix Bug#18942 by dropping all foreign key constraints at the end of
DROP DATABASE. Usually, by then, there are no foreign constraints
left because all of them are dropped when the relevant tables are
dropped. This code is to ensure that any orphaned FKs are wiped too.
storage/innobase/trx/trx0trx.c@stripped, 2008-01-14 22:49:29-07:00,
tsmith@stripped +1 -0
Apply innodb-5.1-ss2146 and innodb-5.1-ss2178 snapshots.
diff -Nrup a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result
--- a/mysql-test/r/innodb.result 2007-12-13 04:57:02 -07:00
+++ b/mysql-test/r/innodb.result 2008-01-14 22:49:28 -07:00
@@ -3218,3 +3218,16 @@ a
2
DROP TABLE t1;
DROP TABLE t2;
+create table t1 (i int, j int) engine=innodb;
+insert into t1 (i, j) values (1, 1), (2, 2);
+update t1 set j = 2;
+affected rows: 1
+info: Rows matched: 2 Changed: 1 Warnings: 0
+drop table t1;
+create table t1 (id int) comment='this is a comment' engine=innodb;
+select table_comment, data_free > 0 as data_free_is_set
+from information_schema.tables
+where table_schema='test' and table_name = 't1';
+table_comment data_free_is_set
+this is a comment 1
+drop table t1;
diff -Nrup a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result
--- a/mysql-test/r/partition_innodb.result 2007-12-06 06:43:04 -07:00
+++ b/mysql-test/r/partition_innodb.result 2008-01-14 22:49:28 -07:00
@@ -13,33 +13,33 @@ DROP TABLE t1;
create table t1 (a int) engine=innodb partition by hash(a) ;
show table status like 't1';
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 InnoDB 10 Compact 2 8192 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Compact 2 8192 16384 0 0 # NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
drop table t1;
create table t1 (a int)
engine = innodb
partition by key (a);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 InnoDB 10 Compact 2 8192 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Compact 2 8192 16384 0 0 # NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
insert into t1 values (0), (1), (2), (3);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 InnoDB 10 Compact 4 4096 16384 0 0 0 NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Compact 4 4096 16384 0 0 # NULL NULL NULL NULL latin1_swedish_ci NULL partitioned
drop table t1;
create table t1 (a int auto_increment primary key)
engine = innodb
partition by key (a);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 InnoDB 10 Compact 2 8192 16384 0 0 0 1 NULL NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Compact 2 8192 16384 0 0 # 1 NULL NULL NULL latin1_swedish_ci NULL partitioned
insert into t1 values (NULL), (NULL), (NULL), (NULL);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 InnoDB 10 Compact 4 4096 16384 0 0 0 5 NULL NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Compact 4 4096 16384 0 0 # 5 NULL NULL NULL latin1_swedish_ci NULL partitioned
insert into t1 values (NULL), (NULL), (NULL), (NULL);
show table status;
Name Engine Version Row_format Rows Avg_row_length Data_length Max_data_length Index_length Data_free Auto_increment Create_time Update_time Check_time Collation Checksum Create_options Comment
-t1 InnoDB 10 Compact 8 2048 16384 0 0 0 9 NULL NULL NULL latin1_swedish_ci NULL partitioned
+t1 InnoDB 10 Compact 8 2048 16384 0 0 # 9 NULL NULL NULL latin1_swedish_ci NULL partitioned
drop table t1;
create table t1 (a int)
partition by key (a)
diff -Nrup a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test
--- a/mysql-test/t/innodb.test 2007-11-21 13:09:20 -07:00
+++ b/mysql-test/t/innodb.test 2008-01-14 22:49:28 -07:00
@@ -2382,6 +2382,27 @@ DROP TABLE t1;
DROP TABLE t2;
DISCONNECT c1;
DISCONNECT c2;
+CONNECTION default;
+
+#
+# Bug #29157 UPDATE, changed rows incorrect
+#
+create table t1 (i int, j int) engine=innodb;
+insert into t1 (i, j) values (1, 1), (2, 2);
+--enable_info
+update t1 set j = 2;
+--disable_info
+drop table t1;
+
+#
+# Bug #32440 InnoDB free space info does not appear in SHOW TABLE STATUS or
+# I_S
+#
+create table t1 (id int) comment='this is a comment' engine=innodb;
+select table_comment, data_free > 0 as data_free_is_set
+ from information_schema.tables
+ where table_schema='test' and table_name = 't1';
+drop table t1;
#######################################################################
# #
diff -Nrup a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test
--- a/mysql-test/t/partition_innodb.test 2007-12-06 06:43:04 -07:00
+++ b/mysql-test/t/partition_innodb.test 2008-01-14 22:49:28 -07:00
@@ -20,6 +20,9 @@ DROP TABLE t1;
# Bug #14673: Wrong InnoDB default row format
#
create table t1 (a int) engine=innodb partition by hash(a) ;
+# Data_free for InnoDB tablespace varies depending on which
+# tests have been run before this one
+--replace_column 10 #
show table status like 't1';
drop table t1;
@@ -29,18 +32,33 @@ drop table t1;
create table t1 (a int)
engine = innodb
partition by key (a);
+# Data_free for InnoDB tablespace varies depending on which
+# tests have been run before this one
+--replace_column 10 #
show table status;
insert into t1 values (0), (1), (2), (3);
+# Data_free for InnoDB tablespace varies depending on which
+# tests have been run before this one
+--replace_column 10 #
show table status;
drop table t1;
create table t1 (a int auto_increment primary key)
engine = innodb
partition by key (a);
+# Data_free for InnoDB tablespace varies depending on which
+# tests have been run before this one
+--replace_column 10 #
show table status;
insert into t1 values (NULL), (NULL), (NULL), (NULL);
+# Data_free for InnoDB tablespace varies depending on which
+# tests have been run before this one
+--replace_column 10 #
show table status;
insert into t1 values (NULL), (NULL), (NULL), (NULL);
+# Data_free for InnoDB tablespace varies depending on which
+# tests have been run before this one
+--replace_column 10 #
show table status;
drop table t1;
diff -Nrup a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
--- a/storage/innobase/handler/ha_innodb.cc 2007-11-20 12:02:17 -07:00
+++ b/storage/innobase/handler/ha_innodb.cc 2008-01-14 22:49:28 -07:00
@@ -600,7 +600,9 @@ convert_error_code_to_mysql(
tell it also to MySQL so that MySQL knows to empty the
cached binlog for this transaction */
- thd_mark_transaction_to_rollback(thd, TRUE);
+ if (thd) {
+ thd_mark_transaction_to_rollback(thd, TRUE);
+ }
return(HA_ERR_LOCK_DEADLOCK);
} else if (error == (int) DB_LOCK_WAIT_TIMEOUT) {
@@ -609,8 +611,10 @@ convert_error_code_to_mysql(
latest SQL statement in a lock wait timeout. Previously, we
rolled back the whole transaction. */
- thd_mark_transaction_to_rollback(thd,
- (bool)row_rollback_on_timeout);
+ if (thd) {
+ thd_mark_transaction_to_rollback(
+ thd, (bool)row_rollback_on_timeout);
+ }
return(HA_ERR_LOCK_WAIT_TIMEOUT);
@@ -662,7 +666,9 @@ convert_error_code_to_mysql(
tell it also to MySQL so that MySQL knows to empty the
cached binlog for this transaction */
- thd_mark_transaction_to_rollback(thd, TRUE);
+ if (thd) {
+ thd_mark_transaction_to_rollback(thd, TRUE);
+ }
return(HA_ERR_LOCK_TABLE_FULL);
} else if (error == DB_TOO_MANY_CONCURRENT_TRXS) {
@@ -3769,6 +3775,16 @@ ha_innobase::update_row(
error = convert_error_code_to_mysql(error, user_thd);
+ if (error == 0 /* success */
+ && uvect->n_fields == 0 /* no columns were updated */) {
+
+ /* This is the same as success, but instructs
+ MySQL that the row is not really updated and it
+ should not increase the count of updated rows.
+ This is fix for http://bugs.mysql.com/29157 */
+ error = HA_ERR_RECORD_IS_THE_SAME;
+ }
+
/* Tell InnoDB server that there might be work for
utility threads: */
@@ -5720,7 +5736,9 @@ ha_innobase::info(
stats.index_file_length = ((ulonglong)
ib_table->stat_sum_of_other_index_sizes)
* UNIV_PAGE_SIZE;
- stats.delete_length = 0;
+ stats.delete_length =
+ fsp_get_available_space_in_free_extents(
+ ib_table->space);
stats.check_time = 0;
if (stats.records == 0) {
@@ -7246,6 +7264,7 @@ On return if there is no error then the
ulong
ha_innobase::innobase_get_auto_increment(
+/*=====================================*/
ulonglong* value) /* out: autoinc value */
{
ulong error;
diff -Nrup a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
--- a/storage/innobase/row/row0mysql.c 2007-11-06 15:23:46 -07:00
+++ b/storage/innobase/row/row0mysql.c 2008-01-14 22:49:29 -07:00
@@ -3312,6 +3312,66 @@ funct_exit:
return((int) err);
}
+/***********************************************************************
+Drop all foreign keys in a database, see Bug#18942.
+Called at the end of row_drop_database_for_mysql(). */
+static
+ulint
+drop_all_foreign_keys_in_db(
+/*========================*/
+ /* out: error code or DB_SUCCESS */
+ const char* name, /* in: database name which ends to '/' */
+ trx_t* trx) /* in: transaction handle */
+{
+ pars_info_t* pinfo;
+ ulint err;
+
+ ut_a(name[strlen(name) - 1] == '/');
+
+ pinfo = pars_info_create();
+
+ pars_info_add_str_literal(pinfo, "dbname", name);
+
+/* true if for_name is not prefixed with dbname */
+#define TABLE_NOT_IN_THIS_DB \
+"SUBSTR(for_name, 0, LENGTH(:dbname)) <> :dbname"
+
+ err = que_eval_sql(pinfo,
+ "PROCEDURE DROP_ALL_FOREIGN_KEYS_PROC () IS\n"
+ "foreign_id CHAR;\n"
+ "for_name CHAR;\n"
+ "found INT;\n"
+ "DECLARE CURSOR cur IS\n"
+ "SELECT ID, FOR_NAME FROM SYS_FOREIGN\n"
+ "WHERE FOR_NAME >= :dbname\n"
+ "LOCK IN SHARE MODE\n"
+ "ORDER BY FOR_NAME;\n"
+ "BEGIN\n"
+ "found := 1;\n"
+ "OPEN cur;\n"
+ "WHILE found = 1 LOOP\n"
+ " FETCH cur INTO foreign_id, for_name;\n"
+ " IF (SQL % NOTFOUND) THEN\n"
+ " found := 0;\n"
+ " ELSIF (" TABLE_NOT_IN_THIS_DB ") THEN\n"
+ " found := 0;\n"
+ " ELSIF (1=1) THEN\n"
+ " DELETE FROM SYS_FOREIGN_COLS\n"
+ " WHERE ID = foreign_id;\n"
+ " DELETE FROM SYS_FOREIGN\n"
+ " WHERE ID = foreign_id;\n"
+ " END IF;\n"
+ "END LOOP;\n"
+ "CLOSE cur;\n"
+ "COMMIT WORK;\n"
+ "END;\n",
+ FALSE, /* do not reserve dict mutex,
+ we are already holding it */
+ trx);
+
+ return(err);
+}
+
/*************************************************************************
Drops a database for MySQL. */
@@ -3379,6 +3439,19 @@ loop:
ut_print_name(stderr, trx, TRUE, table_name);
putc('\n', stderr);
break;
+ }
+ }
+
+ if (err == DB_SUCCESS) {
+ /* after dropping all tables try to drop all leftover
+ foreign keys in case orphaned ones exist */
+ err = (int) drop_all_foreign_keys_in_db(name, trx);
+
+ if (err != DB_SUCCESS) {
+ fputs("InnoDB: DROP DATABASE ", stderr);
+ ut_print_name(stderr, trx, TRUE, name);
+ fprintf(stderr, " failed with error %d while "
+ "dropping all foreign keys", err);
}
}
diff -Nrup a/storage/innobase/trx/trx0trx.c b/storage/innobase/trx/trx0trx.c
--- a/storage/innobase/trx/trx0trx.c 2007-08-27 18:33:54 -06:00
+++ b/storage/innobase/trx/trx0trx.c 2008-01-14 22:49:29 -07:00
@@ -933,6 +933,7 @@ trx_commit_off_kernel(
trx->rseg = NULL;
trx->undo_no = ut_dulint_zero;
trx->last_sql_stat_start.least_undo_no = ut_dulint_zero;
+ trx->mysql_query_str = NULL;
ut_ad(UT_LIST_GET_LEN(trx->wait_thrs) == 0);
ut_ad(UT_LIST_GET_LEN(trx->trx_locks) == 0);
| Thread |
|---|
| • bk commit into 5.1 tree (tsmith:1.2649) BUG#18942 | tim | 15 Jan 2008 |