Bug #40254 NDB Binlog thread starts even though ndb_binlog_index corrupted
Submitted: 22 Oct 2008 14:57 Modified: 22 Oct 2008 14:58
Reporter: Geert Vanderkelen Email Updates:
Status: Verified Impact on me:
Category:MySQL Cluster: Replication Severity:S2 (Serious)
Version:mysql-5.1-telco-6.3 OS:Any
Assigned to: CPU Architecture:Any
Tags: mysql-5.1.28-telco-6.3.18

[22 Oct 2008 14:57] Geert Vanderkelen
Currently, when the ndb_binlog_index is corrupt or marked as crashed, the NDB Binlog thread is started. No error is being given, also not when events are happening and are being logged.

How to repeat:
Setup a normal cluster, with mysqld binary logging. Corrupt the ndb_binlog_index, for example doing:

 shell> cd /path/to/mysql/datadir/mysql
 shell> cat user.MYD > ndb_binlog_index.MYD

Do some updates, restart mysqld, nothing is showing the ndb_binlog_index is not being updated.

Suggested fix:
The mysql.ndb_binlog_index table should be checked upon start of the binary log thread. I think the best is to not repair it, but to actually move it away (RENAME) and create a new table. Definitely putting some error messages in the logs.
[24 Oct 2008 13:28] Tomas Ulin
so the problem is, it is perfectly alright to insert into a broken myisam table... and as all we do in the binlog thread is to insert, it is never detected...  we could test at startup that it it not broken, even issue an automatic repair... but it would not catch corruptions which happen on the fly (but maybe they are not common)

master> insert into mysql.ndb_binlog_index values(0,"",0,0,0,0,0,0,0,0);
Query OK, 1 row affected (0.02 sec)

master> select * from mysql.ndb_binlog_index;
ERROR 1194 (HY000): Table 'ndb_binlog_index' is marked as crashed and should be repaired

and it will even find the row inserted after a repair:

master> repair table mysql.ndb_binlog_index;
master> select * from mysql.ndb_binlog_index;
| Position | File | epoch | inserts | updates | deletes | schemaops | orig_server_id | orig_epoch | gci |
|        0 |      |     0 |       0 |       0 |       0 |         0 |              0 |          0 |   0 | 
1 row in set (0.02 sec)