From: Sergei Golubchik Date: July 22 2010 9:50am Subject: Re: HA_ONLINE_ADD_INDEX v. HA_ONLINE_ADD_INDEX_NO_WRITES List-Archive: http://lists.mysql.com/internals/37992 Message-Id: <20100722095031.GB17731@janus.mylan> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Hi, Zardosht! On Jul 20, Zardosht Kasheff wrote: > Hello all, > > I was looking at alter table flags, and was wondering what the > difference between these two flags are. Their name seems to imply that > declaring HA_ONLINE_ADD_INDEX means the storage engine can accomodate > writes while an index is being added, whereas > HA_ONLINE_ADD_INDEX_NO_WRITES cannot. > > Looking at the code in 5.1.46, I cannot find a difference. The only > change I see is in the function mysql_alter_table, the value of > need_lock_for_indexes is false if the engine exposes > HA_ONLINE_ADD_INDEX, and true if the engine exposes > HA_ONLINE_ADD_INDEX_NO_WRITES. This variable, need_lock_for_indexes, > does not seem to actually be used anywhere. > > So, my question is, despite what their names imply (stating if a table > lock is necessary for add index), is there any functional difference > for storage engines that set one of these flags and not the other? It looks like there is none. Originally there was supposed to be a difference - there was one in the original changeset. But later it was removed, perhaps it was found to be unnecessary. Regards, Sergei