I am new with mysql transaction serializable. When I tried to update a row of a table while other concurrent sessions are reading it, the update transaction has to wait until the read transactions complete. Is there any way to allow the write transaction to proceed forward (then the read transactions should fail to commit)?
Here is my test to verify the property above:
Session 1:
set transaction isolation level serializable;
create database locktest;
use locktest;
create table locktest(id int not null primary key auto_increment, text varchar(100));
insert into locktest(text) values('text1');
start transaction;
select * from locktest where id=1;
Session 2:
use locktest;
update locktest set text='new_text2' where id=1; -- it gets stuck at this point and only proceed forward when I 'commit;' in session 1
What I want is that the update of session 2 must success immediately, and the transaction of session 1 should be aborted. Any suggestion? Thanks.