java - How to avoid lock exception in informix -
i have 1 table of uuid contains 4 columns: id, uuid, used(true/false) , version optimistic locking. there 10000 records. when want insert new person table person read first not used uuid table. update records used , insert new person. when run performance test have problem table uuid , selecting or updating records. there lot of timeout lock isam error:
caused by: java.sql.sqlexception: isam error: lock timeout expired @ com.informix.util.ifxerrmsg.getsqlexception(ifxerrmsg.java:413) ~[ifxjdbc.jar:?] @ com.informix.jdbc.ifxsqli.e(ifxsqli.java:3982) ~[ifxjdbc.jar:?] @ com.informix.jdbc.ifxsqli.dispatchmsg(ifxsqli.java:2698) ~[ifxjdbc.jar:?] @ com.informix.jdbcx.ifxxasqli.receivemessage(ifxxasqli.java:116) ~[ifxjdbcx.jar:?] @ com.informix.jdbc.ifxsqli.executecommand(ifxsqli.java:939) ~[ifxjdbc.jar:?] @ com.informix.jdbc.ifxresultset.b(ifxresultset.java:304) ~[ifxjdbc.jar:?] @ com.informix.jdbc.ifxstatement.c(ifxstatement.java:1283) ~[ifxjdbc.jar:?] @ com.informix.jdbc.ifxpreparedstatement.executeupdate(ifxpreparedstatement.java:421) ~[ifxjdbc.jar:?] @ com.ibm.ws.rsadapter.jdbc.wsjdbcpreparedstatement.pmiexecuteupdate(wsjdbcpreparedstatement.java:1187) ~[com.ibm.ws.runtime.jar:?] @ com.ibm.ws.rsadapter.jdbc.wsjdbcpreparedstatement.executeupdate(wsjdbcpreparedstatement.java:804) ~[com.ibm.ws.runtime.jar:?]
how can avoid exception ? isolation level in webshere set transaction_read_committed lock mode wait set 2s , table has row lock
2 seconds timeout very short. how many concurrent threads using testing? i'll bet barely have time commit before 2s expires. utilize 30s, , modify code next value uuid table , commit possible! not perform other work. i'd recommend allocating new uuid, insert new user row , commit. proceed other work.
also, adding users not strike me needs heavy performance testing concurrent activity. if you're going utilize technique on table heavily accessed, may have real problem.
java sql informix
No comments:
Post a Comment