Bug #31376 DDL during setup of cluster replication give wrong position
Submitted: 3 Oct 2007 15:52 Modified: 28 Oct 2010 8:34
Reporter: Oli Sennhauser Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Cluster: Replication Severity:S2 (Serious)
Version:mysql-5.1-telco-6.2 OS:Any
Assigned to: CPU Architecture:Any
Tags: 5.1.21 (also 5.1.21-6.2.6!)
Triage: Triaged: D4 (Minor) / R6 (Needs Assessment) / E6 (Needs Assessment)

[3 Oct 2007 15:52] Oli Sennhauser
Description:
when during the setup of a cluster replication a create table is done, the create statement is inserted into the binary log but the position according to the documentation is wrong! it points 1 statement after the create table.
so the create table is not done and the following insert fails!

How to repeat:
* Setup 2 clusters (on as master, on as slave) according to: http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-replication-backups.html
* Do a backup of the master cluster
* restore the backup on the slave cluster (ndb_restore -m, 2 x -r, -e)
* get last epoch
| mysql-3312-bin.000007          |     1224 |
* create a table on the master and insert some rows
* finalize the slave (change master to ...)
* start slave:

         Last_Errno: 1146
         Last_Error: Error 'Table 'test.crash' doesn't exist' on opening table `test`.`crash`
Exec_Master_Log_Pos: 1224

look into binary log:

# at 1123
#7103 17:29:41 server id 12  end_log_pos 1224   Query   thread_id=12    exec_time=1     error_code=0
use test/*!*/;
SET TIMESTAMP=1191425381/*!*/;
create table crash (id int) engine=ndb/*!*/;
# at 1224
#7103 17:30:7 server id 12  end_log_pos 1288    Query   thread_id=0     exec_time=0     error_code=0
SET TIMESTAMP=1191425407/*!*/;
BEGIN/*!*/;
# at 1288
# at 1332
# at 1394
# at 1453
#7103 17:30:7 server id 12  end_log_pos 1332    Table_map: `test`.`crash` mapped to number 29
#7103 17:30:7 server id 12  end_log_pos 1394    Table_map: `mysql`.`ndb_apply_status` mapped to number 16
#7103 17:30:7 server id 12  end_log_pos 1453    Write_rows: table id 16
#7103 17:30:7 server id 12  end_log_pos 1497    Write_rows: table id 29 flags: STMT_END_F

BINLOG '
f7UDRxMMAAAALAAAADQFAAAAAB0AAAAAAAAABHRlc3QABWNyYXNoAAEDAAE=
f7UDRxMMAAAAPgAAAHIFAAAAABAAAAAAAAAABW15c3FsABBuZGJfYXBwbHlfc3RhdHVzAAUDCA8I

Suggested fix:
the display of the position seems to be wrong
[19 Feb 2009 13:38] Jonas Oreland
Tomas: isnt this fixed with the "global schema locks"
[5 Nov 2009 12:56] Bernd Ocklin
This is not fixed with global schema lock.
[28 Oct 2010 8:34] Geert Vanderkelen
Duplicate of Bug #54854.