← Back to team overview

maria-developers team mailing list archive

TRUE LOCK=NONE for slave


Hello everyone!

I am thinking of implementing true lock=none for slaves. Currently
Alter command is only executed on slave when master commits it.
I(thanks marko for suggesting this idea) am thinking of  writing
BEGIN_DDL_EVENT in binlog after master hits ha_prepare_inplace_alter_table.
Then master will write QUERY_EVENT on binlog with actual alter query .
On commit/rollback master will write COMMIT_DDL_EVENT/ROLLBACK_DDL_EVENT.

On slave there will be pool of threads(configurable global variable), which
will apply these DDLs. On receiving BEGIN_DDL_EVENT slave thread will pass the
QUERY_EVENT to one of the worker thread. Worker thread will execute until
ha_inplace_alter_table. Actual commit_inplace_alter will be called by
sql thread.
If sql thread recieve some kind of rollback event , then it will somehow signal
worker thread to stop executing alter. If none of the worker threads
are available
then event will be en-queued, then If we received rollback event the
we will simply
discard event from queue, If we received commit event then SQL thread
will synchronously
process DDL event.

Please let me know what you think.
Credits for idea Marko and Lixun.


Follow ups