List:Commits« Previous MessageNext Message »
From:dlenev Date:March 22 2006 5:11pm
Subject:bk commit into 5.0 tree (dlenev:1.2101) BUG#13525
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of dlenev. When dlenev 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
  1.2101 06/03/22 20:11:12 dlenev@stripped +3 -0
  Fix for bug #18153 "ALTER/OPTIMIZE/REPAIR on transactional tables corrupt
  triggers".
  
  Applying ALTER/OPTIMIZE/REPAIR TABLE statements to transactional table or to
  table of any type on Windows caused disappearance of its triggers.
  Bug was introduced in 5.0.19 by my fix for bug #13525 "Rename table does not
  keep info of triggers" (see comment for sql_table.cc for more info).

  mysql-test/t/trigger-trans.test
    1.1 06/03/22 20:11:08 dlenev@stripped +39 -0
    New BitKeeper file ``mysql-test/t/trigger-trans.test''

  mysql-test/r/trigger-trans.result
    1.1 06/03/22 20:11:08 dlenev@stripped +51 -0
    New BitKeeper file ``mysql-test/r/trigger-trans.result''

  sql/sql_table.cc
    1.299 06/03/22 20:11:08 dlenev@stripped +1 -1
    mysql_alter_table():
      At this point in mysql_alter_table() we can't rely on new_table!=table_name
      being indication that table will be renamed (this is because table_name is
      replaced with its strdup()'ed copy several lines above), so let us use
      more explicit and faster check instead.
      
      It is probably good idea to get rid of this strdup() call in 5.1 or 5.2.

  mysql-test/t/trigger-trans.test
    1.0 06/03/22 20:11:08 dlenev@stripped +0 -0
    BitKeeper file /home/dlenev/mysql-5.0-bg18153/mysql-test/t/trigger-trans.test

  mysql-test/r/trigger-trans.result
    1.0 06/03/22 20:11:08 dlenev@stripped +0 -0
    BitKeeper file /home/dlenev/mysql-5.0-bg18153/mysql-test/r/trigger-trans.result

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	dlenev
# Host:	jabberwock.site
# Root:	/home/dlenev/mysql-5.0-bg18153

--- 1.298/sql/sql_table.cc	2006-02-27 15:50:30 +03:00
+++ 1.299/sql/sql_table.cc	2006-03-22 20:11:08 +03:00
@@ -3851,7 +3851,7 @@
   }
   else if (mysql_rename_table(new_db_type,new_db,tmp_name,new_db,
 			      new_alias) ||
-           (new_name != table_name || new_db != db) && // we also do rename
+           (alter_info->flags & ALTER_RENAME) && // we also do rename
            Table_triggers_list::change_table_name(thd, db, table_name,
                                                   new_db, new_alias))
        
--- New file ---
+++ mysql-test/r/trigger-trans.result	06/03/22 20:11:08
drop table if exists t1;
create table t1 (a varchar(16), b int) engine=innodb;
create trigger t1_bi before insert on t1 for each row
begin
set new.a := upper(new.a);
set new.b := new.b + 3;
end|
select trigger_schema, trigger_name, event_object_schema,
event_object_table, action_statement from information_schema.triggers
where event_object_schema = 'test' and event_object_table = 't1';
trigger_schema	trigger_name	event_object_schema	event_object_table	action_statement
test	t1_bi	test	t1	begin
set new.a := upper(new.a);
set new.b := new.b + 3;
end
insert into t1 values ('The Lion', 10);
select * from t1;
a	b
THE LION	13
optimize table t1;
Table	Op	Msg_type	Msg_text
test.t1	optimize	status	OK
select trigger_schema, trigger_name, event_object_schema,
event_object_table, action_statement from information_schema.triggers
where event_object_schema = 'test' and event_object_table = 't1';
trigger_schema	trigger_name	event_object_schema	event_object_table	action_statement
test	t1_bi	test	t1	begin
set new.a := upper(new.a);
set new.b := new.b + 3;
end
insert into t1 values ('The Unicorn', 20);
select * from t1;
a	b
THE LION	13
THE UNICORN	23
alter table t1 add column c int default 0;
select trigger_schema, trigger_name, event_object_schema,
event_object_table, action_statement from information_schema.triggers
where event_object_schema = 'test' and event_object_table = 't1';
trigger_schema	trigger_name	event_object_schema	event_object_table	action_statement
test	t1_bi	test	t1	begin
set new.a := upper(new.a);
set new.b := new.b + 3;
end
insert into t1 values ('Alice', 30, 1);
select * from t1;
a	b	c
THE LION	13	0
THE UNICORN	23	0
ALICE	33	1
drop table t1;

--- New file ---
+++ mysql-test/t/trigger-trans.test	06/03/22 20:11:08
# Tests which involve triggers and transactions
# (or just InnoDB storage engine)
-- source include/have_innodb.inc

--disable_warnings
drop table if exists t1;
--enable_warnings

# Test for bug #18153 "OPTIMIZE/ALTER on transactional tables corrupt
#                      triggers/triggers are lost".

create table t1 (a varchar(16), b int) engine=innodb;
delimiter |;
create trigger t1_bi before insert on t1 for each row
begin
 set new.a := upper(new.a);
 set new.b := new.b + 3;
end|
delimiter ;|
select trigger_schema, trigger_name, event_object_schema,
       event_object_table, action_statement from information_schema.triggers
       where event_object_schema = 'test' and event_object_table = 't1';
insert into t1 values ('The Lion', 10);
select * from t1;
optimize table t1;
select trigger_schema, trigger_name, event_object_schema,
       event_object_table, action_statement from information_schema.triggers
       where event_object_schema = 'test' and event_object_table = 't1';
insert into t1 values ('The Unicorn', 20);
select * from t1;
alter table t1 add column c int default 0;
select trigger_schema, trigger_name, event_object_schema,
       event_object_table, action_statement from information_schema.triggers
       where event_object_schema = 'test' and event_object_table = 't1';
insert into t1 values ('Alice', 30, 1);
select * from t1;
drop table t1;

# End of 5.0 tests

Thread
bk commit into 5.0 tree (dlenev:1.2101) BUG#13525dlenev22 Mar