multithreading - MySQL queue transactions -
i have queue in database (one table has column, enum , has queue, completed , working states) , execute transactions on it, changes rows state working queue or working complete, first have run complex query select row. right now, first application runs select, gets row, then runs update, change state queue working (inside transaction, the application api, written in spring boot , use jdbctemplate access mysql database, method use select , change state marked @transactional
annotation). also, application (that using api!) multi threaded, possible, 2 or more of transaction run @ same time (multiple calls api).
is possible, them return same row? example: t1, t2 transactions, s1,s2 selects, u1,u2 updates. execution order: t1 starts same time t2
t1 { s1 --->u1 } t2 { s2 ----->u2}
the 2nd select runs before first update, can both return same row?
yes, possible 2 select statements return same record same values, depends on locking , isolation level apply while querying data.
see understanding pdo mysql transactions topic further details.
Comments
Post a Comment