I have spent some of my spare time looking into this. It turns out that MySQL Cluster already has this ability. They have the following handler functions listed below. I spent a weekend trying to port MySQL Cluster's alter table function (mysql_alter_table) over to 5.1.46. The port that I did was straightforward, and for the most part, it works. There are a couple of small bugs/issues that I need to investigate and track down, but the functionality is available. If this can be made to work in a safe way, where storage engines can choose whether to use MySQL Cluster's new alter table, and others use the existing, it seems like a very safe thing to integrate into 5.1. One problem I have run into is that I do not know how to get a storage engine to opt in. This was the motivation behind the following email to the MySQL internals alias. http://lists.mysql.com/internals/38105 For those curious, the issues that I have: - alter table on partitioned tables is returning ER_OUTOFMEMORY (This may only be when adding/dropping indexes) - All storage engines use the new alter table, I want storage engines to opt in, to reduce the risk of bugs Any thoughts? -Zardosht virtual int check_if_supported_alter(TABLE *altered_table, HA_CREATE_INFO *create_info, HA_ALTER_FLAGS *alter_flags, uint table_changes) virtual int alter_table_phase1(THD *thd, TABLE *altered_table, HA_CREATE_INFO *create_info, HA_ALTER_INFO *alter_info, HA_ALTER_FLAGS *alter_flags) virtual int alter_table_phase2(THD *thd, TABLE *altered_table, HA_CREATE_INFO *create_info, HA_ALTER_INFO *alter_info, HA_ALTER_FLAGS *alter_flags) virtual int alter_table_phase3(THD *thd, TABLE *table) On Wed, Sep 22, 2010 at 2:28 PM, MARK CALLAGHAN <mdcallag@gmail.com> wrote:
It would be even cooler if there were storage engines that could do this internally. That would be easier to manage. The current process requires that you validate that your version of MariaDB or MySQL does the right thing for the tool.
Note that the tool does a few steps differently for 5.0 versus 5.1 because behavior has changed.
On Tue, Sep 21, 2010 at 7:41 PM, Adam M. Dutko <dutko.adam@gmail.com> wrote:
I'm sure you have all read http://bazaar.launchpad.net/~mysqlatfacebook/mysqlatfacebook/tools/annotate/... already, but if you haven't, it might be neat to look at evaluating and possibly integrating it into MariaDB. _______________________________________________ Mailing list: https://launchpad.net/~maria-developers Post to : maria-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-developers More help : https://help.launchpad.net/ListHelp
-- Mark Callaghan mdcallag@gmail.com
_______________________________________________ Mailing list: https://launchpad.net/~maria-developers Post to : maria-developers@lists.launchpad.net Unsubscribe : https://launchpad.net/~maria-developers More help : https://help.launchpad.net/ListHelp