List:Internals« Previous MessageNext Message »
From:Michael Widenius Date:August 30 2001 10:09am
Subject:Re: adding INSERT support to MERGE tables
View as plain text  
Hi!

>>>>> "Benjamin" == Benjamin Pflugmann <philemon@stripped> writes:

Benjamin> Hi!
Benjamin> Sorry that it was quite quiet around me, but last week took completely
Benjamin> another path as I had planned. But now I am back to the matter.

Benjamin> On Fri, Aug 17, 2001 at 03:50:16PM +0300, monty@stripped wrote:
>> >>>>> "Sergei" == Sergei Golubchik <serg@stripped> writes:
>> 
Sergei> Hi!
Sergei> On Aug 17, Benjamin Pflugmann wrote:
>> >> 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.
>> 
Sergei> Good!

Benjamin> I am still missing one point. I learned that this would only make it
Benjamin> into 4.x. Since currently I am only making changes to 3.23.x, I wanted
Benjamin> to know whether the official tree could benefit from such patches,
Benjamin> i.e. is 4.x similar enough to use these patches? If not, I am probably
Benjamin> not going to implement the configuration mechanism for 3.23.x, because
Benjamin> in my private version fixed constant would be sufficient.

The 4.0 is very similar in most cases. The major changes will be done
in in table.cc, sql_table.cc, sql_base.cc and lock.cc

Anyway, if you can create a patch for 3.23, I can fix it for 4.0.

<cut>

<cut>

>> It's actually MYISAM-MERGE information and not MyISAM. 
>> 
>> If we define the INSERT to be a dynamic property that is always to be
>> sent to mrg_write(), then it's a MySQL problem.

Benjamin> (I did not find any mrg_write() - I assume you mean myrg_write()?)

Yes.

Benjamin> I had expected this info to be kept in the same place as the info
Benjamin> which tables are in the union, i.e. it would be passed to myrg_write()
Benjamin> as an attribute of the struct MYRG_INFO.

Benjamin> Is there any problem with this idea?

No, but see below:

Benjamin> This would mean that myrg_open() would have to read it somewhere and
Benjamin> store it in the struct.

One even simpler solution would be to not let myrg_write() handle this
but instead do a direct call to the MyISAM file handler in the
function: (in sql/ha_myisammrg.cc)

int ha_myisammrg::write_row(byte * buf)
{
  return (my_errno=HA_ERR_WRONG_COMMAND);
}

You could replace the above with something like:

int ha_myisammrg::write_row(byte * buf)
{
  if (table_to_write_to == HA_MERGE_WRITE_TO_FIRST)
    return mi_write(file->open_tables[0],buf);
  else /* HA_MERGE_WRITE_TO_LAST */
    return mi_write(file->open_tables[file->tables-1],buf);
}

(Am I helping you too much here ? :)

<cut>

Benjamin> I need this INSERT mechanism to hide from a (hard to change)
Benjamin> application the fact that I am splitting the tables. Splitting the
Benjamin> tables will enable me to only backup the "insert"-table, while just
Benjamin> keeping the old backups for the (never changing) other tables and it
Benjamin> will look like one table for the application.

Benjamin> So I need only insert into first/last table.

See above.

Regards,
Monty
Thread
adding INSERT support to MERGE tablesBenjamin Pflugmann17 Aug
  • Re: adding INSERT support to MERGE tablesSergei Golubchik17 Aug
    • Re: adding INSERT support to MERGE tablesMichael Widenius17 Aug
      • Re: adding INSERT support to MERGE tablesBenjamin Pflugmann30 Aug
        • Re: adding INSERT support to MERGE tablesSergei Golubchik30 Aug
          • Re: adding INSERT support to MERGE tablesBenjamin Pflugmann30 Aug
        • Re: adding INSERT support to MERGE tablesMichael Widenius30 Aug
          • Re: adding INSERT support to MERGE tablesBenjamin Pflugmann30 Aug
            • Re: adding INSERT support to MERGE tablesMichael Widenius1 Sep
              • Re: adding INSERT support to MERGE tablesBenjamin Pflugmann5 Sep
                • Re: adding INSERT support to MERGE tablesMichael Widenius6 Sep
                  • Re: adding INSERT support to MERGE tablesBenjamin Pflugmann10 Sep
                    • Re: adding INSERT support to MERGE tablesBenjamin Pflugmann11 Sep
                      • Re: adding INSERT support to MERGE tablesMichael Widenius12 Sep
                        • Re: adding INSERT support to MERGE tablesBenjamin Pflugmann12 Sep
                          • Re: adding INSERT support to MERGE tablesMichael Widenius13 Sep
                            • Re: adding INSERT support to MERGE tablesBenjamin Pflugmann18 Sep
                      • Re: adding INSERT support to MERGE tablesMichael Widenius22 Sep
                      • Re: adding INSERT support to MERGE tablesMichael Widenius24 Sep
                        • Re: adding INSERT support to MERGE tablesBenjamin Pflugmann27 Sep
    • Re: adding INSERT support to MERGE tablesSergei Golubchik17 Aug
      • Re: adding INSERT support to MERGE tablesBenjamin Pflugmann17 Aug
      • Re: adding INSERT support to MERGE tablesMichael Widenius18 Aug
        • Re: adding INSERT support to MERGE tablesSergei Golubchik18 Aug
          • Re: adding INSERT support to MERGE tablesMichael Widenius20 Aug
RE: adding INSERT support to MERGE tablesThe Tilghman20 Aug