- 論壇徽章:
- 0
|
這個(gè)要使用RS的隔離級(jí)別(中間件服務(wù)器默認(rèn)隔離級(jí)別是RS,需要檢查一下),并且用select for update。
Read Stability
Read Stability (RS) locks only those rows that an application retrieves within a unit of work. It ensures that any qualifying row read during a unit of work is not changed by other application processes until the unit of work completes, and that any row changed by another application process is not read until the change is committed by that process.
場景1:
session1:
db2 +c "select * from table where id=3 with rs for update"; --如果默認(rèn)是RS,則不用加 with rs
session2:
db2 +c "select * from table where id=3 with rs for update";
這個(gè)時(shí)候如果我們用db2pd -wlocks可以看到,session2正在等待session1的行級(jí)U鎖。
|
|