From: Michal L. <mi...@lo...> - 2007-08-21 13:25:41
|
Hi Andrew, > I've recently created a patch for mysqlfs. The idea of the patch is > to check for the existence of an entry by key in the data_blocks table > before attempting to write (query_write_one_block). The reason? to > stop mysqlfs killing MySQL replication when attempting to insert an > data_block with the same inode/seq as one that already exists. Interesting. What version of MySQL are you running on both master and slave? Replication should never break when you attempt to insert a record with a primary key that already exists. In fact *any* user action or query should never break MySQL replication. If it does in your case and if it's reproducible I'd consider it a MySQL server bug worth filing a bugreport. > Now I'm not that familiar with the mysqlfs code, and was hoping > someone with more knowledge than myself could let me know if I've gone > in the right direction. > > http://dev.iris.ac/~ody/mysqlfs-x86_64/mysqlfs-0.4.0-rc1.patch Problem is that your query_inode_key_exists() and the subsequent insert are two independent transactions. I.e. even if your check returns false the inode can appear in another thread before the first thread decides to run the INSERT. You'd have to make it atomic to be safe, which in case of MYISAM tables means locking the whole table and therefore resulting to a worse performance. Anyway you shouldn't experience this problem even with the current code. I suspect MySQL. What does SHOW SLAVE STATUS\G say when it breaks? Michal |