Skip to content

Commit

Permalink
MCOL-5603 Online alter can break data consistency
Browse files Browse the repository at this point in the history
Propagate the TL lock to TL_READ_NO_INSERT, blocking any concurrent writes until the end of a copy stage.

After that, this lock will be unlocked, allowing a window to write into a table before MDL is upgraded to exclusive (see online_alter_read_from_binlog call and the "alter_table_online_before_lock" debug syncpoint). This window will be covered by the second replication iteration after the lock upgrade
  • Loading branch information
FooBarrior committed Nov 7, 2023
1 parent 67c842e commit f859b82
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions dbcon/mysql/ha_mcs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -922,6 +922,10 @@ THR_LOCK_DATA** ha_mcs::store_lock(THD* thd, THR_LOCK_DATA** to, enum thr_lock_t
#ifdef INFINIDB_DEBUG
puts("store_lock");
#endif
if (thd_sql_command(thd) == SQLCOM_ALTER_TABLE
&& thd_tx_isolation(thd) == ISO_REPEATABLE_READ
&& lock_type == TL_READ)
table->reginfo.lock_type= TL_READ_NO_INSERT;
return to;
}

Expand Down

0 comments on commit f859b82

Please sign in to comment.