Commit e86ea27b authored by unknown's avatar unknown

Merge pnousiainen@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  mysql.com:/space/pekka/ndb/version/my51

parents cc736560 cabebacd
--let $binlog_start=102
--replace_result $binlog_start <binlog_start>
--replace_column 2 # 4 # 5 #
--eval show binlog events from $binlog_start
drop database if exists mysqltest; drop database if exists mysqltest;
drop table if exists t1,t2; drop table if exists t1,t2,t3;
drop database if exists mysqltest; drop database if exists mysqltest;
drop table if exists t1,t2; drop table if exists t1,t2,t3;
reset master; reset master;
reset master; reset master;
create database mysqltest; create database mysqltest;
...@@ -123,3 +123,68 @@ master-bin1.000001 # Table_map # # cluster.apply_status ...@@ -123,3 +123,68 @@ master-bin1.000001 # Table_map # # cluster.apply_status
master-bin1.000001 # Write_rows # # master-bin1.000001 # Write_rows # #
master-bin1.000001 # Query # # COMMIT master-bin1.000001 # Query # # COMMIT
master-bin1.000001 # Query # # use `test`; drop table `t1` master-bin1.000001 # Query # # use `test`; drop table `t1`
reset master;
show tables;
Tables_in_test
reset master;
show tables;
Tables_in_test
create table t1 (a int key) engine=ndb;
create table t2 (a int key) engine=ndb;
create table t3 (a int key) engine=ndb;
rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin1.000001 # Query # # use `test`; create table t1 (a int key) engine=ndb
master-bin1.000001 # Query # # use `test`; create table t2 (a int key) engine=ndb
master-bin1.000001 # Query # # use `test`; create table t3 (a int key) engine=ndb
master-bin1.000001 # Query # # BEGIN
master-bin1.000001 # Table_map # # cluster.apply_status
master-bin1.000001 # Write_rows # #
master-bin1.000001 # Query # # COMMIT
master-bin1.000001 # Query # # use `test`; rename table `test.t3` to `test.t4`
master-bin1.000001 # Query # # BEGIN
master-bin1.000001 # Table_map # # cluster.apply_status
master-bin1.000001 # Write_rows # #
master-bin1.000001 # Query # # COMMIT
master-bin1.000001 # Query # # use `test`; rename table `test.t2` to `test.t3`
master-bin1.000001 # Query # # BEGIN
master-bin1.000001 # Table_map # # cluster.apply_status
master-bin1.000001 # Write_rows # #
master-bin1.000001 # Query # # COMMIT
master-bin1.000001 # Query # # use `test`; rename table `test.t1` to `test.t2`
master-bin1.000001 # Query # # BEGIN
master-bin1.000001 # Table_map # # cluster.apply_status
master-bin1.000001 # Write_rows # #
master-bin1.000001 # Query # # COMMIT
master-bin1.000001 # Query # # use `test`; rename table `test.t4` to `test.t1`
drop table t1;
drop table t2;
drop table t3;
reset master;
show tables;
Tables_in_test
reset master;
show tables;
Tables_in_test
create table t1 (a int key) engine=ndb;
insert into t1 values(1);
rename table t1 to t2;
insert into t2 values(2);
show binlog events from <binlog_start>;
Log_name Pos Event_type Server_id End_log_pos Info
master-bin1.000001 # Query # # use `test`; create table t1 (a int key) engine=ndb
master-bin1.000001 # Query # # BEGIN
master-bin1.000001 # Table_map # # cluster.apply_status
master-bin1.000001 # Write_rows # #
master-bin1.000001 # Table_map # # test.t1
master-bin1.000001 # Write_rows # #
master-bin1.000001 # Query # # COMMIT
master-bin1.000001 # Query # # use `test`; rename table `test.t1` to `test.t2`
master-bin1.000001 # Query # # BEGIN
master-bin1.000001 # Table_map # # cluster.apply_status
master-bin1.000001 # Write_rows # #
master-bin1.000001 # Table_map # # test.t2
master-bin1.000001 # Write_rows # #
master-bin1.000001 # Query # # COMMIT
drop table t2;
...@@ -5,18 +5,16 @@ ...@@ -5,18 +5,16 @@
--disable_warnings --disable_warnings
connection server2; connection server2;
drop database if exists mysqltest; drop database if exists mysqltest;
drop table if exists t1,t2; drop table if exists t1,t2,t3;
connection server1; connection server1;
drop database if exists mysqltest; drop database if exists mysqltest;
drop table if exists t1,t2; drop table if exists t1,t2,t3;
--connection server1 --connection server1
reset master; reset master;
--connection server2 --connection server2
reset master; reset master;
--enable_warnings --enable_warnings
--let $binlog_start=102
# #
# basic test to see if ddl distribution works across # basic test to see if ddl distribution works across
# multiple binlogs # multiple binlogs
...@@ -33,15 +31,10 @@ create table t1 (a int primary key) engine=ndb; ...@@ -33,15 +31,10 @@ create table t1 (a int primary key) engine=ndb;
--connection server2 --connection server2
create table t2 (a int primary key) engine=ndb; create table t2 (a int primary key) engine=ndb;
--replace_result $binlog_start <binlog_start> --source include/show_binlog_events.inc
--replace_column 2 # 4 # 5 #
--eval show binlog events from $binlog_start
--connection server1 --connection server1
--replace_result $binlog_start <binlog_start> -- source include/show_binlog_events.inc
--replace_column 2 # 4 # 5 #
--eval show binlog events from $binlog_start
# alter table # alter table
--connection server1 --connection server1
...@@ -53,9 +46,7 @@ reset master; ...@@ -53,9 +46,7 @@ reset master;
alter table t2 add column (b int); alter table t2 add column (b int);
--connections server1 --connections server1
--replace_result $binlog_start <binlog_start> --source include/show_binlog_events.inc
--replace_column 2 # 4 # 5 #
--eval show binlog events from $binlog_start
# alter database # alter database
...@@ -91,9 +82,7 @@ drop database mysqltest; ...@@ -91,9 +82,7 @@ drop database mysqltest;
create table t1 (a int primary key) engine=ndb; create table t1 (a int primary key) engine=ndb;
--connection server2 --connection server2
--replace_result $binlog_start <binlog_start> --source include/show_binlog_events.inc
--replace_column 2 # 4 # 5 #
--eval show binlog events from $binlog_start
--connection server2 --connection server2
drop table t2; drop table t2;
...@@ -144,6 +133,51 @@ ENGINE =NDB; ...@@ -144,6 +133,51 @@ ENGINE =NDB;
drop table t1; drop table t1;
--connection server2 --connection server2
--replace_result $binlog_start <binlog_start> --source include/show_binlog_events.inc
--replace_column 2 # 4 # 5 #
--eval show binlog events from $binlog_start #
# Bug #17827 cluster: rename of several tables in one statement,
# gets multiply logged
#
--connection server1
reset master;
show tables;
--connection server2
reset master;
show tables;
--connection server1
create table t1 (a int key) engine=ndb;
create table t2 (a int key) engine=ndb;
create table t3 (a int key) engine=ndb;
rename table t3 to t4, t2 to t3, t1 to t2, t4 to t1;
--connection server2
--source include/show_binlog_events.inc
drop table t1;
drop table t2;
drop table t3;
#
# Bug #17838 binlog not setup on seconday master after rename
#
#
--connection server1
reset master;
show tables;
--connection server2
reset master;
show tables;
--connection server1
create table t1 (a int key) engine=ndb;
insert into t1 values(1);
rename table t1 to t2;
insert into t2 values(2);
# now we should see data in table t1 _and_ t2
# prior to bug fix, data was missing for t2
--connection server2
--source include/show_binlog_events.inc
drop table t2;
This diff is collapsed.
...@@ -689,9 +689,45 @@ NdbEventOperationImpl::receive_event() ...@@ -689,9 +689,45 @@ NdbEventOperationImpl::receive_event()
error.code)); error.code));
DBUG_RETURN_EVENT(1); DBUG_RETURN_EVENT(1);
} }
if ( m_eventImpl->m_tableImpl)
delete m_eventImpl->m_tableImpl; NdbTableImpl *tmp_table_impl= m_eventImpl->m_tableImpl;
m_eventImpl->m_tableImpl = at; m_eventImpl->m_tableImpl = at;
DBUG_PRINT("info", ("switching table impl 0x%x -> 0x%x",
tmp_table_impl, at));
// change the rec attrs to refer to the new table object
int i;
for (i = 0; i < 2; i++)
{
NdbRecAttr *p = theFirstPkAttrs[i];
while (p)
{
int no = p->getColumn()->getColumnNo();
NdbColumnImpl *tAttrInfo = at->getColumn(no);
DBUG_PRINT("info", ("rec_attr: 0x%x "
"switching column impl 0x%x -> 0x%x",
p, p->m_column, tAttrInfo));
p->m_column = tAttrInfo;
p = p->next();
}
}
for (i = 0; i < 2; i++)
{
NdbRecAttr *p = theFirstDataAttrs[i];
while (p)
{
int no = p->getColumn()->getColumnNo();
NdbColumnImpl *tAttrInfo = at->getColumn(no);
DBUG_PRINT("info", ("rec_attr: 0x%x "
"switching column impl 0x%x -> 0x%x",
p, p->m_column, tAttrInfo));
p->m_column = tAttrInfo;
p = p->next();
}
}
if (tmp_table_impl)
delete tmp_table_impl;
} }
if (unlikely(operation >= NdbDictionary::Event::_TE_FIRST_NON_DATA_EVENT)) if (unlikely(operation >= NdbDictionary::Event::_TE_FIRST_NON_DATA_EVENT))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment