mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
branches/zip: Merge revisions 6669:6788 from branches/5.1:
------------------------------------------------------------------------
r6774 | calvin | 2010-03-03 23:56:10 +0200 (Wed, 03 Mar 2010) | 2 lines
Changed paths:
M /branches/5.1/trx/trx0sys.c
branches/5.1: fix bug#51653: outdated reference to set-variable
Non functional change.
------------------------------------------------------------------------
r6780 | vasil | 2010-03-08 19:13:20 +0200 (Mon, 08 Mar 2010) | 4 lines
Changed paths:
M /branches/5.1/plug.in
branches/5.1:
Whitespace fixup.
------------------------------------------------------------------------
r6783 | jyang | 2010-03-09 17:54:14 +0200 (Tue, 09 Mar 2010) | 9 lines
Changed paths:
M /branches/5.1/handler/ha_innodb.cc
M /branches/5.1/mysql-test/innodb_bug21704.result
A /branches/5.1/mysql-test/innodb_bug47621.result
A /branches/5.1/mysql-test/innodb_bug47621.test
branches/5.1: Fix bug #47621 "MySQL and InnoDB data dictionaries
will become out of sync when renaming columns". MySQL does not
provide new column name information to storage engine to
update the system table. To avoid column name mismatch, we shall
just request a table copy for now.
rb://246 approved by Marko.
------------------------------------------------------------------------
r6785 | vasil | 2010-03-10 09:04:38 +0200 (Wed, 10 Mar 2010) | 11 lines
Changed paths:
M /branches/5.1/mysql-test/innodb_bug38231.test
branches/5.1:
Add the missing --reap statements in innodb_bug38231.test. Probably MySQL
enforced the presence of those recently and the test started failing like:
main.innodb_bug38231 [ fail ]
Test ended at 2010-03-10 08:48:32
CURRENT_TEST: main.innodb_bug38231
mysqltest: At line 49: Cannot run query on connection between send and reap
------------------------------------------------------------------------
r6788 | vasil | 2010-03-10 10:53:21 +0200 (Wed, 10 Mar 2010) | 8 lines
Changed paths:
M /branches/5.1/mysql-test/innodb_bug38231.test
branches/5.1:
In innodb_bug38231.test: replace the fragile sleep 0.2 that depends on timing
with a more robust condition which waits for the TRUNCATE and LOCK commands
to appear in information_schema.processlist. This could also break if there
are other sessions executing the same SQL commands, but there are none during
the execution of the mysql test.
------------------------------------------------------------------------
This commit is contained in:
@@ -25,8 +25,8 @@ ALTER TABLE t1 CHANGE a c INT;
|
||||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t1' (errno: 150)
|
||||
# Ensure that online column rename works.
|
||||
ALTER TABLE t1 CHANGE b c INT;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
affected rows: 3
|
||||
info: Records: 3 Duplicates: 0 Warnings: 0
|
||||
|
||||
# Test renaming the column in the referencing table
|
||||
|
||||
@@ -34,8 +34,8 @@ ALTER TABLE t2 CHANGE a c INT;
|
||||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t2' (errno: 150)
|
||||
# Ensure that online column rename works.
|
||||
ALTER TABLE t2 CHANGE b c INT;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
affected rows: 3
|
||||
info: Records: 3 Duplicates: 0 Warnings: 0
|
||||
|
||||
# Test with self-referential constraints
|
||||
|
||||
@@ -45,8 +45,8 @@ ALTER TABLE t3 CHANGE b d INT;
|
||||
ERROR HY000: Error on rename of '#sql-temporary' to './test/t3' (errno: 150)
|
||||
# Ensure that online column rename works.
|
||||
ALTER TABLE t3 CHANGE c d INT;
|
||||
affected rows: 0
|
||||
info: Records: 0 Duplicates: 0 Warnings: 0
|
||||
affected rows: 3
|
||||
info: Records: 3 Duplicates: 0 Warnings: 0
|
||||
|
||||
# Cleanup.
|
||||
|
||||
|
||||
21
mysql-test/innodb_bug47621.result
Normal file
21
mysql-test/innodb_bug47621.result
Normal file
@@ -0,0 +1,21 @@
|
||||
CREATE TABLE bug47621 (salesperson INT) ENGINE=InnoDB;
|
||||
ALTER TABLE bug47621 CHANGE salesperson sales_acct_id INT;
|
||||
create index orgs on bug47621(sales_acct_id);
|
||||
ALTER TABLE bug47621 CHANGE sales_acct_id salesperson INT;
|
||||
drop table bug47621;
|
||||
CREATE TABLE bug47621_sale (
|
||||
salesperson INT,
|
||||
PRIMARY KEY(salesperson)) engine = innodb;
|
||||
CREATE TABLE bug47621_shirt(
|
||||
id SMALLINT,
|
||||
owner INT,
|
||||
FOREIGN KEY(owner)
|
||||
references bug47621_sale(salesperson) ON DELETE RESTRICT)
|
||||
engine = innodb;
|
||||
insert into bug47621_sale values(9);
|
||||
insert into bug47621_shirt values(1, 9);
|
||||
ALTER TABLE bug47621_shirt CHANGE id new_id INT;
|
||||
drop table bug47621_shirt;
|
||||
ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT;
|
||||
ALTER TABLE bug47621_sale ADD INDEX idx (sales_acct_id);
|
||||
drop table bug47621_sale;
|
||||
57
mysql-test/innodb_bug47621.test
Normal file
57
mysql-test/innodb_bug47621.test
Normal file
@@ -0,0 +1,57 @@
|
||||
# This is the test for bug #47621, column rename operation should
|
||||
# not result in column definition inconsistency between MySQL and
|
||||
# InnoDB
|
||||
|
||||
--source include/have_innodb.inc
|
||||
|
||||
CREATE TABLE bug47621 (salesperson INT) ENGINE=InnoDB;
|
||||
|
||||
# Change the column name
|
||||
ALTER TABLE bug47621 CHANGE salesperson sales_acct_id INT;
|
||||
|
||||
# If there is inconsistency of column name definition
|
||||
# in MySQL or InnoDB, following create index would fail
|
||||
create index orgs on bug47621(sales_acct_id);
|
||||
|
||||
# Change the column name back with the index defined on it.
|
||||
ALTER TABLE bug47621 CHANGE sales_acct_id salesperson INT;
|
||||
|
||||
drop table bug47621;
|
||||
|
||||
CREATE TABLE bug47621_sale (
|
||||
salesperson INT,
|
||||
PRIMARY KEY(salesperson)) engine = innodb;
|
||||
|
||||
CREATE TABLE bug47621_shirt(
|
||||
id SMALLINT,
|
||||
owner INT,
|
||||
FOREIGN KEY(owner)
|
||||
references bug47621_sale(salesperson) ON DELETE RESTRICT)
|
||||
engine = innodb;
|
||||
|
||||
insert into bug47621_sale values(9);
|
||||
|
||||
insert into bug47621_shirt values(1, 9);
|
||||
|
||||
# Any rename operation on columns involved in a reference constraint will
|
||||
# fail, as it will be rejected by InnoDB row_rename_table_for_mysql().
|
||||
# In above example, any rename on column "salesperson" for table
|
||||
# "bug47621_sale", or on column "owner" for table "bug47621_shirt will
|
||||
# be blocked. We do not put such rename in the test since InnoDB error
|
||||
# message will be printed in the error log, and result in test failure.
|
||||
#
|
||||
# ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT;
|
||||
|
||||
# Any rename on columns not involved in the foreign key constraint
|
||||
# could still proceed
|
||||
ALTER TABLE bug47621_shirt CHANGE id new_id INT;
|
||||
|
||||
# Referencing table dropped, the rename operation on related columns
|
||||
# could proceed
|
||||
drop table bug47621_shirt;
|
||||
|
||||
ALTER TABLE bug47621_sale CHANGE salesperson sales_acct_id INT;
|
||||
|
||||
ALTER TABLE bug47621_sale ADD INDEX idx (sales_acct_id);
|
||||
|
||||
drop table bug47621_sale;
|
||||
Reference in New Issue
Block a user