← Back to team overview

maria-developers team mailing list archive

Re: ALTER ONLINE TABLE syntax

 

Hi, Jan!

On Jul 10, Jan Lindström wrote:
> 
> I really do not see why you would want to define both algorithm and
> lock mode. In my transactional view ALGORITHM=COPY would mean
> EXCLUSIVE lock and INPLACE would mean SHARED lock. Is there some other
> lock that protects from concurrent online alter tables ? Lock NONE
> would mean I do not care what happens.

ALGORITHM=COPY does not mean an EXCLUSIVE lock even now. Never did.

It always used TL_READ_NO_INSERT lock, which is compatible with TL_READ
lock, so it's shared, in a sense. One can read the table that is being
altered (yes, there was an exclusive lock for a short while too).

COPY/NONE isn't very difficult to implement either. Say, you start a
replication slave, copy the table there, ALTER it on the slave, wait for
a slave to catch up, and swap master and a slave under an exclusive
lock. While the table is being altered (on the slave) there is no lock
(on the master) whatsoever.

Other combinations are possible too, I can easily describe an
implementation that has, say, INPLACE/EXCLUSIVE (with the, for example,
archive engine).

Regards,
Sergei



References