>>>>> "Sergei" == Sergei Golubchik <serg@stripped> writes:
Sergei> On Aug 17, Benjamin Pflugmann wrote:
>> I am seriously considering to add INSERT support to MERGE tables
>> (MyISAM) in 3.23.x. I have spent some hours reading the source and
>> now, before I start to put more effort into it, I wanted to know
>> whether it would make sense as contribution, in order to know if I do
>> this as a hack or a configurable mechanism.
>> My own need is for INSERT into first (or last) table, but if I get
>> this far, it would be not much work to add support for round robin, I
Sergei> It shouldn't be difficult, I think.
>> As far as I could see, I need to (re-)write
>> sql/ha_myisammrg.cc:ha_myisammrg::write_row() and
Sergei> Yes, cf. ha_myisam.cc for details.
Sergei> But, all you have do here is to add a call to myrg_write().
Sergei> Then you will need to write myrg_write(), of course :-)
Sergei> But it's very easy - just call my_write for an appropriate table.
Sergei> All the code won't take more then 10-20 lines I bet.
Sergei> Well, I can forget about some black magic of locking here -
Sergei> Monty will correct me if I did.
The problem with locks is that if, you don't take care of it properly,
you would lock all tables in the MERGE table with a WRITE lock, which
isn't that good.
The way to fix this is to ensure that when you do an insert,
ha_myisammrg::lock_count() would return 1 and
ha_myisammrg::store_lock() would only stores the table you are going
to modify in the lock array.
>> If I get this to work reasonable, I am willing to spend more time with
>> MERGE tables (such as implementing CHECK TABLEs, checks whether all
>> sub-tables are compatible and so on), always presumed that my schedule
>> lets time for it.
Yes, that would be good!