Mysql Blob Partial Update


赵明寰 https://whoiami.github.io/

Long Story Short

Blob 在做partial update 并且符合small change 记录到undo record ,之后如果读请求走mvcc 读到这个undo record 的时候有概率造成crash。


场景复现


环境8.0.25

client1 create table t (a int primary key, b json); insert into t values (1, '[ "abc", "def" ]'); update t set b=JSON_SET(b, '$[0]', REPEAT('w', 10000)); client2 set SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ; begin; select * from t where a =1; client1 UPDATE t SET b = JSON_REMOVE(b, '$[1]') where a = 1; client2 select * from t where a =1;