Hi.
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
presume.
As far as I could see, I need to (re-)write
sql/ha_myisammrg.cc:ha_myisammrg::write_row() and
myisammrg/myrg_write.cc:myrg_write()
If this is going a contribution, I thik a mechanism for choosing the
insertion type will be needed, and therefore changes to the CREATE
TABLE and ALTER TABLE syntax. I would suggest something like a table
option
INSERT_METHOD = { NONE | FIRST | LAST | ROUND_ROBIN }
which would result in
CREATE TABLE foo (...) TYPE=MERGE UNION=(a,b) INSERT_METHOD=LAST
I did not have a close enough look at the parser to know where/how to
add this (because I don't know yet whether I will at all), but I
assume it would not be hard to derivate this from other table option
rules.
I must admit that I do not understand yet some concepts of how merge
tables are managed - or more precisely - I am not comfortable with all
the side effects some function calls may have. But more about that at
a later time.
Because I need this to work around a shortage on a production server,
I need to this for 3.23.x. Soon. I would appreciate if my contribution
could go to the official tree some time, because I prefer to use the
precompiled binaries.
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.
Bye,
Benjamin.
PS: If that's of interest for you: I am quite used to C (started 12?
years ago) and C++ (8? years), although my C isn't as good anymore as
it once was, because I seldom write in C nowadays. My experience with
large scale projects started 5 years ago and could be better.